Search in sources :

Example 1 with EntityWithIndexes

use of com.datastax.driver.mapping.entity.EntityWithIndexes in project cassandra-driver-mapping by valchkou.

the class MappingSessionAsyncTest method saveAndGetAndDeleteTest.

@Test
public void saveAndGetAndDeleteTest() throws Exception {
    UUID uuid = UUID.randomUUID();
    EntityWithIndexes obj = new EntityWithIndexes();
    obj.setCount(100);
    obj.setEmail("email@at");
    obj.setName("test");
    obj.setTimeStamp(new Date());
    obj.setUuid(uuid);
    EntityWithIndexes loaded = target.get(EntityWithIndexes.class, uuid);
    assertNull(loaded);
    ResultSetFuture f = target.saveAsync(obj);
    f.getUninterruptibly();
    loaded = target.get(EntityWithIndexes.class, uuid);
    assertEquals(obj, loaded);
    f = target.deleteAsync(loaded);
    f.getUninterruptibly();
    loaded = target.get(EntityWithIndexes.class, uuid);
    assertNull(loaded);
}
Also used : ResultSetFuture(com.datastax.driver.core.ResultSetFuture) EntityWithIndexes(com.datastax.driver.mapping.entity.EntityWithIndexes) UUID(java.util.UUID) Date(java.util.Date) Test(org.junit.Test)

Aggregations

ResultSetFuture (com.datastax.driver.core.ResultSetFuture)1 EntityWithIndexes (com.datastax.driver.mapping.entity.EntityWithIndexes)1 Date (java.util.Date)1 UUID (java.util.UUID)1 Test (org.junit.Test)1