use of com.datastax.driver.mapping.entity.EntityWithKey in project cassandra-driver-mapping by valchkou.
the class MappingSessionAsyncTest method saveAndGetAndDeleteWithSimpleCompositeKeyTest.
@Test
public void saveAndGetAndDeleteWithSimpleCompositeKeyTest() throws Exception {
SimpleKey key = new SimpleKey();
key.setName("name");
key.setRank(10);
key.setT1(UUIDs.timeBased());
key.setT2(UUIDs.timeBased());
Date created = new Date();
EntityWithKey obj = new EntityWithKey();
obj.setKey(key);
obj.setTimestamp(1000);
obj.setAsof(created);
EntityWithKey loaded = target.get(EntityWithKey.class, key);
assertNull(loaded);
ResultSetFuture f = target.saveAsync(obj);
f.getUninterruptibly();
loaded = target.get(EntityWithKey.class, key);
assertEquals(obj, loaded);
f = target.deleteAsync(loaded);
f.getUninterruptibly();
loaded = target.get(EntityWithKey.class, key);
assertNull(loaded);
}
Aggregations