Skip to content
Permalink
Browse files

Merge pull request #48 from varyvol/JENKINS-43990

[JENKINS-43990] Update to 2.X parent POM
  • Loading branch information
olivergondza committed May 6, 2017
2 parents ba659e0 + d490bca commit 8d94ba80991cf84c361c5739bc7d9a427f9171ad
36 pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.609</version>
<version>2.26</version>
</parent>
<artifactId>matrix-project</artifactId>
<version>1.11-SNAPSHOT</version>
@@ -12,8 +12,8 @@
<description>Multi-configuration (matrix) project type.</description>
<url>https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Project+Plugin</url>
<properties>
<findbugs-maven-plugin.version>3.0.1</findbugs-maven-plugin.version>
<findbugs.failOnError>true</findbugs.failOnError>
<jenkins.version>1.609</jenkins.version>
<java.level>6</java.level>
</properties>
<licenses>
<license>
@@ -40,10 +40,22 @@
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness-tools</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.20</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-auth</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
@@ -116,24 +128,6 @@
<argLine>-XX:MaxPermSize=128m</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs-maven-plugin.version}</version>
<configuration>
<xmlOutput>true</xmlOutput>
<failOnError>${findbugs.failOnError}</failOnError>
</configuration>
<executions>
<execution>
<id>run-findbugs</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

@@ -50,7 +50,7 @@
@Before
public void setUp() throws Exception {
wc = j.createWebClient();
p = j.createMatrixProject();
p = j.createProject(MatrixProject.class);

// Setup to make all axes available
j.jenkins.getJDKs().add(new JDK("jdk1.7", "/fake/home"));
@@ -59,7 +59,7 @@ public void setUp() throws Exception {

@Test
public void submitEmptyAxisName() throws Exception {
wc.setThrowExceptionOnFailingStatusCode(false);
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);

final String expectedMsg = "Matrix axis name '' is invalid: Axis name can not be empty";
assertFailedWith(expectedMsg, withName("", "User-defined Axis"));
@@ -69,7 +69,7 @@ public void submitEmptyAxisName() throws Exception {

@Test
public void submitInvalidAxisName() throws Exception {
wc.setThrowExceptionOnFailingStatusCode(false);
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);

String expectedMsg = "Matrix axis name 'a,b' is invalid: ‘,’ is an unsafe character";
assertFailedWith(expectedMsg, withName("a,b", "User-defined Axis"));
@@ -84,7 +84,7 @@ public void submitInvalidAxisName() throws Exception {

@Test
public void submitInvalidAxisValue() throws Exception {
wc.setThrowExceptionOnFailingStatusCode(false);
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);

HtmlForm form = addAxis("User-defined Axis");
form.getInputByName("_.name").setValueAttribute("a_name");
@@ -140,8 +140,21 @@ private void assertFailedWith(String expected, HtmlPage res) {
private HtmlForm addAxis(String axis) throws Exception {
HtmlPage page = wc.getPage(p, "configure");
HtmlForm form = page.getFormByName("config");
form.getButtonByCaption("Add axis").click();
j.getButtonByCaption(form, "Add axis").click();
page.getAnchorByText(axis).click();
waitForInput(form);
return form;
}

private void waitForInput(HtmlForm form) throws InterruptedException {
int numberInputs = form.getInputsByName("_.name").size();
int tries = 30;
while (tries > 0 && numberInputs == 0) {
tries--;
Thread.sleep(10);
numberInputs = form.getInputsByName("_.name").size();
}

assertThat("Input should have appeared", numberInputs != 0);
}
}
@@ -39,7 +39,7 @@
public void test() throws Exception {
j.jenkins.setLabelString("aaaa bbbb");

MatrixProject project = j.createMatrixProject("project");
MatrixProject project = j.createProject(MatrixProject.class,"project");
DescriptorImpl descriptor = new LabelExpAxis.DescriptorImpl();

assertEquals(FormValidation.Kind.ERROR, descriptor.doCheckLabelExpr(project, "").kind);
@@ -18,7 +18,7 @@

@Test
public void testLoadingParameters() throws Exception {
MatrixProject project = j.createMatrixProject("project");
MatrixProject project = j.createProject(MatrixProject.class, "project");
StringParameterDefinition def1 = new StringParameterDefinition("definition1", "value1", "description");
StringParameterDefinition def2 = new StringParameterDefinition("definition2", "value2", "description");
ParametersDefinitionProperty prop = new ParametersDefinitionProperty(def1,def2);
@@ -19,7 +19,7 @@
@Rule public JenkinsRule j = new JenkinsRule();

@Test public void testConfigRoundtrip() throws Exception {
MatrixProject p = j.createMatrixProject();
MatrixProject p = j.createProject(MatrixProject.class);
j.configRoundtrip((Item)p);
j.assertEqualDataBoundBeans(new NoopMatrixConfigurationSorter(),strategy(p).getSorter());

@@ -43,7 +43,7 @@

@Test
public void testDelete() throws Exception{
MatrixProject project = r.createMatrixProject();
MatrixProject project = r.createProject(MatrixProject.class);
AxisList axes = new AxisList(
new Axis("a","active1","active2", "unactive"));
project.setAxes(axes);
@@ -62,12 +62,12 @@ public void testDelete() throws Exception{

@Test @Issue("JENKINS-32423")
public void doNotServeConfigurePage() throws Exception {
MatrixProject p = r.createMatrixProject();
MatrixProject p = r.createProject(MatrixProject.class);
p.setAxes(new AxisList(new Axis("a", "b")));

WebClient wc = r.createWebClient();
wc.setThrowExceptionOnFailingStatusCode(false);
wc.setPrintContentOnFailingStatusCode(false);
wc.getOptions().setThrowExceptionOnFailingStatusCode(false);
wc.getOptions().setPrintContentOnFailingStatusCode(false);

HtmlPage page = wc.getPage(p.getItem("a=b"), "configure");
assertEquals("Page should not exist", 404, page.getWebResponse().getStatusCode());
@@ -78,11 +78,11 @@ public void labelAxis() throws Exception {
LabelAxis label = new LabelAxis("label", Arrays.asList("a", "b"));
LabelExpAxis expr = new LabelExpAxis("expr", Arrays.asList("a||b", "a&&b"));

MatrixProject labelP = r.createMatrixProject();
MatrixProject labelP = r.createProject(MatrixProject.class);
labelP.setAxes(new AxisList(label));
MatrixProject exprP = r.createMatrixProject();
MatrixProject exprP = r.createProject(MatrixProject.class);
exprP.setAxes(new AxisList(expr));
MatrixProject combinedP = r.createMatrixProject();
MatrixProject combinedP = r.createProject(MatrixProject.class);
combinedP.setAxes(new AxisList(expr, label));

Collection<MatrixConfiguration> lc = labelP.getItems();
@@ -42,7 +42,7 @@

@Test
public void customWorkspaceForParentAndChild() throws Exception {
MatrixProject p = j.createMatrixProject();
MatrixProject p = j.createProject(MatrixProject.class);
File dir = tmp.newFolder();
p.setCustomWorkspace(dir.getPath());
p.setChildCustomWorkspace("xyz");
@@ -61,7 +61,7 @@ public void customWorkspaceForParentAndChild() throws Exception {

@Test
public void customWorkspaceForParent() throws Exception {
MatrixProject p = j.createMatrixProject();
MatrixProject p = j.createProject(MatrixProject.class);
File dir = tmp.newFolder();
p.setCustomWorkspace(dir.getPath());
p.setChildCustomWorkspace(null);
@@ -87,7 +87,7 @@ public void customWorkspaceForParent() throws Exception {

@Test
public void customWorkspaceForChild() throws Exception {
MatrixProject p = j.createMatrixProject();
MatrixProject p = j.createProject(MatrixProject.class);
p.setCustomWorkspace(null);
p.setChildCustomWorkspace(".");

@@ -111,7 +111,7 @@ public void customWorkspaceForChild() throws Exception {
*/
@Test
public void noCustomWorkspace() throws Exception {
MatrixProject p = j.createMatrixProject();
MatrixProject p = j.createProject(MatrixProject.class);
p.setCustomWorkspace(null);
p.setChildCustomWorkspace(null);

@@ -28,7 +28,7 @@
* the DependencyGraph
*/
@Test public void matrixProjectTriggersDependencies() throws Exception {
MatrixProject matrixProject = j.createMatrixProject();
MatrixProject matrixProject = j.createProject(MatrixProject.class);
FreeStyleProject freestyleProject = j.createFreeStyleProject();
matrixProject.getPublishersList().add(new BuildTrigger(freestyleProject.getName(), false));

@@ -40,6 +40,7 @@

import org.jvnet.hudson.test.Email;
import org.jvnet.hudson.test.SingleFileSCM;
import org.jvnet.hudson.test.ToolInstallations;
import org.jvnet.hudson.test.UnstableBuilder;
import org.jvnet.hudson.test.recipes.LocalData;

@@ -96,7 +97,6 @@
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.RandomlyFails;
import org.junit.rules.TemporaryFolder;

/**
@@ -115,7 +115,7 @@
@Test
public void testBuildAxisInAnt() throws Exception {
MatrixProject p = createMatrixProject();
Ant.AntInstallation ant = j.configureDefaultAnt();
Ant.AntInstallation ant = ToolInstallations.configureDefaultAnt(tmp);
p.getBuildersList().add(new Ant("-Dprop=${db} test", ant.getName(), null, null, null));

// we need a dummy build script that echos back our property
@@ -137,7 +137,7 @@ public void testBuildAxisInAnt() throws Exception {
@Test
public void testBuildAxisInMaven() throws Exception {
MatrixProject p = createMatrixProject();
Maven.MavenInstallation maven = j.configureDefaultMaven();
Maven.MavenInstallation maven = ToolInstallations.configureDefaultMaven();
p.getBuildersList().add(new Maven("-Dprop=${db} validate", maven.getName()));

// we need a dummy build script that echos back our property
@@ -184,7 +184,7 @@ public void testTouchStone() throws Exception {
}

protected MatrixProject createMatrixProject() throws IOException {
MatrixProject p = j.createMatrixProject();
MatrixProject p = j.createProject(MatrixProject.class);

// set up 2x2 matrix
AxisList axes = new AxisList();
@@ -214,7 +214,7 @@ public void testFingerprinting() throws Exception {

void assertRectangleTable(MatrixProject p) throws Exception {
HtmlPage html = j.createWebClient().getPage(p);
HtmlTable table = html.selectSingleNode("id('matrix')/table");
HtmlTable table = html.getFirstByXPath("id('matrix')/table");

// remember cells that are extended from rows above.
Map<Integer,Integer> rowSpans = new HashMap<Integer,Integer>();
@@ -552,7 +552,7 @@ public void testUpgrade() throws Exception {

@Issue("JENKINS-17337")
@Test public void reload() throws Exception {
MatrixProject p = j.createMatrixProject();
MatrixProject p = j.createProject(MatrixProject.class);
AxisList axes = new AxisList();
axes.add(new TextAxis("p", "only"));
p.setAxes(axes);
@@ -578,7 +578,7 @@ public void testUpgrade() throws Exception {
public void dontRunOnExclusiveSlave() throws Exception {
List<MatrixProject> projects = new ArrayList<MatrixProject>();
for (int i = 0; i <= 10; i++) {
MatrixProject m = j.createMatrixProject();
MatrixProject m = j.createProject(MatrixProject.class);
AxisList axes = new AxisList();
axes.add(new TextAxis("p", "only"));
m.setAxes(axes);
@@ -80,7 +80,7 @@
@Issue("JENKINS-9293")
@Test public void configurationACL() throws Exception {
j.jenkins.setAuthorizationStrategy(new ProjectMatrixAuthorizationStrategy());
MatrixProject mp = j.createMatrixProject();
MatrixProject mp = j.createProject(MatrixProject.class);
mp.setAxes(new AxisList(new Axis("foo", "a", "b")));
MatrixConfiguration mc = mp.getItem("foo=a");
assertNotNull(mc);
@@ -93,7 +93,7 @@
}

@Test public void api() throws Exception {
MatrixProject project = j.createMatrixProject();
MatrixProject project = j.createProject(MatrixProject.class);
project.setAxes(new AxisList(
new Axis("FOO", "abc", "def"),
new Axis("BAR", "uvw", "xyz")));
@@ -103,7 +103,7 @@

@Issue("JENKINS-27162")
@Test public void completedLogging() throws Exception {
MatrixProject project = j.createMatrixProject();
MatrixProject project = j.createProject(MatrixProject.class);
project.setAxes(new AxisList(
new Axis("axis", "a", "b")
));
@@ -118,7 +118,7 @@

@Issue("SECURITY-125")
@Test public void combinationFilterSecurity() throws Exception {
MatrixProject project = j.createMatrixProject();
MatrixProject project = j.createProject(MatrixProject.class);
String combinationFilter = "jenkins.model.Jenkins.getInstance().setSystemMessage('hacked')";
expectRejection(project, combinationFilter, "staticMethod jenkins.model.Jenkins getInstance");
assertNull(j.jenkins.getSystemMessage());
@@ -146,7 +146,7 @@ private static void expectRejection(MatrixProject project, String combinationFil
@Issue("JENKINS-34389")
@Test public void axisValuesChanged() throws Exception {
// create project with dynamic axis
MatrixProject project = j.createMatrixProject();
MatrixProject project = j.createProject(MatrixProject.class);
project.setAxes(new AxisList(
new DynamicTestAxis("axis")
));
@@ -53,7 +53,7 @@
@Test public void persistenceOfParentInMatrixRun() {
r.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
MatrixProject p = r.j.createMatrixProject("project");
MatrixProject p = r.j.createProject(MatrixProject.class, "project");
p.setAxes(new AxisList(new TextAxis("AXIS", "VALUE")));

// Schedule and wait for build to finish
@@ -80,7 +80,7 @@
@Test public void resumeAllCombinations() throws Exception {
r.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
MatrixProject project = r.j.createMatrixProject("p");
MatrixProject project = r.j.createProject(MatrixProject.class, "p");
project.setConcurrentBuild(true);
project.setAxes(new AxisList(new LabelAxis("labels", Arrays.asList("foo", "bar"))));

0 comments on commit 8d94ba8

Please sign in to comment.
You can’t perform that action at this time.