Ejemplo n.º 1
0
  public void testOnSlave() throws Exception {
    MavenModuleSet project = createSimpleProject();
    project.setGoals("validate");
    project.setAssignedLabel(createSlave().getSelfLabel());

    buildAndAssertSuccess(project);
  }
  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);
  }
Ejemplo n.º 3
0
  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());
  }
Ejemplo n.º 4
0
  /** Check if the the site goal will work when run from a slave. */
  @Bug(5943)
  public void testMultiModuleSiteBuildOnSlave() throws Exception {
    MavenModuleSet project = createProject("maven-multimodule-site.zip");
    project.setGoals("site");
    project.setAssignedLabel(createSlave().getSelfLabel());

    try {
      buildAndAssertSuccess(project);
    } catch (InterruptedException x) {
      return; // TODO as above
    }

    // this should succeed
    HudsonTestCase.WebClient wc = new WebClient();
    wc.getPage(project, "site");
    wc.getPage(project, "site/core");
    wc.getPage(project, "site/client");
  }