当前位置: 首页>>代码示例>>Java>>正文


Java FreeStyleBuild类代码示例

本文整理汇总了Java中hudson.model.FreeStyleBuild的典型用法代码示例。如果您正苦于以下问题:Java FreeStyleBuild类的具体用法?Java FreeStyleBuild怎么用?Java FreeStyleBuild使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FreeStyleBuild类属于hudson.model包,在下文中一共展示了FreeStyleBuild类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldGenerateLivingDocumentatation

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void shouldGenerateLivingDocumentatation() throws Exception{
	//given
	FreeStyleProject project = jenkins.createFreeStyleProject("test");
	SingleFileSCM scm = new SingleFileSCM("asciidoctor.json",
			CucumberLivingDocumentationIT.class.getResource("/json-output/asciidoctor/asciidoctor.json").toURI().toURL());
	
	project.setScm(scm);
	CukedoctorPublisher publisher = new CukedoctorPublisher(null, FormatType.HTML, TocType.RIGHT, true, true, "Living Documentation",false,false,false,false,false);
	project.getPublishersList().add(publisher);
	project.save();

	//when
	FreeStyleBuild build = jenkins.buildAndAssertSuccess(project);
	
	//then
	jenkins.assertLogContains("Format: html" + NEW_LINE + "Toc: right"+NEW_LINE +
			"Title: Living Documentation"+NEW_LINE+"Numbered: true"+NEW_LINE +
			"Section anchors: true", build);
	jenkins.assertLogContains("Found 4 feature(s)...",build);
	jenkins.assertLogContains("Documentation generated successfully!",build);
	
}
 
开发者ID:jenkinsci,项目名称:cucumber-living-documentation-plugin,代码行数:24,代码来源:CucumberLivingDocumentationIT.java

示例2: shouldGenerateLivingDocumentatationOnSlaveNode

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void shouldGenerateLivingDocumentatationOnSlaveNode() throws Exception{
	DumbSlave slave = jenkins.createOnlineSlave();
	FreeStyleProject project = jenkins.createFreeStyleProject("test");
	project.setAssignedNode(slave);
	
	SingleFileSCM scm = new SingleFileSCM("asciidoctor.json",
			CucumberLivingDocumentationIT.class.getResource("/json-output/asciidoctor/asciidoctor.json").toURI().toURL());
	
	project.setScm(scm);
	CukedoctorPublisher publisher = new CukedoctorPublisher(null, FormatType.HTML, TocType.RIGHT, true, true, "Living Documentation",false,false,false,false,false);
	project.getPublishersList().add(publisher);
	project.save();

	FreeStyleBuild build = jenkins.buildAndAssertSuccess(project);
	jenkins.assertLogContains("Format: html" + NEW_LINE + "Toc: right"+NEW_LINE +
			"Title: Living Documentation"+NEW_LINE+"Numbered: true"+NEW_LINE +
			"Section anchors: true", build);
	jenkins.assertLogContains("Found 4 feature(s)...",build);
	jenkins.assertLogContains("Documentation generated successfully!",build);
	Assert.assertTrue("It should run on slave",build.getBuiltOn().equals(slave));
	
}
 
开发者ID:jenkinsci,项目名称:cucumber-living-documentation-plugin,代码行数:24,代码来源:CucumberLivingDocumentationIT.java

示例3: consulWrite

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void consulWrite() throws BuilderException {

    try {
        FreeStyleProject project = jenkinsRule.createFreeStyleProject();
        project.getBuildersList().add(new ConsulKVBuilder(ConsulKVBuilderTest.ACL_ID,
                ConsulKVBuilderTest.HOST, ConsulKVBuilderTest.KEY,
                ConsulKVBuilderTest.VALUE, null, null, RequestMode.WRITE, 30000, 30000, DebugMode.ENABLED, false));
        FreeStyleBuild build = project.scheduleBuild2(0).get();

        String log = FileUtils.readFileToString(build.getLogFile());
        assertThat(log, containsString(ConsulKVBuilderTest.WRITE_TEST_VALUE));
    } catch (IOException ioe) {
        throw new BuilderException(ConsulKVBuilderTest.IO_EXCEPTION_TEXT, ioe);
    } catch (InterruptedException ie) {
        throw new BuilderException(ConsulKVBuilderTest.INTERRUPTED_EXCEPTION_TEXT, ie);
    } catch (ExecutionException ee) {
        throw new BuilderException(ConsulKVBuilderTest.EXECUTION_EXCEPTION_TEXT, ee);
    }
}
 
开发者ID:jenkinsci,项目名称:consul-kv-builder-plugin,代码行数:21,代码来源:ConsulKVBuilderTest.java

示例4: consulRead

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void consulRead() throws BuilderException {
    try {
        FreeStyleProject project = jenkinsRule.createFreeStyleProject();
        project.getBuildersList().add(new ConsulKVBuilder(null, ConsulKVBuilderTest.HOST, ConsulKVBuilderTest
                .KEY, null,
                null, ConsulKVBuilderTest.ENV_KEY, RequestMode.READ, 30000,
                30000, DebugMode.ENABLED, false));
        FreeStyleBuild build = project.scheduleBuild2(0).get();

        String log = FileUtils.readFileToString(build.getLogFile());
        assertThat(log, containsString(ConsulKVBuilderTest.READ_TEST_VALUE_1));
        assertThat(log, containsString(ConsulKVBuilderTest.READ_TEST_VALUE_2));
    } catch (IOException ioe) {
        throw new BuilderException(ConsulKVBuilderTest.IO_EXCEPTION_TEXT, ioe);
    } catch (InterruptedException ie) {
        throw new BuilderException(ConsulKVBuilderTest.INTERRUPTED_EXCEPTION_TEXT, ie);
    } catch (ExecutionException ee) {
        throw new BuilderException(ConsulKVBuilderTest.EXECUTION_EXCEPTION_TEXT, ee);
    }
}
 
开发者ID:jenkinsci,项目名称:consul-kv-builder-plugin,代码行数:22,代码来源:ConsulKVBuilderTest.java

示例5: consulDelete

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void consulDelete() throws BuilderException {
    try {
        FreeStyleProject project = jenkinsRule.createFreeStyleProject();
        project.getBuildersList().add(new ConsulKVBuilder(ConsulKVBuilderTest.ACL_ID,
                ConsulKVBuilderTest.HOST, ConsulKVBuilderTest.KEY, null, null, null, RequestMode.DELETE, 30000,
                30000,
                DebugMode.ENABLED, false));
        FreeStyleBuild build = project.scheduleBuild2(0).get();

        String log = FileUtils.readFileToString(build.getLogFile());
        assertThat(log, containsString(ConsulKVBuilderTest.WRITE_TEST_VALUE));
    } catch (IOException ioe) {
        throw new BuilderException(ConsulKVBuilderTest.IO_EXCEPTION_TEXT, ioe);
    } catch (InterruptedException ie) {
        throw new BuilderException(ConsulKVBuilderTest.INTERRUPTED_EXCEPTION_TEXT, ie);
    } catch (ExecutionException ee) {
        throw new BuilderException(ConsulKVBuilderTest.EXECUTION_EXCEPTION_TEXT, ee);
    }
}
 
开发者ID:jenkinsci,项目名称:consul-kv-builder-plugin,代码行数:21,代码来源:ConsulKVBuilderTest.java

示例6: testAutomateExceptionIsHandled

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void testAutomateExceptionIsHandled() throws Exception {
    /* =================== Prepare ================= */
    new MockAutomateClientThatThrowsAutomateException();
    addBuildStep();
    project.getBuildersList().add(new TouchBuilder());

    /* =================== Execute ================= */
    FreeStyleBuild build = project.scheduleBuild2(0).get();
    AutomateTestAction automateTestAction = new AutomateTestAction(build, mockedCaseResult, "Random4756SessionId");
    Session automateSession = automateTestAction.getSession();

    /* =================== Verify ================= */
    Assert.assertNull("Automate Session MUST be null.", automateSession);
    Assert.assertNotNull("Exception MUST not be null.", automateTestAction.getLastException());
    Assert.assertTrue("Exception should be of Type AutomateException", automateTestAction.getLastException() instanceof AutomateException);
    Assert.assertTrue("Exception message MUST not be empty", StringUtils.isNotEmpty(automateTestAction.getLastError()));
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:19,代码来源:AutomateTestActionTest.java

示例7: testSessionNotFoundExceptionIsHandled

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void testSessionNotFoundExceptionIsHandled() throws Exception {
    /* =================== Prepare ================= */
    new MockAutomateClientThatThrowsSessionNotFoundException();
    addBuildStep();
    project.getBuildersList().add(new TouchBuilder());

    /* =================== Execute ================= */
    FreeStyleBuild build = project.scheduleBuild2(0).get();
    AutomateTestAction automateTestAction = new AutomateTestAction(build, mockedCaseResult, "Random4756SessionId");
    Session automateSession = automateTestAction.getSession();

    /* =================== Verify ================= */
    Assert.assertNull("Automate Session MUST be null.", automateSession);
    Assert.assertNotNull("Exception MUST not be null.", automateTestAction.getLastException());
    Assert.assertTrue("Exception should be of Type SessionNotFound", automateTestAction.getLastException() instanceof SessionNotFound);
    Assert.assertTrue("Exception message MUST not be empty", StringUtils.isNotEmpty(automateTestAction.getLastError()));
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:19,代码来源:AutomateTestActionTest.java

示例8: performDeployTest

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void performDeployTest() throws Exception {
  configFilePath.write(CONFIG_FILE_CONTENTS, "UTF-8");
  importPaths.get(0).write(TEMPLATE1_CONTENTS, "UTF-8");
  importPaths.get(1).write(TEMPLATE2_CONTENTS, "UTF-8");

  // Hand the deployer a special builder that will intercept executions
  {
    executor.when(DeploymentManager.Deployments.Insert.class, newRunningOperation());
    executor.when(DeploymentManager.Operations.Get.class, newRunningOperation());
    executor.when(DeploymentManager.Operations.Get.class, newDoneOperation());
    executor.when(DeploymentManager.Deployments.Delete.class, newDoneOperation());
  }
  String remoteImportPaths = PathUtils.toRemotePaths(importPaths);
  GoogleCloudManagerBuildWrapper deployer = new GoogleCloudManagerBuildWrapper(
      getNewTestingTemplatedCloudDeployment(credentials.getId(), DEPLOYMENT_NAME,
          configFilePath.getRemote(), remoteImportPaths, new MockPluginModule(executor)));

  project.getBuildWrappersList().add(deployer);

  FreeStyleBuild build = project.scheduleBuild2(0).get();

  dumpLog(build);
  assertEquals(Result.SUCCESS, build.getResult());
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:26,代码来源:GoogleCloudManagerBuildWrapperTest.java

示例9: performDeployWithIOExceptionDuringDeleteTest

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void performDeployWithIOExceptionDuringDeleteTest() throws Exception {
  configFilePath.write(CONFIG_FILE_CONTENTS, "UTF-8");
  importPaths.get(0).write(TEMPLATE1_CONTENTS, "UTF-8");
  importPaths.get(1).write(TEMPLATE2_CONTENTS, "UTF-8");

  // Hand the deployer a special builder that will intercept executions
  {
    executor.when(DeploymentManager.Deployments.Insert.class, newDoneOperation());
    executor.throwWhen(DeploymentManager.Deployments.Delete.class, new IOException("test"));
  }
  GoogleCloudManagerBuildWrapper deployer =
      new GoogleCloudManagerBuildWrapper(getNewTestingTemplatedCloudDeployment(
          credentials.getId(), DEPLOYMENT_NAME, configFilePath.getRemote(),
          PathUtils.toRemotePaths(importPaths), new MockPluginModule(executor)));

  project.getBuildWrappersList().add(deployer);

  FreeStyleBuild build = project.scheduleBuild2(0).get();

  dumpLog(build);
  assertEquals(Result.FAILURE, build.getResult());
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:24,代码来源:GoogleCloudManagerBuildWrapperTest.java

示例10: performDeployTest

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void performDeployTest() throws Exception {
  configFilePath.write(CONFIG_FILE_CONTENTS, "UTF-8");
  importPaths.get(0).write(TEMPLATE1_CONTENTS, "UTF-8");
  importPaths.get(1).write(TEMPLATE2_CONTENTS, "UTF-8");

  // Hand the deployer a special builder that will intercept executions
  executor.when(DeploymentManager.Deployments.Insert.class, newRunningOperation());
  executor.when(DeploymentManager.Operations.Get.class, newRunningOperation());
  executor.when(DeploymentManager.Operations.Get.class, newDoneOperation());
  GoogleCloudManagerDeployer deployer =
      new GoogleCloudManagerDeployer(getNewTestingTemplatedCloudDeployment(credentials.getId(),
          DEPLOYMENT_NAME, configFilePath.getRemote(), PathUtils.toRemotePaths(importPaths),
          new MockPluginModule(executor)));

  project.getPublishersList().add(deployer);

  FreeStyleBuild build = project.scheduleBuild2(0).get();

  assertEquals(Result.SUCCESS, build.getResult());
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:22,代码来源:GoogleCloudManagerDeployerTest.java

示例11: pickFirstErrorBuildIfPreferringErrors

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void pickFirstErrorBuildIfPreferringErrors() throws Exception {
    FreeStyleProject project = createProject(0, true);

    Shell exitShell = new Shell("exit 1");
    project.getBuildersList().add(exitShell);
    project.scheduleBuild2(0).waitForStart().run();
    project.scheduleBuild2(0).waitForStart().run();

    project.getBuildersList().remove(exitShell);

    FreeStyleBuild successfulBuildAfterFailures = project.scheduleBuild2(0).get();
    String logText = FileUtils.readFileToString(successfulBuildAfterFailures.getLogFile());
    assertEquals(logText, Result.SUCCESS, successfulBuildAfterFailures.getResult());

    FreeStyleBuild completedBuild = project.scheduleBuild2(0).get();
    logText = FileUtils.readFileToString(completedBuild.getLogFile());
    assertThatVmIsInText(completedBuild.getNumber(), 2, logText);
}
 
开发者ID:damienbiggs,项目名称:parameter-pool-plugin,代码行数:20,代码来源:ParameterPoolTest.java

示例12: buildWithConduit

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
protected FreeStyleBuild buildWithConduit(JSONObject queryDiffsResponse, JSONObject postCommentResponse, JSONObject sendMessageResponse, boolean harbormaster) throws Exception {
    Map<String, JSONObject> responses = new HashMap<String, JSONObject>();
    if (queryDiffsResponse != null) {
        responses.put("differential.querydiffs", queryDiffsResponse);
    }
    if (postCommentResponse != null) {
        responses.put("differential.createcomment", postCommentResponse);
    }
    if (sendMessageResponse != null) {
        responses.put("harbormaster.sendmessage", sendMessageResponse);
    }
    responses.put("differential.getcommitmessage", new JSONObject().element("result", "commit message"));
    conduit = new FakeConduit(responses);

    TestUtils.addValidCredentials(conduit);

    addBuildStep();

    TestUtils.setDefaultBuildEnvironment(j, harbormaster);

    return p.scheduleBuild2(0).get();
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:23,代码来源:BuildIntegrationTest.java

示例13: testFailBuildOnDecreasedCoverage

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void testFailBuildOnDecreasedCoverage() throws Exception {
    TestUtils.addCopyBuildStep(p, TestUtils.COBERTURA_XML, CoberturaXMLParser.class, "go-torch-coverage2.xml");
    UberallsClient uberalls = TestUtils.getDefaultUberallsClient();
    notifier = getDecreasedLineCoverageNotifier(0.0);

    when(uberalls.getCoverage(any(String.class))).thenReturn("{\n" +
        "  \"sha\": \"deadbeef\",\n" +
        "  \"lineCoverage\": 100,\n" +
        "  \"filesCoverage\": 100,\n" +
        "  \"packageCoverage\": 100,\n" +
        "  \"classesCoverage\": 100,\n" +
        "  \"methodCoverage\": 100,\n" +
        "  \"conditionalCoverage\": 100\n" +
        "}");
    notifier.getDescriptor().setUberallsURL("http://uber.alls");
    notifier.setUberallsClient(uberalls);

    FreeStyleBuild build = buildWithConduit(getFetchDiffResponse(), null, new JSONObject());
    assertEquals(Result.FAILURE, build.getResult());
    assertLogContains("Sending build result to Harbormaster with PHID PHID-not-real, success: false", build);
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:23,代码来源:PhabricatorNotifierTest.java

示例14: testPassBuildOnDecreasedCoverageButGreaterThanMinPercent

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void testPassBuildOnDecreasedCoverageButGreaterThanMinPercent() throws Exception {
    TestUtils.addCopyBuildStep(p, TestUtils.COBERTURA_XML, CoberturaXMLParser.class, "go-torch-coverage2.xml");
    UberallsClient uberalls = TestUtils.getDefaultUberallsClient();
    notifier = getNotifierWithCoverageCheck(0.0, 90.0);

    when(uberalls.getCoverage(any(String.class))).thenReturn("{\n" +
        "  \"sha\": \"deadbeef\",\n" +
        "  \"lineCoverage\": 100,\n" +
        "  \"filesCoverage\": 100,\n" +
        "  \"packageCoverage\": 100,\n" +
        "  \"classesCoverage\": 100,\n" +
        "  \"methodCoverage\": 100,\n" +
        "  \"conditionalCoverage\": 100\n" +
        "}");
    notifier.getDescriptor().setUberallsURL("http://uber.alls");
    notifier.setUberallsClient(uberalls);

    FreeStyleBuild build = buildWithConduit(getFetchDiffResponse(), null, new JSONObject());
    assertEquals(Result.SUCCESS, build.getResult());
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:22,代码来源:PhabricatorNotifierTest.java

示例15: testPassBuildOnSameCoverage

import hudson.model.FreeStyleBuild; //导入依赖的package包/类
@Test
public void testPassBuildOnSameCoverage() throws Exception {
    TestUtils.addCopyBuildStep(p, TestUtils.COBERTURA_XML, CoberturaXMLParser.class, "go-torch-coverage2.xml");
    UberallsClient uberalls = TestUtils.getDefaultUberallsClient();
    notifier = getDecreasedLineCoverageNotifier(0.0);
    when(uberalls.getCoverage(any(String.class))).thenReturn("{\n" +
        "  \"sha\": \"deadbeef\",\n" +
        "  \"lineCoverage\": 0.0,\n" +
        "  \"packageCoverage\": 0,\n" +
        "  \"classesCoverage\": 0,\n" +
        "  \"methodCoverage\": 0,\n" +
        "  \"conditionalCoverage\": 0\n" +
        "}");
    notifier.setUberallsClient(uberalls);

    FreeStyleBuild build = buildWithConduit(getFetchDiffResponse(), null, new JSONObject());
    assertEquals(Result.SUCCESS, build.getResult());
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:19,代码来源:PhabricatorNotifierTest.java


注:本文中的hudson.model.FreeStyleBuild类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。