當前位置: 首頁>>代碼示例>>Java>>正文


Java FreeStyleProject.setScm方法代碼示例

本文整理匯總了Java中hudson.model.FreeStyleProject.setScm方法的典型用法代碼示例。如果您正苦於以下問題:Java FreeStyleProject.setScm方法的具體用法?Java FreeStyleProject.setScm怎麽用?Java FreeStyleProject.setScm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hudson.model.FreeStyleProject的用法示例。


在下文中一共展示了FreeStyleProject.setScm方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldGenerateLivingDocumentatation

import hudson.model.FreeStyleProject; //導入方法依賴的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.FreeStyleProject; //導入方法依賴的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: shouldBuildTriggersOnUpdatingNewCommitsPR

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test
public void shouldBuildTriggersOnUpdatingNewCommitsPR() throws Exception {
    // GIVEN
    FreeStyleProject project = jenkinsRule.createFreeStyleProject("PRJ");
    GhprcTrigger trigger = GhprcTestUtil.getTrigger(null);
    given(commitPointer.getSha()).willReturn("sha").willReturn("sha").willReturn("newOne").willReturn("newOne");
    given(ghPullRequest.getComments()).willReturn(Lists.<GHIssueComment> newArrayList());
    GhprcTestUtil.setupGhprcTriggerDescriptor(null);
    project.addProperty(new GithubProjectProperty("https://github.com/user/dropwizard"));
    given(ghPullRequest.getNumber()).willReturn(2).willReturn(2).willReturn(3).willReturn(3);
    Ghprc ghprc = spy(trigger.createGhprc(project));
    doReturn(ghprcGitHub).when(ghprc).getGitHub();
    trigger.start(project, true);
    trigger.setHelper(ghprc);
    ghprc.getRepository().setHelper(ghprc);
    project.addTrigger(trigger);
    GitSCM scm = GhprcTestUtil.provideGitSCM();
    project.setScm(scm);

    GhprcTestUtil.triggerRunAndWait(10, trigger, project);

    assertThat(project.getBuilds().toArray().length).isEqualTo(2);
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:24,代碼來源:GhprcIT.java

示例4: subscribeProject

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
protected void subscribeProject(final ProjectFixture fixture) throws Exception {
    String name = UUID.randomUUID().toString();

    final FreeStyleProject job = jenkinsRule.getInstance().createProject(FreeStyleProject.class, name);
    job.setScm(new NullSCM());
    if (fixture.getScm() != null) {
        job.setScm(fixture.getScm());
    }

    final String uuid = this.sqsQueue.getUuid();

    SQSTrigger trigger = null;

    if (fixture.isHasTrigger()) {
        trigger = new SQSTrigger(uuid, fixture.isSubscribeInternalScm(), fixture.getScmConfigs());
    }

    final OneShotEvent event = new OneShotEvent();
    job.getBuildersList().add(new TestBuilder() {

        @Override
        public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
            event.signal();
            fixture.setLastBuild(job.getLastBuild());
            return true;
        }
    });
    job.setQuietPeriod(0);

    if (trigger != null) {
        trigger.start(job, false);
        job.addTrigger(trigger);
    }

    fixture.setEvent(event);
}
 
開發者ID:riboseinc,項目名稱:aws-codecommit-trigger-plugin,代碼行數:37,代碼來源:AbstractFreestyleIT.java

示例5: roundTripTest

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Perform a round trip test on the SCM configuration.
 * <p>
 * A project is created, configured, submitted / saved, and reloaded where the original configuration is compared against
 * the reloaded configuration for equality.
 * 
 * @param jenkinsRule
 *            the Jenkins rule
 * @param scmConfig
 *            the configuration to perform the round trip on
 * @properties ','-separated list of property names that are compared.
 */
public static void roundTripTest(JenkinsRule jenkinsRule, SCM scmConfig, String properties)
{
	try
	{
		FreeStyleProject project = jenkinsRule.createFreeStyleProject("TestProject");
		project.setScm(scmConfig);

		// workaround for eclipse compiler Ambiguous method call
		project.save();
		jenkinsRule.jenkins.reload();

		FreeStyleProject reloaded = jenkinsRule.jenkins.getItemByFullName(project.getFullName(), FreeStyleProject.class);
		assertNotNull(reloaded);

		SCM after = (SCM) reloaded.getScm();
		assertNotNull(after);

		jenkinsRule.assertEqualBeans(scmConfig, after, properties);
	}
	catch (Exception e)
	{
		// Add the print of the stack trace because the exception message is not enough to troubleshoot the root issue. For
		// example, if the exception is constructed without a message, you get no information from executing fail().
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
開發者ID:jenkinsci,項目名稱:compuware-scm-downloader-plugin,代碼行數:40,代碼來源:ScmTestUtils.java

示例6: testGitSCMWithSomeExtensionJob

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test public void testGitSCMWithSomeExtensionJob() throws Exception {
    FreeStyleProject project = j.createFreeStyleProject();
    ArrayList<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
    extensions.add(new CleanCheckout());
    project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
    assertTrue(checker.executeCheck(project));
    extensions.add(new CloneOption(false, "", 0));
    project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
    assertTrue(checker.executeCheck(project));
}
 
開發者ID:v1v,項目名稱:jenkinslint-plugin,代碼行數:11,代碼來源:GitShallowCheckerTestCase.java

示例7: testGitSCMWithCloneOptionExtensionNoShallowJob

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test public void testGitSCMWithCloneOptionExtensionNoShallowJob() throws Exception {
    FreeStyleProject project = j.createFreeStyleProject();
    ArrayList<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
    extensions.add(new CloneOption(false, "", 0));
    project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
    assertTrue(checker.executeCheck(project));
}
 
開發者ID:v1v,項目名稱:jenkinslint-plugin,代碼行數:8,代碼來源:GitShallowCheckerTestCase.java

示例8: testGitSCMWithCloneOptionExtensionShallowJob

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test public void testGitSCMWithCloneOptionExtensionShallowJob() throws Exception {
    FreeStyleProject project = j.createFreeStyleProject();
    ArrayList<GitSCMExtension> extensions = new ArrayList<GitSCMExtension>();
    extensions.add(new CloneOption(true, "", 0));
    project.setScm(new hudson.plugins.git.GitSCM(null, null, false, null, null, "", extensions));
    assertFalse(checker.executeCheck(project));
}
 
開發者ID:v1v,項目名稱:jenkinslint-plugin,代碼行數:8,代碼來源:GitShallowCheckerTestCase.java

示例9: shouldBuildTriggersOnNewPR

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test
public void shouldBuildTriggersOnNewPR() throws Exception {
    // GIVEN
    FreeStyleProject project = jenkinsRule.createFreeStyleProject("PRJ");
    GhprcTrigger trigger = GhprcTestUtil.getTrigger(null);
    given(commitPointer.getSha()).willReturn("sha");
    GhprcTestUtil.setupGhprcTriggerDescriptor(null);
    project.addProperty(new GithubProjectProperty("https://github.com/user/dropwizard"));
    given(ghPullRequest.getNumber()).willReturn(1);

    // Creating spy on ghprc, configuring repo
    Ghprc ghprc = spy(trigger.createGhprc(project));
    doReturn(ghprcGitHub).when(ghprc).getGitHub();
    ghprc.getRepository().setHelper(ghprc);

    // Configuring and adding Ghprc trigger
    project.addTrigger(trigger);

    // Configuring Git SCM
    GitSCM scm = GhprcTestUtil.provideGitSCM();
    project.setScm(scm);

    trigger.start(project, true);
    trigger.setHelper(ghprc);

    GhprcTestUtil.triggerRunAndWait(10, trigger, project);

    assertThat(project.getBuilds().toArray().length).isEqualTo(1);
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:30,代碼來源:GhprcIT.java

示例10: shouldBuildTriggersOnUpdatingRetestMessagePR

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test
public void shouldBuildTriggersOnUpdatingRetestMessagePR() throws Exception {
    // GIVEN
    FreeStyleProject project = jenkinsRule.createFreeStyleProject("PRJ");
    GhprcTrigger trigger = GhprcTestUtil.getTrigger(null);

    given(commitPointer.getSha()).willReturn("sha");

    GHIssueComment comment = mock(GHIssueComment.class);
    given(comment.getBody()).willReturn("retest this please");
    given(comment.getUpdatedAt()).willReturn(new DateTime().plusDays(1).toDate());
    given(comment.getUser()).willReturn(ghUser);
    given(ghPullRequest.getComments()).willReturn(newArrayList(comment));
    given(ghPullRequest.getNumber()).willReturn(5).willReturn(5);
    GhprcTestUtil.setupGhprcTriggerDescriptor(null);
    project.addProperty(new GithubProjectProperty("https://github.com/user/dropwizard"));

    Ghprc ghprc = spy(trigger.createGhprc(project));
    doReturn(ghprcGitHub).when(ghprc).getGitHub();
    trigger.start(project, true);
    trigger.setHelper(ghprc);
    ghprc.getRepository().setHelper(ghprc);
    project.addTrigger(trigger);
    GitSCM scm = GhprcTestUtil.provideGitSCM();
    project.setScm(scm);

    GhprcTestUtil.triggerRunAndWait(10, trigger, project);
    assertThat(project.getBuilds().toArray().length).isEqualTo(2);
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:30,代碼來源:GhprcIT.java

示例11: shouldNotBuildDisabledBuild

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test
public void shouldNotBuildDisabledBuild() throws Exception {
    // GIVEN
    FreeStyleProject project = jenkinsRule.createFreeStyleProject("PRJ");
    GhprcTrigger trigger = GhprcTestUtil.getTrigger(null);

    given(commitPointer.getSha()).willReturn("sha");

    GHIssueComment comment = mock(GHIssueComment.class);
    given(comment.getBody()).willReturn("retest this please");
    given(comment.getUpdatedAt()).willReturn(new DateTime().plusDays(1).toDate());
    given(comment.getUser()).willReturn(ghUser);
    given(ghPullRequest.getComments()).willReturn(newArrayList(comment));
    given(ghPullRequest.getNumber()).willReturn(5);
    GhprcTestUtil.setupGhprcTriggerDescriptor(null);
    project.addProperty(new GithubProjectProperty("https://github.com/user/dropwizard"));

    Ghprc ghprc = spy(trigger.createGhprc(project));
    doReturn(ghprcGitHub).when(ghprc).getGitHub();
    trigger.start(project, true);
    trigger.setHelper(ghprc);
    ghprc.getRepository().setHelper(ghprc);
    project.addTrigger(trigger);
    GitSCM scm = GhprcTestUtil.provideGitSCM();
    project.setScm(scm);
    
    project.disable();

    GhprcTestUtil.triggerRunAndWait(10, trigger, project);
    assertThat(project.getBuilds().toArray().length).isEqualTo(0);
    
    verify(ghRepository, times(0)).createCommitStatus(any(String.class), any(GHCommitState.class), any(String.class), any(String.class));
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:34,代碼來源:GhprcIT.java

示例12: testUrlEncoded

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Test
  public void testUrlEncoded() throws Exception {
      // GIVEN
      FreeStyleProject project = jenkinsRule.createFreeStyleProject("testUrlEncoded");
      GhprcTrigger trigger = spy(GhprcTestUtil.getTrigger(null));
      given(commitPointer.getSha()).willReturn("sha1");
      GhprcTestUtil.setupGhprcTriggerDescriptor(null);
      project.addProperty(new GithubProjectProperty("https://github.com/user/dropwizard"));
      given(ghPullRequest.getNumber()).willReturn(1);
      Ghprc ghprc = spy(trigger.createGhprc(project));
      doReturn(ghprcGitHub).when(ghprc).getGitHub();
      trigger.start(project, true);
      trigger.setHelper(ghprc);
      ghprc.getRepository().setHelper(ghprc);
      project.addTrigger(trigger);
      GitSCM scm = GhprcTestUtil.provideGitSCM();
      project.setScm(scm);

      GhprcTestUtil.triggerRunAndWait(10, trigger, project);

      assertThat(project.getBuilds().toArray().length).isEqualTo(1);

doReturn(gitHub).when(trigger).getGitHub();

      BufferedReader br = new BufferedReader(new StringReader(
              "payload=" + URLEncoder.encode(GhprcTestUtil.PAYLOAD, "UTF-8")));

      given(req.getContentType()).willReturn("application/x-www-form-urlencoded");
      given(req.getParameter("payload")).willReturn(GhprcTestUtil.PAYLOAD);
      given(req.getHeader("X-GitHub-Event")).willReturn("issue_comment");
      given(req.getReader()).willReturn(br);
      given(req.getCharacterEncoding()).willReturn("UTF-8");

      GhprcRootAction ra = new GhprcRootAction();
      ra.doIndex(req, null);
      GhprcTestUtil.waitForBuildsToFinish(project);

      assertThat(project.getBuilds().toArray().length).isEqualTo(2);
  }
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:40,代碼來源:GhprcRootActionTest.java

示例13: executionTest

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Tests the results of an download execution.
 * <p>
 * A project is created, configured and executed where the log is examined to verify parameters being passed to the CLI. The
 * build is not expected to succeed since no CLI exists
 */
@Test
public void executionTest()
{
	try
	{
		FreeStyleProject project = m_jenkinsRule.createFreeStyleProject("TestProject");
		project.setScm(new IspwConfiguration(TestConstants.EXPECTED_CONNECTION_ID, TestConstants.EXPECTED_CREDENTIALS_ID,
				EXPECTED_SERVER_CONFIG, EXPECTED_SERVER_STREAM, EXPECTED_SERVER_APPLICATION, EXPECTED_SERVER_LEVEL,
				EXPECTED_LEVEL_OPTION, EXPECTED_COMPONENT_TYPE, EXPECTED_FOLDER_NAME));

		// don't expect the build to succeed since no CLI exists
		if (project.scheduleBuild(null))
		{
			while (project.getLastCompletedBuild() == null)
			{
				// wait for the build to complete before obtaining the log
				continue;
			}

			FreeStyleBuild build = project.getLastCompletedBuild();
			String logFileOutput = JenkinsRule.getLog(build);

			String expectedConnectionStr = String.format("-host \"%s\" -port \"%s\"", TestConstants.EXPECTED_HOST,
					TestConstants.EXPECTED_PORT);
			assertThat("Expected log to contain Host connection: " + expectedConnectionStr + '.', logFileOutput,
					containsString(expectedConnectionStr));

			String expectedCodePageStr = String.format("-code %s", TestConstants.EXPECTED_CODE_PAGE);
			assertThat("Expected log to contain Host code page: " + expectedCodePageStr + '.', logFileOutput,
					containsString(expectedCodePageStr));

			String expectedTimeoutStr = String.format("-timeout \"%s\"", TestConstants.EXPECTED_TIMEOUT);
			assertThat("Expected log to contain Host timeout: " + expectedTimeoutStr + '.', logFileOutput,
					containsString(expectedTimeoutStr));

			String expectedCredentialsStr = String.format("-id \"%s\" -pass %s", TestConstants.EXPECTED_USER_ID,
					TestConstants.EXPECTED_PASSWORD);
			assertThat("Expected log to contain Login credentials: " + expectedCredentialsStr + '.', logFileOutput,
					containsString(expectedCredentialsStr));

			assertThat(String.format("Expected log to contain server config: \"%s\".", EXPECTED_SERVER_CONFIG),
					logFileOutput, containsString(EXPECTED_SERVER_CONFIG));

			assertThat(String.format("Expected log to contain server stream: \"%s\".", EXPECTED_SERVER_STREAM),
					logFileOutput, containsString(EXPECTED_SERVER_STREAM));

			assertThat(String.format("Expected log to contain server application: \"%s\".", EXPECTED_SERVER_APPLICATION),
					logFileOutput, containsString(EXPECTED_SERVER_APPLICATION));

			assertThat(String.format("Expected log to contain server level: \"%s\".", EXPECTED_SERVER_LEVEL), logFileOutput,
					containsString(EXPECTED_SERVER_LEVEL));

			assertThat(String.format("Expected log to contain level option: \"%s\".", EXPECTED_LEVEL_OPTION), logFileOutput,
					containsString(EXPECTED_LEVEL_OPTION));

			assertThat(String.format("Expected log to contain filter type: \"%s\".", EXPECTED_COMPONENT_TYPE),
					logFileOutput, containsString(EXPECTED_COMPONENT_TYPE));

			assertThat(String.format("Expected log to contain folder name: \"%s\".", EXPECTED_FOLDER_NAME), logFileOutput,
					containsString(EXPECTED_FOLDER_NAME));
		}
	}
	catch (Exception e)
	{
		// Add the print of the stack trace because the exception message is not enough to troubleshoot the root issue. For
		// example, if the exception is constructed without a message, you get no information from executing fail().
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
開發者ID:jenkinsci,項目名稱:compuware-scm-downloader-plugin,代碼行數:77,代碼來源:IspwConfigurationTest.java

示例14: testGetLoginInformation

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Test retrieval of a project's login information.
 */
@Test
public void testGetLoginInformation()
{
	try
	{
		FreeStyleProject project = m_jenkinsRule.createFreeStyleProject("TestProject");
		PdsConfiguration scmConfig = new PdsConfiguration(TestConstants.EXPECTED_CONNECTION_ID,
				TestConstants.EXPECTED_FILTER_PATTERN, TestConstants.EXPECTED_FILE_EXTENSION,
				TestConstants.EXPECTED_CREDENTIALS_ID, TestConstants.EXPECTED_TARGET_FOLDER);
		project.setScm(scmConfig);

		// Test passing a null project and still find credentials
		StandardUsernamePasswordCredentials credential = scmConfig.getLoginInformation(null);

		assertNotNull(credential);
		assertThat(String.format("Expected getId() to return %s", TestConstants.EXPECTED_CREDENTIALS_ID),
				credential.getId(), is(equalTo(TestConstants.EXPECTED_CREDENTIALS_ID)));

		// Test pass the project and find credentials
		credential = scmConfig.getLoginInformation(project);

		assertNotNull(credential);
		assertThat(String.format("Expected getId() to return %s", TestConstants.EXPECTED_CREDENTIALS_ID),
				credential.getId(), is(equalTo(TestConstants.EXPECTED_CREDENTIALS_ID)));

		// Test unable to find credentials
		PdsConfiguration scmConfig2 = new PdsConfiguration(TestConstants.EXPECTED_CONNECTION_ID,
				TestConstants.EXPECTED_FILTER_PATTERN, TestConstants.EXPECTED_FILE_EXTENSION, "blah", TestConstants.EXPECTED_TARGET_FOLDER);
		project.setScm(scmConfig2);

		credential = scmConfig2.getLoginInformation(project);

		assertNull(credential);
	}
	catch (Exception e)
	{
		// Add the print of the stack trace because the exception message is not enough to troubleshoot the root issue. For
		// example, if the exception is constructed without a message, you get no information from executing fail().
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
開發者ID:jenkinsci,項目名稱:compuware-scm-downloader-plugin,代碼行數:46,代碼來源:CpwrScmConfigurationTest.java

示例15: executionTest

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Tests the results of a SCM download execution.
 * <p>
 * A project is created, configured and executed where the log is examined to verify results.
 * 
 * @param jenkinsRule
 *            the Jenkins rule
 * @param scmConfig
 *            the SCM configuration
 */
public static void executionTest(JenkinsRule jenkinsRule, CpwrScmConfiguration scmConfig)
{
	try
	{
		FreeStyleProject project = jenkinsRule.createFreeStyleProject("TestProject");
		project.setScm(scmConfig);

		// don't expect the build to succeed since no CLI exists
		if (project.scheduleBuild(null))
		{
			while (project.getLastCompletedBuild() == null)
			{
				// wait for the build to complete before obtaining the log
				continue;
			}

			FreeStyleBuild build = project.getLastCompletedBuild();
			String logFileOutput = JenkinsRule.getLog(build);

			String expectedConnectionStr = String.format("Host connection = %s:%s", TestConstants.EXPECTED_HOST,
					TestConstants.EXPECTED_PORT);
			assertThat("Expected log to contain Host connection: " + expectedConnectionStr + '.', logFileOutput,
					containsString(expectedConnectionStr));

			String expectedCredentialsStr = String.format("Username = %s", TestConstants.EXPECTED_USER_ID);
			assertThat("Expected log to contain Login credentials: " + expectedCredentialsStr + '.', logFileOutput,
					containsString(expectedCredentialsStr));

			String expectedFilterPatternStr = String.format("Filter pattern = %s", TestConstants.EXPECTED_FILTER_PATTERN);
			assertThat("Expected log to contain filter pattern: " + expectedFilterPatternStr + '.', logFileOutput,
					containsString(expectedFilterPatternStr));

			String expectedFileExtensionStr = String.format("File extension = %s", TestConstants.EXPECTED_FILE_EXTENSION);
			assertThat("Expected log to contain file extension: " + expectedFileExtensionStr + '.', logFileOutput,
					containsString(expectedFileExtensionStr));
		}
	}
	catch (Exception e)
	{
		// Add the print of the stack trace because the exception message is not enough to troubleshoot the root issue. For
		// example, if the exception is constructed without a message, you get no information from executing fail().
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
開發者ID:jenkinsci,項目名稱:compuware-scm-downloader-plugin,代碼行數:56,代碼來源:CpwrScmConfigTestUtils.java


注:本文中的hudson.model.FreeStyleProject.setScm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。