本文整理匯總了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());
}
}
示例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();
}
}
示例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();
}
}