@Test( groups = "unit", expectedExceptions = {IllegalArgumentException.class}) public void batchMixedCounterTest() throws Exception { batch() .add(update("foo").with(incr("a", 1))) .add(update("foo").with(set("b", 2))) .add(update("foo").with(incr("c", 3))) .using(timestamp(42)); }
@Override public BatchBuilder withTtl(int ttl) { batch.using(QueryBuilder.ttl(ttl)); return this; }
batch_query += "INSERT INTO foo.bar (a) VALUES (123);"; batch_query += "APPLY BATCH;"; batch = batch().using(timestamp(42)).add(insertInto("foo", "bar").value("a", 123)); assertEquals(batch.getRoutingKey(protocolVersion, codecRegistry), null); assertEquals(batch.toString(), batch_query);
@Override public BatchBuilder withTimeStamp(long timeStamp) { batch.using(QueryBuilder.timestamp(timeStamp)); return this; }
.add(update("foo").with(incr("b", 2))) .add(update("foo").with(incr("c", 3))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(incr("b"))) .add(update("foo").with(incr("c"))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(decr("b", 2))) .add(update("foo").with(decr("c", 3))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(decr("b"))) .add(update("foo").with(decr("c"))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(incr("b", -2))) .add(update("foo").with(decr("c", 3))) .using(timestamp(42)); assertEquals(batch.toString(), query);
@Override public ReactiveCassandraBatchOperations withTimestamp(long timestamp) { assertNotExecuted(); batch.using(QueryBuilder.timestamp(timestamp)); return this; }
@Override public CassandraBatchOperations withTimestamp(long timestamp) { assertNotExecuted(); batch.using(QueryBuilder.timestamp(timestamp)); return this; }
.from("foo") .where(eq("k", 1))) .using(timestamp(42)); assertEquals(batch.toString(), query);
batch_query += "INSERT INTO foo.bar (a) VALUES (123);"; batch_query += "APPLY BATCH;"; batch = batch().using(timestamp(42)).add(insertInto("foo", "bar").value("a", 123)); assertEquals(batch.getRoutingKey(protocolVersion, codecRegistry), null); assertEquals(batch.toString(), batch_query);
@Test( groups = "unit", expectedExceptions = {IllegalArgumentException.class}) public void batchMixedCounterTest() throws Exception { batch() .add(update("foo").with(incr("a", 1))) .add(update("foo").with(set("b", 2))) .add(update("foo").with(incr("c", 3))) .using(timestamp(42)); }
.from("foo") .where(eq("k", 1))) .using(timestamp(42)); assertEquals(batch.toString(), query); assertThat(batch.getKeyspace())
.add(update("foo").with(incr("b", 2))) .add(update("foo").with(incr("c", 3))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(incr("b"))) .add(update("foo").with(incr("c"))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(decr("b", 2))) .add(update("foo").with(decr("c", 3))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(decr("b"))) .add(update("foo").with(decr("c"))) .using(timestamp(42)); assertEquals(batch.toString(), query); .add(update("foo").with(incr("b", -2))) .add(update("foo").with(decr("c", 3))) .using(timestamp(42)); assertEquals(batch.toString(), query);