Search in sources :

Example 26 with MetacardImpl

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

the class TestPubSubOgcFilter method testMetacardFeatureEvaluate.

public void testMetacardFeatureEvaluate() {
    MetacardImpl metacard = new MetacardImpl();
    metacard.setCreatedDate(new Date());
    metacard.setEffectiveDate(new Date(1323655067L));
    metacard.setExpirationDate(new Date(32533495067L));
    metacard.setLocation("POINT(-112 25)");
    metacard.setSourceId("mts_site_1");
    metacard.setTitle("Metacard Title");
    metacard.setModifiedDate(new Date(1319075867L));
    metacard.setId("ABC123");
    metacard.setContentTypeName("MetacardType");
    Feature feature = convertMetacardToFeature(metacard);
    // TODO: test this feature metacard against an OGC Filter
    assertTrue(true);
}
Also used : SimpleFeature(org.opengis.feature.simple.SimpleFeature) Feature(org.opengis.feature.Feature) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Date(java.util.Date)

Example 27 with MetacardImpl

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

the class AttributeInjectorImpl method changeMetacardType.

private Metacard changeMetacardType(Metacard original, MetacardType newMetacardType) {
    MetacardImpl newMetacard = new MetacardImpl(original);
    newMetacard.setType(newMetacardType);
    newMetacard.setSourceId(original.getSourceId());
    return newMetacard;
}
Also used : MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Example 28 with MetacardImpl

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

the class TestMetacardResourceSizePlugin method testWhenNoCachedResourceFound.

@Test
public void testWhenNoCachedResourceFound() throws Exception {
    ResourceCacheInterface cache = mock(ResourceCacheInterface.class);
    when(cache.getValid(anyString(), (Metacard) anyObject())).thenReturn(null);
    MetacardImpl metacard = new MetacardImpl();
    metacard.setId("abc123");
    metacard.setSourceId("ddf-1");
    metacard.setResourceSize("N/A");
    Result result = new ResultImpl(metacard);
    List<Result> results = new ArrayList<Result>();
    results.add(result);
    QueryResponse input = mock(QueryResponse.class);
    when(input.getResults()).thenReturn(results);
    MetacardResourceSizePlugin plugin = new MetacardResourceSizePlugin(cache);
    QueryResponse queryResponse = plugin.process(input);
    assertThat(queryResponse.getResults().size(), is(1));
    Metacard resultMetacard = queryResponse.getResults().get(0).getMetacard();
    assertThat(metacard, is(notNullValue()));
    // Since using Metacard vs. MetacardImpl have to get resource-size as an
    // Attribute vs. Long
    Attribute resourceSizeAttr = resultMetacard.getAttribute(Metacard.RESOURCE_SIZE);
    assertThat((String) resourceSizeAttr.getValue(), equalTo("N/A"));
}
Also used : Metacard(ddf.catalog.data.Metacard) Attribute(ddf.catalog.data.Attribute) QueryResponse(ddf.catalog.operation.QueryResponse) ArrayList(java.util.ArrayList) ResultImpl(ddf.catalog.data.impl.ResultImpl) ResourceCacheInterface(ddf.catalog.cache.ResourceCacheInterface) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Result(ddf.catalog.data.Result) Test(org.junit.Test)

Example 29 with MetacardImpl

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

the class MetacardResourceStatusTest method getBasicMetacard.

private MetacardImpl getBasicMetacard(String sourceId, String resourceUri) throws URISyntaxException {
    MetacardImpl metacard = new MetacardImpl();
    metacard.setId(METACARD_ID);
    if (sourceId != null) {
        metacard.setSourceId(sourceId);
    }
    metacard.setResourceSize(RESOURCE_SIZE);
    if (resourceUri != null) {
        metacard.setResourceURI(new URI(resourceUri));
    }
    return metacard;
}
Also used : URI(java.net.URI) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Example 30 with MetacardImpl

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

the class TestMetacardGroomerPlugin method copy.

private Metacard copy(Metacard inputMetacard) {
    MetacardImpl newMetacard = new MetacardImpl(getHybridMetacardType());
    newMetacard.setSourceId(inputMetacard.getSourceId());
    newMetacard.setType(inputMetacard.getMetacardType());
    for (AttributeDescriptor ad : inputMetacard.getMetacardType().getAttributeDescriptors()) {
        newMetacard.setAttribute(inputMetacard.getAttribute(ad.getName()));
    }
    return newMetacard;
}
Also used : AttributeDescriptor(ddf.catalog.data.AttributeDescriptor) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Aggregations

MetacardImpl (ddf.catalog.data.impl.MetacardImpl)384 Test (org.junit.Test)247 Metacard (ddf.catalog.data.Metacard)144 ArrayList (java.util.ArrayList)102 Result (ddf.catalog.data.Result)62 HashMap (java.util.HashMap)59 Date (java.util.Date)52 ResultImpl (ddf.catalog.data.impl.ResultImpl)51 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)49 URI (java.net.URI)38 Matchers.anyString (org.mockito.Matchers.anyString)38 QueryRequest (ddf.catalog.operation.QueryRequest)36 QueryResponse (ddf.catalog.operation.QueryResponse)35 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)35 Serializable (java.io.Serializable)33 HashSet (java.util.HashSet)31 QueryImpl (ddf.catalog.operation.impl.QueryImpl)29 MetacardTypeImpl (ddf.catalog.data.impl.MetacardTypeImpl)28 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)27 List (java.util.List)27