Search in sources :

Example 1 with MetacardTypeAdapter

use of ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter 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()));
}
Also used : ArrayList(java.util.ArrayList) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) MetacardTypeAdapter(ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter) MetacardTypeImpl(ddf.catalog.data.impl.MetacardTypeImpl) MetacardType(ddf.catalog.data.MetacardType) Test(org.junit.Test)

Example 2 with MetacardTypeAdapter

use of ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter 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()));
}
Also used : ArrayList(java.util.ArrayList) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) MetacardTypeAdapter(ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter) MetacardTypeImpl(ddf.catalog.data.impl.MetacardTypeImpl) MetacardType(ddf.catalog.data.MetacardType) Test(org.junit.Test)

Example 3 with MetacardTypeAdapter

use of ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter in project ddf by codice.

the class TestMetacardTypeAdapter method testUnmarshalWithNullRegisteredMetacardTypes.

@Test
public void testUnmarshalWithNullRegisteredMetacardTypes() throws CatalogTransformerException {
    MetacardTypeAdapter metacardTypeAdpater = new MetacardTypeAdapter(NULL_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 4 with MetacardTypeAdapter

use of ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter in project ddf by codice.

the class TestMetacardTypeAdapter method testUnmarshalWithDdfMetacardTypeName.

@Test
public void testUnmarshalWithDdfMetacardTypeName() 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(DDF_METACARD_TYPE_NAME);
    assertThat(metacardType.getName(), is(BasicTypes.BASIC_METACARD.getName()));
}
Also used : ArrayList(java.util.ArrayList) AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) MetacardTypeAdapter(ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter) MetacardTypeImpl(ddf.catalog.data.impl.MetacardTypeImpl) MetacardType(ddf.catalog.data.MetacardType) Test(org.junit.Test)

Example 5 with MetacardTypeAdapter

use of ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter in project ddf by codice.

the class TestMetacardTypeAdapter method testUnmarshalWithEmptyTypeName.

@Test
public void testUnmarshalWithEmptyTypeName() throws CatalogTransformerException {
    MetacardTypeAdapter metacardTypeAdpater = new MetacardTypeAdapter();
    MetacardType metacardType = metacardTypeAdpater.unmarshal(EMPTY_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)

Aggregations

MetacardType (ddf.catalog.data.MetacardType)7 MetacardTypeAdapter (ddf.catalog.transformer.xml.adapter.MetacardTypeAdapter)7 Test (org.junit.Test)7 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)3 MetacardTypeImpl (ddf.catalog.data.impl.MetacardTypeImpl)3 ArrayList (java.util.ArrayList)3