Search in sources :

Example 1 with GlobalJobDslSecurityConfiguration

use of javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration in project configuration-as-code-plugin by jenkinsci.

the class SeedJobTest method configure_seed_job_with_security_config.

@Test
@ConfiguredWithCode("SeedJobTest_withSecurityConfig.yml")
@Envs(@Env(name = "SEED_JOB_FOLDER_FILE_PATH", value = "."))
public void configure_seed_job_with_security_config() throws Exception {
    final Jenkins jenkins = Jenkins.get();
    final GlobalJobDslSecurityConfiguration dslSecurity = GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class);
    assertNotNull(dslSecurity);
    assertThat("ScriptSecurity", dslSecurity.isUseScriptSecurity(), is(false));
    FreeStyleProject seedJobWithSecurityConfig = (FreeStyleProject) jenkins.getItem("seedJobWithSecurityConfig");
    assertNotNull(seedJobWithSecurityConfig);
    assertTrue(seedJobWithSecurityConfig.isInQueue());
    FreeStyleBuild freeStyleBuild = j.buildAndAssertSuccess(seedJobWithSecurityConfig);
    j.assertLogContains("Processing DSL script testJob2.groovy", freeStyleBuild);
    j.assertLogContains("Added items:", freeStyleBuild);
    j.assertLogContains("GeneratedJob{name='testJob2'}", freeStyleBuild);
}
Also used : Jenkins(jenkins.model.Jenkins) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) GlobalJobDslSecurityConfiguration(javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration) Test(org.junit.Test) Envs(io.jenkins.plugins.casc.misc.Envs) ConfiguredWithCode(io.jenkins.plugins.casc.misc.ConfiguredWithCode)

Example 2 with GlobalJobDslSecurityConfiguration

use of javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration in project configuration-as-code-plugin by jenkinsci.

the class JobDslGlobaSecurityConfigurationTest method global_dsl_security.

@Test
public void global_dsl_security() throws Exception {
    final GlobalJobDslSecurityConfiguration dslSecurity = GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class);
    dslSecurity.setUseScriptSecurity(true);
    assertThat("ScriptSecurity", dslSecurity.isUseScriptSecurity(), is(true));
    TestConfiguration.withCode("JobDslGlobaSecurityConfigurationTest.yml").configure(getClass());
    assertThat("ScriptSecurity", dslSecurity.isUseScriptSecurity(), is(false));
}
Also used : GlobalJobDslSecurityConfiguration(javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration) Test(org.junit.Test)

Example 3 with GlobalJobDslSecurityConfiguration

use of javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration in project configuration-as-code-plugin by jenkinsci.

the class JobDslGlobalSecurityConfigurationTest method getGlobalJobDslSecurityConfiguration.

private GlobalJobDslSecurityConfiguration getGlobalJobDslSecurityConfiguration() {
    final GlobalJobDslSecurityConfiguration dslSecurity = GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class);
    assertNotNull(dslSecurity);
    return dslSecurity;
}
Also used : GlobalJobDslSecurityConfiguration(javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration)

Aggregations

GlobalJobDslSecurityConfiguration (javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration)3 Test (org.junit.Test)2 FreeStyleBuild (hudson.model.FreeStyleBuild)1 FreeStyleProject (hudson.model.FreeStyleProject)1 ConfiguredWithCode (io.jenkins.plugins.casc.misc.ConfiguredWithCode)1 Envs (io.jenkins.plugins.casc.misc.Envs)1 Jenkins (jenkins.model.Jenkins)1