use of com.hazelcast.internal.config.SchemaViolationConfigurationException in project hazelcast by hazelcast.
the class YamlRootAdditionalPropertiesTest method multipleMisIndented_configProps.
@Test
public void multipleMisIndented_configProps() {
SchemaViolationConfigurationException actual = assertThrows(SchemaViolationConfigurationException.class, () -> YamlClientConfigBuilderTest.buildConfig("hazelcast-client: {}\n" + "instance-name: 'my-instance'\n" + "client-labels: 'my-lbl'\n"));
assertEquals(new SchemaViolationConfigurationException(format("2 schema violations found%n" + "Note: you can disable this validation by passing the " + "-Dhazelcast.yaml.config.indentation.check.enabled=false system property"), "#", "#", asList(new SchemaViolationConfigurationException("Mis-indented hazelcast configuration property found: [instance-name]", "#", "#", emptyList()), new SchemaViolationConfigurationException("Mis-indented hazelcast configuration property found: [client-labels]", "#", "#", emptyList()))), actual);
}
use of com.hazelcast.internal.config.SchemaViolationConfigurationException in project hazelcast by hazelcast.
the class YamlConfigSchemaValidatorTest method validationExceptionIsWrapped.
@Test
public void validationExceptionIsWrapped() {
YamlMapping config = (YamlMapping) YamlDomBuilder.build(new HashMap<>());
YamlConfigSchemaValidator validator = new YamlConfigSchemaValidator();
try {
validator.validate(config);
fail("did not throw exception for invalid config");
} catch (SchemaViolationConfigurationException e) {
assertEquals("#", e.getKeywordLocation());
assertEquals("#", e.getInstanceLocation());
assertEquals("exactly one of [hazelcast], [hazelcast-client] and [hazelcast-client-failover] should be present in the" + " root schema document, 0 are present", e.getMessage());
}
}
use of com.hazelcast.internal.config.SchemaViolationConfigurationException in project hazelcast by hazelcast.
the class YamlRootAdditionalPropertiesTest method testMisIndentedMemberConfigProperty_failsValidation.
@Test
public void testMisIndentedMemberConfigProperty_failsValidation() {
SchemaViolationConfigurationException actual = assertThrows(SchemaViolationConfigurationException.class, () -> buildConfig("hazelcast:\n" + " instance-name: 'my-instance'\n" + "cluster-name: 'my-cluster'\n"));
assertEquals(format("Mis-indented hazelcast configuration property found: [cluster-name]%n" + "Note: you can disable this validation by passing the " + "-Dhazelcast.yaml.config.indentation.check.enabled=false system property"), actual.getMessage());
}
use of com.hazelcast.internal.config.SchemaViolationConfigurationException in project hazelcast by hazelcast.
the class YamlRootAdditionalPropertiesTest method testMisIndented_ClientConfigProperty_failsValidation.
@Test
public void testMisIndented_ClientConfigProperty_failsValidation() {
SchemaViolationConfigurationException actual = assertThrows(SchemaViolationConfigurationException.class, () -> YamlClientConfigBuilderTest.buildConfig("hazelcast-client:\n" + " instance-name: 'my-instance'\n" + "client-labels: 'my-lbl'\n"));
assertEquals(format("Mis-indented hazelcast configuration property found: [client-labels]%n" + "Note: you can disable this validation by passing the " + "-Dhazelcast.yaml.config.indentation.check.enabled=false system property"), actual.getMessage());
}
Aggregations