Search in sources :

Example 41 with ConfiguredWithReadme

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

the class MercurialTest method should_configure_maven_tools_and_global_config.

@Test
@ConfiguredWithReadme("mercurial/README.md")
public void should_configure_maven_tools_and_global_config() {
    final Object descriptor = j.jenkins.getDescriptorOrDie(MercurialInstallation.class);
    Assert.assertNotNull(descriptor);
    Assert.assertEquals(1, ((MercurialInstallation.DescriptorImpl) descriptor).getInstallations().length);
    MercurialInstallation mercurial = ((MercurialInstallation.DescriptorImpl) descriptor).getInstallations()[0];
    Assert.assertEquals("Mercurial 3", mercurial.getName());
    Assert.assertEquals("/mercurial", mercurial.getHome());
    Assert.assertEquals("[defaults]\n" + "clone = --uncompressed\n" + "bundle = --type none", mercurial.getConfig());
    Assert.assertEquals("INSTALLATION/bin/hg", mercurial.getExecutable());
    Assert.assertTrue(mercurial.isUseCaches());
    Assert.assertFalse(mercurial.getDebug());
    Assert.assertFalse(mercurial.getDebug());
    Assert.assertEquals("/cache/root", mercurial.getMasterCacheRoot());
    Assert.assertFalse(mercurial.isUseSharing());
    InstallSourceProperty installSourceProperty = mercurial.getProperties().get(InstallSourceProperty.class);
    Assert.assertEquals(1, installSourceProperty.installers.size());
    CommandInstaller installer = installSourceProperty.installers.get(CommandInstaller.class);
    Assert.assertEquals("mercurial", installer.getToolHome());
    Assert.assertEquals("SomeLabel", installer.getLabel());
    Assert.assertEquals("[ -d mercurial ] || wget -q -O - http://www.archlinux.org/packages/extra/x86_64/mercurial/download/ | xzcat | tar xvf -", installer.getCommand());
}
Also used : CommandInstaller(hudson.tools.CommandInstaller) InstallSourceProperty(hudson.tools.InstallSourceProperty) MercurialInstallation(hudson.plugins.mercurial.MercurialInstallation) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 42 with ConfiguredWithReadme

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

the class ProxyTest method configure_proxy.

@Test
@ConfiguredWithReadme("proxy/README.md")
public void configure_proxy() {
    final ProxyConfiguration proxy = Jenkins.get().proxy;
    assertNotNull(proxy);
    assertThat(proxy.getSecretPassword(), hasPlainText("password"));
    assertThat(proxy.getTestUrl(), is("http://google.com"));
    assertThat(proxy.getUserName(), is("login"));
    assertThat(proxy.name, is("proxyhost"));
    assertThat(proxy.noProxyHost, is("externalhost"));
    assertThat(proxy.port, is(80));
}
Also used : ProxyConfiguration(hudson.ProxyConfiguration) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 43 with ConfiguredWithReadme

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

the class StatisticsGathererTest method configure_statistics.

@Test
@ConfiguredWithReadme("statistics-gatherer/README.md")
public void configure_statistics() {
    StatisticsConfiguration config = StatisticsConfiguration.get();
    assertNotNull(config);
    assertThat(config.getBuildUrl(), containsString("http://elasticsearch:9200/jenkins-stats/builds"));
    assertTrue(config.getShouldSendApiHttpRequests());
    assertTrue(config.getBuildInfo());
    assertFalse(config.getQueueInfo());
    assertFalse(config.getProjectInfo());
    assertFalse(config.getBuildStepInfo());
    assertTrue(config.getScmCheckoutInfo());
}
Also used : StatisticsConfiguration(org.jenkins.plugins.statistics.gatherer.StatisticsConfiguration) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 44 with ConfiguredWithReadme

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

the class TopReadmeTest method configure_demo_third_code_block.

@Test
@ConfiguredWithReadme("README.md#2")
public void configure_demo_third_code_block() {
    final Jenkins jenkins = Jenkins.get();
    assertEquals(2, jenkins.getNodes().size());
    assertEquals("static-agent1", jenkins.getNode("static-agent1").getNodeName());
    assertEquals("static-agent2", jenkins.getNode("static-agent2").getNodeName());
}
Also used : Jenkins(jenkins.model.Jenkins) Test(org.junit.Test) ConfiguredWithReadme(io.jenkins.plugins.casc.misc.ConfiguredWithReadme)

Example 45 with ConfiguredWithReadme

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

the class TopReadmeTest method configure_demo_second_code_block.

@Test
@ConfiguredWithReadme("README.md#1")
public void configure_demo_second_code_block() {
    final Jenkins jenkins = Jenkins.get();
    final LDAPSecurityRealm securityRealm = (LDAPSecurityRealm) jenkins.getSecurityRealm();
    assertEquals(1, securityRealm.getConfigurations().size());
}
Also used : Jenkins(jenkins.model.Jenkins) LDAPSecurityRealm(hudson.security.LDAPSecurityRealm) 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