use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.
the class Jpeg2000ThumbnailConverterTest method testEmptyThumbnail.
@Test
public void testEmptyThumbnail() throws Exception {
Metacard metacard = new MetacardImpl();
metacard.setAttribute(new AttributeImpl(Metacard.THUMBNAIL, new byte[0]));
List<Result> resultList = new ArrayList<>();
resultList.add(new ResultImpl(metacard));
QueryResponseImpl queryResponse = new QueryResponseImpl(null, resultList, 1);
jpeg2000ThumbnailConverter.process(queryResponse);
}
use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.
the class TestExpirationDatePlugin method createMockMetacardsWithExpirationDate.
private List<Metacard> createMockMetacardsWithExpirationDate(int number) {
List<Metacard> mockMetacards = new ArrayList(number);
for (int i = 0; i < number; i++) {
Metacard mockMetacard = new MetacardImpl();
Attribute id = new AttributeImpl(Metacard.ID, Integer.toString(i));
mockMetacard.setAttribute(id);
Attribute title = new AttributeImpl(Metacard.TITLE, Integer.toString(i));
mockMetacard.setAttribute(title);
Attribute createdDate = new AttributeImpl(Core.METACARD_CREATED, CREATED_DATE.toDate());
mockMetacard.setAttribute(createdDate);
Attribute expirationDate = new AttributeImpl(Metacard.EXPIRATION, ORIG_EXPIRATION_DATE.toDate());
mockMetacard.setAttribute(expirationDate);
mockMetacards.add(mockMetacard);
}
return mockMetacards;
}
use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.
the class MetacardValidityFilterPluginTest method getErrorsMetacard.
private MetacardImpl getErrorsMetacard() {
MetacardImpl returnMetacard = new MetacardImpl();
returnMetacard.setAttribute(new AttributeImpl(Validation.VALIDATION_ERRORS, Collections.singletonList("sample-validator")));
return returnMetacard;
}
use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.
the class TestKMLTransformerImpl method testPerformDefaultTransformationPolygonLocation.
@Test
public void testPerformDefaultTransformationPolygonLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(POLYGON_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
assertThat(placemark.getId(), is("Placemark-" + ID));
assertThat(placemark.getName(), is(TITLE));
assertThat(placemark.getTimePrimitive(), instanceOf(TimeSpan.class));
TimeSpan timeSpan = (TimeSpan) placemark.getTimePrimitive();
assertThat(timeSpan.getBegin(), is(dateFormat.format(metacard.getEffectiveDate())));
assertThat(placemark.getGeometry(), instanceOf(MultiGeometry.class));
MultiGeometry multiGeo = (MultiGeometry) placemark.getGeometry();
assertThat(multiGeo.getGeometry().size(), is(2));
assertThat(multiGeo.getGeometry().get(0), instanceOf(Point.class));
assertThat(multiGeo.getGeometry().get(1), instanceOf(Polygon.class));
}
use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.
the class TestKMLTransformerImpl method testPerformDefaultTransformationMultiPolygonLocation.
@Test
public void testPerformDefaultTransformationMultiPolygonLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(MULTIPOLYGON_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
assertThat(placemark.getId(), is("Placemark-" + ID));
assertThat(placemark.getName(), is(TITLE));
assertThat(placemark.getTimePrimitive(), instanceOf(TimeSpan.class));
TimeSpan timeSpan = (TimeSpan) placemark.getTimePrimitive();
assertThat(timeSpan.getBegin(), is(dateFormat.format(metacard.getEffectiveDate())));
assertThat(placemark.getGeometry(), instanceOf(MultiGeometry.class));
MultiGeometry multiGeo = (MultiGeometry) placemark.getGeometry();
assertThat(multiGeo.getGeometry().size(), is(2));
assertThat(multiGeo.getGeometry().get(0), instanceOf(Point.class));
assertThat(multiGeo.getGeometry().get(1), instanceOf(MultiGeometry.class));
MultiGeometry multiPolygon = (MultiGeometry) multiGeo.getGeometry().get(1);
assertThat(multiPolygon.getGeometry().size(), is(2));
assertThat(multiPolygon.getGeometry().get(0), instanceOf(Polygon.class));
assertThat(multiPolygon.getGeometry().get(1), instanceOf(Polygon.class));
}
Aggregations