@Produces
public CassandraOperations createCassandraOperations() throws Exception {
String keySpace = AbstractEmbeddedCassandraIntegrationTest.randomKeyspaceName();
MappingCassandraConverter cassandraConverter = new MappingCassandraConverter();
CassandraAdminTemplate cassandraTemplate = new CassandraAdminTemplate(AbstractEmbeddedCassandraIntegrationTest
.cluster().connect(), cassandraConverter);
CreateKeyspaceSpecification createKeyspaceSpecification = new CreateKeyspaceSpecification(keySpace).ifNotExists();
cassandraTemplate.execute(createKeyspaceSpecification);
cassandraTemplate.execute("USE " + keySpace);
cassandraTemplate.createTable(true, CqlIdentifier.cqlId("users"), User.class, new HashMap<String, Object>());
for (CassandraPersistentEntity<?> entity : cassandraTemplate.getConverter().getMappingContext()
.getPersistentEntities()) {
cassandraTemplate.truncate(entity.getTableName());
}
return cassandraTemplate;
}