use of org.wildfly.swarm.spi.api.config.ConfigView in project wildfly-swarm by wildfly-swarm.
the class ProjectStagesTest method testCLIBasedSelectedStage.
@Test
public void testCLIBasedSelectedStage() throws Exception {
Swarm swarm = new Swarm(new Properties(), "-S", "production");
ConfigView view = swarm.configView();
assertThat(view.resolve("foo.bar.baz").getValue()).isEqualTo("brie");
}
use of org.wildfly.swarm.spi.api.config.ConfigView in project wildfly-swarm by wildfly-swarm.
the class ProjectStagesTest method testPropertiesOnCLIPreferredToEnvironmentVars.
@Test
public void testPropertiesOnCLIPreferredToEnvironmentVars() throws Exception {
Map<String, String> environment = new HashMap<>();
Properties properties = new Properties();
environment.put("swarm.myname", "from_env");
properties.setProperty("swarm.myname", "from_props");
Swarm swarm = new Swarm(properties, environment, "-Dswarm.myname=tacos");
ConfigView view = swarm.configView();
assertThat(view.resolve("swarm.myname").getValue()).isEqualTo("tacos");
}
use of org.wildfly.swarm.spi.api.config.ConfigView in project wildfly-swarm by wildfly-swarm.
the class ProjectStagesTest method testPropertyBasedConfigStagesFileAndSelectedStage.
@Test
public void testPropertyBasedConfigStagesFileAndSelectedStage() throws Exception {
try {
URL projectStages = getClass().getClassLoader().getResource("multi-project-stages.yml");
System.setProperty(SwarmProperties.PROJECT_STAGE_FILE, projectStages.toExternalForm());
System.setProperty(SwarmProperties.PROJECT_STAGE, "production");
Swarm swarm = new Swarm(new Properties());
ConfigView view = swarm.configView();
assertThat(view.resolve("foo.bar.baz").getValue()).isEqualTo("brie");
} finally {
System.clearProperty(SwarmProperties.PROJECT_STAGE_FILE);
System.clearProperty(SwarmProperties.PROJECT_STAGE);
}
}
use of org.wildfly.swarm.spi.api.config.ConfigView in project wildfly-swarm by wildfly-swarm.
the class ProjectStagesTest method testEnvironmentVars.
@Test
public void testEnvironmentVars() throws Exception {
Map<String, String> environment = new HashMap<>();
environment.put("swarm.myname", "from_env");
Swarm swarm = new Swarm(new Properties(), environment);
ConfigView view = swarm.configView();
assertThat(view.resolve("swarm.myname").getValue()).isEqualTo("from_env");
}
use of org.wildfly.swarm.spi.api.config.ConfigView in project wildfly-swarm by wildfly-swarm.
the class ProjectStagesTest method testIsolatedPropertiesToSelectProjectStage.
@Test
public void testIsolatedPropertiesToSelectProjectStage() throws Exception {
Properties props = new Properties();
props.setProperty("swarm.project.stage", "production");
Swarm swarm = new Swarm(props, "-Dswarm.project.stage=production");
ConfigView view = swarm.configView();
assertThat(view.resolve("foo.bar.baz").getValue()).isEqualTo("brie");
assertThat(view.resolve("foo.bar.taco").getValue()).isEqualTo("crunchy");
}
Aggregations