use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class ConfigFileProviderTest method configure_config_file_provider.
@Test
@ConfiguredWithReadme(value = "config-file-provider/README.md")
public void configure_config_file_provider() {
assertThat(GlobalConfigFiles.get().getConfigs(), hasSize(4));
Config config = GlobalConfigFiles.get().getById("custom-test");
assertThat(config.name, is("DummyCustom1"));
assertThat(config.comment, is("dummy custom 1"));
assertThat(config.content, is("dummy content 1"));
config = GlobalConfigFiles.get().getById("json-test");
assertThat(config.name, is("DummyJsonConfig"));
assertThat(config.comment, is("dummy json config"));
assertThat(config.content, containsString("{ \"dummydata\": {\"dummyKey\": \"dummyValue\"} }"));
config = GlobalConfigFiles.get().getById("xml-test");
assertThat(config.name, is("DummyXmlConfig"));
assertThat(config.comment, is("dummy xml config"));
assertThat(config.content, containsString("<root><dummy test=\"abc\"></dummy></root>"));
MavenSettingsConfig mavenSettings = (MavenSettingsConfig) GlobalConfigFiles.get().getById("maven-test");
assertThat(mavenSettings.name, is("DummySettings"));
assertThat(mavenSettings.comment, is("dummy settings"));
assertThat(mavenSettings.isReplaceAll, is(false));
assertThat(mavenSettings.getServerCredentialMappings(), hasSize(2));
assertThat(mavenSettings.getServerCredentialMappings().get(0).getServerId(), is("server1"));
assertThat(mavenSettings.getServerCredentialMappings().get(0).getCredentialsId(), is("someCredentials1"));
assertThat(mavenSettings.getServerCredentialMappings().get(1).getServerId(), is("server2"));
assertThat(mavenSettings.getServerCredentialMappings().get(1).getCredentialsId(), is("someCredentials2"));
assertThat(mavenSettings.content, containsString("<activeProfiles>"));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class GitLabConfigurationTest method configure_gitlab_connection.
@Test
@ConfiguredWithReadme("gitlab/README.md")
public void configure_gitlab_connection() {
final Jenkins jenkins = Jenkins.get();
final GitLabConnectionConfig gitLabConnections = jenkins.getDescriptorByType(GitLabConnectionConfig.class);
assertEquals(1, gitLabConnections.getConnections().size());
final GitLabConnection gitLabConnection = gitLabConnections.getConnections().get(0);
assertEquals("gitlab_token", gitLabConnection.getApiTokenId());
assertEquals("my_gitlab_server", gitLabConnection.getName());
assertEquals("autodetect", gitLabConnection.getClientBuilderId());
assertEquals("https://gitlab.com/", gitLabConnection.getUrl());
assertEquals(20, gitLabConnection.getConnectionTimeout());
assertEquals(10, gitLabConnection.getReadTimeout());
assertTrue(gitLabConnection.isIgnoreCertificateErrors());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class GlobalMatrixAuthorizationTest method checkCorrectlyConfiguredPermissions.
@Test
@ConfiguredWithReadme("matrix-auth/README.md")
public void checkCorrectlyConfiguredPermissions() {
assertEquals("The configured instance must use the Global Matrix Authentication Strategy", GlobalMatrixAuthorizationStrategy.class, Jenkins.get().getAuthorizationStrategy().getClass());
GlobalMatrixAuthorizationStrategy gms = (GlobalMatrixAuthorizationStrategy) Jenkins.get().getAuthorizationStrategy();
List<String> adminPermission = new ArrayList<>(gms.getGrantedPermissions().get(Jenkins.ADMINISTER));
assertEquals("authenticated", adminPermission.get(0));
List<String> readPermission = new ArrayList<>(gms.getGrantedPermissions().get(Jenkins.READ));
assertEquals("anonymous", readPermission.get(0));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class KeycloakTest method configure_artifact_manager.
@Test
@ConfiguredWithReadme("keycloak/README.md")
public void configure_artifact_manager() {
SecurityRealm realm = j.jenkins.get().getSecurityRealm();
assertThat(realm, instanceOf(KeycloakSecurityRealm.class));
KeycloakSecurityRealm securityRealm = (KeycloakSecurityRealm) realm;
assertThat(securityRealm.getKeycloakJson(), containsString("\"auth-server-url\": \"https://my-keycloak-url/auth\""));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class MSBuildTest method configure_msbuild.
@Test
@ConfiguredWithReadme("msbuild/README.md")
public void configure_msbuild() {
final DescriptorImpl msBuildDescriptor = ExtensionList.lookupSingleton(DescriptorImpl.class);
assertNotNull(msBuildDescriptor);
assertEquals(1, msBuildDescriptor.getInstallations().length);
final MsBuildInstallation msBuildInstallation = msBuildDescriptor.getInstallations()[0];
assertEquals("MSBuild Latest", msBuildInstallation.getName());
assertEquals("C:\\WINDOWS\\Microsoft.NET\\Framework\\14.0\\Bin\\MSBuild.exe", msBuildInstallation.getHome());
assertEquals("/p:Configuration=Debug", msBuildInstallation.getDefaultArgs());
}
Aggregations