Search in sources :

Example 6 with ContentType

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)));
}
Also used : ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) Metacard(ddf.catalog.data.Metacard) ContentType(ddf.catalog.data.ContentType) Test(org.junit.Test)

Example 7 with ContentType

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();
    }
}
Also used : SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) ContentType(ddf.catalog.data.ContentType) CatalogFramework(ddf.catalog.CatalogFramework) Date(java.util.Date) Test(org.junit.Test)

Example 8 with ContentType

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();
    }
}
Also used : SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) ContentType(ddf.catalog.data.ContentType) CatalogFramework(ddf.catalog.CatalogFramework) Date(java.util.Date) Test(org.junit.Test)

Example 9 with ContentType

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;
}
Also used : ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) ContentType(ddf.catalog.data.ContentType)

Example 10 with ContentType

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();
    }
}
Also used : SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) ContentType(ddf.catalog.data.ContentType) MockMemoryStorageProvider(ddf.catalog.content.impl.MockMemoryStorageProvider) DeleteRequestImpl(ddf.catalog.operation.impl.DeleteRequestImpl) CatalogFramework(ddf.catalog.CatalogFramework) ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) DeleteRequest(ddf.catalog.operation.DeleteRequest) Test(org.junit.Test)

Aggregations

ContentType (ddf.catalog.data.ContentType)45 Test (org.junit.Test)34 CatalogFramework (ddf.catalog.CatalogFramework)17 ArrayList (java.util.ArrayList)17 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)14 Metacard (ddf.catalog.data.Metacard)12 ContentTypeImpl (ddf.catalog.data.impl.ContentTypeImpl)12 Source (ddf.catalog.source.Source)10 Date (java.util.Date)10 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)8 HashSet (java.util.HashSet)8 Matchers.anyString (org.mockito.Matchers.anyString)7 IngestException (ddf.catalog.source.IngestException)6 URI (java.net.URI)5 SourceInfoResponse (ddf.catalog.operation.SourceInfoResponse)4 CatalogProvider (ddf.catalog.source.CatalogProvider)4 SourceDescriptor (ddf.catalog.source.SourceDescriptor)4 SourcePoller (ddf.catalog.util.impl.SourcePoller)4 URISyntaxException (java.net.URISyntaxException)4 QName (javax.xml.namespace.QName)4