Search in sources :

Example 86 with MetacardType

use of ddf.catalog.data.MetacardType in project ddf by codice.

the class TestMetacardTypeAdapter method testUnmarshalWithEmptyRegisteredMetacardTypes.

@Test
public void testUnmarshalWithEmptyRegisteredMetacardTypes() throws CatalogTransformerException {
    MetacardTypeAdapter metacardTypeAdpater = new MetacardTypeAdapter(EMPTY_METACARD_TYPES_LIST);
    MetacardType metacardType = metacardTypeAdpater.unmarshal(UNKNOWN_TYPE_NAME);
    assertThat(metacardType.getName(), is(BasicTypes.BASIC_METACARD.getName()));
}
Also used : MetacardTypeAdapter(ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter) MetacardType(ddf.catalog.data.MetacardType) Test(org.junit.Test)

Example 87 with MetacardType

use of ddf.catalog.data.MetacardType in project ddf by codice.

the class AttributeInjectorImpl method injectAttributes.

@Override
public Metacard injectAttributes(Metacard original) {
    notNull(original, "The metacard cannot be null.");
    final MetacardType newMetacardType = injectAttributes(original.getMetacardType());
    if (newMetacardType == original.getMetacardType()) {
        return original;
    } else {
        return changeMetacardType(original, newMetacardType);
    }
}
Also used : MetacardType(ddf.catalog.data.MetacardType)

Example 88 with MetacardType

use of ddf.catalog.data.MetacardType in project ddf by codice.

the class AttributeInjectorImplTest method testInjectIntoMetacardType.

@Test
public void testInjectIntoMetacardType() {
    final MetacardType expectedBasicMetacardType = new MetacardTypeImpl(BASIC_METACARD.getName(), BASIC_METACARD, Sets.newHashSet(globalAttribute, basicAttribute, basicAndNitfAttribute));
    assertThat(attributeInjector.injectAttributes(BASIC_METACARD), is(expectedBasicMetacardType));
    final MetacardType expectedNitfMetacardType = new MetacardTypeImpl(NITF, NITF_TYPE, Sets.newHashSet(globalAttribute, basicAndNitfAttribute));
    assertThat(attributeInjector.injectAttributes(NITF_TYPE), is(expectedNitfMetacardType));
}
Also used : MetacardTypeImpl(ddf.catalog.data.impl.MetacardTypeImpl) MetacardType(ddf.catalog.data.MetacardType) Test(org.junit.Test)

Aggregations

MetacardType (ddf.catalog.data.MetacardType)88 Test (org.junit.Test)57 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)41 Metacard (ddf.catalog.data.Metacard)35 ArrayList (java.util.ArrayList)29 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)20 MetacardTypeImpl (ddf.catalog.data.impl.MetacardTypeImpl)17 HashSet (java.util.HashSet)15 Attribute (ddf.catalog.data.Attribute)12 Serializable (java.io.Serializable)10 IOException (java.io.IOException)8 Date (java.util.Date)8 HashMap (java.util.HashMap)8 List (java.util.List)8 Map (java.util.Map)8 AttributeDescriptorImpl (ddf.catalog.data.impl.AttributeDescriptorImpl)7 InputStream (java.io.InputStream)7 Set (java.util.Set)7 ContentItem (ddf.catalog.content.data.ContentItem)6 ContentItemImpl (ddf.catalog.content.data.impl.ContentItemImpl)6