コード例 #1
0
  /**
   * Verifies dependency build ordering of SNAPSHOT dependency. Note - has to build the projects
   * once each first in order to get dependency info.
   */
  public void testSnapshotInDependencyManagementBuildTrigger() throws Exception {

    configureDefaultMaven();
    MavenModuleSet projA = createMavenProject("snap-dep-test-up");
    projA.setGoals("clean install");
    projA.setScm(new ExtractResourceSCM(getClass().getResource("maven-dep-test-A.zip")));
    MavenModuleSet projB = createMavenProject("snap-dep-test-down");
    projB.setGoals("clean install");
    projB.setIgnoreUpstremChanges(false);
    projB.setQuietPeriod(0);
    projB.setScm(new ExtractResourceSCM(getClass().getResource("maven-dep-test-D.zip")));

    buildAndAssertSuccess(projA);
    buildAndAssertSuccess(projB);

    projA.setScm(new ExtractResourceSCM(getClass().getResource("maven-dep-test-A-changed.zip")));
    buildAndAssertSuccess(projA);

    // at this point runB2 should be in the queue, so wait until that completes.
    waitUntilNoActivityUpTo(90 * 1000);
    assertEquals(
        "Expected most recent build of second project to be #2",
        2,
        projB.getLastBuild().getNumber());
  }
コード例 #2
0
  public void testNativeMaven() throws Exception {
    MavenInstallation maven = configureDefaultMaven();
    String mavenPath = maven.getHome();
    Jenkins.getInstance()
        .getDescriptorByType(Maven.DescriptorImpl.class)
        .setInstallations(new MavenInstallation("maven", "THIS IS WRONG", NO_PROPERTIES));

    MavenModuleSet project = createMavenProject();
    project.setScm(new ExtractResourceSCM(getClass().getResource("/simple-projects.zip")));
    project.setAssignedLabel(slave.getSelfLabel());
    project.setJDK(jenkins.getJDK("default"));

    project.setMaven("maven");
    project.setGoals("clean");

    Run build = project.scheduleBuild2(0).get();
    assertBuildStatus(Result.FAILURE, build);

    ToolLocationNodeProperty property =
        new ToolLocationNodeProperty(
            new ToolLocationNodeProperty.ToolLocation(
                jenkins.getDescriptorByType(MavenInstallation.DescriptorImpl.class),
                "maven",
                mavenPath));
    slave.getNodeProperties().add(property);

    build = project.scheduleBuild2(0).get();
    System.out.println(build.getLog());
    assertBuildStatus(Result.SUCCESS, build);
  }
コード例 #3
0
 private MavenModuleSet setupMavenJob() throws Exception {
   configureDefaultMaven();
   MavenModuleSet mp = createMavenProject();
   mp.setGoals("clean package");
   mp.setScm(new ExtractResourceSCM(getClass().getResource("maven-job.zip")));
   return mp;
 }
コード例 #4
0
 private MavenModuleSet createProject(final String scmResource) throws Exception {
   MavenModuleSet project = createMavenProject();
   MavenInstallation mi = configureDefaultMaven();
   project.setScm(new ExtractResourceSCM(getClass().getResource(scmResource)));
   project.setMaven(mi.getName());
   project.setLocalRepository(new PerJobLocalRepositoryLocator());
   return project;
 }
コード例 #5
0
 @Bug(8415)
 public void testMaven3Failed() throws Exception {
   MavenModuleSet m = createMavenProject();
   m.setMaven(configureMaven3().getName());
   m.setGoals("test -Dmaven.test.failure.ignore=false");
   m.setScm(new ExtractResourceSCM(getClass().getResource("maven-multimodule-unit-failure.zip")));
   assertBuildStatus(Result.FAILURE, m.scheduleBuild2(0).get());
 }
コード例 #6
0
 @Bug(8415)
 public void testMaven3Unstable() throws Exception {
   MavenModuleSet m = createMavenProject();
   m.setMaven(configureMaven3().getName());
   m.setGoals("test");
   m.setScm(new ExtractResourceSCM(getClass().getResource("maven-multimodule-unit-failure.zip")));
   assertBuildStatus(Result.UNSTABLE, m.scheduleBuild2(0).get());
 }
コード例 #7
0
ファイル: MavenOptsTest.java プロジェクト: kalyanjk29/jenkins
  public void testGlobalMavenOpts() throws Exception {
    configureDefaultMaven();
    MavenModuleSet m = createMavenProject();
    m.setScm(new ExtractResourceSCM(getClass().getResource("maven-opts-echo.zip")));
    m.setGoals("validate");
    m.DESCRIPTOR.setGlobalMavenOpts("-Dhudson.mavenOpt.test=bar");

    buildAndAssertSuccess(m);

    assertLogContains("[hudson.mavenOpt.test=bar]", m.getLastBuild());
  }
コード例 #8
0
ファイル: MavenOptsTest.java プロジェクト: kalyanjk29/jenkins
  public void testEnvMavenOptsNoneInProject() throws Exception {
    configureDefaultMaven();
    MavenModuleSet m = createMavenProject();
    m.setScm(new ExtractResourceSCM(getClass().getResource("maven-opts-echo.zip")));
    m.setGoals("validate");
    m.setAssignedLabel(
        createSlave(new EnvVars("MAVEN_OPTS", "-Dhudson.mavenOpt.test=foo")).getSelfLabel());

    buildAndAssertSuccess(m);

    assertLogContains("[hudson.mavenOpt.test=foo]", m.getLastBuild());
  }
コード例 #9
0
ファイル: MavenOptsTest.java プロジェクト: kalyanjk29/jenkins
  @Bug(5651)
  public void testNewlinesInOptsRemoved() throws Exception {
    configureDefaultMaven("apache-maven-2.2.1", MavenInstallation.MAVEN_21);
    MavenModuleSet m = createMavenProject();
    m.setScm(new ExtractResourceSCM(getClass().getResource("maven-surefire-unstable.zip")));
    m.setMavenOpts("-XX:MaxPermSize=512m\r\n-Xms128m\r\n-Xmx512m");
    m.setGoals("install");

    assertBuildStatus(Result.UNSTABLE, m.scheduleBuild2(0).get());
    MavenModuleSetBuild pBuild = m.getLastBuild();

    assertEquals("Parent build should have Result.UNSTABLE", Result.UNSTABLE, pBuild.getResult());
  }
コード例 #10
0
  /**
   * Verifies dependency build ordering of multiple SNAPSHOT dependencies. Note - has to build the
   * projects once each first in order to get dependency info. B depends on A, C depends on A and B.
   * Build order should be A->B->C.
   */
  public void testMixedTransitiveSnapshotTrigger() throws Exception {
    configureDefaultMaven();

    MavenModuleSet projA = createMavenProject("snap-dep-test-up");
    projA.setGoals("clean install");
    projA.setScm(new ExtractResourceSCM(getClass().getResource("maven-dep-test-A.zip")));

    MavenModuleSet projB = createMavenProject("snap-dep-test-mid");
    projB.setGoals("clean install");
    projB.setIgnoreUpstremChanges(false);
    projB.setQuietPeriod(0);
    projB.setScm(new ExtractResourceSCM(getClass().getResource("maven-dep-test-B.zip")));

    MavenModuleSet projC = createMavenProject("snap-dep-test-down");
    projC.setGoals("clean install");
    projC.setIgnoreUpstremChanges(false);
    projC.setQuietPeriod(0);
    projC.setScm(new ExtractResourceSCM(getClass().getResource("maven-dep-test-C.zip")));

    buildAndAssertSuccess(projA);
    buildAndAssertSuccess(projB);
    buildAndAssertSuccess(projC);

    projA.setScm(new ExtractResourceSCM(getClass().getResource("maven-dep-test-A-changed.zip")));

    buildAndAssertSuccess(projA);

    waitUntilNoActivityUpTo(90 * 1000); // wait until dependency build trickles down
    assertEquals(
        "Expected most recent build of second project to be #2",
        2,
        projB.getLastBuild().getNumber());
    assertEquals(
        "Expected most recent build of third project to be #2",
        2,
        projC.getLastBuild().getNumber());
  }