use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class GiteaServerTest method configure_gitea.
@Test
@ConfiguredWithReadme("gitea/README.md")
public void configure_gitea() {
final GiteaServers configuration = GlobalConfiguration.all().get(GiteaServers.class);
assertEquals(configuration.getServers().size(), 1);
GiteaServer config = configuration.getServers().get(0);
assertEquals("https://my-scm-url", config.getServerUrl());
assertEquals("<my-credential-id>", config.getCredentialsId());
assertEquals("scm", config.getDisplayName());
assertTrue(config.isManageHooks());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class JenkinsReadmeDemoTest method configure_demo_first_code_block.
@Test
@ConfiguredWithReadme("jenkins/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());
assertEquals(5, jenkins.getNumExecutors());
assertEquals(2, jenkins.getScmCheckoutRetryCount());
assertEquals(Mode.NORMAL, jenkins.getMode());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class JenkinsReadmeDemoTest method configure_demo_second_code_block.
@Test
@ConfiguredWithReadme("jenkins/README.md#1")
public void configure_demo_second_code_block() {
final Jenkins jenkins = Jenkins.get();
assertThat(jenkins.getSystemMessage(), containsString("Welcome to our build server."));
assertEquals(1, jenkins.getNumExecutors());
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme in project configuration-as-code-plugin by jenkinsci.
the class MavenConfiguratorTest method configure_maven_global_config_specific_files.
@Test
@ConfiguredWithReadme("maven/README.md#2")
public void configure_maven_global_config_specific_files() {
final GlobalMavenConfig descriptor = ExtensionList.lookupSingleton(GlobalMavenConfig.class);
assertThat(descriptor.getGlobalSettingsProvider(), instanceOf(FilePathGlobalSettingsProvider.class));
FilePathGlobalSettingsProvider globalProvider = (FilePathGlobalSettingsProvider) descriptor.getGlobalSettingsProvider();
assertThat(globalProvider.getPath(), is("/conf/maven/global-settings.xml"));
assertThat(descriptor.getSettingsProvider(), instanceOf(FilePathSettingsProvider.class));
FilePathSettingsProvider provider = (FilePathSettingsProvider) descriptor.getSettingsProvider();
assertThat(provider.getPath(), is("/conf/maven/settings.xml"));
}
use of io.jenkins.plugins.casc.misc.ConfiguredWithReadme 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