Search in sources :

Example 1 with YamlMemberDomConfigProcessor

use of com.hazelcast.internal.config.YamlMemberDomConfigProcessor in project hazelcast by hazelcast.

the class YamlConfigBuilder method parseAndBuildConfig.

private void parseAndBuildConfig(Config config) throws Exception {
    YamlMapping yamlRootNode;
    try {
        yamlRootNode = ((YamlMapping) YamlLoader.load(in));
    } catch (Exception ex) {
        throw new InvalidConfigurationException("Invalid YAML configuration", ex);
    }
    YamlNode imdgRoot = yamlRootNode.childAsMapping(ConfigSections.HAZELCAST.getName());
    if (imdgRoot == null) {
        imdgRoot = yamlRootNode;
    }
    YamlDomChecker.check(imdgRoot);
    Node w3cRootNode = asW3cNode(imdgRoot);
    replaceVariables(w3cRootNode);
    importDocuments(imdgRoot);
    if (shouldValidateTheSchema()) {
        new YamlConfigSchemaValidator().validate((YamlMapping) imdgRoot.parent());
    }
    new YamlMemberDomConfigProcessor(true, config).buildConfig(w3cRootNode);
}
Also used : YamlConfigSchemaValidator(com.hazelcast.internal.config.YamlConfigSchemaValidator) YamlNode(com.hazelcast.internal.yaml.YamlNode) W3cDomUtil.asW3cNode(com.hazelcast.internal.config.yaml.W3cDomUtil.asW3cNode) Node(org.w3c.dom.Node) YamlNode(com.hazelcast.internal.yaml.YamlNode) YamlMemberDomConfigProcessor(com.hazelcast.internal.config.YamlMemberDomConfigProcessor) YamlMapping(com.hazelcast.internal.yaml.YamlMapping) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Example 2 with YamlMemberDomConfigProcessor

use of com.hazelcast.internal.config.YamlMemberDomConfigProcessor in project hazelcast by hazelcast.

the class ConfigNodeStateTrackerTest method shouldDetectUnappliedMemberConfigEntries.

@Test
public void shouldDetectUnappliedMemberConfigEntries() throws Exception {
    Map<String, String> entries = new HashMap<>();
    entries.put("HZ_CLUSTERNAME", "foo");
    entries.put("HZ_CLUSTRNAME", "foo");
    entries.put("HZ_NETWORK_PORT", "5702");
    entries.put("HZ_NETWORK_JOIN_TCPIP_BLE", "false");
    entries.put("HZ_NETWORK_JOIN_MULTCAST_ENABLED", "false");
    ConfigNode configNode = PropertiesToNodeConverter.propsToNode(EnvVariablesConfigParser.member().parse(entries));
    new YamlMemberDomConfigProcessor(true, new Config(), false).buildConfig(new ConfigOverrideElementAdapter(configNode));
    Map<String, String> unprocessed = new ConfigNodeStateTracker().unprocessedNodes(configNode);
    assertTrue(unprocessed.containsKey("hazelcast.network.port"));
    assertTrue(unprocessed.containsKey("hazelcast.clustrname"));
    assertTrue(unprocessed.containsKey("hazelcast.network.join.tcpip.ble"));
    assertTrue(unprocessed.containsKey("hazelcast.network.join.multcast.enabled"));
}
Also used : HashMap(java.util.HashMap) Config(com.hazelcast.config.Config) ClientConfig(com.hazelcast.client.config.ClientConfig) YamlMemberDomConfigProcessor(com.hazelcast.internal.config.YamlMemberDomConfigProcessor) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

YamlMemberDomConfigProcessor (com.hazelcast.internal.config.YamlMemberDomConfigProcessor)2 ClientConfig (com.hazelcast.client.config.ClientConfig)1 Config (com.hazelcast.config.Config)1 YamlConfigSchemaValidator (com.hazelcast.internal.config.YamlConfigSchemaValidator)1 W3cDomUtil.asW3cNode (com.hazelcast.internal.config.yaml.W3cDomUtil.asW3cNode)1 YamlMapping (com.hazelcast.internal.yaml.YamlMapping)1 YamlNode (com.hazelcast.internal.yaml.YamlNode)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 Node (org.w3c.dom.Node)1