Search in sources :

Example 6 with ConfigContext

use of org.wildfly.extras.config.ConfigContext 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);
}
Also used : ConfigPlugin(org.wildfly.extras.config.ConfigPlugin) LayerConfig(org.wildfly.extras.config.LayerConfig) ConfigContext(org.wildfly.extras.config.ConfigContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 ConfigContext (org.wildfly.extras.config.ConfigContext)6 ConfigPlugin (org.wildfly.extras.config.ConfigPlugin)6 URL (java.net.URL)4 Document (org.jdom.Document)4 SAXBuilder (org.jdom.input.SAXBuilder)4 WildFlyCamelConfigPlugin (org.wildfly.extension.camel.config.WildFlyCamelConfigPlugin)4 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 Element (org.jdom.Element)2 LayerConfig (org.wildfly.extras.config.LayerConfig)2 Attribute (org.jdom.Attribute)1