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


Java FreeStyleProject.getScm方法代碼示例

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


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

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

示例2: assertDataMigrated

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Test data has been migrated.
 * 
 * @param proj
 *            project being migrated
 * 
 * @throws IOException
 */
private static void assertDataMigrated(TopLevelItem proj) throws IOException
{
	assertThat(proj, instanceOf(FreeStyleProject.class));
	FreeStyleProject project = (FreeStyleProject) proj;
	CpwrScmConfiguration config = (CpwrScmConfiguration) project.getScm();

	assertNotNull(config.getConnectionId());

	CpwrGlobalConfiguration globalConfig = CpwrGlobalConfiguration.get();
	HostConnection connection = globalConfig.getHostConnection(config.getConnectionId());
	assertNotNull(connection);

	File inputFile = project.getConfigFile().getFile();
	BufferedReader br = new BufferedReader(new FileReader(inputFile));
	try
	{
		String line = null;

		// Lets use the TreeMap for always correct ordering
		while ((line = br.readLine()) != null)
		{
			line = line.trim();

			String tagName = line.substring(0, line.indexOf(">") + 1);
			if (TestConstants.HOST_PORT_OPEN_TAG.equals(tagName))
			{
				String hostPort = StringUtils.substringBetween(line, tagName, TestConstants.HOST_PORT_CLOSE_TAG);
				String expectedHost = StringUtils.substringBefore(hostPort, TestConstants.COLON);
				String expectedPort = StringUtils.substringAfter(hostPort, TestConstants.COLON);
				assertThat(String.format("Expected HostConnection.getHost() to return %s", expectedHost),
						connection.getHost(), is(equalTo(expectedHost)));
				assertThat(String.format("Expected HostConnection.getPort() to return %s", expectedPort),
						connection.getPort(), is(equalTo(expectedPort)));
			}
			else if (TestConstants.CODE_PAGE_OPEN_TAG.equals(tagName))
			{
				String expectedCodePage = StringUtils.substringBetween(line, tagName, TestConstants.CODE_PAGE_CLOSE_TAG);
				assertThat(String.format("Expected HostConnection.getCodePage() to return %s", expectedCodePage),
						connection.getCodePage(), is(equalTo(expectedCodePage)));
			}
		}
	}
	finally
	{
		br.close();
	}
}
 
開發者ID:jenkinsci,項目名稱:compuware-scm-downloader-plugin,代碼行數:56,代碼來源:CpwrScmConfigTestUtils.java

示例3: assertDataMigrated

import hudson.model.FreeStyleProject; //導入方法依賴的package包/類
/**
 * Test data has been migrated.
 * 
 * @param proj
 *            project being migrated
 * 
 * @throws IOException
 */
private static void assertDataMigrated(TopLevelItem proj) throws IOException
{
	assertThat(proj, instanceOf(FreeStyleProject.class));
	FreeStyleProject project = (FreeStyleProject) proj;
	IspwConfiguration config = (IspwConfiguration) project.getScm();

	assertNotNull(config.getConnectionId());

	CpwrGlobalConfiguration globalConfig = CpwrGlobalConfiguration.get();
	HostConnection connection = globalConfig.getHostConnection(config.getConnectionId());
	assertNotNull(connection);

	File inputFile = project.getConfigFile().getFile();
	BufferedReader br = new BufferedReader(new FileReader(inputFile));
	try
	{
		String line = null;

		// Lets use the TreeMap for always correct ordering
		while ((line = br.readLine()) != null)
		{
			line = line.trim();

			String tagName = line.substring(0, line.indexOf(">") + 1);
			if (TestConstants.HOST_PORT_OPEN_TAG.equals(tagName))
			{
				String hostPort = StringUtils.substringBetween(line, tagName, TestConstants.HOST_PORT_CLOSE_TAG);
				String expectedHost = StringUtils.substringBefore(hostPort, TestConstants.COLON);
				String expectedPort = StringUtils.substringAfter(hostPort, TestConstants.COLON);
				assertThat(String.format("Expected HostConnection.getHost() to return %s", expectedHost),
						connection.getHost(), is(equalTo(expectedHost)));
				assertThat(String.format("Expected HostConnection.getPort() to return %s", expectedPort),
						connection.getPort(), is(equalTo(expectedPort)));
			}
			else if (TestConstants.CODE_PAGE_OPEN_TAG.equals(tagName))
			{
				String expectedCodePage = StringUtils.substringBetween(line, tagName, TestConstants.CODE_PAGE_CLOSE_TAG);
				assertThat(String.format("Expected HostConnection.getCodePage() to return %s", expectedCodePage),
						connection.getCodePage(), is(equalTo(expectedCodePage)));
			}
		}
	}
	finally
	{
		br.close();
	}
}
 
開發者ID:jenkinsci,項目名稱:compuware-scm-downloader-plugin,代碼行數:56,代碼來源:IspwMigrateDataTest.java


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