Search in sources :

Example 36 with ConfiguredWithReadme

use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.

the class MavenConfiguratorTest method export_maven_tool.

@Test
@ConfiguredWithReadme("maven/README.md#0")
public void export_maven_tool() throws Exception {
    ConfiguratorRegistry registry = ConfiguratorRegistry.get();
    ConfigurationContext context = new ConfigurationContext(registry);
    CNode yourAttribute = getToolRoot(context).get("maven");
    String exported = toYamlString(yourAttribute);
    String expected = toStringFromYamlFile(this, "MavenConfiguratorTestExpected.yml");
    assertThat(exported, is(expected));
}
Also used : CNode(io.jenkins.plugins.casc.model.CNode) Util.toYamlString(io.jenkins.plugins.casc.misc.Util.toYamlString) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 37 with ConfiguredWithReadme

use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.

the class MavenConfiguratorTest method configure_maven_global_config.

@Test
@ConfiguredWithReadme("maven/README.md#1")
public void configure_maven_global_config() {
    final GlobalMavenConfig descriptor = ExtensionList.lookupSingleton(GlobalMavenConfig.class);
    assertThat(descriptor.getGlobalSettingsProvider(), instanceOf(DefaultGlobalSettingsProvider.class));
    assertThat(descriptor.getSettingsProvider(), instanceOf(DefaultSettingsProvider.class));
}
Also used : GlobalMavenConfig(jenkins.mvn.GlobalMavenConfig) DefaultGlobalSettingsProvider(jenkins.mvn.DefaultGlobalSettingsProvider) DefaultSettingsProvider(jenkins.mvn.DefaultSettingsProvider) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 38 with ConfiguredWithReadme

use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.

the class MavenConfiguratorTest method export_maven_global_config.

@Test
@ConfiguredWithReadme("maven/README.md#1")
public void export_maven_global_config() throws Exception {
    ConfiguratorRegistry registry = ConfiguratorRegistry.get();
    ConfigurationContext context = new ConfigurationContext(registry);
    CNode yourAttribute = getToolRoot(context).get("mavenGlobalConfig");
    String exported = toYamlString(yourAttribute);
    String expected = toStringFromYamlFile(this, "MavenConfiguratorTestGlobalConfigExpected.yml");
    assertThat(exported, is(expected));
}
Also used : CNode(io.jenkins.plugins.casc.model.CNode) Util.toYamlString(io.jenkins.plugins.casc.misc.Util.toYamlString) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 39 with ConfiguredWithReadme

use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.

the class KubernetesCloudTest method configure_kubernetes_cloud.

@Test
@ConfiguredWithReadme("kubernetes/README.md")
public void configure_kubernetes_cloud() {
    final KubernetesCloud cloud = j.jenkins.clouds.get(KubernetesCloud.class);
    assertNotNull(cloud);
    assertEquals("advanced-k8s-config", cloud.name);
    assertEquals("https://avanced-k8s-config:443", cloud.getServerUrl());
    assertEquals("serverCertificate", cloud.getServerCertificate());
    assertTrue(cloud.isSkipTlsVerify());
    assertEquals("default", cloud.getNamespace());
    assertEquals("http://jenkins/", cloud.getJenkinsUrl());
    assertEquals("advanced-k8s-credentials", cloud.getCredentialsId());
    assertEquals("jenkinsTunnel", cloud.getJenkinsTunnel());
    assertEquals(42, cloud.getContainerCap());
    assertEquals(5, cloud.getRetentionTimeout());
    assertEquals(10, cloud.getConnectTimeout());
    assertEquals(20, cloud.getReadTimeout());
    assertEquals("64", cloud.getMaxRequestsPerHostStr());
    final List<PodTemplate> templates = cloud.getTemplates();
    assertEquals(2, templates.size());
    final PodTemplate template = templates.get(0);
    assertEquals("test", template.getName());
    assertEquals("serviceAccount", template.getServiceAccount());
    assertEquals(1234, template.getInstanceCap());
    assertEquals("label", template.getLabel());
    final List<PodVolume> volumes = template.getVolumes();
    assertEquals(1, volumes.size());
    final PodVolume volume = volumes.get(0);
    assertTrue(volume instanceof HostPathVolume);
    assertEquals("mountPath", volume.getMountPath());
    assertEquals("hostPath", ((HostPathVolume) volume).getHostPath());
    final List<TemplateEnvVar> envVars = template.getEnvVars();
    assertEquals(1, envVars.size());
    final KeyValueEnvVar envVar = (KeyValueEnvVar) envVars.get(0);
    assertEquals("FOO", envVar.getKey());
    assertEquals("BAR", envVar.getValue());
    final PodTemplate template1 = templates.get(1);
    assertEquals("k8s-agent", template1.getName());
    assertEquals("default", template1.getNamespace());
    assertEquals(Mode.EXCLUSIVE, template1.getNodeUsageMode());
}
Also used : TemplateEnvVar(org.csanchez.jenkins.plugins.kubernetes.model.TemplateEnvVar) HostPathVolume(org.csanchez.jenkins.plugins.kubernetes.volumes.HostPathVolume) KeyValueEnvVar(org.csanchez.jenkins.plugins.kubernetes.model.KeyValueEnvVar) KubernetesCloud(org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud) PodVolume(org.csanchez.jenkins.plugins.kubernetes.volumes.PodVolume) PodTemplate(org.csanchez.jenkins.plugins.kubernetes.PodTemplate) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 40 with ConfiguredWithReadme

use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.

the class MSTestRunnerTest method configure_mstestrunner.

@Test
@ConfiguredWithReadme("mstestrunner/README.md")
public void configure_mstestrunner() {
    final DescriptorImpl msTestRunnerDescriptor = ExtensionList.lookupSingleton(DescriptorImpl.class);
    assertNotNull(msTestRunnerDescriptor);
    assertEquals(1, msTestRunnerDescriptor.getInstallations().length);
    final MsTestInstallation msTestRunnerInstallation = msTestRunnerDescriptor.getInstallations()[0];
    assertEquals("MSTest test", msTestRunnerInstallation.getName());
    assertEquals("C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe", msTestRunnerInstallation.getHome());
    assertEquals("/category:SmokeTests", msTestRunnerInstallation.getDefaultArgs());
    assertTrue(msTestRunnerInstallation.getOmitNoIsolation());
}
Also used : MsTestInstallation(org.jenkinsci.plugins.MsTestInstallation) DescriptorImpl(org.jenkinsci.plugins.MsTestInstallation.DescriptorImpl) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Aggregations

ConfiguredWithReadme (io.jenkins.plugins.casc.misc.ConfiguredWithReadme)46 Test (org.junit.Test)46 Jenkins (jenkins.model.Jenkins)12 User (hudson.model.User)3 LDAPSecurityRealm (hudson.security.LDAPSecurityRealm)3 SecurityRealm (hudson.security.SecurityRealm)3 InstallSourceProperty (hudson.tools.InstallSourceProperty)3 BasicSSHUserPrivateKey (com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey)2 StandardUsernamePasswordCredentials (com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials)2 DockerCloud (com.nirima.jenkins.plugins.docker.DockerCloud)2 DockerTemplate (com.nirima.jenkins.plugins.docker.DockerTemplate)2 HudsonPrivateSecurityRealm (hudson.security.HudsonPrivateSecurityRealm)2 Util.toYamlString (io.jenkins.plugins.casc.misc.Util.toYamlString)2 CNode (io.jenkins.plugins.casc.model.CNode)2 AWSCredentialsImpl (com.cloudbees.jenkins.plugins.awscredentials.AWSCredentialsImpl)1 DirectEntryPrivateKeySource (com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey.DirectEntryPrivateKeySource)1 Credentials (com.cloudbees.plugins.credentials.Credentials)1 SecretBytes (com.cloudbees.plugins.credentials.SecretBytes)1 SystemCredentialsProvider (com.cloudbees.plugins.credentials.SystemCredentialsProvider)1 UsernamePasswordCredentials (com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials)1