use of ddf.catalog.data.ContentType in project ddf by codice.
the class SolrProviderTest method testGetContentTypesOneNoVersion.
@Test
public void testGetContentTypesOneNoVersion() throws Exception {
deleteAllIn(provider);
MockMetacard metacard1 = new MockMetacard(Library.getFlagstaffRecord());
metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_1);
metacard1.setContentTypeVersion(null);
List<Metacard> list = Arrays.asList((Metacard) metacard1);
create(list);
Set<ContentType> contentTypes = provider.getContentTypes();
assertEquals(1, contentTypes.size());
assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_1, null)));
}
use of ddf.catalog.data.ContentType in project ddf by codice.
the class CatalogFrameworkImplTest method testNullIdsDelete.
@Test(expected = IngestException.class)
public void testNullIdsDelete() throws IngestException {
MockEventProcessor eventAdmin = new MockEventProcessor();
MockMemoryProvider provider = new MockMemoryProvider("Provider", "Provider", "v1.0", "DDF", new HashSet<ContentType>(), true, new Date());
CatalogFramework framework = this.createDummyCatalogFramework(provider, storageProvider, eventAdmin, true);
// call framework with null request
try {
framework.delete(null);
} catch (SourceUnavailableException e) {
fail();
}
}
use of ddf.catalog.data.ContentType in project ddf by codice.
the class CatalogFrameworkImplTest method testNullEntriesUpdate.
@Test(expected = IngestException.class)
public void testNullEntriesUpdate() throws IngestException {
MockEventProcessor eventAdmin = new MockEventProcessor();
MockMemoryProvider provider = new MockMemoryProvider("Provider", "Provider", "v1.0", "DDF", new HashSet<ContentType>(), true, new Date());
CatalogFramework framework = this.createDummyCatalogFramework(provider, storageProvider, eventAdmin, true);
// call framework with null request
try {
framework.update((UpdateRequest) null);
} catch (SourceUnavailableException e) {
fail();
}
}
use of ddf.catalog.data.ContentType in project ddf by codice.
the class ContentTypeFilterDelegate method propertyIsEqualTo.
// PropertyIsEqualTo
@Override
public List<ContentType> propertyIsEqualTo(String propertyName, String literal, boolean isCaseSensitive) {
List<ContentType> types = null;
verifyInputData(propertyName, literal);
if (propertyName.equalsIgnoreCase(Metacard.CONTENT_TYPE)) {
ContentType type = new ContentTypeImpl(literal, "");
types = new ArrayList<ContentType>();
types.add(type);
} else {
types = Collections.<ContentType>emptyList();
}
return types;
}
use of ddf.catalog.data.ContentType in project ddf by codice.
the class CatalogFrameworkImplTest method testProviderRuntimeExceptionOnDeleteByID.
@Test(expected = IngestException.class)
public void testProviderRuntimeExceptionOnDeleteByID() throws IngestException {
MockEventProcessor eventAdmin = new MockEventProcessor();
// use exception provider instead of memory
MockExceptionProvider provider = new MockExceptionProvider("Provider", "Provider", "v1.0", "DDF", new HashSet<ContentType>(), true, null);
MockMemoryStorageProvider storageProvider = new MockMemoryStorageProvider();
CatalogFramework framework = this.createDummyCatalogFramework(provider, storageProvider, eventAdmin, true);
List<String> ids = new ArrayList<String>();
ids.add("1234");
DeleteRequest request = new DeleteRequestImpl((String[]) ids.toArray(new String[ids.size()]));
// expected to throw exception due to catalog provider
try {
framework.delete(request);
} catch (SourceUnavailableException e) {
fail();
}
}
Aggregations