Search in sources :

Example 1 with GlobalConfigFiles

use of org.jenkinsci.plugins.configfiles.GlobalConfigFiles in project promoted-builds-plugin by jenkinsci.

the class PromotionConfigFilesTest method testPromotionConfigFilesAreRetrievedFromParentJobContext.

@Test
public void testPromotionConfigFilesAreRetrievedFromParentJobContext() throws Exception {
    GlobalConfigFiles store = r.getInstance().getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class);
    Assert.assertTrue(store.getConfigs().isEmpty());
    CustomConfig config = new CustomConfig(CONFIG_ID, "name", "comment", "content");
    store.save(config);
    FreeStyleProject p = r.createFreeStyleProject();
    // promote if the downstream passes
    JobPropertyImpl promotion = new JobPropertyImpl(p);
    p.addProperty(promotion);
    PromotionProcess promo1 = promotion.addProcess("promo1");
    promo1.conditions.add(new SelfPromotionCondition(false));
    List<ManagedFile> managedFiles = new ArrayList<>();
    managedFiles.add(new ManagedFile(CONFIG_ID));
    promo1.getBuildSteps().add(new ConfigFileBuildStep(managedFiles));
    r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    // internally, the promotion is still an asynchronous process. It just happens
    // right away after the build is complete.
    Thread.sleep(1000);
    Promotion pb = promo1.getBuilds().iterator().next();
    assertEquals(Result.SUCCESS, pb.getResult());
}
Also used : CustomConfig(org.jenkinsci.plugins.configfiles.custom.CustomConfig) GlobalConfigFiles(org.jenkinsci.plugins.configfiles.GlobalConfigFiles) ArrayList(java.util.ArrayList) ConfigFileBuildStep(org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep) SelfPromotionCondition(hudson.plugins.promoted_builds.conditions.SelfPromotionCondition) FreeStyleProject(hudson.model.FreeStyleProject) ManagedFile(org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile) Test(org.junit.Test)

Example 2 with GlobalConfigFiles

use of org.jenkinsci.plugins.configfiles.GlobalConfigFiles in project nodejs-plugin by jenkinsci.

the class NodeJSBuildWrapperTest method createSetting.

private Config createSetting(String id, String content, List<NPMRegistry> registries) {
    Config config = new NPMConfig(id, null, null, content, registries);
    GlobalConfigFiles globalConfigFiles = j.jenkins.getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class);
    globalConfigFiles.save(config);
    return config;
}
Also used : NPMConfig(jenkins.plugins.nodejs.configfiles.NPMConfig) GlobalConfigFiles(org.jenkinsci.plugins.configfiles.GlobalConfigFiles) Config(org.jenkinsci.lib.configprovider.model.Config) NPMConfig(jenkins.plugins.nodejs.configfiles.NPMConfig)

Example 3 with GlobalConfigFiles

use of org.jenkinsci.plugins.configfiles.GlobalConfigFiles in project nodejs-plugin by jenkinsci.

the class NodeJSCommandInterpreterTest method createSetting.

private Config createSetting(String id, String content, List<NPMRegistry> registries) {
    Config config = new NPMConfig(id, null, null, content, registries);
    GlobalConfigFiles globalConfigFiles = j.jenkins.getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class);
    globalConfigFiles.save(config);
    return config;
}
Also used : NPMConfig(jenkins.plugins.nodejs.configfiles.NPMConfig) GlobalConfigFiles(org.jenkinsci.plugins.configfiles.GlobalConfigFiles) Config(org.jenkinsci.lib.configprovider.model.Config) NPMConfig(jenkins.plugins.nodejs.configfiles.NPMConfig)

Example 4 with GlobalConfigFiles

use of org.jenkinsci.plugins.configfiles.GlobalConfigFiles in project nodejs-plugin by jenkinsci.

the class NpmrcFileSupplyTest method createSetting.

private Config createSetting(String id, String content, List<NPMRegistry> registries) {
    Config config = new NPMConfig(id, null, null, content, registries);
    GlobalConfigFiles globalConfigFiles = j.jenkins.getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class);
    globalConfigFiles.save(config);
    return config;
}
Also used : NPMConfig(jenkins.plugins.nodejs.configfiles.NPMConfig) GlobalConfigFiles(org.jenkinsci.plugins.configfiles.GlobalConfigFiles) NPMConfig(jenkins.plugins.nodejs.configfiles.NPMConfig) Config(org.jenkinsci.lib.configprovider.model.Config)

Aggregations

GlobalConfigFiles (org.jenkinsci.plugins.configfiles.GlobalConfigFiles)4 NPMConfig (jenkins.plugins.nodejs.configfiles.NPMConfig)3 Config (org.jenkinsci.lib.configprovider.model.Config)3 FreeStyleProject (hudson.model.FreeStyleProject)1 SelfPromotionCondition (hudson.plugins.promoted_builds.conditions.SelfPromotionCondition)1 ArrayList (java.util.ArrayList)1 ConfigFileBuildStep (org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep)1 ManagedFile (org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile)1 CustomConfig (org.jenkinsci.plugins.configfiles.custom.CustomConfig)1 Test (org.junit.Test)1