Query execution via sync and async can timeout. Formatting.

This commit is contained in:
Greg Burd 2017-10-16 13:40:44 -04:00
parent 3ef4ddd5a0
commit 0dba5d6c53
35 changed files with 169 additions and 76 deletions

View file

@ -11,7 +11,11 @@ public class CreateMaterializedView extends Create {
private String clustering;
public CreateMaterializedView(
String keyspaceName, String viewName, Select.Where selection, String primaryKey, String clustering) {
String keyspaceName,
String viewName,
Select.Where selection,
String primaryKey,
String clustering) {
super(keyspaceName, viewName);
this.viewName = viewName;
this.selection = selection;
@ -40,7 +44,7 @@ public class CreateMaterializedView extends Create {
createStatement.append(" ");
createStatement.append(primaryKey);
if (clustering != null) {
createStatement.append(" ").append(clustering);
createStatement.append(" ").append(clustering);
}
createStatement.append(";");

View file

@ -1,6 +1,5 @@
package net.helenus.core;
@FunctionalInterface
public interface CommitThunk {
void apply();

View file

@ -32,7 +32,6 @@ import net.helenus.mapping.type.OptionalColumnMetadata;
import net.helenus.support.CqlUtil;
import net.helenus.support.HelenusMappingException;
public final class SchemaUtil {
private SchemaUtil() {}
@ -191,7 +190,8 @@ public final class SchemaUtil {
c.add(columnName);
where = where.and(new IsNotNullClause(columnName));
ClusteringColumn clusteringColumn = prop.getProperty().getGetterMethod().getAnnotation(ClusteringColumn.class);
ClusteringColumn clusteringColumn =
prop.getProperty().getGetterMethod().getAnnotation(ClusteringColumn.class);
if (clusteringColumn != null && clusteringColumn.ordering() != null) {
o.add(columnName + " " + clusteringColumn.ordering().cql());
}
@ -211,10 +211,10 @@ public final class SchemaUtil {
String clustering = "";
if (o.size() > 0) {
clustering = "WITH CLUSTERING ORDER BY (" + String.join(", ", o) + ")";
clustering = "WITH CLUSTERING ORDER BY (" + String.join(", ", o) + ")";
}
return new CreateMaterializedView(keyspace, viewName, where, primaryKey, clustering)
.ifNotExists();
.ifNotExists();
}
public static SchemaStatement dropMaterializedView(

View file

@ -15,7 +15,6 @@
*/
package net.helenus.core;
import java.util.Map;
import java.util.Set;

View file

@ -17,7 +17,13 @@ package net.helenus.core.operation;
import com.codahale.metrics.Timer;
import com.datastax.driver.core.ResultSet;
import java.sql.Time;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeoutException;
import com.diffplug.common.base.Errors;
import net.helenus.core.AbstractSessionOperations;
import net.helenus.core.UnitOfWork;
@ -38,22 +44,22 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>>
return new PreparedOperation<E>(prepareStatement(), this);
}
public E sync() {
public E sync() throws TimeoutException {
final Timer.Context context = requestLatency.time();
try {
ResultSet resultSet = this.execute(sessionOps, null, traceContext, showValues, false);
ResultSet resultSet = this.execute(sessionOps, null, traceContext, queryExecutionTimeout, queryTimeoutUnits, showValues, false);
return transform(resultSet);
} finally {
context.stop();
}
}
public E sync(UnitOfWork uow) {
public E sync(UnitOfWork uow) throws TimeoutException {
if (uow == null) return sync();
final Timer.Context context = requestLatency.time();
try {
ResultSet resultSet = execute(sessionOps, uow, traceContext, showValues, true);
ResultSet resultSet = execute(sessionOps, uow, traceContext, queryExecutionTimeout, queryTimeoutUnits, showValues, true);
E result = transform(resultSet);
return result;
} finally {
@ -62,11 +68,19 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>>
}
public CompletableFuture<E> async() {
return CompletableFuture.<E>supplyAsync(() -> sync());
return CompletableFuture.<E>supplyAsync(() -> {
try {
return sync();
} catch (TimeoutException ex) { throw new CompletionException(ex); }
});
}
public CompletableFuture<E> async(UnitOfWork uow) {
if (uow == null) return async();
return CompletableFuture.<E>supplyAsync(() -> sync(uow));
return CompletableFuture.<E>supplyAsync(() -> {
try {
return sync();
} catch (TimeoutException ex) { throw new CompletionException(ex); }
});
}
}

View file

@ -25,6 +25,9 @@ import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeoutException;
import net.helenus.core.AbstractSessionOperations;
import net.helenus.core.UnitOfWork;
@ -53,17 +56,17 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
});
}
public Optional<E> sync() {
public Optional<E> sync() throws TimeoutException {
final Timer.Context context = requestLatency.time();
try {
ResultSet resultSet = this.execute(sessionOps, null, traceContext, showValues, false);
ResultSet resultSet = this.execute(sessionOps, null, traceContext, queryExecutionTimeout, queryTimeoutUnits, showValues, false);
return transform(resultSet);
} finally {
context.stop();
}
}
public Optional<E> sync(UnitOfWork uow) {
public Optional<E> sync(UnitOfWork uow) throws TimeoutException {
if (uow == null) return sync();
final Timer.Context context = requestLatency.time();
@ -84,7 +87,7 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
}
if (result == null) {
ResultSet resultSet = execute(sessionOps, uow, traceContext, showValues, true);
ResultSet resultSet = execute(sessionOps, uow, traceContext, queryExecutionTimeout, queryTimeoutUnits, showValues, true);
result = transform(resultSet);
if (key != null) {
@ -105,11 +108,19 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
}
public CompletableFuture<Optional<E>> async() {
return CompletableFuture.<Optional<E>>supplyAsync(() -> sync());
return CompletableFuture.<Optional<E>>supplyAsync(() -> {
try {
return sync();
} catch (TimeoutException ex) { throw new CompletionException(ex); }
});
}
public CompletableFuture<Optional<E>> async(UnitOfWork uow) {
if (uow == null) return async();
return CompletableFuture.<Optional<E>>supplyAsync(() -> sync(uow));
return CompletableFuture.<Optional<E>>supplyAsync(() -> {
try {
return sync();
} catch (TimeoutException ex) { throw new CompletionException(ex); }
});
}
}

View file

@ -32,6 +32,8 @@ import net.helenus.support.HelenusException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
public abstract class AbstractStatementOperation<E, O extends AbstractStatementOperation<E, O>>
extends Operation<E> {
@ -49,6 +51,8 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
private boolean enableTracing = false;
private long[] defaultTimestamp = null;
private int[] fetchSize = null;
long queryExecutionTimeout = 10;
TimeUnit queryTimeoutUnits = TimeUnit.SECONDS;
public AbstractStatementOperation(AbstractSessionOperations sessionOperations) {
super(sessionOperations);
@ -203,6 +207,18 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
return (O) this;
}
public O queryTimeoutMs(long ms) {
this.queryExecutionTimeout = ms;
this.queryTimeoutUnits = TimeUnit.MILLISECONDS;
return (O) this;
}
public O queryTimeout(long timeout, TimeUnit units) {
this.queryExecutionTimeout = timeout;
this.queryTimeoutUnits = units;
return (O) this;
}
public Statement options(Statement statement) {
if (defaultTimestamp != null) {

View file

@ -23,6 +23,8 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeoutException;
import java.util.stream.Stream;
import net.helenus.core.AbstractSessionOperations;
import net.helenus.core.UnitOfWork;
@ -52,17 +54,17 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
});
}
public Stream<E> sync() {
public Stream<E> sync() throws TimeoutException {
final Timer.Context context = requestLatency.time();
try {
ResultSet resultSet = this.execute(sessionOps, null, traceContext, showValues, false);
ResultSet resultSet = this.execute(sessionOps, null, traceContext, queryExecutionTimeout, queryTimeoutUnits, showValues, false);
return transform(resultSet);
} finally {
context.stop();
}
}
public Stream<E> sync(UnitOfWork uow) {
public Stream<E> sync(UnitOfWork uow) throws TimeoutException {
if (uow == null) return sync();
final Timer.Context context = requestLatency.time();
@ -82,7 +84,7 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
}
if (result == null) {
ResultSet resultSet = execute(sessionOps, uow, traceContext, showValues, true);
ResultSet resultSet = execute(sessionOps, uow, traceContext, queryExecutionTimeout, queryTimeoutUnits, showValues, true);
result = transform(resultSet);
if (key != null) {
@ -97,11 +99,19 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
}
public CompletableFuture<Stream<E>> async() {
return CompletableFuture.<Stream<E>>supplyAsync(() -> sync());
return CompletableFuture.<Stream<E>>supplyAsync(() -> {
try {
return sync();
} catch (TimeoutException ex) { throw new CompletionException(ex); }
});
}
public CompletableFuture<Stream<E>> async(UnitOfWork uow) {
if (uow == null) return async();
return CompletableFuture.<Stream<E>>supplyAsync(() -> sync(uow));
return CompletableFuture.<Stream<E>>supplyAsync(() -> {
try {
return sync();
} catch (TimeoutException ex) { throw new CompletionException(ex); }
});
}
}

View file

@ -21,6 +21,7 @@ import com.datastax.driver.core.querybuilder.Insert;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.google.common.base.Joiner;
import java.util.*;
import java.util.concurrent.TimeoutException;
import java.util.function.Function;
import net.helenus.core.AbstractSessionOperations;
import net.helenus.core.Getter;
@ -257,7 +258,7 @@ public final class InsertOperation<T> extends AbstractOperation<T, InsertOperati
}
@Override
public T sync(UnitOfWork uow) {
public T sync(UnitOfWork uow) throws TimeoutException {
if (uow == null) {
return sync();
}

View file

@ -10,8 +10,12 @@ import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.ResultSetFuture;
import com.datastax.driver.core.Statement;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import net.helenus.core.AbstractSessionOperations;
import net.helenus.core.UnitOfWork;
import net.helenus.support.HelenusException;
public abstract class Operation<E> {
@ -32,8 +36,10 @@ public abstract class Operation<E> {
AbstractSessionOperations session,
UnitOfWork uow,
TraceContext traceContext,
long timeout,
TimeUnit units,
boolean showValues,
boolean cached) {
boolean cached) throws TimeoutException {
// Start recording in a Zipkin sub-span our execution time to perform this operation.
Tracer tracer = session.getZipkinTracer();
@ -44,19 +50,14 @@ public abstract class Operation<E> {
try {
if (span != null) {
span.name("cassandra");
span.start();
}
Statement statement = options(buildStatement(cached));
ResultSetFuture futureResultSet = session.executeAsync(statement, showValues);
return futureResultSet.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
if (span != null) {
span.name("cassandra");
span.start();
}
Statement statement = options(buildStatement(cached));
ResultSetFuture futureResultSet = session.executeAsync(statement, showValues);
return futureResultSet.getUninterruptibly(timeout, units);
} finally {
if (span != null) {

View file

@ -24,7 +24,6 @@ import com.datastax.driver.core.querybuilder.Select;
import com.datastax.driver.core.querybuilder.Select.Selection;
import com.datastax.driver.core.querybuilder.Select.Where;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Stream;

View file

@ -21,6 +21,7 @@ import com.datastax.driver.core.querybuilder.BuiltStatement;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Update;
import java.util.*;
import java.util.concurrent.TimeoutException;
import java.util.function.Function;
import net.helenus.core.*;
import net.helenus.core.reflect.HelenusPropertyNode;
@ -578,7 +579,7 @@ public final class UpdateOperation<E> extends AbstractFilterOperation<E, UpdateO
}
@Override
public E sync(UnitOfWork uow) {
public E sync(UnitOfWork uow) throws TimeoutException {
if (uow == null) {
return sync();
}

View file

@ -1,6 +1,5 @@
package net.helenus.core.reflect;
import java.util.Set;
public interface Drafted<T> extends MapExportable {

View file

@ -26,6 +26,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Helenus;
import net.helenus.core.HelenusSession;
import net.helenus.test.integration.build.AbstractEmbeddedCassandraTest;
@ -51,7 +53,7 @@ public class CollectionTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testSetCRUID() {
public void testSetCRUID() throws TimeoutException {
UUID id = UUID.randomUUID();
@ -148,7 +150,7 @@ public class CollectionTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testListCRUID() {
public void testListCRUID() throws TimeoutException {
UUID id = UUID.randomUUID();
@ -278,7 +280,7 @@ public class CollectionTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testMapCRUID() {
public void testMapCRUID() throws TimeoutException {
UUID id = UUID.randomUUID();

View file

@ -24,6 +24,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.concurrent.TimeoutException;
public class CounterTest extends AbstractEmbeddedCassandraTest {
static Page page;
@ -42,7 +44,7 @@ public class CounterTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testCounter() {
public void testCounter() throws TimeoutException {
boolean exists =
session.select(page::hits).where(page::alias, eq("index")).sync().findFirst().isPresent();

View file

@ -4,6 +4,8 @@ import static net.helenus.core.Query.eq;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Helenus;
import net.helenus.core.HelenusSession;
import net.helenus.test.integration.build.AbstractEmbeddedCassandraTest;
@ -35,7 +37,7 @@ public class HierarchyTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testCounter() {
public void testCounter() throws TimeoutException {
session
.insert()
@ -58,7 +60,7 @@ public class HierarchyTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testDefaultMethod() {
public void testDefaultMethod() throws TimeoutException {
session
.insert()
.value(cat::id, rnd.nextInt())

View file

@ -23,6 +23,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.TimeoutException;
public class SecondaryIndexTest extends AbstractEmbeddedCassandraTest {
Book book;
@ -36,7 +38,7 @@ public class SecondaryIndexTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void test() throws Exception {
public void test() throws TimeoutException {
session
.insert()

View file

@ -19,6 +19,8 @@ import static net.helenus.core.Query.eq;
import com.datastax.driver.core.ResultSet;
import java.util.*;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Helenus;
import net.helenus.core.HelenusSession;
import net.helenus.core.Operator;
@ -234,7 +236,7 @@ public class SimpleUserTest extends AbstractEmbeddedCassandraTest {
Assert.assertEquals(0L, cnt);
}
public void testZipkin() throws Exception {
public void testZipkin() throws TimeoutException {
session
.update()
.set(user::name, null)

View file

@ -17,6 +17,7 @@ package net.helenus.test.integration.core.simple;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import net.helenus.core.Helenus;
import net.helenus.core.HelenusSession;
@ -82,7 +83,7 @@ public class StaticColumnTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testCRUID() {
public void testCRUID() throws TimeoutException {
MessageImpl msg = new MessageImpl();
msg.id = 123;

View file

@ -23,6 +23,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.concurrent.TimeoutException;
public class InnerTupleTest extends AbstractEmbeddedCassandraTest {
static PhotoAlbum photoAlbum;
@ -41,7 +43,7 @@ public class InnerTupleTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testCruid() {
public void testCruid() throws TimeoutException {
Photo photo =
new Photo() {

View file

@ -27,6 +27,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.concurrent.TimeoutException;
public class TupleTest extends AbstractEmbeddedCassandraTest {
static Album album;
@ -46,7 +48,7 @@ public class TupleTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testCruid() {
public void testCruid() throws TimeoutException {
AlbumInformation info =
new AlbumInformation() {
@ -119,7 +121,7 @@ public class TupleTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testNoMapping() {
public void testNoMapping() throws TimeoutException {
TupleType tupleType = session.getMetadata().newTupleType(DataType.text(), DataType.text());
TupleValue info = tupleType.newValue();

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.tuplecollection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class TupleKeyMapTest extends TupleCollectionTest {
@Test
public void testKeyMapCRUID() {
public void testKeyMapCRUID() throws TimeoutException {
int id = 888;

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.tuplecollection;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class TupleListTest extends TupleCollectionTest {
@Test
public void testListCRUID() {
public void testListCRUID() throws TimeoutException {
int id = 777;

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.tuplecollection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class TupleMapTest extends TupleCollectionTest {
@Test
public void testMapCRUID() {
public void testMapCRUID() throws TimeoutException {
int id = 333;

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.tuplecollection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class TupleSetTest extends TupleCollectionTest {
@Test
public void testSetCRUID() {
public void testSetCRUID() throws TimeoutException {
int id = 555;

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.tuplecollection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class TupleValueMapTest extends TupleCollectionTest {
@Test
public void testValueMapCRUID() {
public void testValueMapCRUID() throws TimeoutException {
int id = 999;

View file

@ -20,13 +20,15 @@ import static net.helenus.core.Query.get;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import org.junit.Assert;
import org.junit.Test;
public class UDTKeyMapTest extends UDTCollectionTest {
@Test
public void testKeyMapCRUID() {
public void testKeyMapCRUID() throws TimeoutException {
int id = 888;

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.udtcollection;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class UDTListTest extends UDTCollectionTest {
@Test
public void testListCRUID() {
public void testListCRUID() throws TimeoutException {
int id = 777;

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.udtcollection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class UDTMapTest extends UDTCollectionTest {
@Test
public void testMapCRUID() {
public void testMapCRUID() throws TimeoutException {
int id = 333;

View file

@ -17,6 +17,8 @@ package net.helenus.test.integration.core.udtcollection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Query;
import org.junit.Assert;
import org.junit.Test;
@ -24,7 +26,7 @@ import org.junit.Test;
public class UDTSetTest extends UDTCollectionTest {
@Test
public void testSetCRUID() {
public void testSetCRUID() throws TimeoutException {
int id = 555;

View file

@ -20,13 +20,15 @@ import static net.helenus.core.Query.get;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;
import org.junit.Assert;
import org.junit.Test;
public class UDTValueMapTest extends UDTCollectionTest {
@Test
public void testValueMapCRUID() {
public void testValueMapCRUID() throws TimeoutException {
int id = 999;

View file

@ -18,6 +18,8 @@ package net.helenus.test.integration.core.usertype;
import com.google.common.collect.Sets;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Helenus;
import net.helenus.core.HelenusSession;
import net.helenus.core.Query;
@ -56,7 +58,7 @@ public class InnerUserDefinedTypeTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testCrud() {
public void testCrud() throws TimeoutException {
UUID id = UUID.randomUUID();

View file

@ -18,6 +18,8 @@ package net.helenus.test.integration.core.usertype;
import com.datastax.driver.core.UDTValue;
import com.datastax.driver.core.UserType;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Helenus;
import net.helenus.core.HelenusSession;
import net.helenus.core.Query;
@ -103,7 +105,7 @@ public class UserDefinedTypeTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testMappingCRUID() {
public void testMappingCRUID() throws TimeoutException {
AddressImpl addr = new AddressImpl();
addr.street = "1 st";
@ -174,7 +176,7 @@ public class UserDefinedTypeTest extends AbstractEmbeddedCassandraTest {
}
@Test
public void testNoMapping() {
public void testNoMapping() throws TimeoutException {
String ks = getSession().getLoggedKeyspace();
UserType addressType =

View file

@ -2,7 +2,6 @@ package net.helenus.test.integration.core.views;
import java.util.Date;
import java.util.UUID;
import net.helenus.mapping.OrderingDirection;
import net.helenus.mapping.annotation.*;

View file

@ -20,6 +20,8 @@ import static net.helenus.core.Query.eq;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeoutException;
import net.helenus.core.Helenus;
import net.helenus.core.HelenusSession;
import net.helenus.test.integration.build.AbstractEmbeddedCassandraTest;
@ -56,7 +58,8 @@ public class MaterializedViewTest extends AbstractEmbeddedCassandraTest {
.get();
cyclist = session.dsl(Cyclist.class);
session
try {
session
.insert(cyclist)
.value(cyclist::cid, UUID.randomUUID())
.value(cyclist::age, 18)
@ -64,14 +67,12 @@ public class MaterializedViewTest extends AbstractEmbeddedCassandraTest {
.value(cyclist::country, "Netherlands")
.value(cyclist::name, "Pascal EENKHOORN")
.sync();
}
catch (TimeoutException e) {}
}
@Test
public void testMv() throws Exception {
session
.select(Cyclist.class)
.from(CyclistsByAge.class)
.where(cyclist::age, eq(18))
.sync();
public void testMv() throws TimeoutException {
session.select(Cyclist.class).from(CyclistsByAge.class).where(cyclist::age, eq(18)).sync();
}
}