@Test public void testValidateWhenAttributeWithMoreSubAttributesThanValue() { Attribute attribute = new Attribute.Builder().name(ATTRIBUTE1).type(COMPLEX.toString()).mutability("readWrite") .addSubAttribute(new Attribute.Builder().name(ATTRIBUTE1).type(STRING.toString()).mutability("readWrite").build()) .addSubAttribute(new Attribute.Builder().name(ATTRIBUTE2).type(STRING.toString()).mutability("readWrite").build()) .addSubAttribute(new Attribute.Builder().name(ATTRIBUTE3).type(STRING.toString()).mutability("readWrite").build()).build(); Attribute mainAttribute = new Attribute.Builder().name(PARENT_ATTRIBUTE_NAME).type(COMPLEX.toString()).mutability("readWrite") .addSubAttribute(attribute).build(); new SchemaBasedAttributeValueValidator(mainAttribute, Collections.emptyMap()).validate(value); }
@Override public void validate(final Object value) { JsonNode jsonNodeValue = (value instanceof JsonNode) ? (JsonNode) value : new ObjectMapper().valueToTree(value); validateValueAttributes(attributeDefinition, jsonNodeValue); }
SchemaBasedAttributeValueValidator implements Validator<Object> { @Override public void validate(final Object value) { JsonNode jsonNodeValue = (value instanceof JsonNode) ? (JsonNode) value : new ObjectMapper().valueToTree(value); validateValueAttributes(attributeDefinition, jsonNodeValue); } }
SchemaBasedAttributeValueValidator implements Validator<Object> { @Override public void validate(final Object value) { JsonNode jsonNodeValue = (value instanceof JsonNode) ? (JsonNode) value : new ObjectMapper().valueToTree(value); validateValueAttributes(attributeDefinition, jsonNodeValue); } SchemaBasedAttributeValueValidator(final Attribute attributeDefinition, final Map<String, Schema> permittedSchemas); }
SchemaBasedAttributeValueValidator implements Validator<Object> { @Override public void validate(final Object value) { JsonNode jsonNodeValue = (value instanceof JsonNode) ? (JsonNode) value : new ObjectMapper().valueToTree(value); validateValueAttributes(attributeDefinition, jsonNodeValue); } SchemaBasedAttributeValueValidator(final Attribute attributeDefinition, final Map<String, Schema> permittedSchemas); @Override void validate(final Object value); }
SchemaBasedAttributeValueValidator implements Validator<Object> { @Override public void validate(final Object value) { JsonNode jsonNodeValue = (value instanceof JsonNode) ? (JsonNode) value : new ObjectMapper().valueToTree(value); validateValueAttributes(attributeDefinition, jsonNodeValue); } SchemaBasedAttributeValueValidator(final Attribute attributeDefinition, final Map<String, Schema> permittedSchemas); @Override void validate(final Object value);  }