use of ddf.catalog.data.Attribute in project ddf by codice.
the class SaxEventHandlerUtilsTest method assertIdAttribute.
private void assertIdAttribute(List<Attribute> attributes) {
Attribute idAttr = getAttributeByName(attributes, CoreAttributes.ID);
assertThat(idAttr, notNullValue());
assertThat(idAttr.getValues().size(), is(1));
}
use of ddf.catalog.data.Attribute in project ddf by codice.
the class SaxEventHandlerUtilsTest method testNullAttributeDescriptors.
@Test
public void testNullAttributeDescriptors() {
List<Attribute> attributes = getTestAttributes();
attributes.add(new AttributeImpl(CoreAttributes.LANGUAGE, "Dothraki"));
List<Attribute> combinedAttributes = saxEventHandlerUtils.getCombinedMultiValuedAttributes(null, attributes);
assertThat(combinedAttributes.size(), is(3));
Attribute validationWarningAttr = getAttributeByName(combinedAttributes, ValidationAttributes.VALIDATION_WARNINGS);
assertThat(validationWarningAttr, notNullValue());
assertAttributeContainsString(validationWarningAttr, "No attribute descriptor was found for attribute");
assertAttributeContainsString(validationWarningAttr, "Multiple values found for a non-multi-valued attribute.");
assertIdAttribute(combinedAttributes);
assertLanguageAttribute(combinedAttributes, 1);
}
use of ddf.catalog.data.Attribute in project ddf by codice.
the class SaxEventHandlerUtilsTest method getTestAttributes.
private List<Attribute> getTestAttributes() {
List<Attribute> attributes = new ArrayList<>();
attributes.add(new AttributeImpl(CoreAttributes.ID, "id"));
attributes.add(new AttributeImpl(CoreAttributes.LANGUAGE, "English"));
return attributes;
}
use of ddf.catalog.data.Attribute in project ddf by codice.
the class SaxEventHandlerUtilsTest method testEmptyAttributeDescriptors.
@Test
public void testEmptyAttributeDescriptors() {
List<Attribute> attributes = getTestAttributes();
attributes.add(new AttributeImpl(CoreAttributes.LANGUAGE, "Dothraki"));
List<Attribute> combinedAttributes = saxEventHandlerUtils.getCombinedMultiValuedAttributes(Collections.emptySet(), attributes);
assertThat(combinedAttributes.size(), is(3));
Attribute validationWarningAttr = getAttributeByName(combinedAttributes, ValidationAttributes.VALIDATION_WARNINGS);
assertThat(validationWarningAttr, notNullValue());
assertAttributeContainsString(validationWarningAttr, "No attribute descriptor was found for attribute");
assertAttributeContainsString(validationWarningAttr, "Multiple values found for a non-multi-valued attribute.");
assertIdAttribute(combinedAttributes);
assertLanguageAttribute(combinedAttributes, 1);
}
use of ddf.catalog.data.Attribute in project ddf by codice.
the class SaxEventHandlerUtilsTest method assertLanguageAttribute.
private void assertLanguageAttribute(List<Attribute> attributes, int size) {
Attribute languageAttr = getAttributeByName(attributes, CoreAttributes.LANGUAGE);
assertThat(languageAttr, notNullValue());
assertThat(languageAttr.getValues().size(), is(size));
}
Aggregations