use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class TestMetacardTypeAdapter method testUnmarshalWithKnownMetacardType.
@Test
public void testUnmarshalWithKnownMetacardType() throws CatalogTransformerException {
MetacardType knownMetacardType = new MetacardTypeImpl(KNOWN_TYPE_NAME, (Set<AttributeDescriptor>) null);
List<MetacardType> metacardTypes = new ArrayList<MetacardType>(1);
metacardTypes.add(knownMetacardType);
MetacardTypeAdapter metacardTypeAdpater = new MetacardTypeAdapter(metacardTypes);
MetacardType metacardType = metacardTypeAdpater.unmarshal(KNOWN_TYPE_NAME);
assertThat(metacardType.getName(), is(knownMetacardType.getName()));
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class TestMetacardTypeAdapter method testUnmarshalWithUnknownTypeName.
@Test
public void testUnmarshalWithUnknownTypeName() throws CatalogTransformerException {
MetacardType unknownMetacardType = new MetacardTypeImpl(KNOWN_TYPE_NAME, (Set<AttributeDescriptor>) null);
List<MetacardType> metacardTypes = new ArrayList<MetacardType>(1);
metacardTypes.add(unknownMetacardType);
MetacardTypeAdapter metacardTypeAdpater = new MetacardTypeAdapter(metacardTypes);
MetacardType metacardType = metacardTypeAdpater.unmarshal(UNKNOWN_TYPE_NAME);
assertThat(metacardType.getName(), is(BasicTypes.BASIC_METACARD.getName()));
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class TestXmlInputTransformer method testTransformWithExtensibleMetacardType.
@Test
public void testTransformWithExtensibleMetacardType() throws IOException, CatalogTransformerException {
List<MetacardType> metacardTypes = new ArrayList<MetacardType>(1);
MetacardType extensibleType = new MetacardTypeImpl("extensible.metacard", BasicTypes.BASIC_METACARD.getAttributeDescriptors());
metacardTypes.add(extensibleType);
xit.setMetacardTypes(metacardTypes);
Metacard metacard = xit.transform(new FileInputStream("src/test/resources/extensibleMetacard.xml"));
LOGGER.info("ID: {}", metacard.getId());
LOGGER.info("Type: {}", metacard.getMetacardType().getName());
LOGGER.info("Source: {}", metacard.getSourceId());
LOGGER.info("Attributes: ");
for (AttributeDescriptor descriptor : metacard.getMetacardType().getAttributeDescriptors()) {
Attribute attribute = metacard.getAttribute(descriptor.getName());
LOGGER.info("\t" + descriptor.getName() + ": " + ((attribute == null) ? attribute : attribute.getValue()));
}
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class CachedResourceMetacardComparatorTest method isNotSameWhenMetacardsHaveAttributeDescriptorListsOfDifferentSizes.
@Test
public void isNotSameWhenMetacardsHaveAttributeDescriptorListsOfDifferentSizes() {
cachedMetacard.setType(new MetacardTypeImpl(MetacardType.DEFAULT_METACARD_TYPE_NAME, new HashSet<>()));
assertThat(isSame(cachedMetacard, updatedMetacard), is(false));
}
use of ddf.catalog.data.impl.MetacardTypeImpl in project ddf by codice.
the class MetacardCreatorTest method testNullIntAttribute.
@Test
public void testNullIntAttribute() {
Set<AttributeDescriptor> extraAttributes = new HashSet<>();
extraAttributes.add(new AttributeDescriptorImpl(Media.DURATION, false, false, false, false, BasicTypes.INTEGER_TYPE));
final Metadata metadata = new Metadata();
metadata.add(MetacardCreator.COMPRESSION_TYPE_METADATA_KEY, null);
MetacardTypeImpl extendedMetacardType = new MetacardTypeImpl(BasicTypes.BASIC_METACARD.getName(), BasicTypes.BASIC_METACARD, extraAttributes);
final String id = "id";
final String metadataXml = "<xml>test</xml>";
Metacard metacard = MetacardCreator.createMetacard(metadata, id, metadataXml, extendedMetacardType);
assertThat(metacard.getMetadata(), is(metadataXml));
assertThat(metacard.getAttribute(Media.COMPRESSION), is(nullValue()));
}
Aggregations