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


Java FreeStyleProject.scheduleBuild方法代碼示例

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


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

示例1: call

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
@Override
public Boolean call() throws Throwable {
    final Jenkins jenkins = Jenkins.getInstance();

    // prepare job
    final FreeStyleProject project = jenkins.createProject(FreeStyleProject.class, "freestyle-project");
    final Shell env = new Shell("env");
    project.getBuildersList().add(env);
    project.setAssignedLabel(new LabelAtom(DOCKER_CLOUD_LABEL));
    project.save();

    LOG.trace("trace test.");
    project.scheduleBuild(new TestCause());

    // image pull may take time
    waitUntilNoActivityUpTo(jenkins, 10 * 60 * 1000);

    final FreeStyleBuild lastBuild = project.getLastBuild();
    assertThat(lastBuild, not(nullValue()));
    assertThat(lastBuild.getResult(), is(Result.SUCCESS));

    assertThat(getLog(lastBuild), Matchers.containsString(TEST_VALUE));
    assertThat(getLog(lastBuild), Matchers.containsString(CLOUD_ID + "=" + DOCKER_CLOUD_NAME));

    return true;
}
 
開發者ID:KostyaSha,項目名稱:yet-another-docker-plugin,代碼行數:27,代碼來源:FreestyleTest.java

示例2: executionTest

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Tests the results of an execution.
 * <p>
 * A project is created, configured and executed where the log is examined to verify results.
 */
@Test
public void executionTest()
{
	try
	{
		FreeStyleProject project = m_jenkinsRule.createFreeStyleProject("TestProject");
		project.getBuildersList().add(new CodeCoverageBuilder(EXPECTED_CONNECTION_ID, EXPECTED_CREDENTIALS_ID, EXPECTED_ANALYSIS_PROPERTIES_FILEPATH,
				EXPECTED_ANALYSIS_PROPERTIES_STRING));

		// 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\"", EXPECTED_HOST, EXPECTED_PORT);
			assertThat("Expected log to contain Host connection: " + expectedConnectionStr + '.', logFileOutput,
					containsString(expectedConnectionStr));

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

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

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

			assertThat(String.format("Expected log to contain Analysis properties path: \"%s\".",
					EXPECTED_ANALYSIS_PROPERTIES_FILEPATH), logFileOutput, containsString(EXPECTED_ANALYSIS_PROPERTIES_FILEPATH));

			assertThat(String.format("Expected log to contain Analysis properties: \"%s\".", EXPECTED_ANALYSIS_PROPERTIES_STRING),
					logFileOutput, containsString(EXPECTED_ANALYSIS_PROPERTIES_STRING));
			*/
		}
	}
	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:Compuware-Corp,項目名稱:CPWR-CodeCoverage,代碼行數:60,代碼來源:CodeCoverageBuilderTest.java

示例3: 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

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