use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class MavenConfiguratorTest method configure_maven_tool.
@Test
@ConfiguredWithReadme("maven/README.md#0")
public void configure_maven_tool() {
final Maven.DescriptorImpl descriptor = ExtensionList.lookupSingleton(Maven.DescriptorImpl.class);
assertEquals(1, descriptor.getInstallations().length);
Maven.MavenInstallation maven = descriptor.getInstallations()[0];
assertEquals("maven3", maven.getName());
assertEquals("/maven3", maven.getHome());
InstallSourceProperty installSourceProperty = maven.getProperties().get(InstallSourceProperty.class);
assertEquals(1, installSourceProperty.installers.size());
MavenInstaller installer = installSourceProperty.installers.get(MavenInstaller.class);
assertEquals("3.8.4", installer.id);
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class MesosTest method configure_mesos_cloud.
@Test
@ConfiguredWithReadme("mesos/README.md")
public void configure_mesos_cloud() {
final MesosCloud cloud = Jenkins.get().clouds.get(MesosCloud.class);
assertNotNull(cloud);
assertFalse(cloud.isCheckpoint());
assertThat(cloud.getCloudID(), is("mesos-name"));
assertThat(cloud.getCredentialsId(), is("MESOS_CREDENTIALS"));
assertThat(cloud.getDeclineOfferDuration(), is("600"));
assertThat(cloud.getDescription(), is("My Mesos Cloud"));
assertThat(cloud.getFrameworkName(), is("Jenkins Framework"));
assertThat(cloud.getJenkinsURL(), is("https://jenkins.mesos.cloud"));
assertThat(cloud.getMaster(), is("1.2.3.4:8000"));
assertThat(cloud.getRole(), is("*"));
assertThat(cloud.getSlavesUser(), is("jenkins"));
assertThat(cloud.getSlavesUser(), is("jenkins"));
final List<MesosSlaveInfo> slaves = cloud.getSlaveInfos();
assertThat(slaves, hasSize(1));
final MesosSlaveInfo slaveInfo = slaves.get(0);
assertThat(slaveInfo.getLabelString(), is("docker"));
assertThat(slaveInfo.getContainerInfo().getType(), is("DOCKER"));
assertThat(slaveInfo.getContainerInfo().getDockerImage(), is("cloudbees/java-with-docker-client:latest"));
assertThat(slaveInfo.getContainerInfo().getVolumes(), hasSize(2));
assertThat(slaveInfo.getMinExecutors(), is(1));
assertThat(slaveInfo.getMaxExecutors(), is(2));
assertThat(slaveInfo.getMode(), is(Mode.NORMAL));
assertThat(slaveInfo.getSlaveCpus(), is(0.1));
assertThat(slaveInfo.getSlaveMem(), is(512));
assertThat(slaveInfo.getRemoteFSRoot(), is("jenkins"));
assertThat(slaveInfo.getJnlpArgs(), is(""));
assertThat(slaveInfo.getSlaveAttributes().toString(), containsString("\"rack\":\"jenkins-build-agents\""));
assertTrue(slaveInfo.isDefaultSlave());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class LDAPTest method configure_ldap.
@Test
@ConfiguredWithReadme("ldap/README.md")
public void configure_ldap() {
final Jenkins jenkins = Jenkins.get();
final LDAPSecurityRealm securityRealm = (LDAPSecurityRealm) jenkins.getSecurityRealm();
assertEquals(1, securityRealm.getConfigurations().size());
assertTrue(securityRealm.getUserIdStrategy() instanceof IdStrategy.CaseInsensitive);
assertTrue(securityRealm.getGroupIdStrategy() instanceof IdStrategy.CaseSensitive);
final LDAPConfiguration configuration = securityRealm.getConfigurations().get(0);
assertEquals("ldap.acme.com", configuration.getServer());
assertEquals("SECRET", configuration.getManagerPassword());
assertEquals("manager", configuration.getManagerDN());
assertEquals("(&(objectCategory=User)(sAMAccountName={0}))", configuration.getUserSearch());
assertEquals("(&(cn={0})(objectclass=group))", configuration.getGroupSearchFilter());
final FromGroupSearchLDAPGroupMembershipStrategy strategy = ((FromGroupSearchLDAPGroupMembershipStrategy) configuration.getGroupMembershipStrategy());
assertEquals("(&(objectClass=group)(|(cn=GROUP_1)(cn=GROUP_2)))", strategy.getFilter());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class MailerTest method configure_mailer.
@Test
@ConfiguredWithReadme("mailer/README.md")
public void configure_mailer() {
final Jenkins jenkins = Jenkins.get();
final Mailer.DescriptorImpl descriptor = (Mailer.DescriptorImpl) jenkins.getDescriptor(Mailer.class);
assertEquals("4441", descriptor.getSmtpPort());
assertEquals("do-not-reply@acme.org", descriptor.getReplyToAddress());
assertEquals("smtp.acme.org", descriptor.getSmtpHost());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class NodeJSTest method configure_nodejs.
@Test
@ConfiguredWithReadme("nodejs/README.md")
public void configure_nodejs() {
final NodeJSInstallation.DescriptorImpl descriptor = ExtensionList.lookupSingleton(NodeJSInstallation.DescriptorImpl.class);
assertEquals(1, descriptor.getInstallations().length);
final NodeJSInstallation nodejs = descriptor.getInstallations()[0];
final InstallSourceProperty installSourceProperty = nodejs.getProperties().get(InstallSourceProperty.class);
final NodeJSInstaller nodeJSInstaller = installSourceProperty.installers.get(NodeJSInstaller.class);
assertEquals("12.11.1", nodeJSInstaller.id);
assertEquals(48, nodeJSInstaller.getNpmPackagesRefreshHours().longValue());
}
Aggregations