use of org.wildfly.extras.config.LayerConfig in project wildfly-camel by wildfly-extras.
the class LayerConfigTest method testApplyLayerConfigChange.
@Test
public void testApplyLayerConfigChange() throws Exception {
ConfigPlugin plugin = new ConfigPlugin() {
@Override
public String getConfigName() {
return "foo";
}
@Override
public List<LayerConfig> getLayerConfigs() {
return Arrays.asList(new LayerConfig("fuse_6.2.1", Type.INSTALLING, -10), new LayerConfig("soa_6.2.1", Type.INSTALLING, -10), new LayerConfig("brms_6.2.1", Type.OPTIONAL, -11));
}
@Override
public boolean applyStandaloneConfigChange(ConfigContext context, boolean enable) {
return false;
}
@Override
public boolean applyDomainConfigChange(ConfigContext context, boolean enable) {
return false;
}
};
// Install/Uninstall scenario.
List<String> layers;
layers = ConfigSupport.applyLayerChanges(plugin, list("foo", "example"), true);
Assert.assertEquals(list("fuse_6.2.1", "soa_6.2.1", "foo", "example"), layers);
layers = ConfigSupport.applyLayerChanges(plugin, layers, false);
Assert.assertEquals(list("foo", "example"), layers);
// Upgrade/Uninstall scenario.
layers = list("foo", "fuse_6.1", "soa", "example");
layers = ConfigSupport.applyLayerChanges(plugin, layers, true);
Assert.assertEquals(list("fuse_6.2.1", "soa_6.2.1", "foo", "example"), layers);
layers = ConfigSupport.applyLayerChanges(plugin, layers, false);
Assert.assertEquals(list("foo", "example"), layers);
// Another Upgrade/Uninstall scenario.
layers = list("foo", "fuse", "example");
layers = ConfigSupport.applyLayerChanges(plugin, layers, true);
Assert.assertEquals(list("fuse_6.2.1", "soa_6.2.1", "foo", "example"), layers);
layers = ConfigSupport.applyLayerChanges(plugin, layers, false);
Assert.assertEquals(list("foo", "example"), layers);
}
use of org.wildfly.extras.config.LayerConfig in project wildfly-camel by wildfly-extras.
the class LayerConfigTest method testApplyLayerConfigChange2.
@Test
public void testApplyLayerConfigChange2() throws Exception {
ConfigPlugin plugin = new ConfigPlugin() {
@Override
public String getConfigName() {
return "foo";
}
@Override
public List<LayerConfig> getLayerConfigs() {
return Arrays.asList(new LayerConfig("fuse_6.2.1", Type.REQUIRED, -10), new LayerConfig("soa_6.2.1", Type.REQUIRED, -10), new LayerConfig("brms_6.2.1", Type.INSTALLING, -9));
}
@Override
public boolean applyStandaloneConfigChange(ConfigContext context, boolean enable) {
return false;
}
@Override
public boolean applyDomainConfigChange(ConfigContext context, boolean enable) {
return false;
}
};
// Install/Uninstall scenario.
List<String> layers;
try {
layers = list("foo", "example");
ConfigSupport.applyLayerChanges(plugin, layers, true);
Assert.fail("Expecting exception since required modules are not installed");
} catch (Exception e) {
}
layers = list("fuse", "soa");
layers = ConfigSupport.applyLayerChanges(plugin, layers, true);
Assert.assertEquals(list("fuse", "soa", "brms_6.2.1"), layers);
}
Aggregations