use of ddf.catalog.data.MetacardType in project ddf by codice.
the class MetacardTypeImplTest method testMediaType.
@Test
public void testMediaType() {
List<MetacardType> metacardTypeList = new ArrayList<>();
metacardTypeList.add(MEDIA_ATTRIBUTES);
MetacardType metacardType = new MetacardTypeImpl(TEST_NAME, metacardTypeList);
assertMetacardAttributes(metacardType, CORE_ATTRIBUTES.getAttributeDescriptors());
assertMetacardAttributes(metacardType, MEDIA_ATTRIBUTES.getAttributeDescriptors());
}
use of ddf.catalog.data.MetacardType in project ddf by codice.
the class MetacardTypeImplTest method testNullAttributeDescriptors.
@Test
public void testNullAttributeDescriptors() {
MetacardType mt = new MetacardTypeImpl(NAME, (Set<AttributeDescriptor>) null);
assertThat(mt.getAttributeDescriptors(), hasSize(0));
}
use of ddf.catalog.data.MetacardType in project ddf by codice.
the class CatalogBackupPluginTest method getDeleteResponse.
private DeleteResponse getDeleteResponse(List<String> metacardIds) {
MetacardType mockMetacardType = mock(MetacardType.class);
when(mockMetacardType.getName()).thenReturn(MetacardType.DEFAULT_METACARD_TYPE_NAME);
List<Metacard> deletedMetacards = new ArrayList<>(metacardIds.size());
for (String metacardId : metacardIds) {
Metacard mockMetacard = mock(Metacard.class);
when(mockMetacard.getId()).thenReturn(metacardId);
when(mockMetacard.getMetacardType()).thenReturn(mockMetacardType);
deletedMetacards.add(mockMetacard);
}
DeleteRequest request = mock(DeleteRequest.class);
DeleteResponse mockDeleteResponse = mock(DeleteResponse.class);
when(mockDeleteResponse.getDeletedMetacards()).thenReturn(deletedMetacards);
when(mockDeleteResponse.getRequest()).thenReturn(request);
return mockDeleteResponse;
}
use of ddf.catalog.data.MetacardType in project ddf by codice.
the class AttributeInjectorImplTest method testInjectIntoMetacard.
@Test
public void testInjectIntoMetacard() {
final String title = "title";
final Date created = new Date();
final MetacardImpl basicMetacard = new MetacardImpl();
basicMetacard.setTitle(title);
basicMetacard.setCreatedDate(created);
final MetacardType expectedBasicMetacardType = new MetacardTypeImpl(BASIC_METACARD.getName(), BASIC_METACARD, Sets.newHashSet(globalAttribute, basicAttribute, basicAndNitfAttribute));
final Metacard injectedBasicMetacard = attributeInjector.injectAttributes(basicMetacard);
assertThat(injectedBasicMetacard.getMetacardType(), is(expectedBasicMetacardType));
assertThat(injectedBasicMetacard.getTitle(), is(title));
assertThat(injectedBasicMetacard.getCreatedDate(), is(created));
final MetacardImpl nitfMetacard = new MetacardImpl(NITF_TYPE);
nitfMetacard.setTitle(title);
nitfMetacard.setCreatedDate(created);
final MetacardType expectedNitfMetacardType = new MetacardTypeImpl(NITF, NITF_TYPE, Sets.newHashSet(globalAttribute, basicAndNitfAttribute));
final Metacard injectedNitfMetacard = attributeInjector.injectAttributes(nitfMetacard);
assertThat(injectedNitfMetacard.getMetacardType(), is(expectedNitfMetacardType));
assertThat(injectedNitfMetacard.getTitle(), is(title));
assertThat(injectedNitfMetacard.getCreatedDate(), is(created));
}
use of ddf.catalog.data.MetacardType in project ddf by codice.
the class AttributeInjectorImplTest method testInjectNothingIntoMetacardType.
@Test
public void testInjectNothingIntoMetacardType() {
attributeInjector.setInjectableAttributes(Lists.newArrayList(basicInjection));
final MetacardType injectedMetacardType = attributeInjector.injectAttributes(NITF_TYPE);
assertThat(injectedMetacardType, is(sameInstance(NITF_TYPE)));
}
Aggregations