Search in sources :

Example 1 with ContentTypeImpl

use of ddf.catalog.data.impl.ContentTypeImpl in project ddf by codice.

the class SolrProviderTest method testGetContentTypesOne.

@Test
public void testGetContentTypesOne() throws Exception {
    deleteAllIn(provider);
    MockMetacard metacard1 = new MockMetacard(Library.getFlagstaffRecord());
    metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_1);
    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, MockMetacard.DEFAULT_VERSION)));
}
Also used : ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) Metacard(ddf.catalog.data.Metacard) ContentType(ddf.catalog.data.ContentType) Test(org.junit.Test)

Example 2 with ContentTypeImpl

use of ddf.catalog.data.impl.ContentTypeImpl in project ddf by codice.

the class SolrProviderTest method testGetContentTypesVersionsAndNullVersions.

@Test
public void testGetContentTypesVersionsAndNullVersions() throws Exception {
    deleteAllIn(provider);
    MockMetacard metacard1 = new MockMetacard(Library.getFlagstaffRecord());
    MockMetacard metacard2 = new MockMetacard(Library.getShowLowRecord());
    MockMetacard metacard3 = new MockMetacard(Library.getTampaRecord());
    metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_1);
    metacard1.setContentTypeVersion(null);
    metacard2.setContentTypeName(SAMPLE_CONTENT_TYPE_2);
    metacard3.setContentTypeName(SAMPLE_CONTENT_TYPE_2);
    metacard3.setContentTypeVersion(SAMPLE_CONTENT_VERSION_3);
    List<Metacard> list = Arrays.asList((Metacard) metacard1, metacard2, metacard3);
    create(list);
    Set<ContentType> contentTypes = provider.getContentTypes();
    assertEquals(3, contentTypes.size());
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_1, null)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_2, MockMetacard.DEFAULT_VERSION)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_2, SAMPLE_CONTENT_VERSION_3)));
}
Also used : ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) Metacard(ddf.catalog.data.Metacard) ContentType(ddf.catalog.data.ContentType) Test(org.junit.Test)

Example 3 with ContentTypeImpl

use of ddf.catalog.data.impl.ContentTypeImpl in project ddf by codice.

the class SolrProviderTest method testGetContentTypesComplicated.

@Test
public void testGetContentTypesComplicated() throws Exception {
    deleteAllIn(provider);
    List<Metacard> list = new ArrayList<Metacard>();
    // Single content type and version
    MockMetacard metacard1 = new MockMetacard(Library.getFlagstaffRecord());
    metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_1);
    metacard1.setContentTypeVersion(SAMPLE_CONTENT_VERSION_1);
    list.add(metacard1);
    // one content type with multiple versions
    metacard1 = new MockMetacard(Library.getFlagstaffRecord());
    metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_2);
    metacard1.setContentTypeVersion(SAMPLE_CONTENT_VERSION_1);
    list.add(metacard1);
    MockMetacard metacard2 = new MockMetacard(Library.getFlagstaffRecord());
    metacard2.setContentTypeName(SAMPLE_CONTENT_TYPE_2);
    metacard2.setContentTypeVersion(SAMPLE_CONTENT_VERSION_2);
    list.add(metacard2);
    // multiple records with different content type but same version
    metacard1 = new MockMetacard(Library.getFlagstaffRecord());
    metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_3);
    metacard1.setContentTypeVersion(SAMPLE_CONTENT_VERSION_3);
    list.add(metacard1);
    metacard2 = new MockMetacard(Library.getFlagstaffRecord());
    metacard2.setContentTypeName(SAMPLE_CONTENT_TYPE_3);
    metacard2.setContentTypeVersion(SAMPLE_CONTENT_VERSION_4);
    list.add(metacard2);
    // multiple records with different content type and different version
    metacard1 = new MockMetacard(Library.getFlagstaffRecord());
    metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_4);
    metacard1.setContentTypeVersion(SAMPLE_CONTENT_VERSION_1);
    list.add(metacard1);
    metacard2 = new MockMetacard(Library.getFlagstaffRecord());
    metacard2.setContentTypeName(SAMPLE_CONTENT_TYPE_1);
    metacard2.setContentTypeVersion(SAMPLE_CONTENT_VERSION_4);
    list.add(metacard2);
    metacard1 = new MockMetacard(Library.getFlagstaffRecord());
    metacard1.setContentTypeName(SAMPLE_CONTENT_TYPE_4);
    metacard1.setContentTypeVersion(SAMPLE_CONTENT_VERSION_1);
    list.add(metacard1);
    metacard2 = new MockMetacard(Library.getFlagstaffRecord());
    metacard2.setContentTypeName(SAMPLE_CONTENT_TYPE_1);
    metacard2.setContentTypeVersion(SAMPLE_CONTENT_VERSION_4);
    list.add(metacard2);
    create(list);
    Set<ContentType> contentTypes = provider.getContentTypes();
    assertEquals(7, contentTypes.size());
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_1, SAMPLE_CONTENT_VERSION_1)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_2, SAMPLE_CONTENT_VERSION_1)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_2, SAMPLE_CONTENT_VERSION_2)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_3, SAMPLE_CONTENT_VERSION_3)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_3, SAMPLE_CONTENT_VERSION_4)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_4, SAMPLE_CONTENT_VERSION_1)));
    assertThat(contentTypes, hasItem((ContentType) new ContentTypeImpl(SAMPLE_CONTENT_TYPE_1, SAMPLE_CONTENT_VERSION_4)));
}
Also used : ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) Metacard(ddf.catalog.data.Metacard) ContentType(ddf.catalog.data.ContentType) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 4 with ContentTypeImpl

use of ddf.catalog.data.impl.ContentTypeImpl 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 5 with ContentTypeImpl

use of ddf.catalog.data.impl.ContentTypeImpl in project ddf by codice.

the class WfsSource method getContentTypes.

@Override
public Set<ContentType> getContentTypes() {
    Set<QName> typeNames = featureTypeFilters.keySet();
    Set<ContentType> contentTypes = new HashSet<ContentType>();
    for (QName featureName : typeNames) {
        contentTypes.add(new ContentTypeImpl(featureName.getLocalPart(), getVersion()));
    }
    return contentTypes;
}
Also used : ContentTypeImpl(ddf.catalog.data.impl.ContentTypeImpl) ContentType(ddf.catalog.data.ContentType) QName(javax.xml.namespace.QName) HashSet(java.util.HashSet)

Aggregations

ContentTypeImpl (ddf.catalog.data.impl.ContentTypeImpl)19 ContentType (ddf.catalog.data.ContentType)18 Test (org.junit.Test)12 Metacard (ddf.catalog.data.Metacard)11 HashSet (java.util.HashSet)7 SolrProviderTest (ddf.catalog.source.solr.SolrProviderTest)5 ArrayList (java.util.ArrayList)3 CatalogFramework (ddf.catalog.CatalogFramework)2 SourceInfoResponse (ddf.catalog.operation.SourceInfoResponse)2 SourceInfoRequestEnterprise (ddf.catalog.operation.impl.SourceInfoRequestEnterprise)2 SourceInfoResponseImpl (ddf.catalog.operation.impl.SourceInfoResponseImpl)2 SourceDescriptor (ddf.catalog.source.SourceDescriptor)2 SourceDescriptorImpl (ddf.catalog.source.impl.SourceDescriptorImpl)2 QName (javax.xml.namespace.QName)2 JSONArray (net.minidev.json.JSONArray)2 JSONObject (net.minidev.json.JSONObject)2 JSONParser (net.minidev.json.parser.JSONParser)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 BinaryContent (ddf.catalog.data.BinaryContent)1 Result (ddf.catalog.data.Result)1