ObjectStore { public long remove(E e) { OID id = odb.delete(e); odb.commit(); return id.getObjectId(); } ObjectStore(String name, Class<E> objectType); Collection<E> getAll(); E get(String id); long count(); E saveOrUpdate(String id, E e); @SuppressWarnings("unchecked") E insert(E e); E updateProperty(String id, String property, String newValue); int clear(); long remove(E e); boolean close(); abstract List<E> searchByExample(E e);  }
@Test public final void testRemove() { ObjectStore<XdccRequest> store = new ObjectStore<XdccRequest>( "requests.neodatis2", XdccRequest.class) { @Override public List<XdccRequest> searchByExample(XdccRequest e) { return null; } @Override protected Class<XdccRequest> getEntityType() { return XdccRequest.class; } }; try { XdccRequest req = new XdccRequest(); req.setChannel(UUID.randomUUID().toString()); req.setDescription("description"); req.setDestination("./"); req.setHost("127.0.0.1"); req.setPeer("peer"); req.setResource("12"); req.setTtl(324234234); req = XdccRequestCreator.identify(req); Assert.assertNotNull(store.insert(req)); long value = store.count(); Assert.assertTrue("Value is " + value, value == 1); Assert.assertNotNull(store.get(req.getId())); Assert.assertNotNull(store.remove(req)); Assert.assertTrue(store.count() == 0); } finally { store.clear(); Assert.assertTrue(store.close()); } }