use of org.apache.rya.indexing.geotemporal.storage.EventStorage.EventAlreadyExistsException in project incubator-rya by apache.
the class MongoEventStorageIT method can_not_create_with_same_subject.
@Test
public void can_not_create_with_same_subject() throws Exception {
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();
// Create it.
final EventStorage storage = new MongoEventStorage(super.getMongoClient(), RYA_INSTANCE_NAME);
storage.create(event);
// Try to create it again. This will fail.
boolean failed = false;
try {
storage.create(event);
} catch (final EventAlreadyExistsException e) {
failed = true;
}
assertTrue(failed);
}
Aggregations