use of io.jenkins.plugins.casc.model.CNode in project configuration-as-code-plugin by jenkinsci.
the class CredentialsTest method testExportFileCredentials.
@Test
@ConfiguredWithCode("GlobalCredentials.yml")
public void testExportFileCredentials() throws Exception {
ConfiguratorRegistry registry = ConfiguratorRegistry.get();
ConfigurationContext context = new ConfigurationContext(registry);
CredentialsRootConfigurator root = ExtensionList.lookupSingleton(CredentialsRootConfigurator.class);
CNode node = root.describe(root.getTargetComponent(context), context);
assertNotNull(node);
final Mapping mapping = node.asMapping();
Mapping fileCredential = mapping.get("system").asMapping().get("domainCredentials").asSequence().get(0).asMapping().get("credentials").asSequence().get(2).asMapping().get("file").asMapping();
assertThat(fileCredential.getScalarValue("scope"), is("GLOBAL"));
assertThat(fileCredential.getScalarValue("id"), is("secret-file"));
assertThat(fileCredential.getScalarValue("fileName"), is("mysecretfile.txt"));
assertThat(fileCredential.getScalarValue("secretBytes"), not("WJjZAo="));
}
use of io.jenkins.plugins.casc.model.CNode in project configuration-as-code-plugin by jenkinsci.
the class DockerWorkflowSymbolTest method export_global_definition.
@Test
@Issue("1260")
public void export_global_definition() throws Exception {
ConfiguratorRegistry registry = ConfiguratorRegistry.get();
ConfigurationContext context = new ConfigurationContext(registry);
CNode yourAttribute = getUnclassifiedRoot(context).get("pipeline-model-docker");
String exported = toYamlString(yourAttribute);
String expected = toStringFromYamlFile(this, "DockerWorkflowSymbolExpected.yml");
assertThat(exported, is(expected));
}
use of io.jenkins.plugins.casc.model.CNode in project configuration-as-code-plugin by jenkinsci.
the class JdkConfiguratorTest method export_jdk_tool.
@Test
public void export_jdk_tool() throws Exception {
ConfiguratorRegistry registry = ConfiguratorRegistry.get();
ConfigurationContext context = new ConfigurationContext(registry);
CNode yourAttribute = getToolRoot(context).get("jdk");
String exported = toYamlString(yourAttribute);
String expected = toStringFromYamlFile(this, "JdkConfiguratorTestExpected.yml");
assertThat(exported, is(expected));
}
use of io.jenkins.plugins.casc.model.CNode in project configuration-as-code-plugin by jenkinsci.
the class LDAPSecurityRealmTest method export_ldap_no_secret.
@Test
@ConfiguredWithCode("LDAPSecurityRealmTestNoSecret.yml")
public void export_ldap_no_secret() throws Exception {
ConfiguratorRegistry registry = ConfiguratorRegistry.get();
ConfigurationContext context = new ConfigurationContext(registry);
CNode yourAttribute = getJenkinsRoot(context).get("securityRealm").asMapping().get("ldap");
String exported = toYamlString(yourAttribute);
String expected = toStringFromYamlFile(this, "LDAPSecurityRealmTestNoSecretExpected.yml");
assertThat(exported, is(expected));
}
use of io.jenkins.plugins.casc.model.CNode in project configuration-as-code-plugin by jenkinsci.
the class MavenConfiguratorTest method export_maven_global_config_specific_files.
@Test
@ConfiguredWithReadme("maven/README.md#2")
public void export_maven_global_config_specific_files() 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, "MavenConfiguratorTestGlobalConfigSpecificFilesExpected.yml");
assertThat(exported, is(expected));
}
Aggregations