use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class TopReadmeTest method configure_demo_fourth_code_block.
@Test
@ConfiguredWithReadme("README.md#3")
public void configure_demo_fourth_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());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class TopReadmeTest method configure_demo_first_code_block.
@Test
@ConfiguredWithReadme("README.md#0")
public void configure_demo_first_code_block() {
final Jenkins jenkins = Jenkins.get();
assertEquals("Jenkins configured automatically by Jenkins Configuration as Code plugin\n\n", jenkins.getSystemMessage());
final LDAPSecurityRealm securityRealm = (LDAPSecurityRealm) jenkins.getSecurityRealm();
assertEquals(1, securityRealm.getConfigurations().size());
assertEquals(50000, jenkins.getSlaveAgentPort());
assertEquals(1, jenkins.getNodes().size());
assertEquals("static-agent", jenkins.getNode("static-agent").getNodeName());
final GitTool.DescriptorImpl gitTool = (GitTool.DescriptorImpl) jenkins.getDescriptor(GitTool.class);
assertEquals(1, gitTool.getInstallations().length);
List<BasicSSHUserPrivateKey> sshPrivateKeys = CredentialsProvider.lookupCredentials(BasicSSHUserPrivateKey.class, jenkins, ACL.SYSTEM, Collections.emptyList());
assertThat(sshPrivateKeys, hasSize(1));
final BasicSSHUserPrivateKey ssh_with_passphrase = sshPrivateKeys.get(0);
assertThat(ssh_with_passphrase.getPassphrase().getPlainText(), equalTo("ABCD"));
final DirectEntryPrivateKeySource source = (DirectEntryPrivateKeySource) ssh_with_passphrase.getPrivateKeySource();
assertThat(source.getPrivateKey().getPlainText(), equalTo("s3cr3t"));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class HudsonPrivateSecurityRealmConfiguratorTest method configure_all_attributes.
@Test
@ConfiguredWithReadme("embedded-userdatabase/README.md#1")
public void configure_all_attributes() {
final User admin = User.getById("admin", false);
assertNotNull(admin);
assertThat(admin.getFullName(), is("Admin"));
assertThat(admin.getDescription(), is("Superwoman"));
SlackUserProperty slackUserProperty = admin.getProperty(SlackUserProperty.class);
assertThat(slackUserProperty.getUserId(), is("ABCDEFGH"));
UserProperty mailerProperty = admin.getProperty(UserProperty.class);
assertThat(mailerProperty.getEmailAddress(), is("admin3@example.com"));
// Pending https://github.com/jenkinsci/ssh-cli-auth-module/pull/16
// UserPropertyImpl authorizedKeysProperty = admin.getProperty(UserPropertyImpl.class);
// assertThat(authorizedKeysProperty.authorizedKeys, is("ssh-rsa some-key\n"));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class HudsonPrivateSecurityRealmConfiguratorTest method configure_local_security_and_admin_user.
@Test
@ConfiguredWithReadme("embedded-userdatabase/README.md#0")
public void configure_local_security_and_admin_user() {
final Jenkins jenkins = Jenkins.get();
final HudsonPrivateSecurityRealm securityRealm = (HudsonPrivateSecurityRealm) jenkins.getSecurityRealm();
assertFalse(securityRealm.allowsSignup());
final User admin = User.getById("admin", false);
assertNotNull(admin);
final HudsonPrivateSecurityRealm.Details details = admin.getProperty(HudsonPrivateSecurityRealm.Details.class);
assertTrue(details.isPasswordCorrect("somethingsecret"));
final FullControlOnceLoggedInAuthorizationStrategy authorizationStrategy = (FullControlOnceLoggedInAuthorizationStrategy) jenkins.getAuthorizationStrategy();
assertTrue(authorizationStrategy.isAllowAnonymousRead());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class HudsonPrivateSecurityRealmConfiguratorTest method config_local_security_and_hashed_admin_user.
@Test
@ConfiguredWithReadme("embedded-userdatabase/README.md#1")
public void config_local_security_and_hashed_admin_user() {
final User admin = User.getById("hashedadmin", false);
assertNotNull(admin);
final HudsonPrivateSecurityRealm.Details details = admin.getProperty(HudsonPrivateSecurityRealm.Details.class);
assertTrue(details.isPasswordCorrect("password"));
}
Aggregations