use of org.apache.rya.indexing.geotemporal.mongo.EventDocumentConverter in project incubator-rya by apache.
the class EventDocumentConverterTest method to_and_from_document.
@Test
public void to_and_from_document() throws DocumentConverterException {
final Geometry geo = GF.createPoint(new Coordinate(10, 10));
final TemporalInstant instant = new TemporalInstantRfc3339(DateTime.now());
// An Event that will be stored.
final Event event = Event.builder().setSubject(new RyaURI("urn:event/001")).setGeometry(geo).setTemporalInstant(instant).build();
final Document document = new EventDocumentConverter().toDocument(event);
// Convert the Document back into an Event.
final Event converted = new EventDocumentConverter().fromDocument(document);
// Ensure the original matches the round trip converted Event.
assertEquals(event, converted);
}
Aggregations