@After public void teardown() { eventStore.stop(); for (String fileName : configurer.getFiles()) { delete(fileName); } }
@Test public void canReadEventFromDifferentSerializableVersions() throws Exception { NonSerializableEvent.SerializableEventV1 e1 = new NonSerializableEvent.SerializableEventV1( new NonSerializableEvent(Name.valueOf("1"), new Date(2L))); NonSerializableEvent.SerializableEventV2 e2 = new NonSerializableEvent.SerializableEventV2( new NonSerializableEvent(Name.valueOf("2"), new Date(2L))); eventStore.write(e1); eventStore.write(new EmptyEvent()); eventStore.write(e2); eventStore.stop(); eventStore = configurer.configure(); Iterator<Object> events = eventStore.readEvents(EventQuery.select(NonSerializableEvent.class)).iterator(); NonSerializableEvent nse1 = (NonSerializableEvent) events.next(); NonSerializableEvent nse2 = (NonSerializableEvent) events.next(); assertFalse(events.hasNext()); assertEquals("1", nse1.getName().toString()); assertEquals(0, nse1.getDate().getTime()); assertEquals("2", nse2.getName().toString()); assertEquals(2, nse2.getDate().getTime()); assertEquals( 3, size( eventStore .readEvents(EventQuery.select(NonSerializableEvent.class).and(EmptyEvent.class)) .iterator())); }
@Override public void stop() throws Exception { LOG.info("Shutting down actor system for the event store"); eventStore.tell(new Shutdown(), null); }