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


Java LocalData类代码示例

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


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

示例1: localRootPathToNodeMountPoint

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@LocalData
@Test
public void localRootPathToNodeMountPoint() throws Exception {

    // The node configuration version 1.0.0 contains a localRootPath field.
    // This tests that future versions load this field as nodeMountPoint,
    // in other words it tests NodeDisk.readResolve()

    Computer computer = jr.getInstance().getComputer("node1");
    Node node = computer.getNode();
    DescribableList<NodeProperty<?>,NodePropertyDescriptor> props = node.getNodeProperties();
    ExternalWorkspaceProperty exwsProp = props.get(ExternalWorkspaceProperty.class);

    List<NodeDiskPool> diskPools = exwsProp.getNodeDiskPools();
    assertThat(diskPools.size(), is(1));

    NodeDiskPool diskPool = diskPools.get(0);
    assertThat(diskPool.getDiskPoolRefId(), is ("dp1"));

    List<NodeDisk> disks = diskPool.getNodeDisks();
    assertThat(disks.size(), is(1));

    NodeDisk disk = disks.get(0);
    assertThat(disk.getDiskRefId(), is("d1"));
    assertThat(disk.getNodeMountPoint(), is("/tmp/dp1/d1"));
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:27,代码来源:ConfigMigrationTest.java

示例2: testPermissionWhenParameterizedForMatrixConfig

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@LocalData
@Test
public void testPermissionWhenParameterizedForMatrixConfig() throws Exception {
    // This test fails before Jenkins 1.406
    if (new VersionNumber("1.406").isNewerThan(Hudson.getVersion())) return; // Skip

    FreeStyleProject p = createProject("testMatrix/FOO=$FOO", null, "", "", false, false, false, true);
    ParameterDefinition paramDef = new StringParameterDefinition("FOO", "FOO");
    ParametersDefinitionProperty paramsDef = new ParametersDefinitionProperty(paramDef);
    p.addProperty(paramsDef);
    // Build step should succeed when this parameter expands to a job accessible to
    // authenticated users, even when selecting a single matrix config, not the parent job:
    FreeStyleBuild b = p.scheduleBuild2(0, new UserCause(),
            new ParametersAction(new StringParameterValue("FOO", "foo"))).get();
    assertFile(true, "foo.txt", b);
    rule.assertBuildStatusSuccess(b);
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:18,代码来源:CopyArtifactTest.java

示例3: testPermissionWhenParameterizedForMavenModule

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@LocalData
@Test
public void testPermissionWhenParameterizedForMavenModule() throws Exception {
    // This test fails before Jenkins 1.406
    if (new VersionNumber("1.406").isNewerThan(Hudson.getVersion())) return; // Skip

    MavenModuleSet mp = setupMavenJob();
    mp.addProperty(new AuthorizationMatrixProperty(
            Collections.singletonMap(Item.READ, Collections.singleton("authenticated"))));
    rule.assertBuildStatusSuccess(mp.scheduleBuild2(0, new UserCause()).get());
    FreeStyleProject p = createProject(mp.getName() + "/org.jvnet.hudson.main.test.multimod$FOO",
                                       null, "", "", false, false, false, true);
    ParameterDefinition paramDef = new StringParameterDefinition("FOO", "foo");
    ParametersDefinitionProperty paramsDef = new ParametersDefinitionProperty(paramDef);
    p.addProperty(paramsDef);
    // Build step should succeed when this parameter expands to a job accessible to
    // authenticated users, even when selecting a single maven module, not the parent job:
    FreeStyleBuild b = p.scheduleBuild2(0, new UserCause(),
            new ParametersAction(new StringParameterValue("FOO", "$moduleA"))).get();
    String dir = "org.jvnet.hudson.main.test.multimod/";
    assertFile(true, dir + "moduleA/1.0-SNAPSHOT/moduleA-1.0-SNAPSHOT.jar", b);
    assertFile(true, dir + pomName("moduleA", "1.0-SNAPSHOT"), b);
    assertFile(false, dir + "moduleB/1.0-SNAPSHOT/moduleB-1.0-SNAPSHOT.jar", b);
    assertFile(false, dir + pomName("moduleB", "1.0-SNAPSHOT"), b);
    rule.assertBuildStatusSuccess(b);
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:27,代码来源:CopyArtifactTest.java

示例4: testProjectNameSplit

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@LocalData
@Test
public void testProjectNameSplit() throws Exception {
    FreeStyleProject copier = Jenkins.getInstance().getItemByFullName("copier", FreeStyleProject.class);
    assertNotNull(copier);
    String configXml = copier.getConfigFile().asString();
    assertFalse(configXml, configXml.contains("<projectName>"));
    assertTrue(configXml, configXml.contains("<project>plain</project>"));
    assertTrue(configXml, configXml.contains("<project>parameterized</project>"));
    assertTrue(configXml, configXml.contains("<paramsToMatch>good=true</paramsToMatch>"));
    assertTrue(configXml, configXml.contains("<project>matrix/which=two</project>"));
    
    MatrixProject matrixCopier = Jenkins.getInstance().getItemByFullName("matrix-copier", MatrixProject.class);
    assertNotNull(matrixCopier);
    configXml = matrixCopier.getConfigFile().asString();
    assertFalse(configXml, configXml.contains("<projectName>"));
    // When a project is specified with a variable, it is split improperly.
    assertTrue(configXml, configXml.contains("<project>matrix</project>"));
    assertTrue(configXml, configXml.contains("<paramsToMatch>which=${which}</paramsToMatch>"));
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:21,代码来源:CopyArtifactTest.java

示例5: testWrappedCopierProjectNameSplit

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@LocalData
@Test
public void testWrappedCopierProjectNameSplit() throws Exception {
    // Project "copier" is configured with RunSelector wrapped with WrapBuilder.
    // This causes failure of upgrading on loaded.
    // Upgrading is performed when build is triggered.
    FreeStyleProject copier = Jenkins.getInstance().getItemByFullName("copier", FreeStyleProject.class);
    assertNotNull(copier);
    String configXml = copier.getConfigFile().asString();
    // not upgraded on loaded
    assertTrue(configXml, configXml.contains("<projectName>plain</projectName>"));
    
    // upgraded when a build is triggered.
    FreeStyleBuild b = copier.scheduleBuild2(0).get();
    rule.assertBuildStatusSuccess(b);
    FilePath fileToTest = b.getWorkspace().child("from-plain/tag.txt");
    assertTrue(fileToTest.exists());
    assertEquals("jenkins-plain-2\n", fileToTest.readToString());
    
    configXml = copier.getConfigFile().asString();
    assertFalse(configXml, configXml.contains("<projectName>"));
    assertTrue(configXml, configXml.contains("<project>plain</project>"));
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:24,代码来源:CopyArtifactTest.java

示例6: migrateDataTest

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
/**
 * Perform a round trip migration test on the configuration.
 * <p>
 * An existing project is loaded, migrated, saved, and reloaded where the original configuration is compared against
 * the reloaded configuration. The test project is loaded from a .zip file that mimics a Jenkins project's
 * layout within.
 * 
 * See test resource for the migration test: src/test/resources/com.compuware.jenkins.scm/<test>/<test method>.zip
 */
@Test
@LocalData
public void migrateDataTest()
{
	try
	{
		CpwrScmConfigTestUtils.migrateDataTest(m_jenkinsRule);
	}
	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,代码行数:26,代码来源:PdsMigrateDataTest.java

示例7: migrateDataTest

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
/**
 * Perform a round trip migration test on the configuration.
 * <p>
 * An existing project is loaded, migrated, saved, and reloaded where the original configuration is compared against
 * the reloaded configuration. The test project is loaded from a .zip file that mimics a Jenkins project's
 * layout within.
 * 
 * See test resource for the migration test: src/test/resources/com.compuware.jenkins.scm/<test>/<test method>.zip
 */
@Test
@LocalData
public void migrateDataTest()
{
	try
	{
		// Load and migrate the specified project from the test resource .zip file
		m_jenkinsRule.jenkins.getItem("TestEndevorProject"); //$NON-NLS-1$
		m_jenkinsRule.jenkins.getItem("TestIspwProject"); //$NON-NLS-1$
		m_jenkinsRule.jenkins.getItem("TestPdsProject"); //$NON-NLS-1$
	}
	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,代码行数:29,代码来源:AllMigrateDataTest.java

示例8: migrateDataTest

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
/**
 * Perform a round trip migration test on the configuration.
 * <p>
 * An existing project is loaded, migrated, saved, and reloaded where the original configuration is compared against
 * the reloaded configuration. The test project is loaded from a .zip file that mimics a Jenkins project's
 * layout within.
 * 
 * See test resource for the migration test: src/test/resources/com.compuware.jenkins.scm/<test>/<test method>.zip
 */
@Test
@LocalData
public void migrateDataTest()
{
	try
	{
		// Load and migrate the specified project from the test resource .zip file
		TopLevelItem item = m_jenkinsRule.jenkins.getItem("TestProject");
		assertDataMigrated(item);
	}
	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,代码行数:28,代码来源:IspwMigrateDataTest.java

示例9: migrateToV013

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@Test
@LocalData
public void migrateToV013() throws Exception {
    ProvisioningActivity activity = CloudStatistics.get().getActivities().iterator().next();
    List<PhaseExecutionAttachment.ExceptionAttachment> attachments = activity.getPhaseExecution(PROVISIONING).getAttachments(PhaseExecutionAttachment.ExceptionAttachment.class);
    PhaseExecutionAttachment.ExceptionAttachment partial = attachments.get(0);
    assertThat(partial.getDisplayName(), equalTo("EXCEPTION_MESSAGE"));
    assertThat(partial.getText(), equalTo("Plugin was unable to deserialize the exception from version 0.12 or older"));

    PhaseExecutionAttachment.ExceptionAttachment full = attachments.get(1);
    assertThat(full.getDisplayName(), equalTo("java.lang.NullPointerException"));
    assertThat(full.getText(), startsWith("java.lang.NullPointerException\n\tat org.jenkinsci.plugins.cloudstats.CloudStatisticsTest.migrateToV013"));

    CloudStatistics.get().persist();
    assertThat(CloudStatistics.get().getConfigFile().asString(), not(containsString("suppressedExceptions")));
}
 
开发者ID:jenkinsci,项目名称:cloud-stats-plugin,代码行数:17,代码来源:CloudStatisticsTest.java

示例10: testConfig

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@LocalData
@Test
public void testConfig() {
    final Cloud cloud = jenkinsRule.getInstance().getCloud("ff");
    assertThat(cloud, instanceOf(DockerCloud.class));

    final DockerCloud dockerCloud = (DockerCloud) cloud;
    final DockerSlaveTemplate template = dockerCloud.getTemplate("image");
    assertThat(template, notNullValue());

    final RetentionStrategy retentionStrategy = template.getRetentionStrategy();
    assertThat(retentionStrategy, instanceOf(DockerCloudRetentionStrategy.class));

    final DockerCloudRetentionStrategy strategy = (DockerCloudRetentionStrategy) retentionStrategy;
    assertThat(strategy.getIdleMinutes(), is(30));
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:17,代码来源:DockerCloudRetentionStrategyTest.java

示例11: testBuilds

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@Test
@LocalData
public void testBuilds() {
    FreeStyleProject job = j.jenkins.getItemByFullName("JenkinsSlaveTrigger", FreeStyleProject.class);
    assertNotNull("The job should be loaded", job);

    RunList<FreeStyleBuild> builds = job.getBuilds();
    FreeStyleBuild two = builds.getLastBuild();
    assertNotNull(two);
    FreeStyleBuild one = two.getPreviousBuild();
    assertNotNull(one);

    assertSame("First build should be failure", Result.FAILURE, one.getResult());
    assertSame("Second build should be success", Result.SUCCESS, two.getResult());

    DockerHubWebHookCause cause = two.getCause(DockerHubWebHookCause.class);
    assertNotNull("The cause should be loaded", cause);
    PushNotification notification = cause.getPushNotification();
    assertNotNull("The cause should have a notification", notification);
    assertEquals("csanchez/jenkins-swarm-slave", notification.getRepoName());
    assertEquals("registry.hub.example.com", notification.getRegistryHost());
}
 
开发者ID:jenkinsci,项目名称:dockerhub-notification-plugin,代码行数:23,代码来源:BackCompat102Test.java

示例12: testFingerprintDb

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@Test
@LocalData
public void testFingerprintDb() throws IOException, InterruptedException {
    TriggerStore.TriggerEntry entry = TriggerStore.getInstance().getEntry("e9d6eb6cd6a7bfcd2bd622765a87893f");
    assertNotNull("TriggerEntry should be loaded in the fingerprint db", entry);
    assertTrue(entry.areAllDone());
    List<TriggerStore.TriggerEntry.RunEntry> runEntries = entry.getEntries();
    assertNotNull(runEntries);
    assertEquals(1, runEntries.size());
    TriggerStore.TriggerEntry.RunEntry run = runEntries.get(0);
    assertEquals("JenkinsSlaveTrigger", run.getJobName());
    assertNotNull("The run should be retrievable", run.getRun());
    PushNotification notification = entry.getPushNotification();
    assertNotNull("The entry should have a notification", notification);
    assertEquals("csanchez/jenkins-swarm-slave", notification.getRepoName());
    assertEquals("registry.hub.example.com", notification.getRegistryHost());

    DockerHubCallbackPayload data = entry.getCallbackData();
    assertNotNull("There should be stored callback data", data);
    assertSame(DockerHubCallbackPayload.States.success, data.getState());
    assertEquals("dockerhub-webhook/details/e9d6eb6cd6a7bfcd2bd622765a87893f", data.getTargetUrl());
}
 
开发者ID:jenkinsci,项目名称:dockerhub-notification-plugin,代码行数:23,代码来源:BackCompat102Test.java

示例13: should_create_a_new_project

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@Test
@LocalData
public void should_create_a_new_project() throws Exception {
    GHRepository ghRepository = mock(GHRepository.class);
    when(ghRepository.getHtmlUrl()).thenReturn(new URL("http://github.com/meow"));
    GHUser ghUser = mock(GHUser.class);
    when(ghUser.getLogin()).thenReturn("test_user");
    when(ghRepository.getOwner()).thenReturn(ghUser);
    when(ghRepository.getName()).thenReturn("test_job");

    int totalBefore = (int) repo.getDatastore().createQuery(DynamicProject.class).countAll();

    DynamicProject project = repo.createNewProject(ghRepository, "test", "username");
    assertNotNull(project);
    DynamicProject retrieved = repo.getProjectById(project.getId());
    assertNotNull(retrieved);
    int totalAfter = (int) repo.getDatastore().createQuery(DynamicProject.class).countAll();
    assertEquals(totalAfter, totalBefore + 1);
}
 
开发者ID:groupon,项目名称:DotCi,代码行数:20,代码来源:DynamicProjectRepositoryTest.java

示例14: should_save_a_project

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@Test
@LocalData
public void should_save_a_project() throws Exception {
    DynamicProjectRepository repo = SetupConfig.get().getDynamicProjectRepository();

    GHRepository ghRepository = setupMockGHRepository();

    DynamicProject project = repo.createNewProject(ghRepository, null, null);

    project.addProperty(new CyclicProperty(project));
    project.save();

    assertTrue(repo.getDatastore().getCount(DynamicProject.class) > 0);
    DynamicProject restoredProject = repo.getDatastore().createQuery(DynamicProject.class).get();

    assertEquals("repo_name", restoredProject.getName());
}
 
开发者ID:groupon,项目名称:DotCi,代码行数:18,代码来源:MongoRepositoryTest.java

示例15: should_save_mixed_type_lists

import org.jvnet.hudson.test.recipes.LocalData; //导入依赖的package包/类
@Test
@LocalData
public void should_save_mixed_type_lists() {
    MixedTypeListClass mixed = new MixedTypeListClass();
    Serializable[] mixedList = {1, "teststring", new DummySerialiazable()};
    mixed.mixedTypeList = mixedList;
    Datastore ds = SetupConfig.get().getInjector().getInstance(Datastore.class);
    ds.save(mixed);
    MixedTypeListClass restoredMixed = ds.createQuery(MixedTypeListClass.class).get();

    assertEquals(1, restoredMixed.mixedTypeList[0]);
    assertEquals("teststring", restoredMixed.mixedTypeList[1]);
    assertNotNull(restoredMixed.mixedTypeList[2]);
    assertTrue(restoredMixed.mixedTypeList[2] instanceof DummySerialiazable);
    DummySerialiazable dummy = (DummySerialiazable) restoredMixed.mixedTypeList[2];
    assertEquals("test", dummy.test);
}
 
开发者ID:groupon,项目名称:DotCi,代码行数:18,代码来源:MongoRepositoryTest.java


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