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);
}
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;
}
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"));
}
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;
}
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;
}
Aggregations