diff --git a/.gitignore b/.gitignore
index 04352836..dafefef7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
build/
+out/
.gradle/
.#*
*.iml
diff --git a/README.md b/README.md
index f06e857f..295ee69d 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
[](https://search.maven.org/artifact/com.rethinkdb/rethinkdb-driver)
[](https://bintray.com/rethinkdb/maven/rethinkdb-driver/_latestVersion)
+[](https://github.com/rethinkdb/rethinkdb-java/tree/master/LICENSE)
[](https://travis-ci.org/rethinkdb/rethinkdb-java)
[](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Frethinkdb%2Frethinkdb-java)
@@ -23,14 +24,18 @@ Run `./gradlew assemble` to build the jar or `./gradlew install` to install it i
## Contributing to the driver
+If you want to contribute to the driver, make sure to base your branch off of our **develop** branch (or a feature-branch)
+and create your PR into that **same** branch. **We will be rejecting any PRs between branches or into release branches!**
+It is very possible that your change might already be in development or you missed something.
+
### Installation
Besides JDK 8, to be able to contribute to the driver, you must also install:
* Python **3.6** or **3.7**
* PIP3 libraries:
- * mako
- * rethinkdb
+ * `mako`
+ * `rethinkdb`
### Using Gradle
@@ -105,6 +110,4 @@ These are also checked into git, so you don't need to run the conversion script
This section was moved to separate documentation:
-> [How to deploy this repository to Bintray](DEPLOYING-BINTRAY.md)
-
-> [How to deploy this repository to Maven Central (Sonatype)](DEPLOYING-SONATYPE.md)
\ No newline at end of file
+> [How to deploy this repository to Bintray with integration with Maven Central (Sonatype)](DEPLOYING.md)
diff --git a/build.gradle.kts b/build.gradle.kts
index cc54ac80..c3d2c1b4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,7 +13,7 @@ plugins {
id("com.jfrog.bintray") version "1.8.4"
}
-version = "2.4.1.1"
+version = "2.4.2"
group = "com.rethinkdb"
java.sourceCompatibility = JavaVersion.VERSION_1_8
diff --git a/src/main/java/com/rethinkdb/RethinkDB.java b/src/main/java/com/rethinkdb/RethinkDB.java
index afc16e9e..d6216dbe 100644
--- a/src/main/java/com/rethinkdb/RethinkDB.java
+++ b/src/main/java/com/rethinkdb/RethinkDB.java
@@ -17,47 +17,11 @@ public class RethinkDB extends TopLevel {
* The Singleton to use to begin interacting with RethinkDB Driver
*/
public static final RethinkDB r = new RethinkDB();
-
- /**
- * Jackson's {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
- */
- private static ObjectMapper internalMapper;
/**
* Jackson's {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*/
private static ObjectMapper resultMapper;
- /**
- * Gets (or creates, if null) the {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
- *
- * WARNING:If you're trying to get or configure the {@link com.rethinkdb.net.Result}'s mapper,
- * use {@link RethinkDB#getResultMapper()} instead.
- *
- * @return the internal {@link ObjectMapper}
- */
- public synchronized static @NotNull ObjectMapper getInternalMapper() {
- ObjectMapper mapper = internalMapper;
- if (mapper == null) {
- mapper = new ObjectMapper()
- .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.USE_LONG_FOR_INTS);
- internalMapper = mapper;
- }
- return mapper;
- }
-
- /**
- * Sets the {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
- *
- * WARNING:If you're trying to set the {@link com.rethinkdb.net.Result}'s mapper,
- * use {@link RethinkDB#setResultMapper(ObjectMapper)} instead.
- *
- * @param mapper an {@link ObjectMapper}, or null
- */
- public synchronized static void setInternalMapper(@Nullable ObjectMapper mapper) {
- internalMapper = mapper;
- }
-
/**
* Gets (or creates, if null) the {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*
diff --git a/src/main/java/com/rethinkdb/ast/Query.java b/src/main/java/com/rethinkdb/ast/Query.java
index d3ddb8d7..0056e2cd 100644
--- a/src/main/java/com/rethinkdb/ast/Query.java
+++ b/src/main/java/com/rethinkdb/ast/Query.java
@@ -4,6 +4,7 @@
import com.rethinkdb.gen.exc.ReqlRuntimeError;
import com.rethinkdb.gen.proto.QueryType;
import com.rethinkdb.model.OptArgs;
+import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +50,7 @@ public ByteBuffer serialize() {
if (!globalOptions.isEmpty()) {
list.add(ReqlAst.buildOptarg(globalOptions));
}
- String json = RethinkDB.getInternalMapper().writeValueAsString(list);
+ String json = Internals.getInternalMapper().writeValueAsString(list);
byte[] bytes = json.getBytes(StandardCharsets.UTF_8);
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES + Integer.BYTES + bytes.length)
.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/src/main/java/com/rethinkdb/ast/ReqlAst.java b/src/main/java/com/rethinkdb/ast/ReqlAst.java
index a426a112..dece91ad 100644
--- a/src/main/java/com/rethinkdb/ast/ReqlAst.java
+++ b/src/main/java/com/rethinkdb/ast/ReqlAst.java
@@ -9,8 +9,8 @@
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.net.Connection;
import com.rethinkdb.net.Result;
+import com.rethinkdb.utils.Types;
-import java.lang.reflect.Type;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
@@ -95,7 +95,7 @@ public Result run(Connection conn, Result.FetchMode fetchMode) {
* @return The result of this query
*/
public Result run(Connection conn, Class typeRef) {
- return conn.run(this, new OptArgs(), null, new ClassReference<>(typeRef));
+ return conn.run(this, new OptArgs(), null, Types.of(typeRef));
}
/**
@@ -135,7 +135,7 @@ public Result run(Connection conn, OptArgs runOpts, Result.FetchMode fet
* @return The result of this query
*/
public Result run(Connection conn, OptArgs runOpts, Class typeRef) {
- return conn.run(this, runOpts, null, new ClassReference<>(typeRef));
+ return conn.run(this, runOpts, null, Types.of(typeRef));
}
/**
@@ -163,7 +163,7 @@ public Result run(Connection conn, OptArgs runOpts, TypeReference type
* @return The result of this query
*/
public Result run(Connection conn, Result.FetchMode fetchMode, Class typeRef) {
- return conn.run(this, new OptArgs(), fetchMode, new ClassReference<>(typeRef));
+ return conn.run(this, new OptArgs(), fetchMode, Types.of(typeRef));
}
/**
@@ -192,7 +192,7 @@ public Result run(Connection conn, Result.FetchMode fetchMode, TypeRefere
* @return The result of this query
*/
public Result run(Connection conn, OptArgs runOpts, Result.FetchMode fetchMode, Class typeRef) {
- return conn.run(this, runOpts, fetchMode, new ClassReference<>(typeRef));
+ return conn.run(this, runOpts, fetchMode, Types.of(typeRef));
}
/**
@@ -254,7 +254,7 @@ public CompletableFuture> runAsync(Connection conn, Result.FetchM
* @return The result of this query
*/
public CompletableFuture> runAsync(Connection conn, Class typeRef) {
- return conn.runAsync(this, new OptArgs(), null, new ClassReference<>(typeRef));
+ return conn.runAsync(this, new OptArgs(), null, Types.of(typeRef));
}
/**
@@ -294,7 +294,7 @@ public CompletableFuture> runAsync(Connection conn, OptArgs runOp
* @return The result of this query
*/
public CompletableFuture> runAsync(Connection conn, OptArgs runOpts, Class typeRef) {
- return conn.runAsync(this, runOpts, null, new ClassReference<>(typeRef));
+ return conn.runAsync(this, runOpts, null, Types.of(typeRef));
}
/**
@@ -322,7 +322,7 @@ public CompletableFuture> runAsync(Connection conn, OptArgs runOpt
* @return The result of this query
*/
public CompletableFuture> runAsync(Connection conn, Result.FetchMode fetchMode, Class typeRef) {
- return conn.runAsync(this, new OptArgs(), fetchMode, new ClassReference<>(typeRef));
+ return conn.runAsync(this, new OptArgs(), fetchMode, Types.of(typeRef));
}
/**
@@ -351,7 +351,7 @@ public CompletableFuture> runAsync(Connection conn, Result.FetchMo
* @return The result of this query
*/
public CompletableFuture> runAsync(Connection conn, OptArgs runOpts, Result.FetchMode fetchMode, Class typeRef) {
- return conn.runAsync(this, runOpts, fetchMode, new ClassReference<>(typeRef));
+ return conn.runAsync(this, runOpts, fetchMode, Types.of(typeRef));
}
/**
@@ -438,22 +438,4 @@ private void astToString(StringBuilder builder, String name, String indent, bool
}
}
}
-
- /**
- * A TypeReference that accepts an class instead of compiler type information.
- *
- * @param the type referred to.
- */
- private static class ClassReference extends TypeReference {
- private Class c;
-
- ClassReference(Class c) {
- this.c = c;
- }
-
- @Override
- public Type getType() {
- return c;
- }
- }
}
\ No newline at end of file
diff --git a/src/main/java/com/rethinkdb/ast/Util.java b/src/main/java/com/rethinkdb/ast/Util.java
deleted file mode 100644
index 739ab00d..00000000
--- a/src/main/java/com/rethinkdb/ast/Util.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.rethinkdb.ast;
-
-import com.rethinkdb.RethinkDB;
-import com.rethinkdb.gen.ast.*;
-import com.rethinkdb.gen.exc.ReqlDriverCompileError;
-import com.rethinkdb.gen.exc.ReqlDriverError;
-import com.rethinkdb.model.Arguments;
-import com.rethinkdb.model.MapObject;
-import com.rethinkdb.model.ReqlLambda;
-
-import java.lang.reflect.Array;
-import java.time.LocalDateTime;
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-
-public class Util {
- public static int startingDepth = 100;
-
- private Util() {
- }
-
- /**
- * Convert an object to {@link ReqlAst}
- *
- * @param val the original object.
- * @return ReqlAst
- */
- public static ReqlAst toReqlAst(Object val) {
- return toReqlAst(val, startingDepth);
- }
-
- /**
- * Convert an object to {@link ReqlExpr}
- *
- * @param val the original object.
- * @return ReqlAst
- */
- public static ReqlExpr toReqlExpr(Object val) {
- ReqlAst converted = toReqlAst(val);
- if (converted instanceof ReqlExpr) {
- return (ReqlExpr) converted;
- } else {
- throw new ReqlDriverError("Cannot convert %s to ReqlExpr", val);
- }
- }
-
- private static ReqlAst toReqlAst(Object val, int remainingDepth) {
- if (remainingDepth <= 0) {
- throw new ReqlDriverCompileError("Recursion limit reached converting to ReqlAst");
- }
- if (val instanceof ReqlAst) {
- return (ReqlAst) val;
- }
-
- if (val instanceof Collection) {
- Arguments innerValues = new Arguments();
- for (Object innerValue : (Collection>) val) {
- innerValues.add(toReqlAst(innerValue, remainingDepth - 1));
- }
- return new MakeArray(innerValues, null);
- }
-
- if (val instanceof Map) {
- Map obj = new MapObject<>();
- ((Map, ?>) val).forEach((key, value) -> {
- if (key.getClass().isEnum()) {
- obj.put(((Enum>) key).name(), toReqlAst(value, remainingDepth - 1));
- } else if (key instanceof String) {
- obj.put((String) key, toReqlAst(value, remainingDepth - 1));
- } else {
- throw new ReqlDriverCompileError("Object keys can only be strings");
- }
- });
- return MakeObj.fromMap(obj);
- }
-
- if (val instanceof ReqlLambda) {
- return Func.fromLambda((ReqlLambda) val);
- }
-
- final DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX");
-
- if (val instanceof LocalDateTime) {
- ZoneId zid = ZoneId.systemDefault();
- DateTimeFormatter fmt2 = fmt.withZone(zid);
- return Iso8601.fromString(((LocalDateTime) val).format(fmt2));
- }
- if (val instanceof ZonedDateTime) {
- return Iso8601.fromString(((ZonedDateTime) val).format(fmt));
- }
- if (val instanceof OffsetDateTime) {
- return Iso8601.fromString(((OffsetDateTime) val).format(fmt));
- }
-
- if (val instanceof Integer) {
- return new Datum(val);
- }
-
- if (val instanceof Number) {
- return new Datum(val);
- }
-
- if (val instanceof Boolean) {
- return new Datum(val);
- }
-
- if (val instanceof String) {
- return new Datum(val);
- }
-
- if (val == null) {
- return new Datum(null);
- }
-
- Class> valClass = val.getClass();
- if (valClass.isEnum()) {
- return new Datum(((Enum>) val).name());
- }
-
- if (valClass.isArray()) {
- if (val instanceof byte[]) {
- return new Binary(((byte[]) val));
- }
- Arguments innerValues = new Arguments();
- int length = Array.getLength(val);
- for (int i = 0; i < length; i++) {
- innerValues.add(toReqlAst(Array.get(val, i)));
- }
- return new MakeArray(innerValues, null);
- }
-
- // val is a non-null POJO, let's use jackson
- return toReqlAst(RethinkDB.getResultMapper().convertValue(val, Map.class), remainingDepth - 1);
- }
-}
diff --git a/src/main/java/com/rethinkdb/gen/ast/Add.java b/src/main/java/com/rethinkdb/gen/ast/Add.java
index ce242b88..5e81002d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Add.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Add.java
@@ -16,7 +16,7 @@ public class Add extends ReqlExpr {
public Add(Object arg) {
this(new Arguments(arg), null);
}
- public Add(Arguments args){
+ public Add(Arguments args) {
this(args, null);
}
public Add(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/And.java b/src/main/java/com/rethinkdb/gen/ast/And.java
index a4a1df44..018e7383 100644
--- a/src/main/java/com/rethinkdb/gen/ast/And.java
+++ b/src/main/java/com/rethinkdb/gen/ast/And.java
@@ -16,7 +16,7 @@ public class And extends ReqlExpr {
public And(Object arg) {
this(new Arguments(arg), null);
}
- public And(Arguments args){
+ public And(Arguments args) {
this(args, null);
}
public And(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Append.java b/src/main/java/com/rethinkdb/gen/ast/Append.java
index 9207a3f4..61274f66 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Append.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Append.java
@@ -16,7 +16,7 @@ public class Append extends ReqlExpr {
public Append(Object arg) {
this(new Arguments(arg), null);
}
- public Append(Arguments args){
+ public Append(Arguments args) {
this(args, null);
}
public Append(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/April.java b/src/main/java/com/rethinkdb/gen/ast/April.java
index 97100c9b..2e66375d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/April.java
+++ b/src/main/java/com/rethinkdb/gen/ast/April.java
@@ -16,7 +16,7 @@ public class April extends ReqlExpr {
public April(Object arg) {
this(new Arguments(arg), null);
}
- public April(Arguments args){
+ public April(Arguments args) {
this(args, null);
}
public April(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Args.java b/src/main/java/com/rethinkdb/gen/ast/Args.java
index 197112bc..b17c1214 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Args.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Args.java
@@ -16,7 +16,7 @@ public class Args extends ReqlExpr {
public Args(Object arg) {
this(new Arguments(arg), null);
}
- public Args(Arguments args){
+ public Args(Arguments args) {
this(args, null);
}
public Args(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Asc.java b/src/main/java/com/rethinkdb/gen/ast/Asc.java
index f47b97d8..6e2038a0 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Asc.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Asc.java
@@ -16,7 +16,7 @@ public class Asc extends ReqlExpr {
public Asc(Object arg) {
this(new Arguments(arg), null);
}
- public Asc(Arguments args){
+ public Asc(Arguments args) {
this(args, null);
}
public Asc(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/August.java b/src/main/java/com/rethinkdb/gen/ast/August.java
index cc577030..3262b73f 100644
--- a/src/main/java/com/rethinkdb/gen/ast/August.java
+++ b/src/main/java/com/rethinkdb/gen/ast/August.java
@@ -16,7 +16,7 @@ public class August extends ReqlExpr {
public August(Object arg) {
this(new Arguments(arg), null);
}
- public August(Arguments args){
+ public August(Arguments args) {
this(args, null);
}
public August(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Avg.java b/src/main/java/com/rethinkdb/gen/ast/Avg.java
index 3ebd80f6..786898a3 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Avg.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Avg.java
@@ -16,7 +16,7 @@ public class Avg extends ReqlExpr {
public Avg(Object arg) {
this(new Arguments(arg), null);
}
- public Avg(Arguments args){
+ public Avg(Arguments args) {
this(args, null);
}
public Avg(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Between.java b/src/main/java/com/rethinkdb/gen/ast/Between.java
index 5529844a..681512d9 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Between.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Between.java
@@ -16,7 +16,7 @@ public class Between extends ReqlExpr {
public Between(Object arg) {
this(new Arguments(arg), null);
}
- public Between(Arguments args){
+ public Between(Arguments args) {
this(args, null);
}
public Between(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Binary.java b/src/main/java/com/rethinkdb/gen/ast/Binary.java
index 038764be..885e4005 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Binary.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Binary.java
@@ -11,7 +11,7 @@
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.ast.ReqlAst;
-import com.rethinkdb.net.Converter;
+import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.Nullable;
public class Binary extends ReqlExpr {
@@ -38,8 +38,8 @@ protected Binary(TermType termType, Arguments args, OptArgs optargs) {
@Override
public Object build(){
if (binaryData != null) {
- return Converter.toBinary(binaryData);
- }else{
+ return Internals.asBinaryPseudotype(binaryData);
+ } else {
return super.build();
}
}
diff --git a/src/main/java/com/rethinkdb/gen/ast/BitAnd.java b/src/main/java/com/rethinkdb/gen/ast/BitAnd.java
index e48a6402..66035460 100644
--- a/src/main/java/com/rethinkdb/gen/ast/BitAnd.java
+++ b/src/main/java/com/rethinkdb/gen/ast/BitAnd.java
@@ -16,7 +16,7 @@ public class BitAnd extends ReqlExpr {
public BitAnd(Object arg) {
this(new Arguments(arg), null);
}
- public BitAnd(Arguments args){
+ public BitAnd(Arguments args) {
this(args, null);
}
public BitAnd(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/BitNot.java b/src/main/java/com/rethinkdb/gen/ast/BitNot.java
index 7dd71714..b6f3e47d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/BitNot.java
+++ b/src/main/java/com/rethinkdb/gen/ast/BitNot.java
@@ -16,7 +16,7 @@ public class BitNot extends ReqlExpr {
public BitNot(Object arg) {
this(new Arguments(arg), null);
}
- public BitNot(Arguments args){
+ public BitNot(Arguments args) {
this(args, null);
}
public BitNot(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/BitOr.java b/src/main/java/com/rethinkdb/gen/ast/BitOr.java
index ab524543..0887ed50 100644
--- a/src/main/java/com/rethinkdb/gen/ast/BitOr.java
+++ b/src/main/java/com/rethinkdb/gen/ast/BitOr.java
@@ -16,7 +16,7 @@ public class BitOr extends ReqlExpr {
public BitOr(Object arg) {
this(new Arguments(arg), null);
}
- public BitOr(Arguments args){
+ public BitOr(Arguments args) {
this(args, null);
}
public BitOr(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/BitSal.java b/src/main/java/com/rethinkdb/gen/ast/BitSal.java
index 24eb28b1..accfbaf9 100644
--- a/src/main/java/com/rethinkdb/gen/ast/BitSal.java
+++ b/src/main/java/com/rethinkdb/gen/ast/BitSal.java
@@ -16,7 +16,7 @@ public class BitSal extends ReqlExpr {
public BitSal(Object arg) {
this(new Arguments(arg), null);
}
- public BitSal(Arguments args){
+ public BitSal(Arguments args) {
this(args, null);
}
public BitSal(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/BitSar.java b/src/main/java/com/rethinkdb/gen/ast/BitSar.java
index a39330e2..cc54a170 100644
--- a/src/main/java/com/rethinkdb/gen/ast/BitSar.java
+++ b/src/main/java/com/rethinkdb/gen/ast/BitSar.java
@@ -16,7 +16,7 @@ public class BitSar extends ReqlExpr {
public BitSar(Object arg) {
this(new Arguments(arg), null);
}
- public BitSar(Arguments args){
+ public BitSar(Arguments args) {
this(args, null);
}
public BitSar(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/BitXor.java b/src/main/java/com/rethinkdb/gen/ast/BitXor.java
index 9b8d4dda..c413b2f4 100644
--- a/src/main/java/com/rethinkdb/gen/ast/BitXor.java
+++ b/src/main/java/com/rethinkdb/gen/ast/BitXor.java
@@ -16,7 +16,7 @@ public class BitXor extends ReqlExpr {
public BitXor(Object arg) {
this(new Arguments(arg), null);
}
- public BitXor(Arguments args){
+ public BitXor(Arguments args) {
this(args, null);
}
public BitXor(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Bracket.java b/src/main/java/com/rethinkdb/gen/ast/Bracket.java
index 1588dd60..ffa3d25e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Bracket.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Bracket.java
@@ -16,7 +16,7 @@ public class Bracket extends ReqlExpr {
public Bracket(Object arg) {
this(new Arguments(arg), null);
}
- public Bracket(Arguments args){
+ public Bracket(Arguments args) {
this(args, null);
}
public Bracket(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Branch.java b/src/main/java/com/rethinkdb/gen/ast/Branch.java
index fbc1831a..bbbb48cc 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Branch.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Branch.java
@@ -16,7 +16,7 @@ public class Branch extends ReqlExpr {
public Branch(Object arg) {
this(new Arguments(arg), null);
}
- public Branch(Arguments args){
+ public Branch(Arguments args) {
this(args, null);
}
public Branch(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Ceil.java b/src/main/java/com/rethinkdb/gen/ast/Ceil.java
index c0900b48..847f9f69 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Ceil.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Ceil.java
@@ -16,7 +16,7 @@ public class Ceil extends ReqlExpr {
public Ceil(Object arg) {
this(new Arguments(arg), null);
}
- public Ceil(Arguments args){
+ public Ceil(Arguments args) {
this(args, null);
}
public Ceil(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ChangeAt.java b/src/main/java/com/rethinkdb/gen/ast/ChangeAt.java
index 243c965a..d377ebc9 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ChangeAt.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ChangeAt.java
@@ -16,7 +16,7 @@ public class ChangeAt extends ReqlExpr {
public ChangeAt(Object arg) {
this(new Arguments(arg), null);
}
- public ChangeAt(Arguments args){
+ public ChangeAt(Arguments args) {
this(args, null);
}
public ChangeAt(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Changes.java b/src/main/java/com/rethinkdb/gen/ast/Changes.java
index 3a1f8983..3b103bec 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Changes.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Changes.java
@@ -16,7 +16,7 @@ public class Changes extends ReqlExpr {
public Changes(Object arg) {
this(new Arguments(arg), null);
}
- public Changes(Arguments args){
+ public Changes(Arguments args) {
this(args, null);
}
public Changes(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Circle.java b/src/main/java/com/rethinkdb/gen/ast/Circle.java
index 5ef85a24..017a47d2 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Circle.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Circle.java
@@ -16,7 +16,7 @@ public class Circle extends ReqlExpr {
public Circle(Object arg) {
this(new Arguments(arg), null);
}
- public Circle(Arguments args){
+ public Circle(Arguments args) {
this(args, null);
}
public Circle(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/CoerceTo.java b/src/main/java/com/rethinkdb/gen/ast/CoerceTo.java
index cba7c072..4207efb8 100644
--- a/src/main/java/com/rethinkdb/gen/ast/CoerceTo.java
+++ b/src/main/java/com/rethinkdb/gen/ast/CoerceTo.java
@@ -16,7 +16,7 @@ public class CoerceTo extends ReqlExpr {
public CoerceTo(Object arg) {
this(new Arguments(arg), null);
}
- public CoerceTo(Arguments args){
+ public CoerceTo(Arguments args) {
this(args, null);
}
public CoerceTo(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ConcatMap.java b/src/main/java/com/rethinkdb/gen/ast/ConcatMap.java
index 9178f7aa..a59d20b0 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ConcatMap.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ConcatMap.java
@@ -16,7 +16,7 @@ public class ConcatMap extends ReqlExpr {
public ConcatMap(Object arg) {
this(new Arguments(arg), null);
}
- public ConcatMap(Arguments args){
+ public ConcatMap(Arguments args) {
this(args, null);
}
public ConcatMap(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Config.java b/src/main/java/com/rethinkdb/gen/ast/Config.java
index b0a819dc..a6268ed8 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Config.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Config.java
@@ -16,7 +16,7 @@ public class Config extends ReqlExpr {
public Config(Object arg) {
this(new Arguments(arg), null);
}
- public Config(Arguments args){
+ public Config(Arguments args) {
this(args, null);
}
public Config(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Contains.java b/src/main/java/com/rethinkdb/gen/ast/Contains.java
index 67d58e71..d900d74e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Contains.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Contains.java
@@ -16,7 +16,7 @@ public class Contains extends ReqlExpr {
public Contains(Object arg) {
this(new Arguments(arg), null);
}
- public Contains(Arguments args){
+ public Contains(Arguments args) {
this(args, null);
}
public Contains(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Count.java b/src/main/java/com/rethinkdb/gen/ast/Count.java
index 440bec12..2b32ea8f 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Count.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Count.java
@@ -16,7 +16,7 @@ public class Count extends ReqlExpr {
public Count(Object arg) {
this(new Arguments(arg), null);
}
- public Count(Arguments args){
+ public Count(Arguments args) {
this(args, null);
}
public Count(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Date.java b/src/main/java/com/rethinkdb/gen/ast/Date.java
index 7e84a5ff..c1f50ff4 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Date.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Date.java
@@ -16,7 +16,7 @@ public class Date extends ReqlExpr {
public Date(Object arg) {
this(new Arguments(arg), null);
}
- public Date(Arguments args){
+ public Date(Arguments args) {
this(args, null);
}
public Date(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Datum.java b/src/main/java/com/rethinkdb/gen/ast/Datum.java
index d3bb54fd..426db617 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Datum.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Datum.java
@@ -12,14 +12,13 @@
import com.rethinkdb.ast.ReqlAst;
public class Datum extends ReqlExpr {
-
public final java.lang.Object datum;
+
public Datum(java.lang.Object arg) {
super(TermType.DATUM, null, null);
datum = arg;
}
-
@Override
protected Object build() {
// Overridden because Datums are leaf-nodes and therefore
diff --git a/src/main/java/com/rethinkdb/gen/ast/Day.java b/src/main/java/com/rethinkdb/gen/ast/Day.java
index bb79c904..f7447207 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Day.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Day.java
@@ -16,7 +16,7 @@ public class Day extends ReqlExpr {
public Day(Object arg) {
this(new Arguments(arg), null);
}
- public Day(Arguments args){
+ public Day(Arguments args) {
this(args, null);
}
public Day(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/DayOfWeek.java b/src/main/java/com/rethinkdb/gen/ast/DayOfWeek.java
index 07dde6c4..e259093d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/DayOfWeek.java
+++ b/src/main/java/com/rethinkdb/gen/ast/DayOfWeek.java
@@ -16,7 +16,7 @@ public class DayOfWeek extends ReqlExpr {
public DayOfWeek(Object arg) {
this(new Arguments(arg), null);
}
- public DayOfWeek(Arguments args){
+ public DayOfWeek(Arguments args) {
this(args, null);
}
public DayOfWeek(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/DayOfYear.java b/src/main/java/com/rethinkdb/gen/ast/DayOfYear.java
index 080f3f1d..c29f5d3e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/DayOfYear.java
+++ b/src/main/java/com/rethinkdb/gen/ast/DayOfYear.java
@@ -16,7 +16,7 @@ public class DayOfYear extends ReqlExpr {
public DayOfYear(Object arg) {
this(new Arguments(arg), null);
}
- public DayOfYear(Arguments args){
+ public DayOfYear(Arguments args) {
this(args, null);
}
public DayOfYear(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Db.java b/src/main/java/com/rethinkdb/gen/ast/Db.java
index 39403ba5..df0fa7cb 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Db.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Db.java
@@ -16,7 +16,7 @@ public class Db extends ReqlAst {
public Db(Object arg) {
this(new Arguments(arg), null);
}
- public Db(Arguments args){
+ public Db(Arguments args) {
this(args, null);
}
public Db(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/DbCreate.java b/src/main/java/com/rethinkdb/gen/ast/DbCreate.java
index 1cbcf722..045c2a51 100644
--- a/src/main/java/com/rethinkdb/gen/ast/DbCreate.java
+++ b/src/main/java/com/rethinkdb/gen/ast/DbCreate.java
@@ -16,7 +16,7 @@ public class DbCreate extends ReqlExpr {
public DbCreate(Object arg) {
this(new Arguments(arg), null);
}
- public DbCreate(Arguments args){
+ public DbCreate(Arguments args) {
this(args, null);
}
public DbCreate(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/DbDrop.java b/src/main/java/com/rethinkdb/gen/ast/DbDrop.java
index 7093e573..47ab4811 100644
--- a/src/main/java/com/rethinkdb/gen/ast/DbDrop.java
+++ b/src/main/java/com/rethinkdb/gen/ast/DbDrop.java
@@ -16,7 +16,7 @@ public class DbDrop extends ReqlExpr {
public DbDrop(Object arg) {
this(new Arguments(arg), null);
}
- public DbDrop(Arguments args){
+ public DbDrop(Arguments args) {
this(args, null);
}
public DbDrop(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/DbList.java b/src/main/java/com/rethinkdb/gen/ast/DbList.java
index 777e6766..ec5bf2ed 100644
--- a/src/main/java/com/rethinkdb/gen/ast/DbList.java
+++ b/src/main/java/com/rethinkdb/gen/ast/DbList.java
@@ -16,7 +16,7 @@ public class DbList extends ReqlExpr {
public DbList(Object arg) {
this(new Arguments(arg), null);
}
- public DbList(Arguments args){
+ public DbList(Arguments args) {
this(args, null);
}
public DbList(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/December.java b/src/main/java/com/rethinkdb/gen/ast/December.java
index 3d4335e8..73a94c85 100644
--- a/src/main/java/com/rethinkdb/gen/ast/December.java
+++ b/src/main/java/com/rethinkdb/gen/ast/December.java
@@ -16,7 +16,7 @@ public class December extends ReqlExpr {
public December(Object arg) {
this(new Arguments(arg), null);
}
- public December(Arguments args){
+ public December(Arguments args) {
this(args, null);
}
public December(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Default.java b/src/main/java/com/rethinkdb/gen/ast/Default.java
index 6a156bc9..bd3674af 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Default.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Default.java
@@ -16,7 +16,7 @@ public class Default extends ReqlExpr {
public Default(Object arg) {
this(new Arguments(arg), null);
}
- public Default(Arguments args){
+ public Default(Arguments args) {
this(args, null);
}
public Default(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Delete.java b/src/main/java/com/rethinkdb/gen/ast/Delete.java
index 8b0de6ae..f316da0e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Delete.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Delete.java
@@ -16,7 +16,7 @@ public class Delete extends ReqlExpr {
public Delete(Object arg) {
this(new Arguments(arg), null);
}
- public Delete(Arguments args){
+ public Delete(Arguments args) {
this(args, null);
}
public Delete(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/DeleteAt.java b/src/main/java/com/rethinkdb/gen/ast/DeleteAt.java
index 9e1f7106..673c131a 100644
--- a/src/main/java/com/rethinkdb/gen/ast/DeleteAt.java
+++ b/src/main/java/com/rethinkdb/gen/ast/DeleteAt.java
@@ -16,7 +16,7 @@ public class DeleteAt extends ReqlExpr {
public DeleteAt(Object arg) {
this(new Arguments(arg), null);
}
- public DeleteAt(Arguments args){
+ public DeleteAt(Arguments args) {
this(args, null);
}
public DeleteAt(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Desc.java b/src/main/java/com/rethinkdb/gen/ast/Desc.java
index 08ae884a..0d8c1d0b 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Desc.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Desc.java
@@ -16,7 +16,7 @@ public class Desc extends ReqlExpr {
public Desc(Object arg) {
this(new Arguments(arg), null);
}
- public Desc(Arguments args){
+ public Desc(Arguments args) {
this(args, null);
}
public Desc(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Difference.java b/src/main/java/com/rethinkdb/gen/ast/Difference.java
index 4405f40e..2e772edf 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Difference.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Difference.java
@@ -16,7 +16,7 @@ public class Difference extends ReqlExpr {
public Difference(Object arg) {
this(new Arguments(arg), null);
}
- public Difference(Arguments args){
+ public Difference(Arguments args) {
this(args, null);
}
public Difference(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Distance.java b/src/main/java/com/rethinkdb/gen/ast/Distance.java
index f5a6f778..768d026a 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Distance.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Distance.java
@@ -16,7 +16,7 @@ public class Distance extends ReqlExpr {
public Distance(Object arg) {
this(new Arguments(arg), null);
}
- public Distance(Arguments args){
+ public Distance(Arguments args) {
this(args, null);
}
public Distance(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Distinct.java b/src/main/java/com/rethinkdb/gen/ast/Distinct.java
index 614e2699..434370aa 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Distinct.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Distinct.java
@@ -16,7 +16,7 @@ public class Distinct extends ReqlExpr {
public Distinct(Object arg) {
this(new Arguments(arg), null);
}
- public Distinct(Arguments args){
+ public Distinct(Arguments args) {
this(args, null);
}
public Distinct(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Div.java b/src/main/java/com/rethinkdb/gen/ast/Div.java
index c5228b12..c5478469 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Div.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Div.java
@@ -16,7 +16,7 @@ public class Div extends ReqlExpr {
public Div(Object arg) {
this(new Arguments(arg), null);
}
- public Div(Arguments args){
+ public Div(Arguments args) {
this(args, null);
}
public Div(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Downcase.java b/src/main/java/com/rethinkdb/gen/ast/Downcase.java
index 33ae6b0c..e41caaab 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Downcase.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Downcase.java
@@ -16,7 +16,7 @@ public class Downcase extends ReqlExpr {
public Downcase(Object arg) {
this(new Arguments(arg), null);
}
- public Downcase(Arguments args){
+ public Downcase(Arguments args) {
this(args, null);
}
public Downcase(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/During.java b/src/main/java/com/rethinkdb/gen/ast/During.java
index 7122f1b8..9e8eb8d8 100644
--- a/src/main/java/com/rethinkdb/gen/ast/During.java
+++ b/src/main/java/com/rethinkdb/gen/ast/During.java
@@ -16,7 +16,7 @@ public class During extends ReqlExpr {
public During(Object arg) {
this(new Arguments(arg), null);
}
- public During(Arguments args){
+ public During(Arguments args) {
this(args, null);
}
public During(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/EpochTime.java b/src/main/java/com/rethinkdb/gen/ast/EpochTime.java
index 697f8aaa..061d09f0 100644
--- a/src/main/java/com/rethinkdb/gen/ast/EpochTime.java
+++ b/src/main/java/com/rethinkdb/gen/ast/EpochTime.java
@@ -16,7 +16,7 @@ public class EpochTime extends ReqlExpr {
public EpochTime(Object arg) {
this(new Arguments(arg), null);
}
- public EpochTime(Arguments args){
+ public EpochTime(Arguments args) {
this(args, null);
}
public EpochTime(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Eq.java b/src/main/java/com/rethinkdb/gen/ast/Eq.java
index c96ac751..d5816e49 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Eq.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Eq.java
@@ -16,7 +16,7 @@ public class Eq extends ReqlExpr {
public Eq(Object arg) {
this(new Arguments(arg), null);
}
- public Eq(Arguments args){
+ public Eq(Arguments args) {
this(args, null);
}
public Eq(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/EqJoin.java b/src/main/java/com/rethinkdb/gen/ast/EqJoin.java
index 1e01a13d..d0f2e635 100644
--- a/src/main/java/com/rethinkdb/gen/ast/EqJoin.java
+++ b/src/main/java/com/rethinkdb/gen/ast/EqJoin.java
@@ -16,7 +16,7 @@ public class EqJoin extends ReqlExpr {
public EqJoin(Object arg) {
this(new Arguments(arg), null);
}
- public EqJoin(Arguments args){
+ public EqJoin(Arguments args) {
this(args, null);
}
public EqJoin(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Error.java b/src/main/java/com/rethinkdb/gen/ast/Error.java
index b522990c..53e77dc0 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Error.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Error.java
@@ -16,7 +16,7 @@ public class Error extends ReqlExpr {
public Error(Object arg) {
this(new Arguments(arg), null);
}
- public Error(Arguments args){
+ public Error(Arguments args) {
this(args, null);
}
public Error(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/February.java b/src/main/java/com/rethinkdb/gen/ast/February.java
index 40256e24..05b043f6 100644
--- a/src/main/java/com/rethinkdb/gen/ast/February.java
+++ b/src/main/java/com/rethinkdb/gen/ast/February.java
@@ -16,7 +16,7 @@ public class February extends ReqlExpr {
public February(Object arg) {
this(new Arguments(arg), null);
}
- public February(Arguments args){
+ public February(Arguments args) {
this(args, null);
}
public February(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Fill.java b/src/main/java/com/rethinkdb/gen/ast/Fill.java
index 4a30cf93..307ebe24 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Fill.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Fill.java
@@ -16,7 +16,7 @@ public class Fill extends ReqlExpr {
public Fill(Object arg) {
this(new Arguments(arg), null);
}
- public Fill(Arguments args){
+ public Fill(Arguments args) {
this(args, null);
}
public Fill(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Filter.java b/src/main/java/com/rethinkdb/gen/ast/Filter.java
index dadee812..f9b57e2e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Filter.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Filter.java
@@ -16,7 +16,7 @@ public class Filter extends ReqlExpr {
public Filter(Object arg) {
this(new Arguments(arg), null);
}
- public Filter(Arguments args){
+ public Filter(Arguments args) {
this(args, null);
}
public Filter(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Floor.java b/src/main/java/com/rethinkdb/gen/ast/Floor.java
index 9696779a..99f88d1b 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Floor.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Floor.java
@@ -16,7 +16,7 @@ public class Floor extends ReqlExpr {
public Floor(Object arg) {
this(new Arguments(arg), null);
}
- public Floor(Arguments args){
+ public Floor(Arguments args) {
this(args, null);
}
public Floor(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Fold.java b/src/main/java/com/rethinkdb/gen/ast/Fold.java
index 56ff76aa..298929c2 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Fold.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Fold.java
@@ -16,7 +16,7 @@ public class Fold extends ReqlExpr {
public Fold(Object arg) {
this(new Arguments(arg), null);
}
- public Fold(Arguments args){
+ public Fold(Arguments args) {
this(args, null);
}
public Fold(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ForEach.java b/src/main/java/com/rethinkdb/gen/ast/ForEach.java
index 1c644f16..8c684f00 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ForEach.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ForEach.java
@@ -16,7 +16,7 @@ public class ForEach extends ReqlExpr {
public ForEach(Object arg) {
this(new Arguments(arg), null);
}
- public ForEach(Arguments args){
+ public ForEach(Arguments args) {
this(args, null);
}
public ForEach(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Friday.java b/src/main/java/com/rethinkdb/gen/ast/Friday.java
index 70122478..fe73f9ff 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Friday.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Friday.java
@@ -16,7 +16,7 @@ public class Friday extends ReqlExpr {
public Friday(Object arg) {
this(new Arguments(arg), null);
}
- public Friday(Arguments args){
+ public Friday(Arguments args) {
this(args, null);
}
public Friday(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Func.java b/src/main/java/com/rethinkdb/gen/ast/Func.java
index 66aebd34..ac4d4569 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Func.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Func.java
@@ -12,7 +12,7 @@
import com.rethinkdb.ast.ReqlAst;
import com.rethinkdb.model.ReqlLambda;
-import com.rethinkdb.ast.Util;
+import com.rethinkdb.utils.Internals;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.Arrays;
import java.util.List;
@@ -24,11 +24,10 @@ protected Func(Arguments args){
super(TermType.FUNC, args, null);
}
public static Func fromLambda(ReqlLambda function) {
- if(function instanceof ReqlFunction0) {
- return new Func(Arguments.make(new MakeArray(Arrays.asList()),
- Util.toReqlAst(((ReqlFunction0) function).apply())));
+ if (function instanceof ReqlFunction0) {
+ return new Func(Arguments.make(new MakeArray(Arrays.asList()), Internals.toReqlAst(((ReqlFunction0) function).apply())));
}
- else if(function instanceof ReqlFunction1){
+ else if (function instanceof ReqlFunction1) {
ReqlFunction1 func1 = (ReqlFunction1) function;
int var1 = nextVarId();
List varIds = Arrays.asList(
@@ -36,11 +35,9 @@ else if(function instanceof ReqlFunction1){
Object appliedFunction = func1.apply(
new Var(var1)
);
- return new Func(Arguments.make(
- new MakeArray(varIds),
- Util.toReqlAst(appliedFunction)));
+ return new Func(Arguments.make(new MakeArray(varIds), Internals.toReqlAst(appliedFunction)));
}
- else if(function instanceof ReqlFunction2){
+ else if (function instanceof ReqlFunction2) {
ReqlFunction2 func2 = (ReqlFunction2) function;
int var1 = nextVarId();
int var2 = nextVarId();
@@ -49,11 +46,9 @@ else if(function instanceof ReqlFunction2){
Object appliedFunction = func2.apply(
new Var(var1), new Var(var2)
);
- return new Func(Arguments.make(
- new MakeArray(varIds),
- Util.toReqlAst(appliedFunction)));
+ return new Func(Arguments.make(new MakeArray(varIds), Internals.toReqlAst(appliedFunction)));
}
- else if(function instanceof ReqlFunction3){
+ else if (function instanceof ReqlFunction3) {
ReqlFunction3 func3 = (ReqlFunction3) function;
int var1 = nextVarId();
int var2 = nextVarId();
@@ -63,11 +58,9 @@ else if(function instanceof ReqlFunction3){
Object appliedFunction = func3.apply(
new Var(var1), new Var(var2), new Var(var3)
);
- return new Func(Arguments.make(
- new MakeArray(varIds),
- Util.toReqlAst(appliedFunction)));
+ return new Func(Arguments.make(new MakeArray(varIds), Internals.toReqlAst(appliedFunction)));
}
- else if(function instanceof ReqlFunction4){
+ else if (function instanceof ReqlFunction4) {
ReqlFunction4 func4 = (ReqlFunction4) function;
int var1 = nextVarId();
int var2 = nextVarId();
@@ -78,9 +71,7 @@ else if(function instanceof ReqlFunction4){
Object appliedFunction = func4.apply(
new Var(var1), new Var(var2), new Var(var3), new Var(var4)
);
- return new Func(Arguments.make(
- new MakeArray(varIds),
- Util.toReqlAst(appliedFunction)));
+ return new Func(Arguments.make(new MakeArray(varIds), Internals.toReqlAst(appliedFunction)));
}
else {
throw new ReqlDriverError("Arity of ReqlLambda not recognized!");
diff --git a/src/main/java/com/rethinkdb/gen/ast/Funcall.java b/src/main/java/com/rethinkdb/gen/ast/Funcall.java
index 01b3fab8..ea5d1e22 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Funcall.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Funcall.java
@@ -16,7 +16,7 @@ public class Funcall extends ReqlExpr {
public Funcall(Object arg) {
this(new Arguments(arg), null);
}
- public Funcall(Arguments args){
+ public Funcall(Arguments args) {
this(args, null);
}
public Funcall(Arguments args, OptArgs optargs) {
@@ -25,8 +25,7 @@ public Funcall(Arguments args, OptArgs optargs) {
@Override
- protected Object build()
- {
+ protected Object build() {
/*
This object should be constructed with arguments first, and the
function itself as the last parameter. This makes it easier for
diff --git a/src/main/java/com/rethinkdb/gen/ast/Ge.java b/src/main/java/com/rethinkdb/gen/ast/Ge.java
index 95558fde..dfc0229f 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Ge.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Ge.java
@@ -16,7 +16,7 @@ public class Ge extends ReqlExpr {
public Ge(Object arg) {
this(new Arguments(arg), null);
}
- public Ge(Arguments args){
+ public Ge(Arguments args) {
this(args, null);
}
public Ge(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Geojson.java b/src/main/java/com/rethinkdb/gen/ast/Geojson.java
index 9176889f..ca7619d5 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Geojson.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Geojson.java
@@ -16,7 +16,7 @@ public class Geojson extends ReqlExpr {
public Geojson(Object arg) {
this(new Arguments(arg), null);
}
- public Geojson(Arguments args){
+ public Geojson(Arguments args) {
this(args, null);
}
public Geojson(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Get.java b/src/main/java/com/rethinkdb/gen/ast/Get.java
index 9a4f0166..a77bd8da 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Get.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Get.java
@@ -16,7 +16,7 @@ public class Get extends ReqlExpr {
public Get(Object arg) {
this(new Arguments(arg), null);
}
- public Get(Arguments args){
+ public Get(Arguments args) {
this(args, null);
}
public Get(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/GetAll.java b/src/main/java/com/rethinkdb/gen/ast/GetAll.java
index 0f6ae988..70413cb6 100644
--- a/src/main/java/com/rethinkdb/gen/ast/GetAll.java
+++ b/src/main/java/com/rethinkdb/gen/ast/GetAll.java
@@ -16,7 +16,7 @@ public class GetAll extends ReqlExpr {
public GetAll(Object arg) {
this(new Arguments(arg), null);
}
- public GetAll(Arguments args){
+ public GetAll(Arguments args) {
this(args, null);
}
public GetAll(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/GetField.java b/src/main/java/com/rethinkdb/gen/ast/GetField.java
index 687127dd..380019fb 100644
--- a/src/main/java/com/rethinkdb/gen/ast/GetField.java
+++ b/src/main/java/com/rethinkdb/gen/ast/GetField.java
@@ -16,7 +16,7 @@ public class GetField extends ReqlExpr {
public GetField(Object arg) {
this(new Arguments(arg), null);
}
- public GetField(Arguments args){
+ public GetField(Arguments args) {
this(args, null);
}
public GetField(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/GetIntersecting.java b/src/main/java/com/rethinkdb/gen/ast/GetIntersecting.java
index 8885086e..52abf6dd 100644
--- a/src/main/java/com/rethinkdb/gen/ast/GetIntersecting.java
+++ b/src/main/java/com/rethinkdb/gen/ast/GetIntersecting.java
@@ -16,7 +16,7 @@ public class GetIntersecting extends ReqlExpr {
public GetIntersecting(Object arg) {
this(new Arguments(arg), null);
}
- public GetIntersecting(Arguments args){
+ public GetIntersecting(Arguments args) {
this(args, null);
}
public GetIntersecting(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/GetNearest.java b/src/main/java/com/rethinkdb/gen/ast/GetNearest.java
index e64a60b2..ee2f92be 100644
--- a/src/main/java/com/rethinkdb/gen/ast/GetNearest.java
+++ b/src/main/java/com/rethinkdb/gen/ast/GetNearest.java
@@ -16,7 +16,7 @@ public class GetNearest extends ReqlExpr {
public GetNearest(Object arg) {
this(new Arguments(arg), null);
}
- public GetNearest(Arguments args){
+ public GetNearest(Arguments args) {
this(args, null);
}
public GetNearest(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/GetWriteHook.java b/src/main/java/com/rethinkdb/gen/ast/GetWriteHook.java
index 191108eb..d1b8bbaa 100644
--- a/src/main/java/com/rethinkdb/gen/ast/GetWriteHook.java
+++ b/src/main/java/com/rethinkdb/gen/ast/GetWriteHook.java
@@ -16,7 +16,7 @@ public class GetWriteHook extends ReqlExpr {
public GetWriteHook(Object arg) {
this(new Arguments(arg), null);
}
- public GetWriteHook(Arguments args){
+ public GetWriteHook(Arguments args) {
this(args, null);
}
public GetWriteHook(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Grant.java b/src/main/java/com/rethinkdb/gen/ast/Grant.java
index 7383223f..0ecb4e58 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Grant.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Grant.java
@@ -16,7 +16,7 @@ public class Grant extends ReqlExpr {
public Grant(Object arg) {
this(new Arguments(arg), null);
}
- public Grant(Arguments args){
+ public Grant(Arguments args) {
this(args, null);
}
public Grant(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Group.java b/src/main/java/com/rethinkdb/gen/ast/Group.java
index 09b91f9d..c23f8d61 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Group.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Group.java
@@ -16,7 +16,7 @@ public class Group extends ReqlExpr {
public Group(Object arg) {
this(new Arguments(arg), null);
}
- public Group(Arguments args){
+ public Group(Arguments args) {
this(args, null);
}
public Group(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Gt.java b/src/main/java/com/rethinkdb/gen/ast/Gt.java
index 6a5e0299..2b60d642 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Gt.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Gt.java
@@ -16,7 +16,7 @@ public class Gt extends ReqlExpr {
public Gt(Object arg) {
this(new Arguments(arg), null);
}
- public Gt(Arguments args){
+ public Gt(Arguments args) {
this(args, null);
}
public Gt(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/HasFields.java b/src/main/java/com/rethinkdb/gen/ast/HasFields.java
index 50829ee6..aff71629 100644
--- a/src/main/java/com/rethinkdb/gen/ast/HasFields.java
+++ b/src/main/java/com/rethinkdb/gen/ast/HasFields.java
@@ -16,7 +16,7 @@ public class HasFields extends ReqlExpr {
public HasFields(Object arg) {
this(new Arguments(arg), null);
}
- public HasFields(Arguments args){
+ public HasFields(Arguments args) {
this(args, null);
}
public HasFields(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Hours.java b/src/main/java/com/rethinkdb/gen/ast/Hours.java
index 7a1193e3..377a44af 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Hours.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Hours.java
@@ -16,7 +16,7 @@ public class Hours extends ReqlExpr {
public Hours(Object arg) {
this(new Arguments(arg), null);
}
- public Hours(Arguments args){
+ public Hours(Arguments args) {
this(args, null);
}
public Hours(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Http.java b/src/main/java/com/rethinkdb/gen/ast/Http.java
index 8c343008..1c1692e1 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Http.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Http.java
@@ -16,7 +16,7 @@ public class Http extends ReqlExpr {
public Http(Object arg) {
this(new Arguments(arg), null);
}
- public Http(Arguments args){
+ public Http(Arguments args) {
this(args, null);
}
public Http(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/InTimezone.java b/src/main/java/com/rethinkdb/gen/ast/InTimezone.java
index 320cba87..f9975bce 100644
--- a/src/main/java/com/rethinkdb/gen/ast/InTimezone.java
+++ b/src/main/java/com/rethinkdb/gen/ast/InTimezone.java
@@ -16,7 +16,7 @@ public class InTimezone extends ReqlExpr {
public InTimezone(Object arg) {
this(new Arguments(arg), null);
}
- public InTimezone(Arguments args){
+ public InTimezone(Arguments args) {
this(args, null);
}
public InTimezone(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Includes.java b/src/main/java/com/rethinkdb/gen/ast/Includes.java
index d47b23c4..4c965033 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Includes.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Includes.java
@@ -16,7 +16,7 @@ public class Includes extends ReqlExpr {
public Includes(Object arg) {
this(new Arguments(arg), null);
}
- public Includes(Arguments args){
+ public Includes(Arguments args) {
this(args, null);
}
public Includes(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/IndexCreate.java b/src/main/java/com/rethinkdb/gen/ast/IndexCreate.java
index a78f2bf6..67ef2a9d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/IndexCreate.java
+++ b/src/main/java/com/rethinkdb/gen/ast/IndexCreate.java
@@ -16,7 +16,7 @@ public class IndexCreate extends ReqlExpr {
public IndexCreate(Object arg) {
this(new Arguments(arg), null);
}
- public IndexCreate(Arguments args){
+ public IndexCreate(Arguments args) {
this(args, null);
}
public IndexCreate(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/IndexDrop.java b/src/main/java/com/rethinkdb/gen/ast/IndexDrop.java
index 59789102..794d8d1f 100644
--- a/src/main/java/com/rethinkdb/gen/ast/IndexDrop.java
+++ b/src/main/java/com/rethinkdb/gen/ast/IndexDrop.java
@@ -16,7 +16,7 @@ public class IndexDrop extends ReqlExpr {
public IndexDrop(Object arg) {
this(new Arguments(arg), null);
}
- public IndexDrop(Arguments args){
+ public IndexDrop(Arguments args) {
this(args, null);
}
public IndexDrop(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/IndexList.java b/src/main/java/com/rethinkdb/gen/ast/IndexList.java
index ab2c6b58..9b877997 100644
--- a/src/main/java/com/rethinkdb/gen/ast/IndexList.java
+++ b/src/main/java/com/rethinkdb/gen/ast/IndexList.java
@@ -16,7 +16,7 @@ public class IndexList extends ReqlExpr {
public IndexList(Object arg) {
this(new Arguments(arg), null);
}
- public IndexList(Arguments args){
+ public IndexList(Arguments args) {
this(args, null);
}
public IndexList(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/IndexRename.java b/src/main/java/com/rethinkdb/gen/ast/IndexRename.java
index 89211b0d..a04fcb69 100644
--- a/src/main/java/com/rethinkdb/gen/ast/IndexRename.java
+++ b/src/main/java/com/rethinkdb/gen/ast/IndexRename.java
@@ -16,7 +16,7 @@ public class IndexRename extends ReqlExpr {
public IndexRename(Object arg) {
this(new Arguments(arg), null);
}
- public IndexRename(Arguments args){
+ public IndexRename(Arguments args) {
this(args, null);
}
public IndexRename(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/IndexStatus.java b/src/main/java/com/rethinkdb/gen/ast/IndexStatus.java
index 62ff2a4c..5954ce5b 100644
--- a/src/main/java/com/rethinkdb/gen/ast/IndexStatus.java
+++ b/src/main/java/com/rethinkdb/gen/ast/IndexStatus.java
@@ -16,7 +16,7 @@ public class IndexStatus extends ReqlExpr {
public IndexStatus(Object arg) {
this(new Arguments(arg), null);
}
- public IndexStatus(Arguments args){
+ public IndexStatus(Arguments args) {
this(args, null);
}
public IndexStatus(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/IndexWait.java b/src/main/java/com/rethinkdb/gen/ast/IndexWait.java
index eb71482d..d8dd01b9 100644
--- a/src/main/java/com/rethinkdb/gen/ast/IndexWait.java
+++ b/src/main/java/com/rethinkdb/gen/ast/IndexWait.java
@@ -16,7 +16,7 @@ public class IndexWait extends ReqlExpr {
public IndexWait(Object arg) {
this(new Arguments(arg), null);
}
- public IndexWait(Arguments args){
+ public IndexWait(Arguments args) {
this(args, null);
}
public IndexWait(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Info.java b/src/main/java/com/rethinkdb/gen/ast/Info.java
index 85cd59d7..63599b20 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Info.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Info.java
@@ -16,7 +16,7 @@ public class Info extends ReqlExpr {
public Info(Object arg) {
this(new Arguments(arg), null);
}
- public Info(Arguments args){
+ public Info(Arguments args) {
this(args, null);
}
public Info(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/InnerJoin.java b/src/main/java/com/rethinkdb/gen/ast/InnerJoin.java
index 89de768c..2f00eb0d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/InnerJoin.java
+++ b/src/main/java/com/rethinkdb/gen/ast/InnerJoin.java
@@ -16,7 +16,7 @@ public class InnerJoin extends ReqlExpr {
public InnerJoin(Object arg) {
this(new Arguments(arg), null);
}
- public InnerJoin(Arguments args){
+ public InnerJoin(Arguments args) {
this(args, null);
}
public InnerJoin(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Insert.java b/src/main/java/com/rethinkdb/gen/ast/Insert.java
index 1a865a21..04ec8b19 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Insert.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Insert.java
@@ -16,7 +16,7 @@ public class Insert extends ReqlExpr {
public Insert(Object arg) {
this(new Arguments(arg), null);
}
- public Insert(Arguments args){
+ public Insert(Arguments args) {
this(args, null);
}
public Insert(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/InsertAt.java b/src/main/java/com/rethinkdb/gen/ast/InsertAt.java
index e8bfebd1..dddb8efc 100644
--- a/src/main/java/com/rethinkdb/gen/ast/InsertAt.java
+++ b/src/main/java/com/rethinkdb/gen/ast/InsertAt.java
@@ -16,7 +16,7 @@ public class InsertAt extends ReqlExpr {
public InsertAt(Object arg) {
this(new Arguments(arg), null);
}
- public InsertAt(Arguments args){
+ public InsertAt(Arguments args) {
this(args, null);
}
public InsertAt(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Intersects.java b/src/main/java/com/rethinkdb/gen/ast/Intersects.java
index 3dbadc0e..6a2fa095 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Intersects.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Intersects.java
@@ -16,7 +16,7 @@ public class Intersects extends ReqlExpr {
public Intersects(Object arg) {
this(new Arguments(arg), null);
}
- public Intersects(Arguments args){
+ public Intersects(Arguments args) {
this(args, null);
}
public Intersects(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/IsEmpty.java b/src/main/java/com/rethinkdb/gen/ast/IsEmpty.java
index f98bb9d2..c09ff248 100644
--- a/src/main/java/com/rethinkdb/gen/ast/IsEmpty.java
+++ b/src/main/java/com/rethinkdb/gen/ast/IsEmpty.java
@@ -16,7 +16,7 @@ public class IsEmpty extends ReqlExpr {
public IsEmpty(Object arg) {
this(new Arguments(arg), null);
}
- public IsEmpty(Arguments args){
+ public IsEmpty(Arguments args) {
this(args, null);
}
public IsEmpty(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Iso8601.java b/src/main/java/com/rethinkdb/gen/ast/Iso8601.java
index 6fd42979..426b01dc 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Iso8601.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Iso8601.java
@@ -16,7 +16,7 @@ public class Iso8601 extends ReqlExpr {
public Iso8601(Object arg) {
this(new Arguments(arg), null);
}
- public Iso8601(Arguments args){
+ public Iso8601(Arguments args) {
this(args, null);
}
public Iso8601(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/January.java b/src/main/java/com/rethinkdb/gen/ast/January.java
index a41492f5..e8315bea 100644
--- a/src/main/java/com/rethinkdb/gen/ast/January.java
+++ b/src/main/java/com/rethinkdb/gen/ast/January.java
@@ -16,7 +16,7 @@ public class January extends ReqlExpr {
public January(Object arg) {
this(new Arguments(arg), null);
}
- public January(Arguments args){
+ public January(Arguments args) {
this(args, null);
}
public January(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Javascript.java b/src/main/java/com/rethinkdb/gen/ast/Javascript.java
index 08cf3260..a7bcd012 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Javascript.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Javascript.java
@@ -16,7 +16,7 @@ public class Javascript extends ReqlExpr {
public Javascript(Object arg) {
this(new Arguments(arg), null);
}
- public Javascript(Arguments args){
+ public Javascript(Arguments args) {
this(args, null);
}
public Javascript(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Json.java b/src/main/java/com/rethinkdb/gen/ast/Json.java
index ee90a010..7b977418 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Json.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Json.java
@@ -16,7 +16,7 @@ public class Json extends ReqlExpr {
public Json(Object arg) {
this(new Arguments(arg), null);
}
- public Json(Arguments args){
+ public Json(Arguments args) {
this(args, null);
}
public Json(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/July.java b/src/main/java/com/rethinkdb/gen/ast/July.java
index 9fba8d3f..2c8163be 100644
--- a/src/main/java/com/rethinkdb/gen/ast/July.java
+++ b/src/main/java/com/rethinkdb/gen/ast/July.java
@@ -16,7 +16,7 @@ public class July extends ReqlExpr {
public July(Object arg) {
this(new Arguments(arg), null);
}
- public July(Arguments args){
+ public July(Arguments args) {
this(args, null);
}
public July(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/June.java b/src/main/java/com/rethinkdb/gen/ast/June.java
index 8d297799..5d82b9ff 100644
--- a/src/main/java/com/rethinkdb/gen/ast/June.java
+++ b/src/main/java/com/rethinkdb/gen/ast/June.java
@@ -16,7 +16,7 @@ public class June extends ReqlExpr {
public June(Object arg) {
this(new Arguments(arg), null);
}
- public June(Arguments args){
+ public June(Arguments args) {
this(args, null);
}
public June(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Keys.java b/src/main/java/com/rethinkdb/gen/ast/Keys.java
index 100feb1b..5bdfa579 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Keys.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Keys.java
@@ -16,7 +16,7 @@ public class Keys extends ReqlExpr {
public Keys(Object arg) {
this(new Arguments(arg), null);
}
- public Keys(Arguments args){
+ public Keys(Arguments args) {
this(args, null);
}
public Keys(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Le.java b/src/main/java/com/rethinkdb/gen/ast/Le.java
index 86df5e3f..a2634d7e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Le.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Le.java
@@ -16,7 +16,7 @@ public class Le extends ReqlExpr {
public Le(Object arg) {
this(new Arguments(arg), null);
}
- public Le(Arguments args){
+ public Le(Arguments args) {
this(args, null);
}
public Le(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Limit.java b/src/main/java/com/rethinkdb/gen/ast/Limit.java
index 12a7c36b..64a453ce 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Limit.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Limit.java
@@ -16,7 +16,7 @@ public class Limit extends ReqlExpr {
public Limit(Object arg) {
this(new Arguments(arg), null);
}
- public Limit(Arguments args){
+ public Limit(Arguments args) {
this(args, null);
}
public Limit(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Line.java b/src/main/java/com/rethinkdb/gen/ast/Line.java
index b03baa2c..c6a5d4e7 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Line.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Line.java
@@ -16,7 +16,7 @@ public class Line extends ReqlExpr {
public Line(Object arg) {
this(new Arguments(arg), null);
}
- public Line(Arguments args){
+ public Line(Arguments args) {
this(args, null);
}
public Line(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Literal.java b/src/main/java/com/rethinkdb/gen/ast/Literal.java
index a00e0dd2..1f7a4e0f 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Literal.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Literal.java
@@ -16,7 +16,7 @@ public class Literal extends ReqlExpr {
public Literal(Object arg) {
this(new Arguments(arg), null);
}
- public Literal(Arguments args){
+ public Literal(Arguments args) {
this(args, null);
}
public Literal(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Lt.java b/src/main/java/com/rethinkdb/gen/ast/Lt.java
index e655b5ac..82cee4b1 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Lt.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Lt.java
@@ -16,7 +16,7 @@ public class Lt extends ReqlExpr {
public Lt(Object arg) {
this(new Arguments(arg), null);
}
- public Lt(Arguments args){
+ public Lt(Arguments args) {
this(args, null);
}
public Lt(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/MakeArray.java b/src/main/java/com/rethinkdb/gen/ast/MakeArray.java
index 94b9a37d..b2d99577 100644
--- a/src/main/java/com/rethinkdb/gen/ast/MakeArray.java
+++ b/src/main/java/com/rethinkdb/gen/ast/MakeArray.java
@@ -16,7 +16,7 @@ public class MakeArray extends ReqlExpr {
public MakeArray(Object arg) {
this(new Arguments(arg), null);
}
- public MakeArray(Arguments args){
+ public MakeArray(Arguments args) {
this(args, null);
}
public MakeArray(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/MakeObj.java b/src/main/java/com/rethinkdb/gen/ast/MakeObj.java
index 9a8a5228..5cdc4804 100644
--- a/src/main/java/com/rethinkdb/gen/ast/MakeObj.java
+++ b/src/main/java/com/rethinkdb/gen/ast/MakeObj.java
@@ -15,20 +15,20 @@ public class MakeObj extends ReqlExpr {
public MakeObj(Object arg) {
this(new Arguments(arg), null);
}
- public MakeObj(OptArgs opts){
+ public MakeObj(OptArgs opts) {
this(new Arguments(), opts);
}
- public MakeObj(Arguments args){
+ public MakeObj(Arguments args) {
this(args, null);
}
public MakeObj(Arguments args, OptArgs optargs) {
this(TermType.MAKE_OBJ, args, optargs);
}
- protected MakeObj(TermType termType, Arguments args, OptArgs optargs){
+ protected MakeObj(TermType termType, Arguments args, OptArgs optargs) {
super(termType, args, optargs);
}
- public static MakeObj fromMap(java.util.Map map){
+ public static MakeObj fromMap(java.util.Map map) {
return new MakeObj(OptArgs.fromMap(map));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/ast/Map.java b/src/main/java/com/rethinkdb/gen/ast/Map.java
index 4dc14645..2c8872ec 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Map.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Map.java
@@ -16,7 +16,7 @@ public class Map extends ReqlExpr {
public Map(Object arg) {
this(new Arguments(arg), null);
}
- public Map(Arguments args){
+ public Map(Arguments args) {
this(args, null);
}
public Map(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/March.java b/src/main/java/com/rethinkdb/gen/ast/March.java
index 444ce4d6..45096c8d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/March.java
+++ b/src/main/java/com/rethinkdb/gen/ast/March.java
@@ -16,7 +16,7 @@ public class March extends ReqlExpr {
public March(Object arg) {
this(new Arguments(arg), null);
}
- public March(Arguments args){
+ public March(Arguments args) {
this(args, null);
}
public March(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Match.java b/src/main/java/com/rethinkdb/gen/ast/Match.java
index fef43792..eb4e7070 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Match.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Match.java
@@ -16,7 +16,7 @@ public class Match extends ReqlExpr {
public Match(Object arg) {
this(new Arguments(arg), null);
}
- public Match(Arguments args){
+ public Match(Arguments args) {
this(args, null);
}
public Match(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Max.java b/src/main/java/com/rethinkdb/gen/ast/Max.java
index 8b2ff851..9ba568b2 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Max.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Max.java
@@ -16,7 +16,7 @@ public class Max extends ReqlExpr {
public Max(Object arg) {
this(new Arguments(arg), null);
}
- public Max(Arguments args){
+ public Max(Arguments args) {
this(args, null);
}
public Max(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Maxval.java b/src/main/java/com/rethinkdb/gen/ast/Maxval.java
index 71488ed0..79098d08 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Maxval.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Maxval.java
@@ -16,7 +16,7 @@ public class Maxval extends ReqlExpr {
public Maxval(Object arg) {
this(new Arguments(arg), null);
}
- public Maxval(Arguments args){
+ public Maxval(Arguments args) {
this(args, null);
}
public Maxval(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/May.java b/src/main/java/com/rethinkdb/gen/ast/May.java
index f3bfe666..4cc95732 100644
--- a/src/main/java/com/rethinkdb/gen/ast/May.java
+++ b/src/main/java/com/rethinkdb/gen/ast/May.java
@@ -16,7 +16,7 @@ public class May extends ReqlExpr {
public May(Object arg) {
this(new Arguments(arg), null);
}
- public May(Arguments args){
+ public May(Arguments args) {
this(args, null);
}
public May(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Merge.java b/src/main/java/com/rethinkdb/gen/ast/Merge.java
index df00c3e5..66ba7ea1 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Merge.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Merge.java
@@ -16,7 +16,7 @@ public class Merge extends ReqlExpr {
public Merge(Object arg) {
this(new Arguments(arg), null);
}
- public Merge(Arguments args){
+ public Merge(Arguments args) {
this(args, null);
}
public Merge(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Min.java b/src/main/java/com/rethinkdb/gen/ast/Min.java
index 185d7a7c..8d7442a7 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Min.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Min.java
@@ -16,7 +16,7 @@ public class Min extends ReqlExpr {
public Min(Object arg) {
this(new Arguments(arg), null);
}
- public Min(Arguments args){
+ public Min(Arguments args) {
this(args, null);
}
public Min(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Minutes.java b/src/main/java/com/rethinkdb/gen/ast/Minutes.java
index 9a695ba3..93e4c63c 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Minutes.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Minutes.java
@@ -16,7 +16,7 @@ public class Minutes extends ReqlExpr {
public Minutes(Object arg) {
this(new Arguments(arg), null);
}
- public Minutes(Arguments args){
+ public Minutes(Arguments args) {
this(args, null);
}
public Minutes(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Minval.java b/src/main/java/com/rethinkdb/gen/ast/Minval.java
index dd016bbe..5774b9a1 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Minval.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Minval.java
@@ -16,7 +16,7 @@ public class Minval extends ReqlExpr {
public Minval(Object arg) {
this(new Arguments(arg), null);
}
- public Minval(Arguments args){
+ public Minval(Arguments args) {
this(args, null);
}
public Minval(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Mod.java b/src/main/java/com/rethinkdb/gen/ast/Mod.java
index 2554c779..eab53219 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Mod.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Mod.java
@@ -16,7 +16,7 @@ public class Mod extends ReqlExpr {
public Mod(Object arg) {
this(new Arguments(arg), null);
}
- public Mod(Arguments args){
+ public Mod(Arguments args) {
this(args, null);
}
public Mod(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Monday.java b/src/main/java/com/rethinkdb/gen/ast/Monday.java
index 415c3d17..04a242a5 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Monday.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Monday.java
@@ -16,7 +16,7 @@ public class Monday extends ReqlExpr {
public Monday(Object arg) {
this(new Arguments(arg), null);
}
- public Monday(Arguments args){
+ public Monday(Arguments args) {
this(args, null);
}
public Monday(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Month.java b/src/main/java/com/rethinkdb/gen/ast/Month.java
index 57721436..1755f5f6 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Month.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Month.java
@@ -16,7 +16,7 @@ public class Month extends ReqlExpr {
public Month(Object arg) {
this(new Arguments(arg), null);
}
- public Month(Arguments args){
+ public Month(Arguments args) {
this(args, null);
}
public Month(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Mul.java b/src/main/java/com/rethinkdb/gen/ast/Mul.java
index aaa07abd..54f7c69d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Mul.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Mul.java
@@ -16,7 +16,7 @@ public class Mul extends ReqlExpr {
public Mul(Object arg) {
this(new Arguments(arg), null);
}
- public Mul(Arguments args){
+ public Mul(Arguments args) {
this(args, null);
}
public Mul(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Ne.java b/src/main/java/com/rethinkdb/gen/ast/Ne.java
index d0b01f90..ad85e5ed 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Ne.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Ne.java
@@ -16,7 +16,7 @@ public class Ne extends ReqlExpr {
public Ne(Object arg) {
this(new Arguments(arg), null);
}
- public Ne(Arguments args){
+ public Ne(Arguments args) {
this(args, null);
}
public Ne(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Not.java b/src/main/java/com/rethinkdb/gen/ast/Not.java
index d7e4c784..34abef2c 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Not.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Not.java
@@ -16,7 +16,7 @@ public class Not extends ReqlExpr {
public Not(Object arg) {
this(new Arguments(arg), null);
}
- public Not(Arguments args){
+ public Not(Arguments args) {
this(args, null);
}
public Not(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/November.java b/src/main/java/com/rethinkdb/gen/ast/November.java
index 0222f09d..b2134cbc 100644
--- a/src/main/java/com/rethinkdb/gen/ast/November.java
+++ b/src/main/java/com/rethinkdb/gen/ast/November.java
@@ -16,7 +16,7 @@ public class November extends ReqlExpr {
public November(Object arg) {
this(new Arguments(arg), null);
}
- public November(Arguments args){
+ public November(Arguments args) {
this(args, null);
}
public November(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Now.java b/src/main/java/com/rethinkdb/gen/ast/Now.java
index dd966810..b7a2b135 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Now.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Now.java
@@ -16,7 +16,7 @@ public class Now extends ReqlExpr {
public Now(Object arg) {
this(new Arguments(arg), null);
}
- public Now(Arguments args){
+ public Now(Arguments args) {
this(args, null);
}
public Now(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Nth.java b/src/main/java/com/rethinkdb/gen/ast/Nth.java
index 11816315..58b57908 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Nth.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Nth.java
@@ -16,7 +16,7 @@ public class Nth extends ReqlExpr {
public Nth(Object arg) {
this(new Arguments(arg), null);
}
- public Nth(Arguments args){
+ public Nth(Arguments args) {
this(args, null);
}
public Nth(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/October.java b/src/main/java/com/rethinkdb/gen/ast/October.java
index 8100f744..4b6a7c7c 100644
--- a/src/main/java/com/rethinkdb/gen/ast/October.java
+++ b/src/main/java/com/rethinkdb/gen/ast/October.java
@@ -16,7 +16,7 @@ public class October extends ReqlExpr {
public October(Object arg) {
this(new Arguments(arg), null);
}
- public October(Arguments args){
+ public October(Arguments args) {
this(args, null);
}
public October(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/OffsetsOf.java b/src/main/java/com/rethinkdb/gen/ast/OffsetsOf.java
index cb4a44df..bb7ea491 100644
--- a/src/main/java/com/rethinkdb/gen/ast/OffsetsOf.java
+++ b/src/main/java/com/rethinkdb/gen/ast/OffsetsOf.java
@@ -16,7 +16,7 @@ public class OffsetsOf extends ReqlExpr {
public OffsetsOf(Object arg) {
this(new Arguments(arg), null);
}
- public OffsetsOf(Arguments args){
+ public OffsetsOf(Arguments args) {
this(args, null);
}
public OffsetsOf(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Or.java b/src/main/java/com/rethinkdb/gen/ast/Or.java
index 042e73fb..81b5defa 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Or.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Or.java
@@ -16,7 +16,7 @@ public class Or extends ReqlExpr {
public Or(Object arg) {
this(new Arguments(arg), null);
}
- public Or(Arguments args){
+ public Or(Arguments args) {
this(args, null);
}
public Or(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/OrderBy.java b/src/main/java/com/rethinkdb/gen/ast/OrderBy.java
index 27b07d74..cdaae92e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/OrderBy.java
+++ b/src/main/java/com/rethinkdb/gen/ast/OrderBy.java
@@ -16,7 +16,7 @@ public class OrderBy extends ReqlExpr {
public OrderBy(Object arg) {
this(new Arguments(arg), null);
}
- public OrderBy(Arguments args){
+ public OrderBy(Arguments args) {
this(args, null);
}
public OrderBy(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/OuterJoin.java b/src/main/java/com/rethinkdb/gen/ast/OuterJoin.java
index 66b71b87..361bd915 100644
--- a/src/main/java/com/rethinkdb/gen/ast/OuterJoin.java
+++ b/src/main/java/com/rethinkdb/gen/ast/OuterJoin.java
@@ -16,7 +16,7 @@ public class OuterJoin extends ReqlExpr {
public OuterJoin(Object arg) {
this(new Arguments(arg), null);
}
- public OuterJoin(Arguments args){
+ public OuterJoin(Arguments args) {
this(args, null);
}
public OuterJoin(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Pluck.java b/src/main/java/com/rethinkdb/gen/ast/Pluck.java
index 533ffe4c..0b08a0b3 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Pluck.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Pluck.java
@@ -16,7 +16,7 @@ public class Pluck extends ReqlExpr {
public Pluck(Object arg) {
this(new Arguments(arg), null);
}
- public Pluck(Arguments args){
+ public Pluck(Arguments args) {
this(args, null);
}
public Pluck(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Point.java b/src/main/java/com/rethinkdb/gen/ast/Point.java
index e6e0221f..e044614e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Point.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Point.java
@@ -16,7 +16,7 @@ public class Point extends ReqlExpr {
public Point(Object arg) {
this(new Arguments(arg), null);
}
- public Point(Arguments args){
+ public Point(Arguments args) {
this(args, null);
}
public Point(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Polygon.java b/src/main/java/com/rethinkdb/gen/ast/Polygon.java
index 88174d47..de93c7c7 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Polygon.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Polygon.java
@@ -16,7 +16,7 @@ public class Polygon extends ReqlExpr {
public Polygon(Object arg) {
this(new Arguments(arg), null);
}
- public Polygon(Arguments args){
+ public Polygon(Arguments args) {
this(args, null);
}
public Polygon(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/PolygonSub.java b/src/main/java/com/rethinkdb/gen/ast/PolygonSub.java
index ffe31b86..1aba83d2 100644
--- a/src/main/java/com/rethinkdb/gen/ast/PolygonSub.java
+++ b/src/main/java/com/rethinkdb/gen/ast/PolygonSub.java
@@ -16,7 +16,7 @@ public class PolygonSub extends ReqlExpr {
public PolygonSub(Object arg) {
this(new Arguments(arg), null);
}
- public PolygonSub(Arguments args){
+ public PolygonSub(Arguments args) {
this(args, null);
}
public PolygonSub(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Prepend.java b/src/main/java/com/rethinkdb/gen/ast/Prepend.java
index 6f51d8a6..646bb81c 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Prepend.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Prepend.java
@@ -16,7 +16,7 @@ public class Prepend extends ReqlExpr {
public Prepend(Object arg) {
this(new Arguments(arg), null);
}
- public Prepend(Arguments args){
+ public Prepend(Arguments args) {
this(args, null);
}
public Prepend(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Random.java b/src/main/java/com/rethinkdb/gen/ast/Random.java
index 0a254b27..645ba902 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Random.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Random.java
@@ -16,7 +16,7 @@ public class Random extends ReqlExpr {
public Random(Object arg) {
this(new Arguments(arg), null);
}
- public Random(Arguments args){
+ public Random(Arguments args) {
this(args, null);
}
public Random(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Range.java b/src/main/java/com/rethinkdb/gen/ast/Range.java
index 21b06b7f..34e7ece8 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Range.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Range.java
@@ -16,7 +16,7 @@ public class Range extends ReqlExpr {
public Range(Object arg) {
this(new Arguments(arg), null);
}
- public Range(Arguments args){
+ public Range(Arguments args) {
this(args, null);
}
public Range(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Rebalance.java b/src/main/java/com/rethinkdb/gen/ast/Rebalance.java
index 66f27206..9016cc82 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Rebalance.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Rebalance.java
@@ -16,7 +16,7 @@ public class Rebalance extends ReqlExpr {
public Rebalance(Object arg) {
this(new Arguments(arg), null);
}
- public Rebalance(Arguments args){
+ public Rebalance(Arguments args) {
this(args, null);
}
public Rebalance(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Reconfigure.java b/src/main/java/com/rethinkdb/gen/ast/Reconfigure.java
index 72b00da3..1c67f6e7 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Reconfigure.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Reconfigure.java
@@ -16,7 +16,7 @@ public class Reconfigure extends ReqlExpr {
public Reconfigure(Object arg) {
this(new Arguments(arg), null);
}
- public Reconfigure(Arguments args){
+ public Reconfigure(Arguments args) {
this(args, null);
}
public Reconfigure(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Reduce.java b/src/main/java/com/rethinkdb/gen/ast/Reduce.java
index 459151fc..d7a11daf 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Reduce.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Reduce.java
@@ -16,7 +16,7 @@ public class Reduce extends ReqlExpr {
public Reduce(Object arg) {
this(new Arguments(arg), null);
}
- public Reduce(Arguments args){
+ public Reduce(Arguments args) {
this(args, null);
}
public Reduce(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Replace.java b/src/main/java/com/rethinkdb/gen/ast/Replace.java
index 0b40cbeb..6b33a0fd 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Replace.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Replace.java
@@ -16,7 +16,7 @@ public class Replace extends ReqlExpr {
public Replace(Object arg) {
this(new Arguments(arg), null);
}
- public Replace(Arguments args){
+ public Replace(Arguments args) {
this(args, null);
}
public Replace(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ReqlExpr.java b/src/main/java/com/rethinkdb/gen/ast/ReqlExpr.java
index 4f7a8a1f..59e5c3ae 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ReqlExpr.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ReqlExpr.java
@@ -13,7 +13,7 @@
public class ReqlExpr extends ReqlAst {
- protected ReqlExpr(TermType termType, Arguments args, OptArgs optargs){
+ protected ReqlExpr(TermType termType, Arguments args, OptArgs optargs) {
super(termType, args, optargs);
}
diff --git a/src/main/java/com/rethinkdb/gen/ast/ReqlObject.java b/src/main/java/com/rethinkdb/gen/ast/ReqlObject.java
index ed3eab2c..7a7cfc39 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ReqlObject.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ReqlObject.java
@@ -16,7 +16,7 @@ public class ReqlObject extends ReqlExpr {
public ReqlObject(Object arg) {
this(new Arguments(arg), null);
}
- public ReqlObject(Arguments args){
+ public ReqlObject(Arguments args) {
this(args, null);
}
public ReqlObject(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Round.java b/src/main/java/com/rethinkdb/gen/ast/Round.java
index 7c885518..94fefcf0 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Round.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Round.java
@@ -16,7 +16,7 @@ public class Round extends ReqlExpr {
public Round(Object arg) {
this(new Arguments(arg), null);
}
- public Round(Arguments args){
+ public Round(Arguments args) {
this(args, null);
}
public Round(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Sample.java b/src/main/java/com/rethinkdb/gen/ast/Sample.java
index 77eeb9b5..c49a2cb6 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Sample.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Sample.java
@@ -16,7 +16,7 @@ public class Sample extends ReqlExpr {
public Sample(Object arg) {
this(new Arguments(arg), null);
}
- public Sample(Arguments args){
+ public Sample(Arguments args) {
this(args, null);
}
public Sample(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Saturday.java b/src/main/java/com/rethinkdb/gen/ast/Saturday.java
index 76701c89..ea90bcbc 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Saturday.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Saturday.java
@@ -16,7 +16,7 @@ public class Saturday extends ReqlExpr {
public Saturday(Object arg) {
this(new Arguments(arg), null);
}
- public Saturday(Arguments args){
+ public Saturday(Arguments args) {
this(args, null);
}
public Saturday(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Seconds.java b/src/main/java/com/rethinkdb/gen/ast/Seconds.java
index e065447b..c67daff7 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Seconds.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Seconds.java
@@ -16,7 +16,7 @@ public class Seconds extends ReqlExpr {
public Seconds(Object arg) {
this(new Arguments(arg), null);
}
- public Seconds(Arguments args){
+ public Seconds(Arguments args) {
this(args, null);
}
public Seconds(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/September.java b/src/main/java/com/rethinkdb/gen/ast/September.java
index fbcd43d4..a5c1414b 100644
--- a/src/main/java/com/rethinkdb/gen/ast/September.java
+++ b/src/main/java/com/rethinkdb/gen/ast/September.java
@@ -16,7 +16,7 @@ public class September extends ReqlExpr {
public September(Object arg) {
this(new Arguments(arg), null);
}
- public September(Arguments args){
+ public September(Arguments args) {
this(args, null);
}
public September(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/SetDifference.java b/src/main/java/com/rethinkdb/gen/ast/SetDifference.java
index e6082cf3..f3f62dd4 100644
--- a/src/main/java/com/rethinkdb/gen/ast/SetDifference.java
+++ b/src/main/java/com/rethinkdb/gen/ast/SetDifference.java
@@ -16,7 +16,7 @@ public class SetDifference extends ReqlExpr {
public SetDifference(Object arg) {
this(new Arguments(arg), null);
}
- public SetDifference(Arguments args){
+ public SetDifference(Arguments args) {
this(args, null);
}
public SetDifference(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/SetInsert.java b/src/main/java/com/rethinkdb/gen/ast/SetInsert.java
index ed214eef..76a68f05 100644
--- a/src/main/java/com/rethinkdb/gen/ast/SetInsert.java
+++ b/src/main/java/com/rethinkdb/gen/ast/SetInsert.java
@@ -16,7 +16,7 @@ public class SetInsert extends ReqlExpr {
public SetInsert(Object arg) {
this(new Arguments(arg), null);
}
- public SetInsert(Arguments args){
+ public SetInsert(Arguments args) {
this(args, null);
}
public SetInsert(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/SetIntersection.java b/src/main/java/com/rethinkdb/gen/ast/SetIntersection.java
index 6966fb72..99afba87 100644
--- a/src/main/java/com/rethinkdb/gen/ast/SetIntersection.java
+++ b/src/main/java/com/rethinkdb/gen/ast/SetIntersection.java
@@ -16,7 +16,7 @@ public class SetIntersection extends ReqlExpr {
public SetIntersection(Object arg) {
this(new Arguments(arg), null);
}
- public SetIntersection(Arguments args){
+ public SetIntersection(Arguments args) {
this(args, null);
}
public SetIntersection(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/SetUnion.java b/src/main/java/com/rethinkdb/gen/ast/SetUnion.java
index 0f43c9e0..d5e79135 100644
--- a/src/main/java/com/rethinkdb/gen/ast/SetUnion.java
+++ b/src/main/java/com/rethinkdb/gen/ast/SetUnion.java
@@ -16,7 +16,7 @@ public class SetUnion extends ReqlExpr {
public SetUnion(Object arg) {
this(new Arguments(arg), null);
}
- public SetUnion(Arguments args){
+ public SetUnion(Arguments args) {
this(args, null);
}
public SetUnion(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/SetWriteHook.java b/src/main/java/com/rethinkdb/gen/ast/SetWriteHook.java
index de837ae6..57db1a2e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/SetWriteHook.java
+++ b/src/main/java/com/rethinkdb/gen/ast/SetWriteHook.java
@@ -16,7 +16,7 @@ public class SetWriteHook extends ReqlExpr {
public SetWriteHook(Object arg) {
this(new Arguments(arg), null);
}
- public SetWriteHook(Arguments args){
+ public SetWriteHook(Arguments args) {
this(args, null);
}
public SetWriteHook(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Skip.java b/src/main/java/com/rethinkdb/gen/ast/Skip.java
index 025a72ff..59b0cc0c 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Skip.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Skip.java
@@ -16,7 +16,7 @@ public class Skip extends ReqlExpr {
public Skip(Object arg) {
this(new Arguments(arg), null);
}
- public Skip(Arguments args){
+ public Skip(Arguments args) {
this(args, null);
}
public Skip(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Slice.java b/src/main/java/com/rethinkdb/gen/ast/Slice.java
index 5c888793..f7c44c6b 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Slice.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Slice.java
@@ -16,7 +16,7 @@ public class Slice extends ReqlExpr {
public Slice(Object arg) {
this(new Arguments(arg), null);
}
- public Slice(Arguments args){
+ public Slice(Arguments args) {
this(args, null);
}
public Slice(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/SpliceAt.java b/src/main/java/com/rethinkdb/gen/ast/SpliceAt.java
index 05255eb7..052e4fb7 100644
--- a/src/main/java/com/rethinkdb/gen/ast/SpliceAt.java
+++ b/src/main/java/com/rethinkdb/gen/ast/SpliceAt.java
@@ -16,7 +16,7 @@ public class SpliceAt extends ReqlExpr {
public SpliceAt(Object arg) {
this(new Arguments(arg), null);
}
- public SpliceAt(Arguments args){
+ public SpliceAt(Arguments args) {
this(args, null);
}
public SpliceAt(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Split.java b/src/main/java/com/rethinkdb/gen/ast/Split.java
index 6e065944..366e896e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Split.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Split.java
@@ -16,7 +16,7 @@ public class Split extends ReqlExpr {
public Split(Object arg) {
this(new Arguments(arg), null);
}
- public Split(Arguments args){
+ public Split(Arguments args) {
this(args, null);
}
public Split(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Status.java b/src/main/java/com/rethinkdb/gen/ast/Status.java
index e28210bc..987fb823 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Status.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Status.java
@@ -16,7 +16,7 @@ public class Status extends ReqlExpr {
public Status(Object arg) {
this(new Arguments(arg), null);
}
- public Status(Arguments args){
+ public Status(Arguments args) {
this(args, null);
}
public Status(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Sub.java b/src/main/java/com/rethinkdb/gen/ast/Sub.java
index 9d83067f..b224ff94 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Sub.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Sub.java
@@ -16,7 +16,7 @@ public class Sub extends ReqlExpr {
public Sub(Object arg) {
this(new Arguments(arg), null);
}
- public Sub(Arguments args){
+ public Sub(Arguments args) {
this(args, null);
}
public Sub(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Sum.java b/src/main/java/com/rethinkdb/gen/ast/Sum.java
index 234184dc..66d5b0b1 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Sum.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Sum.java
@@ -16,7 +16,7 @@ public class Sum extends ReqlExpr {
public Sum(Object arg) {
this(new Arguments(arg), null);
}
- public Sum(Arguments args){
+ public Sum(Arguments args) {
this(args, null);
}
public Sum(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Sunday.java b/src/main/java/com/rethinkdb/gen/ast/Sunday.java
index 52c7c806..80c392d1 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Sunday.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Sunday.java
@@ -16,7 +16,7 @@ public class Sunday extends ReqlExpr {
public Sunday(Object arg) {
this(new Arguments(arg), null);
}
- public Sunday(Arguments args){
+ public Sunday(Arguments args) {
this(args, null);
}
public Sunday(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Sync.java b/src/main/java/com/rethinkdb/gen/ast/Sync.java
index 48f612e6..fe20087b 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Sync.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Sync.java
@@ -16,7 +16,7 @@ public class Sync extends ReqlExpr {
public Sync(Object arg) {
this(new Arguments(arg), null);
}
- public Sync(Arguments args){
+ public Sync(Arguments args) {
this(args, null);
}
public Sync(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Table.java b/src/main/java/com/rethinkdb/gen/ast/Table.java
index 0465fedf..df16eebe 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Table.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Table.java
@@ -16,7 +16,7 @@ public class Table extends ReqlExpr {
public Table(Object arg) {
this(new Arguments(arg), null);
}
- public Table(Arguments args){
+ public Table(Arguments args) {
this(args, null);
}
public Table(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/TableCreate.java b/src/main/java/com/rethinkdb/gen/ast/TableCreate.java
index c996acb0..fc456214 100644
--- a/src/main/java/com/rethinkdb/gen/ast/TableCreate.java
+++ b/src/main/java/com/rethinkdb/gen/ast/TableCreate.java
@@ -16,7 +16,7 @@ public class TableCreate extends ReqlExpr {
public TableCreate(Object arg) {
this(new Arguments(arg), null);
}
- public TableCreate(Arguments args){
+ public TableCreate(Arguments args) {
this(args, null);
}
public TableCreate(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/TableDrop.java b/src/main/java/com/rethinkdb/gen/ast/TableDrop.java
index d0bbda24..8c561d8a 100644
--- a/src/main/java/com/rethinkdb/gen/ast/TableDrop.java
+++ b/src/main/java/com/rethinkdb/gen/ast/TableDrop.java
@@ -16,7 +16,7 @@ public class TableDrop extends ReqlExpr {
public TableDrop(Object arg) {
this(new Arguments(arg), null);
}
- public TableDrop(Arguments args){
+ public TableDrop(Arguments args) {
this(args, null);
}
public TableDrop(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/TableList.java b/src/main/java/com/rethinkdb/gen/ast/TableList.java
index 7e26740e..37d8ddd9 100644
--- a/src/main/java/com/rethinkdb/gen/ast/TableList.java
+++ b/src/main/java/com/rethinkdb/gen/ast/TableList.java
@@ -16,7 +16,7 @@ public class TableList extends ReqlExpr {
public TableList(Object arg) {
this(new Arguments(arg), null);
}
- public TableList(Arguments args){
+ public TableList(Arguments args) {
this(args, null);
}
public TableList(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Thursday.java b/src/main/java/com/rethinkdb/gen/ast/Thursday.java
index 136e0064..f79e1eaa 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Thursday.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Thursday.java
@@ -16,7 +16,7 @@ public class Thursday extends ReqlExpr {
public Thursday(Object arg) {
this(new Arguments(arg), null);
}
- public Thursday(Arguments args){
+ public Thursday(Arguments args) {
this(args, null);
}
public Thursday(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Time.java b/src/main/java/com/rethinkdb/gen/ast/Time.java
index 6dd7e1eb..485383a5 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Time.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Time.java
@@ -16,7 +16,7 @@ public class Time extends ReqlExpr {
public Time(Object arg) {
this(new Arguments(arg), null);
}
- public Time(Arguments args){
+ public Time(Arguments args) {
this(args, null);
}
public Time(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/TimeOfDay.java b/src/main/java/com/rethinkdb/gen/ast/TimeOfDay.java
index 205de472..ad27d90b 100644
--- a/src/main/java/com/rethinkdb/gen/ast/TimeOfDay.java
+++ b/src/main/java/com/rethinkdb/gen/ast/TimeOfDay.java
@@ -16,7 +16,7 @@ public class TimeOfDay extends ReqlExpr {
public TimeOfDay(Object arg) {
this(new Arguments(arg), null);
}
- public TimeOfDay(Arguments args){
+ public TimeOfDay(Arguments args) {
this(args, null);
}
public TimeOfDay(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Timezone.java b/src/main/java/com/rethinkdb/gen/ast/Timezone.java
index 31d8305b..12b0a12f 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Timezone.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Timezone.java
@@ -16,7 +16,7 @@ public class Timezone extends ReqlExpr {
public Timezone(Object arg) {
this(new Arguments(arg), null);
}
- public Timezone(Arguments args){
+ public Timezone(Arguments args) {
this(args, null);
}
public Timezone(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ToEpochTime.java b/src/main/java/com/rethinkdb/gen/ast/ToEpochTime.java
index aa27c490..b95ff700 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ToEpochTime.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ToEpochTime.java
@@ -16,7 +16,7 @@ public class ToEpochTime extends ReqlExpr {
public ToEpochTime(Object arg) {
this(new Arguments(arg), null);
}
- public ToEpochTime(Arguments args){
+ public ToEpochTime(Arguments args) {
this(args, null);
}
public ToEpochTime(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ToGeojson.java b/src/main/java/com/rethinkdb/gen/ast/ToGeojson.java
index 468df38e..fcc1ccb3 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ToGeojson.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ToGeojson.java
@@ -16,7 +16,7 @@ public class ToGeojson extends ReqlExpr {
public ToGeojson(Object arg) {
this(new Arguments(arg), null);
}
- public ToGeojson(Arguments args){
+ public ToGeojson(Arguments args) {
this(args, null);
}
public ToGeojson(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ToIso8601.java b/src/main/java/com/rethinkdb/gen/ast/ToIso8601.java
index 5d195da7..f9adc7ce 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ToIso8601.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ToIso8601.java
@@ -16,7 +16,7 @@ public class ToIso8601 extends ReqlExpr {
public ToIso8601(Object arg) {
this(new Arguments(arg), null);
}
- public ToIso8601(Arguments args){
+ public ToIso8601(Arguments args) {
this(args, null);
}
public ToIso8601(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/ToJsonString.java b/src/main/java/com/rethinkdb/gen/ast/ToJsonString.java
index 6252f766..72f366f8 100644
--- a/src/main/java/com/rethinkdb/gen/ast/ToJsonString.java
+++ b/src/main/java/com/rethinkdb/gen/ast/ToJsonString.java
@@ -16,7 +16,7 @@ public class ToJsonString extends ReqlExpr {
public ToJsonString(Object arg) {
this(new Arguments(arg), null);
}
- public ToJsonString(Arguments args){
+ public ToJsonString(Arguments args) {
this(args, null);
}
public ToJsonString(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Tuesday.java b/src/main/java/com/rethinkdb/gen/ast/Tuesday.java
index 1991b3f9..6658b7dc 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Tuesday.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Tuesday.java
@@ -16,7 +16,7 @@ public class Tuesday extends ReqlExpr {
public Tuesday(Object arg) {
this(new Arguments(arg), null);
}
- public Tuesday(Arguments args){
+ public Tuesday(Arguments args) {
this(args, null);
}
public Tuesday(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/TypeOf.java b/src/main/java/com/rethinkdb/gen/ast/TypeOf.java
index 4294e3e8..18a85a87 100644
--- a/src/main/java/com/rethinkdb/gen/ast/TypeOf.java
+++ b/src/main/java/com/rethinkdb/gen/ast/TypeOf.java
@@ -16,7 +16,7 @@ public class TypeOf extends ReqlExpr {
public TypeOf(Object arg) {
this(new Arguments(arg), null);
}
- public TypeOf(Arguments args){
+ public TypeOf(Arguments args) {
this(args, null);
}
public TypeOf(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Ungroup.java b/src/main/java/com/rethinkdb/gen/ast/Ungroup.java
index e1bf12bc..8af19c8c 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Ungroup.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Ungroup.java
@@ -16,7 +16,7 @@ public class Ungroup extends ReqlExpr {
public Ungroup(Object arg) {
this(new Arguments(arg), null);
}
- public Ungroup(Arguments args){
+ public Ungroup(Arguments args) {
this(args, null);
}
public Ungroup(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Union.java b/src/main/java/com/rethinkdb/gen/ast/Union.java
index c7a036de..d497cea0 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Union.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Union.java
@@ -16,7 +16,7 @@ public class Union extends ReqlExpr {
public Union(Object arg) {
this(new Arguments(arg), null);
}
- public Union(Arguments args){
+ public Union(Arguments args) {
this(args, null);
}
public Union(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Upcase.java b/src/main/java/com/rethinkdb/gen/ast/Upcase.java
index 41640117..804b1a7f 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Upcase.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Upcase.java
@@ -16,7 +16,7 @@ public class Upcase extends ReqlExpr {
public Upcase(Object arg) {
this(new Arguments(arg), null);
}
- public Upcase(Arguments args){
+ public Upcase(Arguments args) {
this(args, null);
}
public Upcase(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Update.java b/src/main/java/com/rethinkdb/gen/ast/Update.java
index e6c9d5e4..21ad7475 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Update.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Update.java
@@ -16,7 +16,7 @@ public class Update extends ReqlExpr {
public Update(Object arg) {
this(new Arguments(arg), null);
}
- public Update(Arguments args){
+ public Update(Arguments args) {
this(args, null);
}
public Update(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Uuid.java b/src/main/java/com/rethinkdb/gen/ast/Uuid.java
index b0ad7f39..fb1e2074 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Uuid.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Uuid.java
@@ -16,7 +16,7 @@ public class Uuid extends ReqlExpr {
public Uuid(Object arg) {
this(new Arguments(arg), null);
}
- public Uuid(Arguments args){
+ public Uuid(Arguments args) {
this(args, null);
}
public Uuid(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Values.java b/src/main/java/com/rethinkdb/gen/ast/Values.java
index 2e97c77a..ca853e57 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Values.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Values.java
@@ -16,7 +16,7 @@ public class Values extends ReqlExpr {
public Values(Object arg) {
this(new Arguments(arg), null);
}
- public Values(Arguments args){
+ public Values(Arguments args) {
this(args, null);
}
public Values(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Var.java b/src/main/java/com/rethinkdb/gen/ast/Var.java
index 6c727b4e..ee74ed11 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Var.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Var.java
@@ -16,7 +16,7 @@ public class Var extends ReqlExpr {
public Var(Object arg) {
this(new Arguments(arg), null);
}
- public Var(Arguments args){
+ public Var(Arguments args) {
this(args, null);
}
public Var(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Wait.java b/src/main/java/com/rethinkdb/gen/ast/Wait.java
index ec51c5f4..1919bd54 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Wait.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Wait.java
@@ -16,7 +16,7 @@ public class Wait extends ReqlExpr {
public Wait(Object arg) {
this(new Arguments(arg), null);
}
- public Wait(Arguments args){
+ public Wait(Arguments args) {
this(args, null);
}
public Wait(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Wednesday.java b/src/main/java/com/rethinkdb/gen/ast/Wednesday.java
index bfd47139..9e1a18a3 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Wednesday.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Wednesday.java
@@ -16,7 +16,7 @@ public class Wednesday extends ReqlExpr {
public Wednesday(Object arg) {
this(new Arguments(arg), null);
}
- public Wednesday(Arguments args){
+ public Wednesday(Arguments args) {
this(args, null);
}
public Wednesday(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/WithFields.java b/src/main/java/com/rethinkdb/gen/ast/WithFields.java
index a82ec65b..7f1d3942 100644
--- a/src/main/java/com/rethinkdb/gen/ast/WithFields.java
+++ b/src/main/java/com/rethinkdb/gen/ast/WithFields.java
@@ -16,7 +16,7 @@ public class WithFields extends ReqlExpr {
public WithFields(Object arg) {
this(new Arguments(arg), null);
}
- public WithFields(Arguments args){
+ public WithFields(Arguments args) {
this(args, null);
}
public WithFields(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Without.java b/src/main/java/com/rethinkdb/gen/ast/Without.java
index e1b3c834..2877d79d 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Without.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Without.java
@@ -16,7 +16,7 @@ public class Without extends ReqlExpr {
public Without(Object arg) {
this(new Arguments(arg), null);
}
- public Without(Arguments args){
+ public Without(Arguments args) {
this(args, null);
}
public Without(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Year.java b/src/main/java/com/rethinkdb/gen/ast/Year.java
index 6e03a82d..860c2cdb 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Year.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Year.java
@@ -16,7 +16,7 @@ public class Year extends ReqlExpr {
public Year(Object arg) {
this(new Arguments(arg), null);
}
- public Year(Arguments args){
+ public Year(Arguments args) {
this(args, null);
}
public Year(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/ast/Zip.java b/src/main/java/com/rethinkdb/gen/ast/Zip.java
index 37a3ade0..400a8b9e 100644
--- a/src/main/java/com/rethinkdb/gen/ast/Zip.java
+++ b/src/main/java/com/rethinkdb/gen/ast/Zip.java
@@ -16,7 +16,7 @@ public class Zip extends ReqlExpr {
public Zip(Object arg) {
this(new Arguments(arg), null);
}
- public Zip(Arguments args){
+ public Zip(Arguments args) {
this(args, null);
}
public Zip(Arguments args, OptArgs optargs) {
diff --git a/src/main/java/com/rethinkdb/gen/model/TopLevel.java b/src/main/java/com/rethinkdb/gen/model/TopLevel.java
index e9017c72..eb3ffb25 100644
--- a/src/main/java/com/rethinkdb/gen/model/TopLevel.java
+++ b/src/main/java/com/rethinkdb/gen/model/TopLevel.java
@@ -10,8 +10,8 @@
import com.rethinkdb.model.MapObject;
import com.rethinkdb.gen.ast.Error;
import com.rethinkdb.gen.ast.*;
-import com.rethinkdb.ast.Util;
import com.rethinkdb.gen.exc.ReqlDriverError;
+import com.rethinkdb.utils.Internals;
import java.util.Arrays;
import java.util.ArrayList;
@@ -21,7 +21,7 @@
public class TopLevel {
public ReqlExpr expr(Object value){
- return Util.toReqlExpr(value);
+ return Internals.toReqlExpr(value);
}
public ReqlExpr row(Object... values) {
diff --git a/src/main/java/com/rethinkdb/gen/proto/DatumType.java b/src/main/java/com/rethinkdb/gen/proto/DatumType.java
index 1eb0f50b..7ce94b13 100644
--- a/src/main/java/com/rethinkdb/gen/proto/DatumType.java
+++ b/src/main/java/com/rethinkdb/gen/proto/DatumType.java
@@ -19,7 +19,7 @@ public enum DatumType {
public final int value;
- private DatumType(int value){
+ private DatumType(int value) {
this.value = value;
}
@@ -33,8 +33,7 @@ public static DatumType fromValue(int value) {
case 6: return DatumType.R_OBJECT;
case 7: return DatumType.R_JSON;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for DatumType", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for DatumType", value));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/proto/ErrorType.java b/src/main/java/com/rethinkdb/gen/proto/ErrorType.java
index 1d6595ea..8b830dd2 100644
--- a/src/main/java/com/rethinkdb/gen/proto/ErrorType.java
+++ b/src/main/java/com/rethinkdb/gen/proto/ErrorType.java
@@ -20,7 +20,7 @@ public enum ErrorType {
public final int value;
- private ErrorType(int value){
+ private ErrorType(int value) {
this.value = value;
}
@@ -35,8 +35,7 @@ public static ErrorType fromValue(int value) {
case 5000000: return ErrorType.USER;
case 6000000: return ErrorType.PERMISSION_ERROR;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for ErrorType", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for ErrorType", value));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/proto/Protocol.java b/src/main/java/com/rethinkdb/gen/proto/Protocol.java
index 6b88a8a3..ec922007 100644
--- a/src/main/java/com/rethinkdb/gen/proto/Protocol.java
+++ b/src/main/java/com/rethinkdb/gen/proto/Protocol.java
@@ -14,7 +14,7 @@ public enum Protocol {
public final int value;
- private Protocol(int value){
+ private Protocol(int value) {
this.value = value;
}
@@ -23,8 +23,7 @@ public static Protocol fromValue(int value) {
case 656407617: return Protocol.PROTOBUF;
case 2120839367: return Protocol.JSON;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for Protocol", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for Protocol", value));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/proto/QueryType.java b/src/main/java/com/rethinkdb/gen/proto/QueryType.java
index d848fcbf..a1ef2393 100644
--- a/src/main/java/com/rethinkdb/gen/proto/QueryType.java
+++ b/src/main/java/com/rethinkdb/gen/proto/QueryType.java
@@ -17,7 +17,7 @@ public enum QueryType {
public final int value;
- private QueryType(int value){
+ private QueryType(int value) {
this.value = value;
}
@@ -29,8 +29,7 @@ public static QueryType fromValue(int value) {
case 4: return QueryType.NOREPLY_WAIT;
case 5: return QueryType.SERVER_INFO;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for QueryType", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for QueryType", value));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/proto/ResponseNote.java b/src/main/java/com/rethinkdb/gen/proto/ResponseNote.java
index 6b529722..2c277d76 100644
--- a/src/main/java/com/rethinkdb/gen/proto/ResponseNote.java
+++ b/src/main/java/com/rethinkdb/gen/proto/ResponseNote.java
@@ -17,7 +17,7 @@ public enum ResponseNote {
public final int value;
- private ResponseNote(int value){
+ private ResponseNote(int value) {
this.value = value;
}
@@ -29,8 +29,7 @@ public static ResponseNote fromValue(int value) {
case 4: return ResponseNote.UNIONED_FEED;
case 5: return ResponseNote.INCLUDES_STATES;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for ResponseNote", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for ResponseNote", value));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/proto/ResponseType.java b/src/main/java/com/rethinkdb/gen/proto/ResponseType.java
index fb39b49f..1ccfb901 100644
--- a/src/main/java/com/rethinkdb/gen/proto/ResponseType.java
+++ b/src/main/java/com/rethinkdb/gen/proto/ResponseType.java
@@ -20,7 +20,7 @@ public enum ResponseType {
public final int value;
- private ResponseType(int value){
+ private ResponseType(int value) {
this.value = value;
}
@@ -35,8 +35,7 @@ public static ResponseType fromValue(int value) {
case 17: return ResponseType.COMPILE_ERROR;
case 18: return ResponseType.RUNTIME_ERROR;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for ResponseType", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for ResponseType", value));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/proto/TermType.java b/src/main/java/com/rethinkdb/gen/proto/TermType.java
index cd63e1e7..b610558c 100644
--- a/src/main/java/com/rethinkdb/gen/proto/TermType.java
+++ b/src/main/java/com/rethinkdb/gen/proto/TermType.java
@@ -198,7 +198,7 @@ public enum TermType {
public final int value;
- private TermType(int value){
+ private TermType(int value) {
this.value = value;
}
@@ -391,8 +391,7 @@ public static TermType fromValue(int value) {
case 195: return TermType.BIT_SAL;
case 196: return TermType.BIT_SAR;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for TermType", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for TermType", value));
}
}
diff --git a/src/main/java/com/rethinkdb/gen/proto/Version.java b/src/main/java/com/rethinkdb/gen/proto/Version.java
index e2572f0a..f7500467 100644
--- a/src/main/java/com/rethinkdb/gen/proto/Version.java
+++ b/src/main/java/com/rethinkdb/gen/proto/Version.java
@@ -17,7 +17,7 @@ public enum Version {
public final int value;
- private Version(int value){
+ private Version(int value) {
this.value = value;
}
@@ -29,8 +29,7 @@ public static Version fromValue(int value) {
case 1074539808: return Version.V0_4;
case 885177795: return Version.V1_0;
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for Version", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for Version", value));
}
}
diff --git a/src/main/java/com/rethinkdb/model/Arguments.java b/src/main/java/com/rethinkdb/model/Arguments.java
index 8697458d..5ded0fd6 100644
--- a/src/main/java/com/rethinkdb/model/Arguments.java
+++ b/src/main/java/com/rethinkdb/model/Arguments.java
@@ -2,21 +2,17 @@
import com.rethinkdb.ast.ReqlAst;
-import com.rethinkdb.ast.Util;
+import com.rethinkdb.utils.Internals;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
-import java.util.stream.Collectors;
public class Arguments extends ArrayList {
public Arguments() {}
- @SuppressWarnings("unchecked")
public Arguments(Object arg) {
if (arg instanceof List) {
- coerceAndAddAll((List) arg);
+ coerceAndAddAll((List>) arg);
} else {
coerceAndAdd(arg);
}
@@ -34,7 +30,7 @@ public Arguments(Object[] args) {
coerceAndAddAll(args);
}
- public Arguments(List args) {
+ public Arguments(List> args) {
coerceAndAddAll(args);
}
@@ -43,7 +39,7 @@ public static Arguments make(Object... args) {
}
public void coerceAndAdd(Object obj) {
- add(Util.toReqlAst(obj));
+ add(Internals.toReqlAst(obj));
}
public void coerceAndAddAll(Object[] args) {
@@ -52,7 +48,7 @@ public void coerceAndAddAll(Object[] args) {
}
}
- public void coerceAndAddAll(List args) {
+ public void coerceAndAddAll(List> args) {
args.forEach(this::coerceAndAdd);
}
}
diff --git a/src/main/java/com/rethinkdb/model/GroupedResult.java b/src/main/java/com/rethinkdb/model/GroupedResult.java
index a50ee793..c25c43d2 100644
--- a/src/main/java/com/rethinkdb/model/GroupedResult.java
+++ b/src/main/java/com/rethinkdb/model/GroupedResult.java
@@ -3,7 +3,11 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
public class GroupedResult {
private final G group;
@@ -22,4 +26,8 @@ public G getGroup() {
public List getValues() {
return values;
}
+
+ public static Map> toMap(List> list) {
+ return list.stream().collect(Collectors.toMap(GroupedResult::getGroup, it -> new LinkedHashSet<>(it.getValues())));
+ }
}
diff --git a/src/main/java/com/rethinkdb/model/OptArgs.java b/src/main/java/com/rethinkdb/model/OptArgs.java
index 3b9147dd..d2d4535e 100644
--- a/src/main/java/com/rethinkdb/model/OptArgs.java
+++ b/src/main/java/com/rethinkdb/model/OptArgs.java
@@ -1,7 +1,7 @@
package com.rethinkdb.model;
import com.rethinkdb.ast.ReqlAst;
-import com.rethinkdb.ast.Util;
+import com.rethinkdb.utils.Internals;
import java.util.LinkedHashMap;
import java.util.List;
@@ -10,14 +10,14 @@
public class OptArgs extends LinkedHashMap {
public OptArgs with(String key, Object value) {
if (key != null) {
- put(key, Util.toReqlAst(value));
+ put(key, Internals.toReqlAst(value));
}
return this;
}
public OptArgs with(String key, List value) {
if (key != null) {
- put(key, Util.toReqlAst(value));
+ put(key, Internals.toReqlAst(value));
}
return this;
}
diff --git a/src/main/java/com/rethinkdb/model/ReqlLambda.java b/src/main/java/com/rethinkdb/model/ReqlLambda.java
index 7bcbee44..3eacf5e5 100644
--- a/src/main/java/com/rethinkdb/model/ReqlLambda.java
+++ b/src/main/java/com/rethinkdb/model/ReqlLambda.java
@@ -1,5 +1,4 @@
package com.rethinkdb.model;
public interface ReqlLambda {
-
}
diff --git a/src/main/java/com/rethinkdb/net/Connection.java b/src/main/java/com/rethinkdb/net/Connection.java
index 9e8cf86f..cebc9550 100644
--- a/src/main/java/com/rethinkdb/net/Connection.java
+++ b/src/main/java/com/rethinkdb/net/Connection.java
@@ -10,6 +10,8 @@
import com.rethinkdb.model.Arguments;
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.model.Server;
+import com.rethinkdb.utils.Internals;
+import com.rethinkdb.utils.Types;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -181,11 +183,12 @@ public boolean isOpen() {
@Nullable TypeReference typeRef) {
try {
return runAsync(term, optArgs, fetchMode, typeRef).join();
- } catch (CompletionException e) {
- if (e.getCause() instanceof ReqlError) {
- throw ((ReqlError) e.getCause());
+ } catch (CompletionException ce) {
+ Throwable t = ce.getCause();
+ if (t instanceof ReqlError) {
+ throw ((ReqlError) t);
}
- throw e;
+ throw new ReqlDriverError(t);
}
}
@@ -197,7 +200,7 @@ public boolean isOpen() {
public @NotNull CompletableFuture serverAsync() {
return sendQuery(Query.createServerInfo(nextToken.incrementAndGet())).thenApply(res -> {
if (res.type.equals(ResponseType.SERVER_INFO)) {
- return Util.convertToPojo(res.data.get(0), new TypeReference() {});
+ return Internals.toPojo(res.data.get(0), Types.of(Server.class));
}
throw new ReqlDriverError("Did not receive a SERVER_INFO response.");
});
@@ -211,12 +214,12 @@ public boolean isOpen() {
public @NotNull Server server() {
try {
return serverAsync().join();
- } catch (
- CompletionException e) {
- if (e.getCause() instanceof ReqlError) {
- throw ((ReqlError) e.getCause());
+ } catch (CompletionException ce) {
+ Throwable t = ce.getCause();
+ if (t instanceof ReqlError) {
+ throw ((ReqlError) t);
}
- throw e;
+ throw new ReqlDriverError(t);
}
}
@@ -235,11 +238,12 @@ public boolean isOpen() {
public void noreplyWait() {
try {
noreplyWaitAsync().join();
- } catch (CompletionException e) {
- if (e.getCause() instanceof ReqlError) {
- throw ((ReqlError) e.getCause());
+ } catch (CompletionException ce) {
+ Throwable t = ce.getCause();
+ if (t instanceof ReqlError) {
+ throw ((ReqlError) t);
}
- throw e;
+ throw new ReqlDriverError(t);
}
}
@@ -396,7 +400,6 @@ protected void handleOptArgs(@NotNull OptArgs optArgs) {
// builder
-
/**
* Builder should be used to build a Connection instance.
*/
@@ -539,9 +542,8 @@ public Builder(@NotNull URI uri) {
return this;
}
- public @NotNull Builder certFile(@Nullable InputStream val) {
- sslContext = Crypto.readCertFile(val);
- return this;
+ public @NotNull Builder certFile(@NotNull InputStream val) {
+ return sslContext(Internals.readCertFile(val));
}
public @NotNull Builder sslContext(@Nullable SSLContext val) {
diff --git a/src/main/java/com/rethinkdb/net/Converter.java b/src/main/java/com/rethinkdb/net/Converter.java
deleted file mode 100644
index 538fc2cd..00000000
--- a/src/main/java/com/rethinkdb/net/Converter.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package com.rethinkdb.net;
-
-
-import com.rethinkdb.gen.ast.Datum;
-import com.rethinkdb.gen.exc.ReqlDriverError;
-import com.rethinkdb.model.GroupedResult;
-import com.rethinkdb.model.MapObject;
-import com.rethinkdb.model.OptArgs;
-
-import java.time.Instant;
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
-import java.util.*;
-import java.util.stream.Collectors;
-
-public class Converter {
- private static final Base64.Decoder b64decoder = Base64.getMimeDecoder();
- private static final Base64.Encoder b64encoder = Base64.getMimeEncoder();
-
- public static final String PSEUDOTYPE_KEY = "$reql_type$";
-
- public static final String TIME = "TIME";
- public static final String GROUPED_DATA = "GROUPED_DATA";
- public static final String GEOMETRY = "GEOMETRY";
- public static final String BINARY = "BINARY";
-
- /* Compact way of keeping these flags around through multiple recursive
- passes */
- public static class FormatOptions{
- public final boolean rawTime;
- public final boolean rawGroups;
- public final boolean rawBinary;
-
- public FormatOptions(OptArgs args){
- this.rawTime = ((Datum)args.getOrDefault("time_format",
- new Datum("native"))).datum.equals("raw");
- this.rawBinary = ((Datum)args.getOrDefault("binary_format",
- new Datum("native"))).datum.equals("raw");
- this.rawGroups = ((Datum)args.getOrDefault("group_format",
- new Datum("native"))).datum.equals("raw");
- }
- }
-
- @SuppressWarnings("unchecked")
- public static Object convertPseudotypes(Object obj, FormatOptions fmt){
- if(obj instanceof List) {
- return ((List) obj).stream()
- .map(item -> convertPseudotypes(item, fmt))
- .collect(Collectors.toList());
- } else if(obj instanceof Map) {
- Map mapobj = (Map) obj;
- if(mapobj.containsKey(PSEUDOTYPE_KEY)){
- return convertPseudo(mapobj, fmt);
- }
- return mapobj.entrySet().stream()
- .collect(
- LinkedHashMap::new,
- (map, entry) -> map.put(
- entry.getKey(),
- convertPseudotypes(entry.getValue(), fmt)
- ),
- LinkedHashMap::putAll
- );
- } else {
- return obj;
- }
- }
-
- public static Object convertPseudo(Map value, FormatOptions fmt) {
- if(value == null){
- return null;
- }
- String reqlType = (String) value.get(PSEUDOTYPE_KEY);
- switch (reqlType) {
- case TIME:
- return fmt.rawTime ? value : getTime(value);
- case GROUPED_DATA:
- return fmt.rawGroups ? value : getGrouped(value);
- case BINARY:
- return fmt.rawBinary ? value : getBinary(value);
- case GEOMETRY:
- // Nothing specific here
- return value;
- default:
- // Just leave unknown pseudo-types alone
- return value;
- }
- }
-
- @SuppressWarnings("unchecked")
- private static List> getGrouped(Map value) {
- return ((List>) value.get("data")).stream()
- .map(g -> new GroupedResult<>(g.remove(0), g))
- .collect(Collectors.toList());
- }
-
- private static OffsetDateTime getTime(Map obj) {
- try {
- ZoneOffset offset = ZoneOffset.of((String) obj.get("timezone"));
- double epochTime = ((Number) obj.get("epoch_time")).doubleValue();
- Instant timeInstant = Instant.ofEpochMilli(((Double) (epochTime * 1000.0)).longValue());
- return OffsetDateTime.ofInstant(timeInstant, offset);
- } catch (Exception ex) {
- throw new ReqlDriverError("Error handling date", ex);
- }
- }
-
- private static byte[] getBinary(Map value) {
- return b64decoder.decode((String) value.get("data"));
- }
-
- public static Map toBinary(byte[] data){
- return new MapObject()
- .with("$reql_type$", BINARY)
- .with("data", b64encoder.encodeToString(data));
- }
-}
diff --git a/src/main/java/com/rethinkdb/net/Crypto.java b/src/main/java/com/rethinkdb/net/Crypto.java
deleted file mode 100644
index 6a2e4eee..00000000
--- a/src/main/java/com/rethinkdb/net/Crypto.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package com.rethinkdb.net;
-
-import com.rethinkdb.gen.exc.ReqlDriverError;
-import org.jetbrains.annotations.Nullable;
-
-import javax.crypto.Mac;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.SecretKeySpec;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManagerFactory;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.security.*;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.security.spec.InvalidKeySpecException;
-import java.util.Arrays;
-import java.util.Base64;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-class Crypto {
- private static final String DEFAULT_SSL_PROTOCOL = "TLSv1.2";
- private static final String HMAC_SHA_256 = "HmacSHA256";
- private static final String PBKDF2_ALGORITHM = "PBKDF2WithHmacSHA256";
-
- private static final Base64.Encoder encoder = Base64.getEncoder();
- private static final Base64.Decoder decoder = Base64.getDecoder();
- private static final SecureRandom secureRandom = new SecureRandom();
- private static final Map pbkdf2Cache = new ConcurrentHashMap<>();
- private static final int NONCE_BYTES = 18;
-
- private static class PasswordLookup {
- final byte[] password;
- final byte[] salt;
- final int iterations;
-
- PasswordLookup(byte[] password, byte[] salt, int iterations) {
- this.password = password;
- this.salt = salt;
- this.iterations = iterations;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- PasswordLookup that = (PasswordLookup) o;
-
- if (iterations != that.iterations) return false;
- if (!Arrays.equals(password, that.password)) return false;
- return Arrays.equals(salt, that.salt);
-
- }
-
- @Override
- public int hashCode() {
- int result = Arrays.hashCode(password);
- result = 31 * result + Arrays.hashCode(salt);
- result = 31 * result + iterations;
- return result;
- }
- }
-
- private static byte[] cacheLookup(byte[] password, byte[] salt, int iterations) {
- return pbkdf2Cache.get(new PasswordLookup(password, salt, iterations));
- }
-
- private static void setCache(byte[] password, byte[] salt, int iterations, byte[] result) {
- pbkdf2Cache.put(new PasswordLookup(password, salt, iterations), result);
- }
-
- static byte[] sha256(byte[] clientKey) {
- try {
- MessageDigest digest = MessageDigest.getInstance("SHA-256");
- return digest.digest(clientKey);
- } catch (NoSuchAlgorithmException e) {
- throw new ReqlDriverError(e);
- }
- }
-
- static byte[] hmac(byte[] key, String string) {
- try {
- Mac mac = Mac.getInstance(HMAC_SHA_256);
- SecretKeySpec secretKey = new SecretKeySpec(key, HMAC_SHA_256);
- mac.init(secretKey);
- return mac.doFinal(string.getBytes(StandardCharsets.UTF_8));
- } catch (InvalidKeyException | NoSuchAlgorithmException e) {
- throw new ReqlDriverError(e);
- }
- }
-
- static byte[] pbkdf2(byte[] password, byte[] salt, Integer iterationCount) {
- final byte[] cachedValue = cacheLookup(password, salt, iterationCount);
- if (cachedValue != null) {
- return cachedValue;
- }
- final PBEKeySpec spec = new PBEKeySpec(
- new String(password, StandardCharsets.UTF_8).toCharArray(),
- salt, iterationCount, 256
- );
- final SecretKeyFactory skf;
- try {
- skf = SecretKeyFactory.getInstance(PBKDF2_ALGORITHM);
- final byte[] calculatedValue = skf.generateSecret(spec).getEncoded();
- setCache(password, salt, iterationCount, calculatedValue);
- return calculatedValue;
- } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
- throw new ReqlDriverError(e);
- }
- }
-
- static String makeNonce() {
- byte[] rawNonce = new byte[NONCE_BYTES];
- secureRandom.nextBytes(rawNonce);
- return toBase64(rawNonce);
- }
-
- static byte[] xor(byte[] a, byte[] b) {
- if (a.length != b.length) {
- throw new ReqlDriverError("arrays must be the same length");
- }
- byte[] result = new byte[a.length];
- for (int i = 0; i < result.length; i++) {
- result[i] = (byte) (a[i] ^ b[i]);
- }
- return result;
- }
-
- static String toBase64(byte[] bytes) {
- return new String(encoder.encode(bytes), StandardCharsets.UTF_8);
- }
-
- static byte[] fromBase64(String string) {
- return decoder.decode(string);
- }
-
- static SSLContext readCertFile(@Nullable InputStream certFile) {
- try {
- final CertificateFactory cf = CertificateFactory.getInstance("X.509");
- final X509Certificate caCert = (X509Certificate) cf.generateCertificate(certFile);
-
- final TrustManagerFactory tmf = TrustManagerFactory
- .getInstance(TrustManagerFactory.getDefaultAlgorithm());
- KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
- ks.load(null); // You don't need the KeyStore instance to come from a file.
- ks.setCertificateEntry("caCert", caCert);
- tmf.init(ks);
-
- final SSLContext ssc = SSLContext.getInstance(DEFAULT_SSL_PROTOCOL);
- ssc.init(null, tmf.getTrustManagers(), null);
- return ssc;
- } catch (IOException | CertificateException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {
- throw new ReqlDriverError(e);
- }
- }
-}
diff --git a/src/main/java/com/rethinkdb/net/DefaultConnectionFactory.java b/src/main/java/com/rethinkdb/net/DefaultConnectionFactory.java
index 674a4f9d..32b3b28a 100644
--- a/src/main/java/com/rethinkdb/net/DefaultConnectionFactory.java
+++ b/src/main/java/com/rethinkdb/net/DefaultConnectionFactory.java
@@ -106,25 +106,30 @@ public void write(@NotNull ByteBuffer buffer) {
@Override
public @NotNull String readCString(@Nullable Long deadline) {
- try {
- final StringBuilder sb = new StringBuilder();
- int next;
- char c;
- while ((next = inputStream.read()) != -1 && (c = (char) next) != '\0') {
- // is there a deadline?
- if (deadline != null) {
- // have we timed-out?
- if (deadline < System.currentTimeMillis()) { // reached time-out
- throw new ReqlDriverError("Connection timed out.");
- }
+ Long timeout = deadline == null ? null : System.currentTimeMillis() + deadline;
+ final StringBuilder b = new StringBuilder();
+ int has;
+ int next;
+ char c;
+ while (timeout == null || System.currentTimeMillis() < timeout) {
+ try {
+ has = inputStream.available();
+ if (has < 0) {
+ break;
+ }
+ if (has == 0) {
+ Thread.yield();
+ continue;
}
- sb.append(c);
+ if ((next = inputStream.read()) == -1 || (c = (char) next) == '\0') {
+ return b.toString();
+ }
+ } catch (IOException e) {
+ throw new ReqlDriverError(e);
}
-
- return sb.toString();
- } catch (IOException e) {
- throw new ReqlDriverError(e);
+ b.append(c);
}
+ throw new ReqlDriverError("Read timed out.");
}
@Override
@@ -231,5 +236,10 @@ private void shutdown(Exception e) {
public void shutdownPump() {
shutdown(new ReqlDriverError("Response pump closed."));
}
+
+ @Override
+ public String toString() {
+ return "ThreadResponsePump";
+ }
}
}
diff --git a/src/main/java/com/rethinkdb/net/HandshakeProtocol.java b/src/main/java/com/rethinkdb/net/HandshakeProtocol.java
index d01b3a18..b272649a 100644
--- a/src/main/java/com/rethinkdb/net/HandshakeProtocol.java
+++ b/src/main/java/com/rethinkdb/net/HandshakeProtocol.java
@@ -1,25 +1,33 @@
package com.rethinkdb.net;
-import com.rethinkdb.gen.ast.Wait;
import com.rethinkdb.gen.exc.ReqlAuthError;
import com.rethinkdb.gen.exc.ReqlDriverError;
import com.rethinkdb.gen.proto.Protocol;
import com.rethinkdb.gen.proto.Version;
+import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.Nullable;
+import javax.crypto.Mac;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.SecretKeySpec;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
import java.security.MessageDigest;
-import java.util.Map;
-
-import static com.rethinkdb.net.Crypto.*;
-import static com.rethinkdb.net.Util.readJSON;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.spec.InvalidKeySpecException;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Internal class used by {@link Connection#connect()} to do a proper handshake with the server.
*/
-abstract class HandshakeProtocol {
+class HandshakeProtocol {
+ private static final HandshakeProtocol FINISHED = new HandshakeProtocol();
+
public static final Version VERSION = Version.V1_0;
public static final Long SUB_PROTOCOL_VERSION = 0L;
public static final Protocol PROTOCOL = Protocol.JSON;
@@ -27,12 +35,15 @@ abstract class HandshakeProtocol {
public static final String CLIENT_KEY = "Client Key";
public static final String SERVER_KEY = "Server Key";
+ private HandshakeProtocol() {
+ }
+
static void doHandshake(ConnectionSocket socket, String username, String password, Long timeout) {
// initialize handshake
HandshakeProtocol handshake = new WaitingForProtocolRange(username, password);
// Sit in the handshake until it's completed. Exceptions will be thrown if
// anything goes wrong.
- while (!handshake.isFinished()) {
+ while (handshake != FINISHED) {
ByteBuffer toWrite = handshake.toSend();
if (toWrite != null) {
socket.write(toWrite);
@@ -41,15 +52,14 @@ static void doHandshake(ConnectionSocket socket, String username, String passwor
}
}
- private HandshakeProtocol() {
- }
-
- protected abstract HandshakeProtocol nextState(String response);
-
@Nullable
- protected abstract ByteBuffer toSend();
+ protected ByteBuffer toSend() {
+ throw new IllegalStateException();
+ }
- protected abstract boolean isFinished();
+ protected HandshakeProtocol nextState(String response) {
+ throw new IllegalStateException();
+ }
private static void throwIfFailure(Map json) {
if (!(boolean) json.get("success")) {
@@ -63,19 +73,23 @@ private static void throwIfFailure(Map json) {
}
static class WaitingForProtocolRange extends HandshakeProtocol {
+ private static final SecureRandom secureRandom = new SecureRandom();
+ private static final int NONCE_BYTES = 18;
+
private final String nonce;
- private final ByteBuffer message;
private final ScramAttributes clientFirstMessageBare;
private final byte[] password;
WaitingForProtocolRange(String username, String password) {
this.password = password.getBytes(StandardCharsets.UTF_8);
this.nonce = makeNonce();
-
- // We could use a json serializer, but it's fairly straightforward
this.clientFirstMessageBare = new ScramAttributes()
.username(username)
.nonce(nonce);
+ }
+
+ @Override
+ public ByteBuffer toSend() {
byte[] jsonBytes = ("{" +
"\"protocol_version\":" + SUB_PROTOCOL_VERSION + "," +
"\"authentication_method\":\"SCRAM-SHA-256\"," +
@@ -84,39 +98,32 @@ static class WaitingForProtocolRange extends HandshakeProtocol {
// Creating the ByteBuffer over an underlying array makes
// it easier to turn into a string later.
//return ByteBuffer.wrap(new byte[capacity]).order(ByteOrder.LITTLE_ENDIAN);
- // size of VERSION
- // json auth payload
- // terminating null byte
- this.message = ByteBuffer.allocate(Integer.BYTES + // size of VERSION
- jsonBytes.length + // json auth payload
- 1).order(ByteOrder.LITTLE_ENDIAN).putInt(VERSION.value)
+ // size of VERSION + json auth payload + terminating null byte
+ return ByteBuffer.allocate(Integer.BYTES + jsonBytes.length + 1)
+ .order(ByteOrder.LITTLE_ENDIAN)
+ .putInt(VERSION.value)
.put(jsonBytes)
.put(new byte[1]);
}
@Override
public HandshakeProtocol nextState(String response) {
- Map json = Util.readJSON(response);
+ Map json = Internals.readJson(response);
throwIfFailure(json);
long minVersion = (long) json.get("min_protocol_version");
long maxVersion = (long) json.get("max_protocol_version");
if (SUB_PROTOCOL_VERSION < minVersion || SUB_PROTOCOL_VERSION > maxVersion) {
- throw new ReqlDriverError(
- "Unsupported protocol version " + SUB_PROTOCOL_VERSION +
- ", expected between " + minVersion + " and " + maxVersion);
+ throw new ReqlDriverError("Unsupported protocol version " + SUB_PROTOCOL_VERSION + ", expected between " + minVersion + " and " + maxVersion);
}
return new WaitingForAuthResponse(nonce, password, clientFirstMessageBare);
}
- @Override
- public ByteBuffer toSend() {
- return message;
+ static String makeNonce() {
+ byte[] rawNonce = new byte[NONCE_BYTES];
+ secureRandom.nextBytes(rawNonce);
+ return Base64.getEncoder().encodeToString(rawNonce);
}
- @Override
- public boolean isFinished() {
- return false;
- }
}
static class WaitingForAuthResponse extends HandshakeProtocol {
@@ -131,116 +138,152 @@ static class WaitingForAuthResponse extends HandshakeProtocol {
this.clientFirstMessageBare = clientFirstMessageBare;
}
+ @Override
+ public ByteBuffer toSend() {
+ return null;
+ }
+
@Override
public HandshakeProtocol nextState(String response) {
- Map json = Util.readJSON(response);
+ Map json = Internals.readJson(response);
throwIfFailure(json);
- String serverFirstMessage = (String) json.get("authentication");
- ScramAttributes serverAuth = ScramAttributes.from(serverFirstMessage);
- if (!serverAuth.nonce().startsWith(nonce)) {
+ ScramAttributes serverScram = ScramAttributes.from((String) json.get("authentication"));
+ if (!Objects.requireNonNull(serverScram._nonce).startsWith(nonce)) {
throw new ReqlAuthError("Invalid nonce from server");
}
- ScramAttributes clientFinalMessageWithoutProof = new ScramAttributes()
+ ScramAttributes clientScram = new ScramAttributes()
.headerAndChannelBinding("biws")
- .nonce(serverAuth.nonce());
+ .nonce(serverScram._nonce);
// SaltedPassword := Hi(Normalize(password), salt, i)
- byte[] saltedPassword = pbkdf2(
- password, serverAuth.salt(), serverAuth.iterationCount());
-
// ClientKey := HMAC(SaltedPassword, "Client Key")
- byte[] clientKey = hmac(saltedPassword, CLIENT_KEY);
-
// StoredKey := H(ClientKey)
+ byte[] saltedPassword = PBKDF2.compute(password, serverScram._salt, serverScram._iterationCount);
+ byte[] clientKey = hmac(saltedPassword, CLIENT_KEY);
byte[] storedKey = sha256(clientKey);
// AuthMessage := client-first-message-bare + "," +
// server-first-message + "," +
// client-final-message-without-proof
- String authMessage =
- clientFirstMessageBare + "," +
- serverFirstMessage + "," +
- clientFinalMessageWithoutProof;
+ String authMessage = clientFirstMessageBare + "," + serverScram + "," + clientScram;
// ClientSignature := HMAC(StoredKey, AuthMessage)
- byte[] clientSignature = hmac(storedKey, authMessage);
-
// ClientProof := ClientKey XOR ClientSignature
- byte[] clientProof = xor(clientKey, clientSignature);
-
// ServerKey := HMAC(SaltedPassword, "Server Key")
- byte[] serverKey = hmac(saltedPassword, SERVER_KEY);
-
// ServerSignature := HMAC(ServerKey, AuthMessage)
+ byte[] clientSignature = hmac(storedKey, authMessage);
+ byte[] clientProof = xor(clientKey, clientSignature);
+ byte[] serverKey = hmac(saltedPassword, SERVER_KEY);
byte[] serverSignature = hmac(serverKey, authMessage);
- ScramAttributes auth = clientFinalMessageWithoutProof
- .clientProof(clientProof);
- byte[] authJson = ("{\"authentication\":\"" + auth + "\"}").getBytes(StandardCharsets.UTF_8);
-
- ByteBuffer message = ByteBuffer.allocate(authJson.length + 1).order(ByteOrder.LITTLE_ENDIAN)
- .put(authJson)
- .put(new byte[1]);
- return new WaitingForAuthSuccess(serverSignature, message);
+ return new WaitingForAuthSuccess(serverSignature, clientScram.clientProof(clientProof));
}
- @Override
- public ByteBuffer toSend() {
- return null;
+ static byte[] sha256(byte[] clientKey) {
+ try {
+ return MessageDigest.getInstance("SHA-256").digest(clientKey);
+ } catch (NoSuchAlgorithmException e) {
+ throw new ReqlDriverError(e);
+ }
}
- @Override
- public boolean isFinished() {
- return false;
+ static byte[] hmac(byte[] key, String string) {
+ try {
+ Mac mac = Mac.getInstance("HmacSHA256");
+ mac.init(new SecretKeySpec(key, "HmacSHA256"));
+ return mac.doFinal(string.getBytes(StandardCharsets.UTF_8));
+ } catch (InvalidKeyException | NoSuchAlgorithmException e) {
+ throw new ReqlDriverError(e);
+ }
}
- }
- static class HandshakeSuccess extends HandshakeProtocol {
- @Override
- public HandshakeProtocol nextState(String response) {
- return this;
+ static byte[] xor(byte[] a, byte[] b) {
+ if (a.length != b.length) {
+ throw new ReqlDriverError("arrays must be the same length");
+ }
+ byte[] result = new byte[a.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = (byte) (a[i] ^ b[i]);
+ }
+ return result;
}
- @Override
- public ByteBuffer toSend() {
- return null;
- }
+ private static class PBKDF2 {
+ static byte[] compute(byte[] password, byte[] salt, Integer iterationCount) {
+ return cache.computeIfAbsent(new PBKDF2(password, salt, iterationCount), PBKDF2::compute);
+ }
- @Override
- public boolean isFinished() {
- return true;
+ private static final Map cache = new ConcurrentHashMap<>();
+
+ final byte[] password;
+ final byte[] salt;
+ final int iterations;
+
+ PBKDF2(byte[] password, byte[] salt, int iterations) {
+ this.password = password;
+ this.salt = salt;
+ this.iterations = iterations;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ PBKDF2 that = (PBKDF2) o;
+
+ if (iterations != that.iterations) return false;
+ if (!Arrays.equals(password, that.password)) return false;
+ return Arrays.equals(salt, that.salt);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = Arrays.hashCode(password);
+ result = 31 * result + Arrays.hashCode(salt);
+ result = 31 * result + iterations;
+ return result;
+ }
+
+ public byte[] compute() {
+ final PBEKeySpec spec = new PBEKeySpec(
+ new String(password, StandardCharsets.UTF_8).toCharArray(),
+ salt, iterations, 256
+ );
+ try {
+ return SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(spec).getEncoded();
+ } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
+ throw new ReqlDriverError(e);
+ }
+ }
}
}
static class WaitingForAuthSuccess extends HandshakeProtocol {
private final byte[] serverSignature;
- private final ByteBuffer message;
+ private final ScramAttributes auth;
- public WaitingForAuthSuccess(byte[] serverSignature, ByteBuffer message) {
+ public WaitingForAuthSuccess(byte[] serverSignature, ScramAttributes auth) {
this.serverSignature = serverSignature;
- this.message = message;
- }
-
- @Override
- public HandshakeProtocol nextState(String response) {
- Map json = Util.readJSON(response);
- throwIfFailure(json);
- ScramAttributes auth = ScramAttributes
- .from((String) json.get("authentication"));
- if (!MessageDigest.isEqual(auth.serverSignature(), serverSignature)) {
- throw new ReqlAuthError("Invalid server signature");
- }
- return new HandshakeSuccess();
+ this.auth = auth;
}
@Override
public ByteBuffer toSend() {
- return message;
+ byte[] authJson = ("{\"authentication\":\"" + auth + "\"}").getBytes(StandardCharsets.UTF_8);
+ return ByteBuffer.allocate(authJson.length + 1).order(ByteOrder.LITTLE_ENDIAN)
+ .put(authJson)
+ .put(new byte[1]);
}
@Override
- public boolean isFinished() {
- return false;
+ public HandshakeProtocol nextState(String response) {
+ Map json = Internals.readJson(response);
+ throwIfFailure(json);
+ ScramAttributes auth = ScramAttributes.from((String) json.get("authentication"));
+ if (!MessageDigest.isEqual(auth._serverSignature, serverSignature)) {
+ throw new ReqlAuthError("Invalid server signature");
+ }
+ return FINISHED;
}
}
@@ -300,7 +343,7 @@ private void setAttribute(String key, String val) {
_headerAndChannelBinding = val;
break;
case "s":
- _salt = Crypto.fromBase64(val);
+ _salt = Base64.getDecoder().decode(val);
break;
case "i":
_iterationCount = Integer.parseInt(val);
@@ -309,7 +352,7 @@ private void setAttribute(String key, String val) {
_clientProof = val;
break;
case "v":
- _serverSignature = Crypto.fromBase64(val);
+ _serverSignature = Base64.getDecoder().decode(val);
break;
case "e":
_error = val;
@@ -323,24 +366,20 @@ public String toString() {
if (_originalString != null) {
return _originalString;
}
- String output = "";
+ StringJoiner j = new StringJoiner(",");
if (_username != null) {
- output += ",n=" + _username;
+ j.add("n=" + _username);
}
if (_nonce != null) {
- output += ",r=" + _nonce;
+ j.add("r=" + _nonce);
}
if (_headerAndChannelBinding != null) {
- output += ",c=" + _headerAndChannelBinding;
+ j.add("c=" + _headerAndChannelBinding);
}
if (_clientProof != null) {
- output += ",p=" + _clientProof;
- }
- if (output.startsWith(",")) {
- return output.substring(1);
- } else {
- return output;
+ j.add("p=" + _clientProof);
}
+ return j.toString();
}
// Setters with coercion
@@ -364,45 +403,8 @@ ScramAttributes headerAndChannelBinding(String hacb) {
ScramAttributes clientProof(byte[] clientProof) {
ScramAttributes next = ScramAttributes.from(this);
- next._clientProof = Crypto.toBase64(clientProof);
+ next._clientProof = Base64.getEncoder().encodeToString(clientProof);
return next;
}
-
- // Getters
- String authIdentity() {
- return _authIdentity;
- }
-
- String username() {
- return _username;
- }
-
- String nonce() {
- return _nonce;
- }
-
- String headerAndChannelBinding() {
- return _headerAndChannelBinding;
- }
-
- byte[] salt() {
- return _salt;
- }
-
- Integer iterationCount() {
- return _iterationCount;
- }
-
- String clientProof() {
- return _clientProof;
- }
-
- byte[] serverSignature() {
- return _serverSignature;
- }
-
- String error() {
- return _error;
- }
}
}
diff --git a/src/main/java/com/rethinkdb/net/Response.java b/src/main/java/com/rethinkdb/net/Response.java
index 311c3b02..2f7f3b0d 100644
--- a/src/main/java/com/rethinkdb/net/Response.java
+++ b/src/main/java/com/rethinkdb/net/Response.java
@@ -8,6 +8,7 @@
import com.rethinkdb.gen.proto.ResponseType;
import com.rethinkdb.model.Backtrace;
import com.rethinkdb.model.Profile;
+import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -99,7 +100,7 @@ public static Response readFromSocket(ConnectionSocket socket) {
);
}
- Map json = Util.readJSON(buffer);
+ Map json = Internals.readJson(buffer);
return new Response(
token,
ResponseType.fromValue(((Long) json.get("t")).intValue()),
diff --git a/src/main/java/com/rethinkdb/net/Result.java b/src/main/java/com/rethinkdb/net/Result.java
index f7f02cd4..e5f150e1 100644
--- a/src/main/java/com/rethinkdb/net/Result.java
+++ b/src/main/java/com/rethinkdb/net/Result.java
@@ -7,6 +7,7 @@
import com.rethinkdb.gen.exc.ReqlRuntimeError;
import com.rethinkdb.gen.proto.ResponseType;
import com.rethinkdb.model.Profile;
+import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -83,7 +84,7 @@ public enum FetchMode {
protected final Query query;
protected final Response firstRes;
protected final TypeReference typeRef;
- protected final Converter.FormatOptions fmt;
+ protected final Internals.FormatOptions fmt;
// can be altered depending on the operation
protected FetchMode fetchMode;
@@ -107,7 +108,7 @@ public Result(Connection connection,
this.firstRes = firstRes;
this.fetchMode = fetchMode;
this.typeRef = typeRef;
- fmt = new Converter.FormatOptions(query.globalOptions);
+ fmt = new Internals.FormatOptions(query.globalOptions);
currentResponse.set(firstRes);
handleFirstResponse();
}
@@ -240,7 +241,7 @@ public boolean hasNext() {
if (next == NIL) {
return null;
}
- return Util.convertToPojo(next, typeRef);
+ return Internals.toPojo(next, typeRef);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@@ -260,7 +261,7 @@ public boolean hasNext() {
if (next == NIL) {
return null;
}
- return Util.convertToPojo(next, typeRef);
+ return Internals.toPojo(next, typeRef);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@@ -281,7 +282,7 @@ public boolean hasNext() {
if (next == NIL) {
return null;
}
- return Util.convertToPojo(next, typeRef);
+ return Internals.toPojo(next, typeRef);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
@@ -308,7 +309,7 @@ public boolean hasNext() {
if (next == NIL) {
return null;
}
- return Util.convertToPojo(next, typeRef);
+ return Internals.toPojo(next, typeRef);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
@@ -549,8 +550,7 @@ protected void emitData(Response res) {
}
}
lastRequestCount.set(0);
- List> objects = (List>) Converter.convertPseudotypes(res.data, fmt);
- for (Object each : objects) {
+ for (Object each : (List>) Internals.convertPseudotypes(res.data, fmt)) {
if (connection.unwrapLists && firstRes.type.equals(ResponseType.SUCCESS_ATOM) && each instanceof List) {
for (Object o : ((List>) each)) {
rawQueue.offer(o == null ? NIL : o);
diff --git a/src/main/java/com/rethinkdb/net/Util.java b/src/main/java/com/rethinkdb/net/Util.java
deleted file mode 100644
index 32c35126..00000000
--- a/src/main/java/com/rethinkdb/net/Util.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.rethinkdb.net;
-
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JavaType;
-import com.rethinkdb.RethinkDB;
-import com.rethinkdb.gen.exc.ReqlDriverError;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.time.OffsetDateTime;
-import java.util.*;
-
-public class Util {
- private static final TypeReference> mapTypeRef = new TypeReference>() {};
-
- private Util() {}
-
- public static Map readJSON(String str) {
- try {
- return RethinkDB.getInternalMapper().readValue(str, mapTypeRef);
- } catch (IOException e) {
- throw new ReqlDriverError(e);
- }
- }
-
- public static Map readJSON(ByteBuffer buf) {
- try {
- return RethinkDB.getInternalMapper().readValue(
- buf.array(),
- buf.arrayOffset() + buf.position(),
- buf.remaining(),
- mapTypeRef
- );
- } catch (IOException e) {
- throw new ReqlDriverError(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- public static T convertToPojo(Object value, TypeReference typeRef) {
- if (typeRef != null) {
- JavaType type = RethinkDB.getInternalMapper().getTypeFactory().constructType(typeRef);
- Class rawClass = (Class) type.getRawClass();
- if (rawClass.isEnum()) {
- Enum>[] enumConstants = ((Class>) rawClass).getEnumConstants();
- for (Enum> enumConst : enumConstants) {
- if (enumConst.name().equals(value)) {
- return (T) enumConst;
- }
- }
- } else if (rawClass.isAssignableFrom(value.getClass()) && type.containedTypeCount() == 0) {
- // class is assignable from value and has no type parameters.
- // since the only thing that matches those are primitives, strings and dates, it's safe
- return rawClass.cast(value);
- } else {
- try {
- return RethinkDB.getResultMapper().convertValue(value, typeRef);
- } catch (Exception e) {
- throw new ReqlDriverError("Tried to convert " + value + ", of type " + value.getClass() + ", to " + typeRef.getType() + ", but got " + e, e);
- }
- }
- }
- return (T) value;
- }
-}
-
-
-
diff --git a/src/main/java/com/rethinkdb/utils/Internals.java b/src/main/java/com/rethinkdb/utils/Internals.java
new file mode 100644
index 00000000..b42a9dc6
--- /dev/null
+++ b/src/main/java/com/rethinkdb/utils/Internals.java
@@ -0,0 +1,291 @@
+package com.rethinkdb.utils;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.rethinkdb.RethinkDB;
+import com.rethinkdb.ast.ReqlAst;
+import com.rethinkdb.gen.ast.*;
+import com.rethinkdb.gen.exc.ReqlDriverCompileError;
+import com.rethinkdb.gen.exc.ReqlDriverError;
+import com.rethinkdb.model.*;
+import org.jetbrains.annotations.NotNull;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Array;
+import java.nio.ByteBuffer;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.Temporal;
+import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * RethinkDB Common Internals.
+ * Methods and fields are subject to change at any moment.
+ */
+public class Internals {
+ private static final String DEFAULT_SSL_PROTOCOL = "TLSv1.2";
+ private static final TypeReference> mapTypeRef = Types.mapOf(String.class, Object.class);
+ private static final ObjectMapper internalMapper = new ObjectMapper()
+ .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.USE_LONG_FOR_INTS);
+ private static final DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX");
+
+
+ public static final String PSEUDOTYPE_KEY = "$reql_type$";
+ public static final String TIME = "TIME";
+ public static final String GROUPED_DATA = "GROUPED_DATA";
+ public static final String GEOMETRY = "GEOMETRY";
+ public static final String BINARY = "BINARY";
+
+ public static int startingDepth = 100;
+
+ private Internals() {
+ }
+
+ public static ObjectMapper getInternalMapper() {
+ return internalMapper;
+ }
+
+ public static Map asBinaryPseudotype(byte[] data) {
+ return new MapObject()
+ .with("$reql_type$", BINARY)
+ .with("data", Base64.getEncoder().encodeToString(data));
+ }
+
+ public static Map readJson(ByteBuffer buf) {
+ try {
+ return getInternalMapper().readValue(
+ buf.array(),
+ buf.arrayOffset() + buf.position(),
+ buf.remaining(),
+ mapTypeRef
+ );
+ } catch (IOException e) {
+ throw new ReqlDriverError(e);
+ }
+ }
+
+ public static Map readJson(String str) {
+ try {
+ return getInternalMapper().readValue(str, mapTypeRef);
+ } catch (IOException e) {
+ throw new ReqlDriverError(e);
+ }
+ }
+
+ public static Object convertPseudotypes(Object obj, FormatOptions fmt) {
+ if (obj instanceof List) {
+ return ((List>) obj).stream()
+ .map(item -> convertPseudotypes(item, fmt))
+ .collect(Collectors.toList());
+ }
+ if (obj instanceof Map) {
+ Map, ?> map = (Map, ?>) obj;
+ if (map.containsKey(PSEUDOTYPE_KEY)) {
+ return handlePseudotypes(map, fmt);
+ }
+ return map.entrySet().stream().collect(
+ LinkedHashMap::new,
+ (m, e) -> m.put(e.getKey(), convertPseudotypes(e.getValue(), fmt)),
+ LinkedHashMap::putAll
+ );
+ }
+ return obj;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static T toPojo(Object value, TypeReference typeRef) {
+ if (typeRef != null) {
+ JavaType type = getInternalMapper().getTypeFactory().constructType(typeRef);
+ Class rawClass = (Class) type.getRawClass();
+ if (rawClass.isEnum()) {
+ Enum>[] enumConstants = ((Class>) rawClass).getEnumConstants();
+ for (Enum> enumConst : enumConstants) {
+ if (enumConst.name().equals(value)) {
+ return (T) enumConst;
+ }
+ }
+ } else if (rawClass.isAssignableFrom(value.getClass()) && type.containedTypeCount() == 0) {
+ // class is assignable from value and has no type parameters.
+ // since the only thing that matches those are primitives, strings and dates, it's safe
+ return rawClass.cast(value);
+ } else {
+ try {
+ return RethinkDB.getResultMapper().convertValue(value, typeRef);
+ } catch (Exception e) {
+ throw new ReqlDriverError("Tried to convert " + value + ", of type " + value.getClass() + ", to " + typeRef.getType() + ", but got " + e, e);
+ }
+ }
+ }
+ return (T) value;
+ }
+
+ public static ReqlAst toReqlAst(Object val) {
+ return toReqlAst(val, startingDepth);
+ }
+
+ public static ReqlExpr toReqlExpr(Object val) {
+ ReqlAst converted = toReqlAst(val);
+ if (converted instanceof ReqlExpr) {
+ return (ReqlExpr) converted;
+ } else {
+ throw new ReqlDriverError("Cannot convert %s to ReqlExpr", val);
+ }
+ }
+
+ private static Object handlePseudotypes(Map, ?> value, FormatOptions fmt) {
+ switch ((String) value.get(PSEUDOTYPE_KEY)) {
+ case TIME: {
+ if (fmt.rawTime) {
+ return value;
+ }
+ try {
+ long epochMillis = (long) (((Number) value.get("epoch_time")).doubleValue() * 1000.0);
+ return OffsetDateTime.ofInstant(Instant.ofEpochMilli(epochMillis), ZoneOffset.of((String) value.get("timezone")));
+ } catch (Exception ex) {
+ throw new ReqlDriverError("Error handling date", ex);
+ }
+ }
+ case GROUPED_DATA: {
+ if (fmt.rawGroups) {
+ return value;
+ }
+ return ((List>) value.get("data")).stream()
+ .map(it -> new ArrayList<>((Collection>) it))
+ .map(it -> new GroupedResult<>(it.remove(0), it))
+ .collect(Collectors.toList());
+ }
+ case BINARY: {
+ if (fmt.rawBinary) {
+ return value;
+ }
+ return Base64.getMimeDecoder().decode((String) value.get("data"));
+ }
+ case GEOMETRY: {
+ // Nothing specific here
+ return value;
+ }
+ }
+ return value;
+ }
+
+ private static ReqlAst toReqlAst(Object val, int remainingDepth) {
+ if (val instanceof ReqlAst) {
+ return (ReqlAst) val;
+ }
+
+ if (val == null || val instanceof Number || val instanceof Boolean || val instanceof String) {
+ return new Datum(val);
+ }
+
+ if (val instanceof LocalDateTime) {
+ ZoneId zid = ZoneId.systemDefault();
+ DateTimeFormatter fmt2 = fmt.withZone(zid);
+ return Iso8601.fromString(((LocalDateTime) val).format(fmt2));
+ }
+
+ if (val instanceof ZonedDateTime || val instanceof OffsetDateTime) {
+ return Iso8601.fromString(fmt.format(((Temporal) val)));
+ }
+
+ Class> valClass = val.getClass();
+ if (valClass.isEnum()) {
+ return new Datum(((Enum>) val).name());
+ }
+
+ if (remainingDepth <= 0) {
+ throw new ReqlDriverCompileError("Recursion limit reached converting to ReqlAst");
+ }
+
+ if (val instanceof ReqlLambda) {
+ return Func.fromLambda((ReqlLambda) val);
+ }
+
+ if (val instanceof Collection) {
+ Arguments innerValues = new Arguments();
+ for (Object innerValue : (Collection>) val) {
+ innerValues.add(toReqlAst(innerValue, remainingDepth - 1));
+ }
+ return new MakeArray(innerValues, null);
+ }
+
+ if (val instanceof Map) {
+ Map obj = new MapObject<>();
+ ((Map, ?>) val).forEach((key, value) -> {
+ if (key.getClass().isEnum()) {
+ obj.put(((Enum>) key).name(), toReqlAst(value, remainingDepth - 1));
+ } else if (key instanceof String) {
+ obj.put((String) key, toReqlAst(value, remainingDepth - 1));
+ } else {
+ throw new ReqlDriverCompileError("Object keys can only be strings");
+ }
+ });
+ return MakeObj.fromMap(obj);
+ }
+
+ if (valClass.isArray()) {
+ if (val instanceof byte[]) {
+ return new Binary(((byte[]) val));
+ }
+ Arguments innerValues = new Arguments();
+ int length = Array.getLength(val);
+ for (int i = 0; i < length; i++) {
+ innerValues.add(toReqlAst(Array.get(val, i)));
+ }
+ return new MakeArray(innerValues, null);
+ }
+
+ // val is a non-null POJO, let's use jackson
+ return toReqlAst(RethinkDB.getResultMapper().convertValue(val, Map.class), remainingDepth - 1);
+ }
+
+ public static SSLContext readCertFile(@NotNull InputStream certFile) {
+ try {
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
+ Certificate cert = CertificateFactory.getInstance("X.509").generateCertificate(certFile);
+
+ ks.load(null);
+ ks.setCertificateEntry("caCert", cert);
+ tmf.init(ks);
+
+ SSLContext ctx = SSLContext.getInstance(DEFAULT_SSL_PROTOCOL);
+ ctx.init(null, tmf.getTrustManagers(), null);
+ certFile.close();
+ return ctx;
+ } catch (IOException | CertificateException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {
+ throw new ReqlDriverError(e);
+ }
+ }
+
+ public static class FormatOptions {
+ public final boolean rawTime;
+ public final boolean rawGroups;
+ public final boolean rawBinary;
+
+ public FormatOptions(OptArgs args) {
+ Datum time_format = (Datum) args.get("time_format");
+ this.rawTime = time_format != null && "raw".equals(time_format.datum);
+
+ Datum binary_format = (Datum) args.get("binary_format");
+ this.rawBinary = binary_format != null && "raw".equals(binary_format.datum);
+
+ Datum group_format = (Datum) args.get("group_format");
+ this.rawGroups = group_format != null && "raw".equals(group_format.datum);
+ }
+ }
+}
diff --git a/src/main/java/com/rethinkdb/utils/Types.java b/src/main/java/com/rethinkdb/utils/Types.java
new file mode 100644
index 00000000..3ac9079c
--- /dev/null
+++ b/src/main/java/com/rethinkdb/utils/Types.java
@@ -0,0 +1,131 @@
+package com.rethinkdb.utils;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+
+import java.lang.reflect.MalformedParameterizedTypeException;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * An utility class that can create simple generic type references without having to grab information from the compiler.
+ */
+public class Types {
+ private Types() {
+ }
+
+ public static TypeReference of(Class type) {
+ return new BuiltTypeRef<>(Objects.requireNonNull(type, "type"));
+ }
+
+ public static TypeReference> listOf(Class type) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(List.class, Objects.requireNonNull(type, "type"))
+ );
+ }
+
+ public static TypeReference> listOf(TypeReference type) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(List.class, Objects.requireNonNull(type, "type").getType())
+ );
+ }
+
+ public static TypeReference> setOf(Class type) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(Set.class, Objects.requireNonNull(type, "type"))
+ );
+ }
+
+ public static TypeReference> setOf(TypeReference type) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(Set.class, Objects.requireNonNull(type, "type").getType())
+ );
+ }
+
+ public static TypeReference> mapOf(Class keyType, Class valueType) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(Map.class, Objects.requireNonNull(keyType, "keyType"), Objects.requireNonNull(valueType, "valueType"))
+ );
+ }
+
+ public static TypeReference> mapOf(TypeReference keyType, Class valueType) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(Map.class, Objects.requireNonNull(keyType, "keyType").getType(), Objects.requireNonNull(valueType, "valueType"))
+ );
+ }
+
+ public static TypeReference> mapOf(Class keyType, TypeReference valueType) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(Map.class, Objects.requireNonNull(keyType, "keyType"), Objects.requireNonNull(valueType, "valueType").getType())
+ );
+ }
+
+ public static TypeReference> mapOf(TypeReference keyType, TypeReference valueType) {
+ return new BuiltTypeRef<>(
+ new BuiltParametrizedType(Map.class, Objects.requireNonNull(keyType, "keyType").getType(), Objects.requireNonNull(valueType, "valueType").getType())
+ );
+ }
+
+ private static class BuiltTypeRef extends TypeReference {
+ private final Type type;
+
+ private BuiltTypeRef(Type type) {
+ this.type = type;
+ }
+
+ @Override
+ public Type getType() {
+ return type;
+ }
+ }
+
+ private static class BuiltParametrizedType implements ParameterizedType {
+ private final Class> type;
+ private final Type[] params;
+
+ public BuiltParametrizedType(Class> type, Type... params) {
+ if (params.length != type.getTypeParameters().length) {
+ throw new MalformedParameterizedTypeException();
+ }
+ this.type = type;
+ this.params = params;
+ }
+
+ @Override
+ public Type[] getActualTypeArguments() {
+ return params.clone();
+ }
+
+ @Override
+ public Type getRawType() {
+ return type;
+ }
+
+ @Override
+ public Type getOwnerType() {
+ return type.getDeclaringClass();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ParameterizedType)) return false;
+ ParameterizedType that = (ParameterizedType) o;
+ return Objects.equals(type, that.getRawType()) &&
+ Objects.equals(type.getDeclaringClass(), that.getOwnerType()) &&
+ Arrays.equals(params, that.getActualTypeArguments());
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(params) ^ Objects.hashCode(type) ^ Objects.hashCode(type.getDeclaringClass());
+ }
+
+ @Override
+ public String toString() {
+ return type.getName() + Arrays.stream(params).map(Type::getTypeName)
+ .collect(Collectors.joining(", ", "<", ">"));
+ }
+ }
+}
diff --git a/src/test/java/com/rethinkdb/RethinkDBTest.java b/src/test/java/com/rethinkdb/RethinkDBTest.java
index 0696c3a2..abc52b29 100644
--- a/src/test/java/com/rethinkdb/RethinkDBTest.java
+++ b/src/test/java/com/rethinkdb/RethinkDBTest.java
@@ -7,6 +7,7 @@
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.net.Connection;
import com.rethinkdb.net.Result;
+import com.rethinkdb.utils.Types;
import net.jodah.concurrentunit.Waiter;
import org.junit.*;
import org.junit.rules.ExpectedException;
@@ -24,6 +25,8 @@
import static org.junit.Assert.*;
public class RethinkDBTest {
+ private static final TypeReference> stringList = Types.listOf(String.class);
+ private static final TypeReference> stringObjectMap = Types.mapOf(String.class, Object.class);
public static final RethinkDB r = RethinkDB.r;
Connection conn;
@@ -156,67 +159,62 @@ public void testCoerceFailureInfinity() {
@Test
public void testSplitEdgeCases() {
- TypeReference> typeRef = new TypeReference>() {};
- List emptySplitNothing = r.expr("").split().run(conn, typeRef).single();
+ List emptySplitNothing = r.expr("").split().run(conn, stringList).single();
assertEquals(emptyList(), emptySplitNothing);
- List nullSplit = r.expr("").split(null).run(conn, typeRef).single();
+ List nullSplit = r.expr("").split(null).run(conn, stringList).single();
assertEquals(emptyList(), nullSplit);
- List emptySplitSpace = r.expr("").split(" ").run(conn, typeRef).single();
+ List emptySplitSpace = r.expr("").split(" ").run(conn, stringList).single();
assertEquals(singletonList(""), emptySplitSpace);
- List emptySplitEmpty = r.expr("").split("").run(conn, typeRef).single();
+ List emptySplitEmpty = r.expr("").split("").run(conn, stringList).single();
assertEquals(emptyList(), emptySplitEmpty);
- List emptySplitNull5 = r.expr("").split(null, 5).run(conn, typeRef).single();
+ List emptySplitNull5 = r.expr("").split(null, 5).run(conn, stringList).single();
assertEquals(emptyList(), emptySplitNull5);
- List emptySplitSpace5 = r.expr("").split(" ", 5).run(conn, typeRef).single();
+ List emptySplitSpace5 = r.expr("").split(" ", 5).run(conn, stringList).single();
assertEquals(singletonList(""), emptySplitSpace5);
- List emptySplitEmpty5 = r.expr("").split("", 5).run(conn, typeRef).single();
+ List emptySplitEmpty5 = r.expr("").split("", 5).run(conn, stringList).single();
assertEquals(emptyList(), emptySplitEmpty5);
}
@Test
public void testSplitWithNullOrWhitespace() {
- TypeReference> typeRef = new TypeReference>() {};
- List extraWhitespace = r.expr("aaaa bbbb cccc ").split().run(conn, typeRef).single();
+ List extraWhitespace = r.expr("aaaa bbbb cccc ").split().run(conn, stringList).single();
assertEquals(Arrays.asList("aaaa", "bbbb", "cccc"), extraWhitespace);
- List extraWhitespaceNull = r.expr("aaaa bbbb cccc ").split(null).run(conn, typeRef).single();
+ List extraWhitespaceNull = r.expr("aaaa bbbb cccc ").split(null).run(conn, stringList).single();
assertEquals(Arrays.asList("aaaa", "bbbb", "cccc"), extraWhitespaceNull);
- List extraWhitespaceSpace = r.expr("aaaa bbbb cccc ").split(" ").run(conn, typeRef).single();
+ List extraWhitespaceSpace = r.expr("aaaa bbbb cccc ").split(" ").run(conn, stringList).single();
assertEquals(Arrays.asList("aaaa", "bbbb", "", "cccc", ""), extraWhitespaceSpace);
- List extraWhitespaceEmpty = r.expr("aaaa bbbb cccc ").split("").run(conn, typeRef).single();
+ List extraWhitespaceEmpty = r.expr("aaaa bbbb cccc ").split("").run(conn, stringList).single();
assertEquals(Arrays.asList("a", "a", "a", "a", " ",
"b", "b", "b", "b", " ", " ", "c", "c", "c", "c", " "), extraWhitespaceEmpty);
}
@Test
public void testSplitWithString() {
- TypeReference> typeRef = new TypeReference>() {};
- List b = r.expr("aaaa bbbb cccc ").split("b").run(conn, typeRef).single();
+ List b = r.expr("aaaa bbbb cccc ").split("b").run(conn, stringList).single();
assertEquals(Arrays.asList("aaaa ", "", "", "", " cccc "), b);
}
@Test
public void testTableInsert() {
- TypeReference> typeRef = new TypeReference>() {};
MapObject foo = r.hashMap("hi", "There")
.with("yes", 7)
.with("no", null);
- Map result = r.db(dbName).table(tableName).insert(foo).run(conn, typeRef).single();
+ Map result = r.db(dbName).table(tableName).insert(foo).run(conn, stringObjectMap).single();
assertNotNull(result);
assertEquals(1L, result.get("inserted"));
}
@Test
public void testDbGlobalArgInserted() {
- TypeReference> typeRef = new TypeReference>() {};
final String tblName = "test_global_optargs";
try {
@@ -234,25 +232,25 @@ public void testDbGlobalArgInserted() {
try {
// no optarg set, no default db
conn.use(null);
- Map x1 = r.table(tblName).get(1).run(conn, typeRef).single();
+ Map x1 = r.table(tblName).get(1).run(conn, stringObjectMap).single();
assertNotNull(x1);
assertEquals("test", x1.get("dbName"));
// no optarg set, default db set
conn.use("conn_default");
- Map x2 = r.table(tblName).get(1).run(conn, typeRef).single();
+ Map x2 = r.table(tblName).get(1).run(conn, stringObjectMap).single();
assertNotNull(x2);
assertEquals("conn_default", x2.get("dbName"));
// optarg set, no default db
conn.use(null);
- Map x3 = r.table(tblName).get(1).run(conn, OptArgs.of("db", "optargs"), typeRef).single();
+ Map x3 = r.table(tblName).get(1).run(conn, OptArgs.of("db", "optargs"), stringObjectMap).single();
assertNotNull(x3);
assertEquals("optargs", x3.get("dbName"));
// optarg set, default db
conn.use("conn_default");
- Map x4 = r.table(tblName).get(1).run(conn, OptArgs.of("db", "optargs"), typeRef).single();
+ Map x4 = r.table(tblName).get(1).run(conn, OptArgs.of("db", "optargs"), stringObjectMap).single();
assertNotNull(x4);
assertEquals("optargs", x4.get("dbName"));
@@ -289,10 +287,8 @@ public void testResultTryWithResources() {
@Test
public void testTableSelectOfPojo() {
- TypeReference> typeRef = new TypeReference>() {};
-
TestPojo pojo = new TestPojo("foo", new TestPojoInner(42L, true));
- Map pojoResult = r.db(dbName).table(tableName).insert(pojo).run(conn, typeRef).single();
+ Map pojoResult = r.db(dbName).table(tableName).insert(pojo).run(conn, stringObjectMap).single();
assertNotNull(pojoResult);
assertEquals(1L, pojoResult.get("inserted"));
@@ -307,12 +303,10 @@ public void testTableSelectOfPojo() {
@Test
public void testTableSelectOfPojoSequence() {
- TypeReference> typeRef = new TypeReference>() {};
-
TestPojo pojoOne = new TestPojo("foo", new TestPojoInner(42L, true));
TestPojo pojoTwo = new TestPojo("bar", new TestPojoInner(53L, false));
- Map pojoOneResult = r.db(dbName).table(tableName).insert(pojoOne).run(conn, typeRef).single();
- Map pojoTwoResult = r.db(dbName).table(tableName).insert(pojoTwo).run(conn, typeRef).single();
+ Map pojoOneResult = r.db(dbName).table(tableName).insert(pojoOne).run(conn, stringObjectMap).single();
+ Map pojoTwoResult = r.db(dbName).table(tableName).insert(pojoTwo).run(conn, stringObjectMap).single();
assertNotNull(pojoOneResult);
assertNotNull(pojoTwoResult);
assertEquals(1L, pojoOneResult.get("inserted"));
@@ -335,14 +329,13 @@ public void testTableSelectOfPojoSequence() {
@Test(timeout = 40000)
public void testConcurrentWrites() throws TimeoutException, InterruptedException {
- TypeReference> typeRef = new TypeReference>() {};
final int total = 500;
final AtomicInteger writeCounter = new AtomicInteger(0);
final Waiter waiter = new Waiter();
for (int i = 0; i < total; i++)
new Thread(() -> {
final TestPojo pojo = new TestPojo("writezz", new TestPojoInner(10L, true));
- final Map result = r.db(dbName).table(tableName).insert(pojo).run(conn, typeRef).single();
+ final Map result = r.db(dbName).table(tableName).insert(pojo).run(conn, stringObjectMap).single();
waiter.assertNotNull(result);
waiter.assertEquals(1L, Objects.requireNonNull(result).get("inserted"));
writeCounter.getAndIncrement();
@@ -356,14 +349,13 @@ public void testConcurrentWrites() throws TimeoutException, InterruptedException
@Test(timeout = 20000)
public void testConcurrentReads() throws TimeoutException, InterruptedException {
- TypeReference> typeRef = new TypeReference>() {};
final int total = 500;
final AtomicInteger readCounter = new AtomicInteger(0);
// write to the database and retrieve the id
final TestPojo pojo = new TestPojo("readzz", new TestPojoInner(10L, true));
final Map result = r.db(dbName).table(tableName).insert(pojo)
- .optArg("return_changes", true).run(conn, typeRef).single();
+ .optArg("return_changes", true).run(conn, stringObjectMap).single();
assertNotNull(result);
final String id = ((List>) result.get("generated_keys")).get(0).toString();
@@ -391,13 +383,12 @@ public void testConcurrentReads() throws TimeoutException, InterruptedException
@Test(timeout = 20000)
public void testConcurrentCursor() throws TimeoutException, InterruptedException {
- TypeReference> typeRef = new TypeReference>() {};
final int total = 500;
final Waiter waiter = new Waiter();
for (int i = 0; i < total; i++)
new Thread(() -> {
final TestPojo pojo = new TestPojo("writezz", new TestPojoInner(10L, true));
- final Map result = r.db(dbName).table(tableName).insert(pojo).run(conn, typeRef).single();
+ final Map result = r.db(dbName).table(tableName).insert(pojo).run(conn, stringObjectMap).single();
waiter.assertNotNull(result);
waiter.assertEquals(1L, Objects.requireNonNull(result).get("inserted"));
waiter.resume();
diff --git a/src/test/java/com/rethinkdb/TestingCommon.java b/src/test/java/com/rethinkdb/TestingCommon.java
index b3bde0c9..dfc9df78 100644
--- a/src/test/java/com/rethinkdb/TestingCommon.java
+++ b/src/test/java/com/rethinkdb/TestingCommon.java
@@ -9,198 +9,249 @@
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import java.util.stream.LongStream;
+@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
public final class TestingCommon {
+ public static Object AnythingIsFine = new Object() {
+ public boolean equals(Object other) {
+ return true;
+ }
- // Python test conversion compatibility definitions
+ public String toString() {
+ return "AnythingIsFine";
+ }
+ };
- public static int len(List array) {
- return array.size();
+ public static Bag bag(List> lst) {
+ return new Bag(lst);
}
- public static class Lst {
- final List lst;
- public Lst(List lst) {
- this.lst = lst;
- }
+ public static PartialLst partial(List> lst) {
+ return new PartialLst(lst);
+ }
- public boolean equals(Object other) {
- return lst.equals(other);
- }
+ public static PartialDct partial(Map, ?> dct) {
+ return new PartialDct(dct);
}
- public static class Bag {
- final List lst;
- public Bag(List lst) {
- stringSort(lst);
- this.lst = lst;
- }
+ public static ArrLen arrlen(Long length, Object thing) {
+ return new ArrLen(length.intValue(), thing);
+ }
- public boolean equals(Object other) {
- if(!(other instanceof List)) {
- return false;
+ public static UUIDMatch uuid() {
+ return new UUIDMatch();
+ }
+
+ public static IntCmp int_cmp(Long nbr) {
+ return new IntCmp(nbr);
+ }
+
+ public static FloatCmp float_cmp(Double nbr) {
+ return new FloatCmp(nbr);
+ }
+
+ public static Regex regex(String regexString) {
+ return new Regex(regexString);
+ }
+
+ public static Err err(String classname, String message) {
+ return new Err(classname, message);
+ }
+
+ @SuppressWarnings("unused")
+ public static Err err(String classname, String message, List> _unused) {
+ return err(classname, message);
+ }
+
+ @SuppressWarnings("unused")
+ public static ErrRegex err_regex(String classname, String message_rgx, Object _unused) {
+ // Some invocations pass a stack frame as a third argument
+ return new ErrRegex(classname, message_rgx);
+ }
+
+ public static Double float_(Double nbr) {
+ return nbr;
+ }
+
+ public static ZoneOffset PacificTimeZone() {
+ return ZoneOffset.ofHours(-7);
+ }
+
+ public static ZoneOffset UTCTimeZone() {
+ return ZoneOffset.ofHours(0);
+ }
+
+ // Generated-tests specific methods
+ public static List> fetch(Object resultObj, long limit) throws Exception {
+ if (limit < 0) {
+ limit = Long.MAX_VALUE;
+ }
+ Result> result = (Result>) resultObj;
+ List list = new ArrayList<>((int) limit);
+ for (long i = 0; i < limit; i++) {
+ if (!result.hasNext()) {
+ break;
}
- List otherList = (List) other;
- stringSort(otherList);
- return lst.equals(otherList);
+ list.add(result.next(500, TimeUnit.MILLISECONDS));
}
+ return list;
+ }
- public void stringSort(List input) {
- Collections.sort(input, (Object a, Object b) ->
- a.toString().compareTo(b.toString()));
+ public static Object runOrCatch(Object query, OptArgs runopts, Connection conn) {
+ if (query == null || query instanceof List) {
+ return query;
}
-
- public String toString() {
- return "Bag(" + lst + ")";
+ try {
+ Result res = ((ReqlAst) query).run(conn, runopts);
+ if (res.responseType() == ResponseType.SUCCESS_ATOM || res.responseType().isError()) {
+ return res.single();
+ } else {
+ return res.toList();
+ }
+ } catch (Exception e) {
+ return e;
}
}
- public static Bag bag(List lst) {
- return new Bag(lst);
+ public static Object maybeRun(Object query, Connection conn, OptArgs runopts) {
+ return query instanceof ReqlAst ? ((ReqlAst) query).run(conn, runopts) : query;
}
- public static class Partial {}
+ public static Object maybeRun(Object query, Connection conn) {
+ return query instanceof ReqlAst ? ((ReqlAst) query).run(conn) : query;
+ }
- public static class PartialLst extends Partial {
- final List lst;
- public PartialLst(List lst){
- this.lst = lst;
+ // Python emulated methods and interfaces
+ public interface Partial {}
+
+ public static class sys {
+ public static class floatInfo {
+ public static final Double min = Double.MIN_VALUE;
+ public static final Double max = Double.MAX_VALUE;
}
+ }
- public String toString(){
- return "PartialLst(" + lst + ")";
+ public static class datetime {
+ public static OffsetDateTime fromtimestamp(double seconds, ZoneOffset offset) {
+ Instant inst = Instant.ofEpochMilli(Double.valueOf(seconds * 1000).longValue());
+ return OffsetDateTime.ofInstant(inst, offset);
}
- public boolean equals(Object other) {
- if(!(other instanceof List)) {
- return false;
- }
- List otherList = (List) other;
- if(lst.size() > otherList.size()){
- return false;
- }
- for(Object item: lst) {
- if(otherList.indexOf(item) == -1){
- return false;
- }
+ public static OffsetDateTime now() {
+ return OffsetDateTime.now();
+ }
+ }
+
+ public static class ast {
+ public static ZoneOffset rqlTzinfo(String offset) {
+ if (offset.equals("00:00")) {
+ offset = "Z";
}
- return true;
+ return ZoneOffset.of(offset);
}
}
- public static PartialLst partial(List lst) {
- return new PartialLst(lst);
+ // Implementations
+ public static class Bag {
+ final Set> bag;
+
+ public Bag(List> bag) {
+ this.bag = new HashSet<>(bag);
+ }
+
+ public boolean equals(Object other) {
+ return other instanceof Collection && bag.equals(new HashSet<>(((Collection>) other)));
+ }
+
+ public String toString() {
+ return "Bag(" + bag + ")";
+ }
+
}
- public static class Dct {
- final Map dct;
- public Dct(Map dct){
- this.dct = dct;
+ public static class PartialLst implements Partial {
+ final List> lst;
+
+ public PartialLst(List> lst) {
+ this.lst = lst;
+ }
+
+ public String toString() {
+ return "PartialLst(" + lst + ")";
}
public boolean equals(Object other) {
- return dct.equals(other);
+ return other instanceof List && ((List>) other).containsAll(lst);
}
+
}
- public static class PartialDct extends Partial {
- final Map dct;
- public PartialDct(Map dct){
+ public static class PartialDct implements Partial {
+ final Map, ?> dct;
+
+ public PartialDct(Map, ?> dct) {
this.dct = dct;
}
public boolean equals(Object other_) {
- if(!(other_ instanceof Map)) {
- return false;
- }
- Map other = ((Map) other_);
- for(Map.Entry entry : ((Map)dct).entrySet()){
- if(!other.containsKey(entry.getKey())){
- System.out.println("Obtained didn't have key " + entry.getKey());
- return false;
- }
- Object val = other.get(entry.getKey());
- if(entry.getValue() == null && val == null){
- continue;
- }
- if(entry.getValue() == null && val != null ||
- val == null && entry.getValue() != null){
- System.out.println("One was null and the other wasn't for key " + entry.getKey());
- return false;
- }
- if(!entry.getValue().equals(val)){
- System.out.println("Weren't equal: " + entry.getValue() + " and " + val);
- return false;
+ if (other_ instanceof Map) {
+ Map, ?> other = ((Map, ?>) other_);
+ for (Map.Entry, ?> entry : ((Map, ?>) dct).entrySet()) {
+ Object key = entry.getKey();
+ Object value = entry.getValue();
+ if (!other.containsKey(key)) {
+ System.out.println("Obtained didn't have key " + key);
+ return false;
+ }
+ Object otherValue = other.get(key);
+ if (value != null || otherValue != null) {
+ if (value == null || otherValue == null) {
+ System.out.println("One was null and the other wasn't for key " + key);
+ return false;
+ } else if (!value.equals(otherValue)) {
+ System.out.println("Weren't equal: " + value + " and " + otherValue);
+ return false;
+ }
+ }
}
+ return true;
}
- return true;
+ return false;
}
public String toString() {
return "PartialDct(" + dct + ")";
}
}
- public static PartialDct partial(Map dct) {
- return new PartialDct(dct);
- }
public static class ArrLen {
+ final List> list;
final int length;
final Object thing;
+
public ArrLen(int length, Object thing) {
this.length = length;
this.thing = thing;
+ this.list = Collections.nCopies(length, thing);
}
public String toString() {
- return "ArrLen(length="+length+" of "+thing+")";
+ return "ArrLen(length=" + length + " of " + thing + ")";
}
public boolean equals(Object other) {
- if(!(other instanceof List)){
- return false;
- }
- List otherList = (List) other;
- if(length != otherList.size()) {
- return false;
- }
- if(thing == null) {
- return true;
- }
- for(Object item: otherList) {
- if(!thing.equals(item)){
- return false;
- }
- }
- return true;
+ return other instanceof List && list.equals(other);
}
}
- public static ArrLen arrlen(Long length, Object thing) {
- return new ArrLen(length.intValue(), thing);
- }
-
- public static ArrLen arrlen(Long length) {
- return new ArrLen(length.intValue(), null);
- }
-
public static class UUIDMatch {
- static final String uuidRgx =
- "[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}";
+ static final Pattern p = Pattern.compile("[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}");
public boolean equals(Object other) {
- if(!(other instanceof String)) {
- return false;
- }
- return Pattern.matches(uuidRgx, (String) other);
+ return other instanceof String && p.matcher((String) other).matches();
}
public String toString() {
@@ -208,256 +259,144 @@ public String toString() {
}
}
- public static UUIDMatch uuid() {
- return new UUIDMatch();
- }
-
public static class IntCmp {
final Long nbr;
+
public IntCmp(Long nbr) {
this.nbr = nbr;
}
+
public boolean equals(Object other) {
return nbr.equals(other);
}
}
- public static IntCmp int_cmp(Long nbr) {
- return new IntCmp(nbr);
- }
-
public static class FloatCmp {
final Double nbr;
+
public FloatCmp(Double nbr) {
this.nbr = nbr;
}
+
public boolean equals(Object other) {
return nbr.equals(other);
}
}
- public static FloatCmp float_cmp(Double nbr) {
- return new FloatCmp(nbr);
- }
-
public static class Regex {
public final Pattern pattern;
- public Regex(String regexString){
+ public Regex(String regexString) {
this.pattern = Pattern.compile(regexString, Pattern.DOTALL);
}
- public String toString(){
+ public String toString() {
return "Regex(" + pattern + ")";
}
- public boolean equals(Object other){
- if(!(other instanceof String)){
- return false;
- }else{
- return pattern.matcher((String) other).matches();
- }
+ public boolean equals(Object other) {
+ return other instanceof String && pattern.matcher((String) other).matches();
}
}
- public static Regex regex(String regexString){
- return new Regex(regexString);
- }
-
public static class Err {
- public final Class clazz;
+ public final Class> clazz;
public final String message;
- public final Pattern inRegex = Pattern.compile(
- "^(?[^\n]*?)(?: in)?:\n.*$",
- Pattern.DOTALL);
- public final Pattern assertionRegex = Pattern.compile(
- "^(?[^\n]*?)\nFailed assertion:.*$",
- Pattern.DOTALL);
-
- public String toString() {
- return "Err(" + clazz + ": " + message + ")";
- }
+ public final Pattern inRegex = Pattern.compile("^(?[^\n]*?)(?: in)?:\n.*$", Pattern.DOTALL);
+ public final Pattern assertionRegex = Pattern.compile("^(?[^\n]*?)\nFailed assertion:.*$", Pattern.DOTALL);
public Err(String classname, String message) {
String clazzname = "com.rethinkdb.gen.exc." + classname;
try {
this.clazz = Class.forName(clazzname);
} catch (ClassNotFoundException cnfe) {
- throw new RuntimeException("Bad exception class: "+clazzname, cnfe);
+ throw new RuntimeException("Bad exception class: " + clazzname, cnfe);
}
this.message = message;
}
public boolean equals(Object other) {
- if(!clazz.isInstance(other)) {
- System.out.println("Classes didn't match: "
- + clazz + " vs. " + other.getClass());
+ if (!clazz.isInstance(other)) {
+ System.out.println("Classes didn't match: " + clazz + " vs. " + other.getClass());
return false;
}
String otherMessage = ((Exception) other).getMessage();
- otherMessage = inRegex.matcher(otherMessage)
- .replaceFirst("${message}:");
- otherMessage = assertionRegex.matcher(otherMessage)
- .replaceFirst("${message}");
+ otherMessage = inRegex.matcher(otherMessage).replaceFirst("${message}:");
+ otherMessage = assertionRegex.matcher(otherMessage).replaceFirst("${message}");
return message.equals(otherMessage);
}
- }
- public static Err err(String classname, String message) {
- return new Err(classname, message);
- }
+ public String toString() {
+ return "Err(" + clazz + ": " + message + ")";
+ }
- public static Err err(String classname, String message, List _unused) {
- return err(classname, message);
}
public static class ErrRegex {
- public final Class clazz;
- public final String message_rgx;
+ public final Class> clazz;
+ public final Pattern message_rgx;
public ErrRegex(String classname, String message_rgx) {
String clazzname = "com.rethinkdb.gen.exc." + classname;
try {
this.clazz = Class.forName(clazzname);
} catch (ClassNotFoundException cnfe) {
- throw new RuntimeException("Bad exception class: "+clazzname, cnfe);
+ throw new RuntimeException("Bad exception class: " + clazzname, cnfe);
}
- this.message_rgx = message_rgx;
+ this.message_rgx = Pattern.compile(message_rgx);
}
public boolean equals(Object other) {
- if(!clazz.isInstance(other)) {
- return false;
- }
- return Pattern.matches(message_rgx, ((Exception)other).getMessage());
+ return clazz.isInstance(other) && message_rgx.matcher(((Exception) other).getMessage()).matches();
}
}
- public static ErrRegex err_regex(String classname, String message_rgx) {
- return new ErrRegex(classname, message_rgx);
- }
-
- public static ErrRegex err_regex(String classname, String message_rgx, Object dummy) {
- // Some invocations pass a stack frame as a third argument
- return new ErrRegex(classname, message_rgx);
- }
-
- public static ArrayList fetch(Object cursor_, long limit) throws Exception {
- if(limit < 0) {
- limit = Long.MAX_VALUE;
- }
- Result cursor = (Result) cursor_;
- long total = 0;
- ArrayList result = new ArrayList((int) limit);
- for(long i = 0; i < limit; i++) {
- if(!cursor.hasNext()){
- break;
- }
- result.add(cursor.next(500, TimeUnit.MILLISECONDS));
- }
- return result;
+ /*
+ // UNUSED CODE BELOW
+ public static ArrLen arrlen(Long length) {
+ return new ArrLen(length.intValue(), null);
}
-
- public static ArrayList fetch(Result cursor) throws Exception {
- return fetch(cursor, -1);
+ public static int len(List> array) {
+ return array.size();
}
-
- public static Object runOrCatch(Object query, OptArgs runopts, Connection conn) {
- if(query == null) {
- return null;
- }
- if(query instanceof List) {
- return query;
- }
- try {
- Result res = ((ReqlAst)query).run(conn, runopts);
- if (res.responseType() == ResponseType.SUCCESS_ATOM || res.responseType().isError()) {
- return res.single();
- } else {
- return res.toList();
- }
- } catch (Exception e) {
- return e;
- }
+ public static ErrRegex err_regex(String classname, String message_rgx) {
+ return new ErrRegex(classname, message_rgx);
}
-
public static LongStream range(long start, long stop) {
return LongStream.range(start, stop);
}
-
- public static List list(LongStream str) {
+ public static List> list(LongStream str) {
return str.boxed().collect(Collectors.toList());
}
-
- public static class sys {
- public static class floatInfo {
- public static final Double min = Double.MIN_VALUE;
- public static final Double max = Double.MAX_VALUE;
- }
- }
-
- public static ZoneOffset PacificTimeZone() {
- return ZoneOffset.ofHours(-7);
- }
-
- public static ZoneOffset UTCTimeZone() {
- return ZoneOffset.ofHours(0);
- }
-
- public static class datetime {
- public static OffsetDateTime fromtimestamp(double seconds, ZoneOffset offset) {
- Instant inst = Instant.ofEpochMilli(
- (new Double(seconds * 1000)).longValue());
- return OffsetDateTime.ofInstant(inst, offset);
- }
-
- public static OffsetDateTime now() {
- return OffsetDateTime.now();
- }
- }
-
- public static class ast {
- public static ZoneOffset rqlTzinfo(String offset) {
- if(offset.equals("00:00")){
- offset = "Z";
- }
- return ZoneOffset.of(offset);
- }
- }
-
- public static Double float_(Double nbr) {
- return nbr;
- }
-
public static Object wait_(long length) {
try {
Thread.sleep(length * 1000);
- }catch(InterruptedException ie) {}
+ } catch (InterruptedException ie) {
+ }
return null;
}
-
- public static Object maybeRun(Object query, Connection conn, OptArgs runopts) {
- if (query instanceof ReqlAst) {
- return ((ReqlAst)query).run(conn, runopts);
- } else {
- return query;
- }
+ public static List> fetch(Result> cursor) throws Exception {
+ return fetch(cursor, -1);
}
+ public static class Lst {
+ final List> lst;
+ public Lst(List> lst) {
+ this.lst = lst;
+ }
- public static Object maybeRun(Object query, Connection conn) {
- if (query instanceof ReqlAst) {
- return ((ReqlAst)query).run(conn);
- } else {
- return query;
+ public boolean equals(Object other) {
+ return lst.equals(other);
}
}
+ public static class Dct {
+ final Map dct;
+ public Dct(Map dct){
+ this.dct = dct;
+ }
- public static Object AnythingIsFine = new Object() {
public boolean equals(Object other) {
- return true;
- }
- public String toString() {
- return "AnythingIsFine";
+ return dct.equals(other);
}
- };
+ }
+ */
}
diff --git a/src/test/java/com/rethinkdb/TestingFramework.java b/src/test/java/com/rethinkdb/TestingFramework.java
index 220dda9f..df05d8e7 100644
--- a/src/test/java/com/rethinkdb/TestingFramework.java
+++ b/src/test/java/com/rethinkdb/TestingFramework.java
@@ -2,7 +2,11 @@
import com.rethinkdb.net.Connection;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Objects;
import java.util.Properties;
/**
@@ -40,7 +44,7 @@ public static Connection.Builder defaultConnectionBuilder() {
Properties config = new Properties();
try (InputStream is = TestingFramework.class.getClassLoader().getResourceAsStream(DEFAULT_CONFIG_RESOURCE)) {
- config.load(is);
+ config.load(Objects.requireNonNull(is));
} catch (NullPointerException | IOException e) {
throw new IllegalStateException(e);
}
@@ -61,7 +65,7 @@ public static Connection.Builder defaultConnectionBuilder() {
// mandatory fields
defaultConnectionBuilder = defaultConnectionBuilder.hostname(config.getProperty(PROP_HOSTNAME).trim());
defaultConnectionBuilder = defaultConnectionBuilder.port(Integer.parseInt(config.getProperty(PROP_PORT).trim()));
- // optinal fields
+ // optional fields
final String authKey = config.getProperty(PROP_AUTHKEY);
if (authKey != null) {
defaultConnectionBuilder.authKey(config.getProperty(PROP_AUTHKEY).trim());
@@ -74,7 +78,7 @@ public static Connection.Builder defaultConnectionBuilder() {
/**
* @return A new connection from the configuration.
*/
- public static Connection createConnection() throws Exception {
+ public static Connection createConnection() {
return createConnection(defaultConnectionBuilder());
}
@@ -82,8 +86,7 @@ public static Connection createConnection() throws Exception {
* @return A new connection from a specific builder to be used in tests where a specific connection is needed,
* i.e. connection secured with SSL.
*/
- public static Connection createConnection(Connection.Builder builder) throws Exception {
+ public static Connection createConnection(Connection.Builder builder) {
return builder.connect();
}
-
}
diff --git a/src/test/java/com/rethinkdb/gen/MathLogicBit.java b/src/test/java/com/rethinkdb/gen/MathLogicBit.java
deleted file mode 100644
index b50baea1..00000000
--- a/src/test/java/com/rethinkdb/gen/MathLogicBit.java
+++ /dev/null
@@ -1,932 +0,0 @@
-// Autogenerated by convert_tests.py and process_polyglot.py.
-// Do not edit this file directly.
-// The template for this file is located at:
-// ../../../../../../../templates/Test.java
-package com.rethinkdb.gen;
-
-import com.rethinkdb.RethinkDB;
-import com.rethinkdb.model.OptArgs;
-import com.rethinkdb.net.Connection;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertArrayEquals;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.junit.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static com.rethinkdb.TestingCommon.*;
-import com.rethinkdb.TestingFramework;
-
-public class MathLogicBit {
- // Tests bitwise operators
- Logger logger = LoggerFactory.getLogger(MathLogicBit.class);
- public static final RethinkDB r = RethinkDB.r;
-
- Connection conn;
-
- @Before
- public void setUp() throws Exception {
- logger.info("Setting up.");
- conn = TestingFramework.createConnection();
- try {
- r.dbCreate("test").run(conn);
- r.db("test").wait_().run(conn);
- }catch (Exception e){}
- }
-
- @After
- public void tearDown() throws Exception {
- logger.info("Tearing down.");
- r.db("rethinkdb").table("_debug_scratch").delete().run(conn);
- if(!conn.isOpen()){
- conn.close();
- conn = TestingFramework.createConnection();
- }
- r.dbDrop("test").run(conn);
- conn.close(false);
- }
-
- // Matches Python's str() function, which we use.
- // TODO: We might want to handle this in a visit_Call in convert_tests.py instead.
- private static String str(long i) {
- return String.valueOf(i);
- }
-
- // A hack to concatenate two Lists -- see is_array_add in convert_tests.py.
- private static List concatList(List x, List y) {
- List ret = new ArrayList(x);
- ret.addAll(y);
- return ret;
- }
-
- // Autogenerated tests below
-
- @Test(timeout=120000)
- public void test() throws Exception {
-
- {
- // math_logic/bit.yaml line #4
- /* 2 */
- Long expected_ = 2L;
- /* r.expr(3).bit_and(2) */
- logger.info("About to run line #4: r.expr(3L).bitAnd(2L)");
- Object obtained = runOrCatch(r.expr(3L).bitAnd(2L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #4");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #4:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #7
- /* 2 */
- Long expected_ = 2L;
- /* r.expr(-2).bit_and(3) */
- logger.info("About to run line #7: r.expr(-2L).bitAnd(3L)");
- Object obtained = runOrCatch(r.expr(-2L).bitAnd(3L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #7");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #7:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #10
- /* err('ReqlQueryLogicError', 'Integer too large: 9007199254740992') */
- Err expected_ = err("ReqlQueryLogicError", "Integer too large: 9007199254740992");
- /* r.expr(9007199254740992).bit_and(0) */
- logger.info("About to run line #10: r.expr(9007199254740992L).bitAnd(0L)");
- Object obtained = runOrCatch(r.expr(9007199254740992L).bitAnd(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #10");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #10:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #13
- /* err('ReqlQueryLogicError', 'Number not an integer (>2^53): 9007199254740994') */
- Err expected_ = err("ReqlQueryLogicError", "Number not an integer (>2^53): 9007199254740994");
- /* r.expr(9007199254740994).bit_and(0) */
- logger.info("About to run line #13: r.expr(9007199254740994L).bitAnd(0L)");
- Object obtained = runOrCatch(r.expr(9007199254740994L).bitAnd(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #13");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #13:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #16
- /* 23 */
- Long expected_ = 23L;
- /* r.expr(9007199254740991).bit_and(23) */
- logger.info("About to run line #16: r.expr(9007199254740991L).bitAnd(23L)");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitAnd(23L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #16");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #16:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #19
- /* 0 */
- Long expected_ = 0L;
- /* r.expr(-9007199254740992).bit_and(12345) */
- logger.info("About to run line #19: r.expr(-9007199254740992L).bitAnd(12345L)");
- Object obtained = runOrCatch(r.expr(-9007199254740992L).bitAnd(12345L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #19");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #19:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #22
- /* 3 */
- Long expected_ = 3L;
- /* r.expr(1).bit_or(2) */
- logger.info("About to run line #22: r.expr(1L).bitOr(2L)");
- Object obtained = runOrCatch(r.expr(1L).bitOr(2L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #22");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #22:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #25
- /* err('ReqlQueryLogicError', 'Integer too large: 9007199254740992') */
- Err expected_ = err("ReqlQueryLogicError", "Integer too large: 9007199254740992");
- /* r.expr(9007199254740992).bit_or(0) */
- logger.info("About to run line #25: r.expr(9007199254740992L).bitOr(0L)");
- Object obtained = runOrCatch(r.expr(9007199254740992L).bitOr(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #25");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #25:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #28
- /* 9007199254740991 */
- Long expected_ = 9007199254740991L;
- /* r.expr(9007199254740991).bit_or(0) */
- logger.info("About to run line #28: r.expr(9007199254740991L).bitOr(0L)");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitOr(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #28");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #28:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #31
- /* -1 */
- Long expected_ = -1L;
- /* r.expr(9007199254740991).bit_or(-1) */
- logger.info("About to run line #31: r.expr(9007199254740991L).bitOr(-1L)");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitOr(-1L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #31");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #31:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #34
- /* 5 */
- Long expected_ = 5L;
- /* r.expr(3).bit_xor(6) */
- logger.info("About to run line #34: r.expr(3L).bitXor(6L)");
- Object obtained = runOrCatch(r.expr(3L).bitXor(6L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #34");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #34:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #37
- /* -3 */
- Long expected_ = -3L;
- /* r.expr(2).bit_not() */
- logger.info("About to run line #37: r.expr(2L).bitNot()");
- Object obtained = runOrCatch(r.expr(2L).bitNot(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #37");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #37:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #40
- /* -9007199254740992 */
- Long expected_ = -9007199254740992L;
- /* r.expr(9007199254740991).bit_not() */
- logger.info("About to run line #40: r.expr(9007199254740991L).bitNot()");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitNot(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #40");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #40:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #43
- /* 9007199254740991 */
- Long expected_ = 9007199254740991L;
- /* r.expr(9007199254740991).bit_not().bit_not() */
- logger.info("About to run line #43: r.expr(9007199254740991L).bitNot().bitNot()");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitNot().bitNot(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #43");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #43:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #47
- /* err('ReqlQueryLogicError', 'Integer too large: 9007199254740992') */
- Err expected_ = err("ReqlQueryLogicError", "Integer too large: 9007199254740992");
- /* r.expr(9007199254740992).bit_sar(0) */
- logger.info("About to run line #47: r.expr(9007199254740992L).bitSar(0L)");
- Object obtained = runOrCatch(r.expr(9007199254740992L).bitSar(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #47");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #47:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #50
- /* -9007199254740992 */
- Long expected_ = -9007199254740992L;
- /* r.expr(-9007199254740992).bit_sar(0) */
- logger.info("About to run line #50: r.expr(-9007199254740992L).bitSar(0L)");
- Object obtained = runOrCatch(r.expr(-9007199254740992L).bitSar(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #50");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #50:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #53
- /* -4503599627370496 */
- Long expected_ = -4503599627370496L;
- /* r.expr(-9007199254740992).bit_sar(1) */
- logger.info("About to run line #53: r.expr(-9007199254740992L).bitSar(1L)");
- Object obtained = runOrCatch(r.expr(-9007199254740992L).bitSar(1L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #53");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #53:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #56
- /* -2 */
- Long expected_ = -2L;
- /* r.expr(-9007199254740992).bit_sar(52) */
- logger.info("About to run line #56: r.expr(-9007199254740992L).bitSar(52L)");
- Object obtained = runOrCatch(r.expr(-9007199254740992L).bitSar(52L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #56");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #56:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #59
- /* -1 */
- Long expected_ = -1L;
- /* r.expr(-9007199254740992).bit_sar(53) */
- logger.info("About to run line #59: r.expr(-9007199254740992L).bitSar(53L)");
- Object obtained = runOrCatch(r.expr(-9007199254740992L).bitSar(53L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #59");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #59:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #62
- /* -1 */
- Long expected_ = -1L;
- /* r.expr(-9007199254740992).bit_sar(54) */
- logger.info("About to run line #62: r.expr(-9007199254740992L).bitSar(54L)");
- Object obtained = runOrCatch(r.expr(-9007199254740992L).bitSar(54L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #62");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #62:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #65
- /* 9007199254740991 */
- Long expected_ = 9007199254740991L;
- /* r.expr(9007199254740991).bit_sar(0) */
- logger.info("About to run line #65: r.expr(9007199254740991L).bitSar(0L)");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitSar(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #65");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #65:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #68
- /* 4503599627370495 */
- Long expected_ = 4503599627370495L;
- /* r.expr(9007199254740991).bit_sar(1) */
- logger.info("About to run line #68: r.expr(9007199254740991L).bitSar(1L)");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitSar(1L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #68");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #68:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #71
- /* 1 */
- Long expected_ = 1L;
- /* r.expr(9007199254740991).bit_sar(52) */
- logger.info("About to run line #71: r.expr(9007199254740991L).bitSar(52L)");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitSar(52L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #71");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #71:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #74
- /* 0 */
- Long expected_ = 0L;
- /* r.expr(9007199254740991).bit_sar(53) */
- logger.info("About to run line #74: r.expr(9007199254740991L).bitSar(53L)");
- Object obtained = runOrCatch(r.expr(9007199254740991L).bitSar(53L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #74");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #74:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #78
- /* 0 */
- Long expected_ = 0L;
- /* r.expr(0).bit_sal(999999) */
- logger.info("About to run line #78: r.expr(0L).bitSal(999999L)");
- Object obtained = runOrCatch(r.expr(0L).bitSal(999999L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #78");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #78:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #81
- /* 0 */
- Long expected_ = 0L;
- /* r.expr(0).bit_sal(3000) */
- logger.info("About to run line #81: r.expr(0L).bitSal(3000L)");
- Object obtained = runOrCatch(r.expr(0L).bitSal(3000L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #81");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #81:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #84
- /* 0 */
- Long expected_ = 0L;
- /* r.expr(0).bit_sal(500) */
- logger.info("About to run line #84: r.expr(0L).bitSal(500L)");
- Object obtained = runOrCatch(r.expr(0L).bitSal(500L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #84");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #84:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #87
- /* 0 */
- Long expected_ = 0L;
- /* r.expr(0).bit_sal(0) */
- logger.info("About to run line #87: r.expr(0L).bitSal(0L)");
- Object obtained = runOrCatch(r.expr(0L).bitSal(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #87");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #87:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #90
- /* 1 */
- Long expected_ = 1L;
- /* r.expr(1).bit_sal(0) */
- logger.info("About to run line #90: r.expr(1L).bitSal(0L)");
- Object obtained = runOrCatch(r.expr(1L).bitSal(0L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #90");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #90:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #93
- /* 2 */
- Long expected_ = 2L;
- /* r.expr(1).bit_sal(1) */
- logger.info("About to run line #93: r.expr(1L).bitSal(1L)");
- Object obtained = runOrCatch(r.expr(1L).bitSal(1L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #93");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #93:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #96
- /* 8 */
- Long expected_ = 8L;
- /* r.expr(1).bit_sal(3) */
- logger.info("About to run line #96: r.expr(1L).bitSal(3L)");
- Object obtained = runOrCatch(r.expr(1L).bitSal(3L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #96");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #96:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #99
- /* -8 */
- Long expected_ = -8L;
- /* r.expr(-1).bit_sal(3) */
- logger.info("About to run line #99: r.expr(-1L).bitSal(3L)");
- Object obtained = runOrCatch(r.expr(-1L).bitSal(3L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #99");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #99:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #102
- /* -18014398509481984 */
- Long expected_ = -18014398509481984L;
- /* r.expr(-1).bit_sal(54) */
- logger.info("About to run line #102: r.expr(-1L).bitSal(54L)");
- Object obtained = runOrCatch(r.expr(-1L).bitSal(54L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #102");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #102:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #105
- /* 18014398509481984 */
- Long expected_ = 18014398509481984L;
- /* r.expr(1).bit_sal(54) */
- logger.info("About to run line #105: r.expr(1L).bitSal(54L)");
- Object obtained = runOrCatch(r.expr(1L).bitSal(54L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #105");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #105:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #108
- /* -18014398509481984 */
- Long expected_ = -18014398509481984L;
- /* r.expr(-2).bit_sal(53) */
- logger.info("About to run line #108: r.expr(-2L).bitSal(53L)");
- Object obtained = runOrCatch(r.expr(-2L).bitSal(53L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #108");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #108:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #111
- /* 18014398509481984 */
- Long expected_ = 18014398509481984L;
- /* r.expr(2).bit_sal(53) */
- logger.info("About to run line #111: r.expr(2L).bitSal(53L)");
- Object obtained = runOrCatch(r.expr(2L).bitSal(53L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #111");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #111:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #114
- /* err('ReqlQueryLogicError', 'Cannot bit-shift by a negative value') */
- Err expected_ = err("ReqlQueryLogicError", "Cannot bit-shift by a negative value");
- /* r.expr(5).bit_sal(-1) */
- logger.info("About to run line #114: r.expr(5L).bitSal(-1L)");
- Object obtained = runOrCatch(r.expr(5L).bitSal(-1L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #114");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #114:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #117
- /* err('ReqlQueryLogicError', 'Cannot bit-shift by a negative value') */
- Err expected_ = err("ReqlQueryLogicError", "Cannot bit-shift by a negative value");
- /* r.expr(5).bit_sar(-1) */
- logger.info("About to run line #117: r.expr(5L).bitSar(-1L)");
- Object obtained = runOrCatch(r.expr(5L).bitSar(-1L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #117");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #117:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #121
- /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */
- Err expected_ = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", r.array(0L));
- /* r.expr('a').bit_and(12) */
- logger.info("About to run line #121: r.expr('a').bitAnd(12L)");
- Object obtained = runOrCatch(r.expr("a").bitAnd(12L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #121");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #121:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #124
- /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [1]) */
- Err expected_ = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", r.array(1L));
- /* r.expr(12).bit_and('a') */
- logger.info("About to run line #124: r.expr(12L).bitAnd('a')");
- Object obtained = runOrCatch(r.expr(12L).bitAnd("a"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #124");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #124:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/bit.yaml line #127
- /* err('ReqlQueryLogicError', 'Number not an integer: 1.5') */
- Err expected_ = err("ReqlQueryLogicError", "Number not an integer: 1.5");
- /* r.expr(1.5).bit_and(3) */
- logger.info("About to run line #127: r.expr(1.5).bitAnd(3L)");
- Object obtained = runOrCatch(r.expr(1.5).bitAnd(3L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #127");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #127:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
- }
-}
diff --git a/src/test/java/com/rethinkdb/gen/MathLogicLogic.java b/src/test/java/com/rethinkdb/gen/MathLogicLogic.java
deleted file mode 100644
index a16ea5ce..00000000
--- a/src/test/java/com/rethinkdb/gen/MathLogicLogic.java
+++ /dev/null
@@ -1,1101 +0,0 @@
-// Autogenerated by convert_tests.py and process_polyglot.py.
-// Do not edit this file directly.
-// The template for this file is located at:
-// ../../../../../../../templates/Test.java
-package com.rethinkdb.gen;
-
-import com.rethinkdb.RethinkDB;
-import com.rethinkdb.gen.ast.*;
-import com.rethinkdb.model.OptArgs;
-import com.rethinkdb.net.Connection;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertArrayEquals;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.junit.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static com.rethinkdb.TestingCommon.*;
-import com.rethinkdb.TestingFramework;
-
-public class MathLogicLogic {
- // These tests are aimed at &&, ||, and !
- Logger logger = LoggerFactory.getLogger(MathLogicLogic.class);
- public static final RethinkDB r = RethinkDB.r;
-
- Connection conn;
-
- @Before
- public void setUp() throws Exception {
- logger.info("Setting up.");
- conn = TestingFramework.createConnection();
- try {
- r.dbCreate("test").run(conn);
- r.db("test").wait_().run(conn);
- }catch (Exception e){}
- }
-
- @After
- public void tearDown() throws Exception {
- logger.info("Tearing down.");
- r.db("rethinkdb").table("_debug_scratch").delete().run(conn);
- if(!conn.isOpen()){
- conn.close();
- conn = TestingFramework.createConnection();
- }
- r.dbDrop("test").run(conn);
- conn.close(false);
- }
-
- // Matches Python's str() function, which we use.
- // TODO: We might want to handle this in a visit_Call in convert_tests.py instead.
- private static String str(long i) {
- return String.valueOf(i);
- }
-
- // A hack to concatenate two Lists -- see is_array_add in convert_tests.py.
- private static List concatList(List x, List y) {
- List ret = new ArrayList(x);
- ret.addAll(y);
- return ret;
- }
-
- // Autogenerated tests below
-
- @Test(timeout=120000)
- public void test() throws Exception {
-
- {
- // math_logic/logic.yaml line #8
- /* true */
- Boolean expected_ = true;
- /* r.expr(true) & true */
- logger.info("About to run line #8: r.expr(true).and(true)");
- Object obtained = runOrCatch(r.expr(true).and(true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #8");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #8:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #9
- /* true */
- Boolean expected_ = true;
- /* true & r.expr(true) */
- logger.info("About to run line #9: r.and(true, r.expr(true))");
- Object obtained = runOrCatch(r.and(true, r.expr(true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #9");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #9:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #10
- /* true */
- Boolean expected_ = true;
- /* r.and_(true,true) */
- logger.info("About to run line #10: r.and(true, true)");
- Object obtained = runOrCatch(r.and(true, true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #10");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #10:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #11
- /* true */
- Boolean expected_ = true;
- /* r.expr(true).and_(true) */
- logger.info("About to run line #11: r.expr(true).and(true)");
- Object obtained = runOrCatch(r.expr(true).and(true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #11");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #11:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #22
- /* false */
- Boolean expected_ = false;
- /* r.expr(true) & false */
- logger.info("About to run line #22: r.expr(true).and(false)");
- Object obtained = runOrCatch(r.expr(true).and(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #22");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #22:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #23
- /* false */
- Boolean expected_ = false;
- /* r.expr(false) & false */
- logger.info("About to run line #23: r.expr(false).and(false)");
- Object obtained = runOrCatch(r.expr(false).and(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #23");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #23:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #24
- /* false */
- Boolean expected_ = false;
- /* true & r.expr(false) */
- logger.info("About to run line #24: r.and(true, r.expr(false))");
- Object obtained = runOrCatch(r.and(true, r.expr(false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #24");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #24:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #25
- /* false */
- Boolean expected_ = false;
- /* false & r.expr(false) */
- logger.info("About to run line #25: r.and(false, r.expr(false))");
- Object obtained = runOrCatch(r.and(false, r.expr(false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #25");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #25:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #26
- /* false */
- Boolean expected_ = false;
- /* r.and_(true,false) */
- logger.info("About to run line #26: r.and(true, false)");
- Object obtained = runOrCatch(r.and(true, false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #26");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #26:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #27
- /* false */
- Boolean expected_ = false;
- /* r.and_(false,false) */
- logger.info("About to run line #27: r.and(false, false)");
- Object obtained = runOrCatch(r.and(false, false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #27");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #27:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #28
- /* false */
- Boolean expected_ = false;
- /* r.expr(true).and_(false) */
- logger.info("About to run line #28: r.expr(true).and(false)");
- Object obtained = runOrCatch(r.expr(true).and(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #28");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #28:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #29
- /* false */
- Boolean expected_ = false;
- /* r.expr(false).and_(false) */
- logger.info("About to run line #29: r.expr(false).and(false)");
- Object obtained = runOrCatch(r.expr(false).and(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #29");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #29:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #48
- /* true */
- Boolean expected_ = true;
- /* r.expr(true) | true */
- logger.info("About to run line #48: r.expr(true).or(true)");
- Object obtained = runOrCatch(r.expr(true).or(true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #48");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #48:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #49
- /* true */
- Boolean expected_ = true;
- /* r.expr(true) | false */
- logger.info("About to run line #49: r.expr(true).or(false)");
- Object obtained = runOrCatch(r.expr(true).or(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #49");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #49:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #50
- /* true */
- Boolean expected_ = true;
- /* true | r.expr(true) */
- logger.info("About to run line #50: r.or(true, r.expr(true))");
- Object obtained = runOrCatch(r.or(true, r.expr(true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #50");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #50:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #51
- /* true */
- Boolean expected_ = true;
- /* true | r.expr(false) */
- logger.info("About to run line #51: r.or(true, r.expr(false))");
- Object obtained = runOrCatch(r.or(true, r.expr(false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #51");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #51:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #52
- /* true */
- Boolean expected_ = true;
- /* r.or_(true,true) */
- logger.info("About to run line #52: r.or(true, true)");
- Object obtained = runOrCatch(r.or(true, true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #52");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #52:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #53
- /* true */
- Boolean expected_ = true;
- /* r.or_(true,false) */
- logger.info("About to run line #53: r.or(true, false)");
- Object obtained = runOrCatch(r.or(true, false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #53");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #53:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #54
- /* true */
- Boolean expected_ = true;
- /* r.expr(true).or_(true) */
- logger.info("About to run line #54: r.expr(true).or(true)");
- Object obtained = runOrCatch(r.expr(true).or(true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #54");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #54:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #55
- /* true */
- Boolean expected_ = true;
- /* r.expr(true).or_(false) */
- logger.info("About to run line #55: r.expr(true).or(false)");
- Object obtained = runOrCatch(r.expr(true).or(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #55");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #55:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #72
- /* false */
- Boolean expected_ = false;
- /* r.expr(false) | false */
- logger.info("About to run line #72: r.expr(false).or(false)");
- Object obtained = runOrCatch(r.expr(false).or(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #72");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #72:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #73
- /* false */
- Boolean expected_ = false;
- /* false | r.expr(false) */
- logger.info("About to run line #73: r.or(false, r.expr(false))");
- Object obtained = runOrCatch(r.or(false, r.expr(false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #73");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #73:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #74
- /* false */
- Boolean expected_ = false;
- /* r.and_(false,false) */
- logger.info("About to run line #74: r.and(false, false)");
- Object obtained = runOrCatch(r.and(false, false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #74");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #74:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #75
- /* false */
- Boolean expected_ = false;
- /* r.expr(false).and_(false) */
- logger.info("About to run line #75: r.expr(false).and(false)");
- Object obtained = runOrCatch(r.expr(false).and(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #75");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #75:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #88
- /* false */
- Boolean expected_ = false;
- /* ~r.expr(True) */
- logger.info("About to run line #88: r.expr(true).not()");
- Object obtained = runOrCatch(r.expr(true).not(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #88");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #88:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #89
- /* false */
- Boolean expected_ = false;
- /* r.not_(True) */
- logger.info("About to run line #89: r.not(true)");
- Object obtained = runOrCatch(r.not(true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #89");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #89:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #93
- /* true */
- Boolean expected_ = true;
- /* ~r.expr(False) */
- logger.info("About to run line #93: r.expr(false).not()");
- Object obtained = runOrCatch(r.expr(false).not(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #93");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #93:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #94
- /* true */
- Boolean expected_ = true;
- /* r.not_(False) */
- logger.info("About to run line #94: r.not(false)");
- Object obtained = runOrCatch(r.not(false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #94");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #94:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #97
- /* false */
- Boolean expected_ = false;
- /* r.expr(True).not_() */
- logger.info("About to run line #97: r.expr(true).not()");
- Object obtained = runOrCatch(r.expr(true).not(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #97");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #97:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #100
- /* true */
- Boolean expected_ = true;
- /* r.expr(False).not_() */
- logger.info("About to run line #100: r.expr(false).not()");
- Object obtained = runOrCatch(r.expr(false).not(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #100");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #100:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #107
- /* true */
- Boolean expected_ = true;
- /* ~r.and_(True, True) == r.or_(~r.expr(True), ~r.expr(True)) */
- logger.info("About to run line #107: r.and(true, true).not().eq(r.or(r.expr(true).not(), r.expr(true).not()))");
- Object obtained = runOrCatch(r.and(true, true).not().eq(r.or(r.expr(true).not(), r.expr(true).not())),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #107");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #107:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #108
- /* true */
- Boolean expected_ = true;
- /* ~r.and_(True, False) == r.or_(~r.expr(True), ~r.expr(False)) */
- logger.info("About to run line #108: r.and(true, false).not().eq(r.or(r.expr(true).not(), r.expr(false).not()))");
- Object obtained = runOrCatch(r.and(true, false).not().eq(r.or(r.expr(true).not(), r.expr(false).not())),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #108");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #108:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #109
- /* true */
- Boolean expected_ = true;
- /* ~r.and_(False, False) == r.or_(~r.expr(False), ~r.expr(False)) */
- logger.info("About to run line #109: r.and(false, false).not().eq(r.or(r.expr(false).not(), r.expr(false).not()))");
- Object obtained = runOrCatch(r.and(false, false).not().eq(r.or(r.expr(false).not(), r.expr(false).not())),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #109");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #109:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #110
- /* true */
- Boolean expected_ = true;
- /* ~r.and_(False, True) == r.or_(~r.expr(False), ~r.expr(True)) */
- logger.info("About to run line #110: r.and(false, true).not().eq(r.or(r.expr(false).not(), r.expr(true).not()))");
- Object obtained = runOrCatch(r.and(false, true).not().eq(r.or(r.expr(false).not(), r.expr(true).not())),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #110");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #110:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #120
- /* true */
- Boolean expected_ = true;
- /* r.and_(True, True, True, True, True) */
- logger.info("About to run line #120: r.and(true, true, true, true, true)");
- Object obtained = runOrCatch(r.and(true, true, true, true, true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #120");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #120:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #123
- /* false */
- Boolean expected_ = false;
- /* r.and_(True, True, True, False, True) */
- logger.info("About to run line #123: r.and(true, true, true, false, true)");
- Object obtained = runOrCatch(r.and(true, true, true, false, true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #123");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #123:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #126
- /* false */
- Boolean expected_ = false;
- /* r.and_(True, False, True, False, True) */
- logger.info("About to run line #126: r.and(true, false, true, false, true)");
- Object obtained = runOrCatch(r.and(true, false, true, false, true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #126");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #126:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #129
- /* false */
- Boolean expected_ = false;
- /* r.or_(False, False, False, False, False) */
- logger.info("About to run line #129: r.or(false, false, false, false, false)");
- Object obtained = runOrCatch(r.or(false, false, false, false, false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #129");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #129:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #132
- /* true */
- Boolean expected_ = true;
- /* r.or_(False, False, False, True, False) */
- logger.info("About to run line #132: r.or(false, false, false, true, false)");
- Object obtained = runOrCatch(r.or(false, false, false, true, false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #132");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #132:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #135
- /* true */
- Boolean expected_ = true;
- /* r.or_(False, True, False, True, False) */
- logger.info("About to run line #135: r.or(false, true, false, true, false)");
- Object obtained = runOrCatch(r.or(false, true, false, true, false),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #135");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #135:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #140
- /* err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.", []) */
- Err expected_ = err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.", r.array());
- /* r.expr(r.expr('a')['b']).default(2) */
- logger.info("About to run line #140: r.expr(r.expr('a').bracket('b')).default_(2L)");
- Object obtained = runOrCatch(r.expr(r.expr("a").bracket("b")).default_(2L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #140");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #140:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #143
- /* err("ReqlDriverCompileError", "Calling '==' on result of infix bitwise operator:", []) */
- Err expected_ = err("ReqlDriverCompileError", "Calling '==' on result of infix bitwise operator:", r.array());
- /* r.expr(r.expr(True) & r.expr(False) == r.expr(False) | r.expr(True)) */
- logger.info("About to run line #143: r.expr(r.expr(true).and(r.expr(false)).eq(r.expr(false).or(r.expr(true))))");
- Object obtained = runOrCatch(r.expr(r.expr(true).and(r.expr(false)).eq(r.expr(false).or(r.expr(true)))),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #143");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #143:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #145
- /* False */
- Boolean expected_ = false;
- /* r.expr(r.and_(True, False) == r.or_(False, True)) */
- logger.info("About to run line #145: r.expr(r.and(true, false).eq(r.or(false, true)))");
- Object obtained = runOrCatch(r.expr(r.and(true, false).eq(r.or(false, true))),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #145");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #145:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #147
- /* err("ReqlDriverCompileError", "Calling '>=' on result of infix bitwise operator:", []) */
- Err expected_ = err("ReqlDriverCompileError", "Calling '>=' on result of infix bitwise operator:", r.array());
- /* r.expr(r.expr(True) & r.expr(False) >= r.expr(False) | r.expr(True)) */
- logger.info("About to run line #147: r.expr(r.expr(true).and(r.expr(false)).ge(r.expr(false).or(r.expr(true))))");
- Object obtained = runOrCatch(r.expr(r.expr(true).and(r.expr(false)).ge(r.expr(false).or(r.expr(true)))),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #147");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #147:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #151
- /* False */
- Boolean expected_ = false;
- /* r.expr(r.and_(True, False) >= r.or_(False, True)) */
- logger.info("About to run line #151: r.expr(r.and(true, false).ge(r.or(false, true)))");
- Object obtained = runOrCatch(r.expr(r.and(true, false).ge(r.or(false, true))),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #151");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #151:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #156
- /* true */
- Boolean expected_ = true;
- /* r.expr(1) & True */
- logger.info("About to run line #156: r.expr(1L).and(true)");
- Object obtained = runOrCatch(r.expr(1L).and(true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #156");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #156:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #160
- /* ("str") */
- String expected_ = "str";
- /* r.expr(False) | 'str' */
- logger.info("About to run line #160: r.expr(false).or('str')");
- Object obtained = runOrCatch(r.expr(false).or("str"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #160");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #160:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #164
- /* false */
- Boolean expected_ = false;
- /* ~r.expr(1) */
- logger.info("About to run line #164: r.expr(1L).not()");
- Object obtained = runOrCatch(r.expr(1L).not(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #164");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #164:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // math_logic/logic.yaml line #168
- /* true */
- Boolean expected_ = true;
- /* ~r.expr(null) */
- logger.info("About to run line #168: r.expr((ReqlExpr) null).not()");
- Object obtained = runOrCatch(r.expr((ReqlExpr) null).not(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #168");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #168:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
- }
-}
diff --git a/src/test/java/com/rethinkdb/gen/MetaGrant.java b/src/test/java/com/rethinkdb/gen/MetaGrant.java
deleted file mode 100644
index ddca25f1..00000000
--- a/src/test/java/com/rethinkdb/gen/MetaGrant.java
+++ /dev/null
@@ -1,706 +0,0 @@
-// Autogenerated by convert_tests.py and process_polyglot.py.
-// Do not edit this file directly.
-// The template for this file is located at:
-// ../../../../../../../templates/Test.java
-package com.rethinkdb.gen;
-
-import com.rethinkdb.RethinkDB;
-import com.rethinkdb.model.OptArgs;
-import com.rethinkdb.net.Connection;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertArrayEquals;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.junit.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static com.rethinkdb.TestingCommon.*;
-import com.rethinkdb.TestingFramework;
-
-public class MetaGrant {
- // tests the `r.grant` term
- Logger logger = LoggerFactory.getLogger(MetaGrant.class);
- public static final RethinkDB r = RethinkDB.r;
-
- Connection conn;
-
- @Before
- public void setUp() throws Exception {
- logger.info("Setting up.");
- conn = TestingFramework.createConnection();
- try {
- r.dbCreate("test").run(conn);
- r.db("test").wait_().run(conn);
- }catch (Exception e){}
- }
-
- @After
- public void tearDown() throws Exception {
- logger.info("Tearing down.");
- r.db("rethinkdb").table("_debug_scratch").delete().run(conn);
- if(!conn.isOpen()){
- conn.close();
- conn = TestingFramework.createConnection();
- }
- r.dbDrop("test").run(conn);
- conn.close(false);
- }
-
- // Matches Python's str() function, which we use.
- // TODO: We might want to handle this in a visit_Call in convert_tests.py instead.
- private static String str(long i) {
- return String.valueOf(i);
- }
-
- // A hack to concatenate two Lists -- see is_array_add in convert_tests.py.
- private static List concatList(List x, List y) {
- List ret = new ArrayList(x);
- ret.addAll(y);
- return ret;
- }
-
- // Autogenerated tests below
-
- @Test(timeout=120000)
- public void test() throws Exception {
-
- {
- // meta/grant.yaml line #3
- /* err("ReqlOpFailedError", "Expected a boolean or nu" + "ll for `read`, got 1.", []) */
- Err expected_ = err("ReqlOpFailedError", "Expected a boolean or nu" + "ll for `read`, got 1.", r.array());
- /* r.grant("test_user", {"read": 1}) */
- logger.info("About to run line #3: r.grant('test_user', r.hashMap('read', 1L))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", 1L)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #3");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #3:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #5
- /* err("ReqlOpFailedError", "Unexpected key(s) `invalid`.", []) */
- Err expected_ = err("ReqlOpFailedError", "Unexpected key(s) `invalid`.", r.array());
- /* r.grant("test_user", {"invalid": "invalid"}) */
- logger.info("About to run line #5: r.grant('test_user', r.hashMap('invalid', 'invalid'))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("invalid", "invalid")),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #5");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #5:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #7
- /* {"granted": 1, "permissions_changes": [{"old_val": {"read": true, "write": true, "config": true, "connect": true}, "new_val": null}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", r.hashMap("read", true).with("write", true).with("config", true).with("connect", true)).with("new_val", null)));
- /* r.grant("test_user", {"read": null, "write": null, "config": null, "connect": null}) */
- logger.info("About to run line #7: r.grant('test_user', r.hashMap('read', null).with('write', null).with('config', null).with('connect', null))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", null).with("write", null).with("config", null).with("connect", null)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #7");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #7:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #9
- /* {"granted": 1, "permissions_changes": [{"old_val": null, "new_val": {"read": true, "write": true, "config": true, "connect": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", null).with("new_val", r.hashMap("read", true).with("write", true).with("config", true).with("connect", true))));
- /* r.grant("test_user", {"read": true, "write": true, "config": true, "connect": true}) */
- logger.info("About to run line #9: r.grant('test_user', r.hashMap('read', true).with('write', true).with('config', true).with('connect', true))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", true).with("write", true).with("config", true).with("connect", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #9");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #9:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #11
- /* {"granted": 1, "permissions_changes": [{"old_val": {"read": true, "write": true, "config": true, "connect": true}, "new_val": {"read": false, "write": false, "config": true, "connect": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", r.hashMap("read", true).with("write", true).with("config", true).with("connect", true)).with("new_val", r.hashMap("read", false).with("write", false).with("config", true).with("connect", true))));
- /* r.grant("test_user", {"read": false, "write": false}) */
- logger.info("About to run line #11: r.grant('test_user', r.hashMap('read', false).with('write', false))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", false).with("write", false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #11");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #11:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #13
- /* {"granted": 1, "permissions_changes": [{"old_val": {"read": false, "write": false, "config": true, "connect": true}, "new_val": {"write": false, "config": true, "connect": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", r.hashMap("read", false).with("write", false).with("config", true).with("connect", true)).with("new_val", r.hashMap("write", false).with("config", true).with("connect", true))));
- /* r.grant("test_user", {"read": null}) */
- logger.info("About to run line #13: r.grant('test_user', r.hashMap('read', null))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", null)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #13");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #13:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #15
- /* {"granted": 1, "permissions_changes": [{"old_val": {"write": false, "config": true, "connect": true}, "new_val": {"write": false, "config": true, "connect": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", r.hashMap("write", false).with("config", true).with("connect", true)).with("new_val", r.hashMap("write", false).with("config", true).with("connect", true))));
- /* r.grant("test_user", {}) */
- logger.info("About to run line #15: r.grant('test_user', r.hashMap())");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap()),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #15");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #15:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #18
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.db_create("database") */
- logger.info("About to run line #18: r.dbCreate('database')");
- Object obtained = runOrCatch(r.dbCreate("database"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #18");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #18:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #20
- /* err("ReqlOpFailedError", "The `connect` permission is only valid at the global scope.", []) */
- Err expected_ = err("ReqlOpFailedError", "The `connect` permission is only valid at the global scope.", r.array());
- /* r.db("database").grant("test_user", {"connect": true}) */
- logger.info("About to run line #20: r.db('database').grant('test_user', r.hashMap('connect', true))");
- Object obtained = runOrCatch(r.db("database").grant("test_user", r.hashMap("connect", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #20");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #20:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #22
- /* err("ReqlOpFailedError", "Unexpected key(s) `invalid`.", []) */
- Err expected_ = err("ReqlOpFailedError", "Unexpected key(s) `invalid`.", r.array());
- /* r.db("database").grant("test_user", {"invalid": "invalid"}) */
- logger.info("About to run line #22: r.db('database').grant('test_user', r.hashMap('invalid', 'invalid'))");
- Object obtained = runOrCatch(r.db("database").grant("test_user", r.hashMap("invalid", "invalid")),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #22");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #22:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #24
- /* {"granted": 1, "permissions_changes": [{"old_val": null, "new_val": {"read": true, "write": true, "config": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", null).with("new_val", r.hashMap("read", true).with("write", true).with("config", true))));
- /* r.db("database").grant("test_user", {"read": true, "write": true, "config": true}) */
- logger.info("About to run line #24: r.db('database').grant('test_user', r.hashMap('read', true).with('write', true).with('config', true))");
- Object obtained = runOrCatch(r.db("database").grant("test_user", r.hashMap("read", true).with("write", true).with("config", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #24");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #24:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #27
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.db("database").table_create("table") */
- logger.info("About to run line #27: r.db('database').tableCreate('table')");
- Object obtained = runOrCatch(r.db("database").tableCreate("table"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #27");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #27:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #29
- /* err("ReqlOpFailedError", "The `connect` permission is only valid at the global scope.", []) */
- Err expected_ = err("ReqlOpFailedError", "The `connect` permission is only valid at the global scope.", r.array());
- /* r.db("database").table("table").grant("test_user", {"connect": true}) */
- logger.info("About to run line #29: r.db('database').table('table').grant('test_user', r.hashMap('connect', true))");
- Object obtained = runOrCatch(r.db("database").table("table").grant("test_user", r.hashMap("connect", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #29");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #29:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #31
- /* err("ReqlOpFailedError", "Unexpected key(s) `invalid`.", []) */
- Err expected_ = err("ReqlOpFailedError", "Unexpected key(s) `invalid`.", r.array());
- /* r.db("database").table("table").grant("test_user", {"invalid": "invalid"}) */
- logger.info("About to run line #31: r.db('database').table('table').grant('test_user', r.hashMap('invalid', 'invalid'))");
- Object obtained = runOrCatch(r.db("database").table("table").grant("test_user", r.hashMap("invalid", "invalid")),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #31");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #31:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #33
- /* {"granted": 1, "permissions_changes": [{"old_val": null, "new_val": {"read": true, "write": true, "config": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", null).with("new_val", r.hashMap("read", true).with("write", true).with("config", true))));
- /* r.db("database").table("table").grant("test_user", {"read": true, "write": true, "config": true}) */
- logger.info("About to run line #33: r.db('database').table('table').grant('test_user', r.hashMap('read', true).with('write', true).with('config', true))");
- Object obtained = runOrCatch(r.db("database").table("table").grant("test_user", r.hashMap("read", true).with("write", true).with("config", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #33");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #33:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #36
- /* err("ReqlOpFailedError", "The permissions of the user `admin` can't be modified.", []) */
- Err expected_ = err("ReqlOpFailedError", "The permissions of the user `admin` can't be modified.", r.array());
- /* r.grant("admin", {"config": false}) */
- logger.info("About to run line #36: r.grant('admin', r.hashMap('config', false))");
- Object obtained = runOrCatch(r.grant("admin", r.hashMap("config", false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #36");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #36:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #38
- /* err("ReqlOpFailedError", "The permissions of the user `admin` can't be modified.", []) */
- Err expected_ = err("ReqlOpFailedError", "The permissions of the user `admin` can't be modified.", r.array());
- /* r.db("database").grant("admin", {"config": false}) */
- logger.info("About to run line #38: r.db('database').grant('admin', r.hashMap('config', false))");
- Object obtained = runOrCatch(r.db("database").grant("admin", r.hashMap("config", false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #38");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #38:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #40
- /* err("ReqlOpFailedError", "The permissions of the user `admin` can't be modified.", []) */
- Err expected_ = err("ReqlOpFailedError", "The permissions of the user `admin` can't be modified.", r.array());
- /* r.db("database").table("table").grant("admin", {"config": false}) */
- logger.info("About to run line #40: r.db('database').table('table').grant('admin', r.hashMap('config', false))");
- Object obtained = runOrCatch(r.db("database").table("table").grant("admin", r.hashMap("config", false)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #40");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #40:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #43
- /* {"granted": 1, "permissions_changes": [{"old_val": null, "new_val": {"read": true, "write": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", null).with("new_val", r.hashMap("read", true).with("write", true))));
- /* r.db("rethinkdb").grant("test_user", {"read": true, "write": true}) */
- logger.info("About to run line #43: r.db('rethinkdb').grant('test_user', r.hashMap('read', true).with('write', true))");
- Object obtained = runOrCatch(r.db("rethinkdb").grant("test_user", r.hashMap("read", true).with("write", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #43");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #43:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #45
- /* {"granted": 1, "permissions_changes": [{"old_val": null, "new_val": {"read": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", null).with("new_val", r.hashMap("read", true))));
- /* r.db("rethinkdb").table("stats").grant("test_user", {"read": true}) */
- logger.info("About to run line #45: r.db('rethinkdb').table('stats').grant('test_user', r.hashMap('read', true))");
- Object obtained = runOrCatch(r.db("rethinkdb").table("stats").grant("test_user", r.hashMap("read", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #45");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #45:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #48
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.db("rethinkdb").table("permissions").filter({"user": "test_user"}).delete() */
- logger.info("About to run line #48: r.db('rethinkdb').table('permissions').filter(r.hashMap('user', 'test_user')).delete()");
- Object obtained = runOrCatch(r.db("rethinkdb").table("permissions").filter(r.hashMap("user", "test_user")).delete(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #48");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #48:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #49
- /* err("ReqlPermissionError", "User `test_user` does not have the required `read` permission.", []) */
- Err expected_ = err("ReqlPermissionError", "User `test_user` does not have the required `read` permission.", r.array());
- /* r.grant("test_user", {"read": true}) */
- logger.info("About to run line #49: r.grant('test_user', r.hashMap('read', true))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", true)),
- new OptArgs()
- .with("user", "test_user")
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #49");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #49:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #53
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.grant("test_user", {"read": true, "write": true}) */
- logger.info("About to run line #53: r.grant('test_user', r.hashMap('read', true).with('write', true))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", true).with("write", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #53");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #53:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #54
- /* err("ReqlPermissionError", "User `test_user` does not have the required `read` permission.", []) */
- Err expected_ = err("ReqlPermissionError", "User `test_user` does not have the required `read` permission.", r.array());
- /* r.grant("test_user", {"read": true}) */
- logger.info("About to run line #54: r.grant('test_user', r.hashMap('read', true))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", true)),
- new OptArgs()
- .with("user", "test_user")
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #54");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #54:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #58
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.grant("test_user", {"read": null, "write": null}) */
- logger.info("About to run line #58: r.grant('test_user', r.hashMap('read', null).with('write', null))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", null).with("write", null)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #58");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #58:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #59
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.db("rethinkdb").grant("test_user", {"read": true, "write": true}) */
- logger.info("About to run line #59: r.db('rethinkdb').grant('test_user', r.hashMap('read', true).with('write', true))");
- Object obtained = runOrCatch(r.db("rethinkdb").grant("test_user", r.hashMap("read", true).with("write", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #59");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #59:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #60
- /* {"granted": 1, "permissions_changes": [{"old_val": null, "new_val": {"read": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", null).with("new_val", r.hashMap("read", true))));
- /* r.grant("test_user", {"read": true}) */
- logger.info("About to run line #60: r.grant('test_user', r.hashMap('read', true))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("read", true)),
- new OptArgs()
- .with("user", "test_user")
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #60");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #60:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #64
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.db("rethinkdb").grant("test_user", {"read": null, "write": null}) */
- logger.info("About to run line #64: r.db('rethinkdb').grant('test_user', r.hashMap('read', null).with('write', null))");
- Object obtained = runOrCatch(r.db("rethinkdb").grant("test_user", r.hashMap("read", null).with("write", null)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #64");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #64:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #65
- /* AnythingIsFine */
- Object expected_ = AnythingIsFine;
- /* r.db("rethinkdb").table("permissions").grant("test_user", {"read": true, "write": true}) */
- logger.info("About to run line #65: r.db('rethinkdb').table('permissions').grant('test_user', r.hashMap('read', true).with('write', true))");
- Object obtained = runOrCatch(r.db("rethinkdb").table("permissions").grant("test_user", r.hashMap("read", true).with("write", true)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #65");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #65:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // meta/grant.yaml line #66
- /* {"granted": 1, "permissions_changes": [{"old_val": {"read": true}, "new_val": {"read": true, "write": true}}]} */
- Map expected_ = r.hashMap("granted", 1L).with("permissions_changes", r.array(r.hashMap("old_val", r.hashMap("read", true)).with("new_val", r.hashMap("read", true).with("write", true))));
- /* r.grant("test_user", {"write": true}) */
- logger.info("About to run line #66: r.grant('test_user', r.hashMap('write', true))");
- Object obtained = runOrCatch(r.grant("test_user", r.hashMap("write", true)),
- new OptArgs()
- .with("user", "test_user")
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #66");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #66:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
- }
-}
diff --git a/src/test/java/com/rethinkdb/gen/MutationInsert.java b/src/test/java/com/rethinkdb/gen/MutationInsert.java
deleted file mode 100644
index 0028c5d3..00000000
--- a/src/test/java/com/rethinkdb/gen/MutationInsert.java
+++ /dev/null
@@ -1,1204 +0,0 @@
-// Autogenerated by convert_tests.py and process_polyglot.py.
-// Do not edit this file directly.
-// The template for this file is located at:
-// ../../../../../../../templates/Test.java
-package com.rethinkdb.gen;
-
-import com.rethinkdb.RethinkDB;
-import com.rethinkdb.gen.ast.*;
-import com.rethinkdb.model.OptArgs;
-import com.rethinkdb.net.Connection;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertArrayEquals;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.junit.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.LongStream;
-import java.util.stream.Collectors;
-
-import static com.rethinkdb.TestingCommon.*;
-import com.rethinkdb.TestingFramework;
-
-public class MutationInsert {
- // Tests insertion into tables
- Logger logger = LoggerFactory.getLogger(MutationInsert.class);
- public static final RethinkDB r = RethinkDB.r;
- public static final Table tbl = r.db("test").table("tbl");
-
- Connection conn;
-
- @Before
- public void setUp() throws Exception {
- logger.info("Setting up.");
- conn = TestingFramework.createConnection();
- try {
- r.dbCreate("test").run(conn);
- r.db("test").wait_().run(conn);
- }catch (Exception e){}
- try {
- r.db("test").tableCreate("tbl").run(conn);
- r.db("test").table(tbl).wait_().run(conn);
- }catch (Exception e){}
- }
-
- @After
- public void tearDown() throws Exception {
- logger.info("Tearing down.");
- r.db("rethinkdb").table("_debug_scratch").delete().run(conn);
- if(!conn.isOpen()){
- conn.close();
- conn = TestingFramework.createConnection();
- }
- r.db("test").tableDrop("tbl").run(conn);
- r.dbDrop("test").run(conn);
- conn.close(false);
- }
-
- // Matches Python's str() function, which we use.
- // TODO: We might want to handle this in a visit_Call in convert_tests.py instead.
- private static String str(long i) {
- return String.valueOf(i);
- }
-
- // A hack to concatenate two Lists -- see is_array_add in convert_tests.py.
- private static List concatList(List x, List y) {
- List ret = new ArrayList(x);
- ret.addAll(y);
- return ret;
- }
-
- // Autogenerated tests below
-
- @Test(timeout=120000)
- public void test() throws Exception {
-
- {
- // mutation/insert.yaml line #6
- /* partial({'tables_created':1}) */
- Partial expected_ = partial(r.hashMap("tables_created", 1L));
- /* r.db('test').table_create('test2') */
- logger.info("About to run line #6: r.db('test').tableCreate('test2')");
- Object obtained = runOrCatch(r.db("test").tableCreate("test2"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #6");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #6:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- // mutation/insert.yaml line #9
- // tbl2 = r.db('test').table('test2')
- logger.info("Possibly executing: Table tbl2 = (Table) (r.db('test').table('test2'));");
- Table tbl2 = (Table) (r.db("test").table("test2"));
-
- {
- // mutation/insert.yaml line #12
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tbl.insert({'id':0,'a':0}) */
- logger.info("About to run line #12: tbl.insert(r.hashMap('id', 0L).with('a', 0L))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 0L).with("a", 0L)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #12");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #12:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #14
- /* 1 */
- Long expected_ = 1L;
- /* tbl.count() */
- logger.info("About to run line #14: tbl.count()");
- Object obtained = runOrCatch(tbl.count(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #14");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #14:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #18
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tbl.insert({'id':1, 'a':1}, durability='hard') */
- logger.info("About to run line #18: tbl.insert(r.hashMap('id', 1L).with('a', 1L)).optArg('durability', 'hard')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 1L).with("a", 1L)).optArg("durability", "hard"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #18");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #18:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #22
- /* 2 */
- Long expected_ = 2L;
- /* tbl.count() */
- logger.info("About to run line #22: tbl.count()");
- Object obtained = runOrCatch(tbl.count(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #22");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #22:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #26
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tbl.insert({'id':2, 'a':2}, durability='soft') */
- logger.info("About to run line #26: tbl.insert(r.hashMap('id', 2L).with('a', 2L)).optArg('durability', 'soft')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 2L).with("a", 2L)).optArg("durability", "soft"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #26");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #26:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #30
- /* 3 */
- Long expected_ = 3L;
- /* tbl.count() */
- logger.info("About to run line #30: tbl.count()");
- Object obtained = runOrCatch(tbl.count(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #30");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #30:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #34
- /* err('ReqlQueryLogicError', 'Durability option `wrong` unrecognized (options are "hard" and "soft").', [0]) */
- Err expected_ = err("ReqlQueryLogicError", "Durability option `wrong` unrecognized (options are \"hard\" and \"soft\").", r.array(0L));
- /* tbl.insert({'id':3, 'a':3}, durability='wrong') */
- logger.info("About to run line #34: tbl.insert(r.hashMap('id', 3L).with('a', 3L)).optArg('durability', 'wrong')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 3L).with("a", 3L)).optArg("durability", "wrong"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #34");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #34:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #38
- /* 3 */
- Long expected_ = 3L;
- /* tbl.count() */
- logger.info("About to run line #38: tbl.count()");
- Object obtained = runOrCatch(tbl.count(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #38");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #38:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #42
- /* {'deleted':1,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0} */
- Map expected_ = r.hashMap("deleted", 1L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 0L);
- /* tbl.get(2).delete() */
- logger.info("About to run line #42: tbl.get(2L).delete()");
- Object obtained = runOrCatch(tbl.get(2L).delete(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #42");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #42:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #46
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':2} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 2L);
- /* tbl.insert([{'id':2,'a':2}, {'id':3,'a':3}]) */
- logger.info("About to run line #46: tbl.insert(r.array(r.hashMap('id', 2L).with('a', 2L), r.hashMap('id', 3L).with('a', 3L)))");
- Object obtained = runOrCatch(tbl.insert(r.array(r.hashMap("id", 2L).with("a", 2L), r.hashMap("id", 3L).with("a", 3L))),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #46");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #46:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #50
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':4} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 4L);
- /* tbl2.insert(tbl) */
- logger.info("About to run line #50: tbl2.insert(tbl)");
- Object obtained = runOrCatch(tbl2.insert(tbl),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #50");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #50:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #54
- /* {'first_error':"Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}",'deleted':0,'replaced':0,'unchanged':0,'errors':1,'skipped':0,'inserted':0} */
- Map expected_ = r.hashMap("first_error", "Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}").with("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 1L).with("skipped", 0L).with("inserted", 0L);
- /* tbl.insert({'id':2,'b':20}) */
- logger.info("About to run line #54: tbl.insert(r.hashMap('id', 2L).with('b', 20L))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 2L).with("b", 20L)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #54");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #54:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #58
- /* {'first_error':"Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}",'deleted':0,'replaced':0,'unchanged':0,'errors':1,'skipped':0,'inserted':0} */
- Map expected_ = r.hashMap("first_error", "Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}").with("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 1L).with("skipped", 0L).with("inserted", 0L);
- /* tbl.insert({'id':2,'b':20}, conflict='error') */
- logger.info("About to run line #58: tbl.insert(r.hashMap('id', 2L).with('b', 20L)).optArg('conflict', 'error')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 2L).with("b", 20L)).optArg("conflict", "error"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #58");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #58:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #64
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tbl.insert({'id':15,'b':20}, conflict='error') */
- logger.info("About to run line #64: tbl.insert(r.hashMap('id', 15L).with('b', 20L)).optArg('conflict', 'error')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 15L).with("b", 20L)).optArg("conflict", "error"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #64");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #64:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #69
- /* {'id':15,'b':20} */
- Map expected_ = r.hashMap("id", 15L).with("b", 20L);
- /* tbl.get(15) */
- logger.info("About to run line #69: tbl.get(15L)");
- Object obtained = runOrCatch(tbl.get(15L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #69");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #69:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #73
- /* {'deleted':0,'replaced':1,'unchanged':0,'errors':0,'skipped':0,'inserted':0} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 1L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 0L);
- /* tbl.insert({'id':2,'b':20}, conflict='replace') */
- logger.info("About to run line #73: tbl.insert(r.hashMap('id', 2L).with('b', 20L)).optArg('conflict', 'replace')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 2L).with("b", 20L)).optArg("conflict", "replace"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #73");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #73:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #78
- /* {'id':2,'b':20} */
- Map expected_ = r.hashMap("id", 2L).with("b", 20L);
- /* tbl.get(2) */
- logger.info("About to run line #78: tbl.get(2L)");
- Object obtained = runOrCatch(tbl.get(2L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #78");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #78:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #82
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tbl.insert({'id':20,'b':20}, conflict='replace') */
- logger.info("About to run line #82: tbl.insert(r.hashMap('id', 20L).with('b', 20L)).optArg('conflict', 'replace')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 20L).with("b", 20L)).optArg("conflict", "replace"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #82");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #82:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #87
- /* {'id':20,'b':20} */
- Map expected_ = r.hashMap("id", 20L).with("b", 20L);
- /* tbl.get(20) */
- logger.info("About to run line #87: tbl.get(20L)");
- Object obtained = runOrCatch(tbl.get(20L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #87");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #87:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #91
- /* {'deleted':0,'replaced':1,'unchanged':0,'errors':0,'skipped':0,'inserted':0} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 1L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 0L);
- /* tbl.insert({'id':2,'c':30}, conflict='update') */
- logger.info("About to run line #91: tbl.insert(r.hashMap('id', 2L).with('c', 30L)).optArg('conflict', 'update')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 2L).with("c", 30L)).optArg("conflict", "update"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #91");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #91:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #96
- /* {'id':2, 'b':20, 'c':30} */
- Map expected_ = r.hashMap("id", 2L).with("b", 20L).with("c", 30L);
- /* tbl.get(2) */
- logger.info("About to run line #96: tbl.get(2L)");
- Object obtained = runOrCatch(tbl.get(2L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #96");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #96:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #100
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tbl.insert({'id':30,'b':20}, conflict='update') */
- logger.info("About to run line #100: tbl.insert(r.hashMap('id', 30L).with('b', 20L)).optArg('conflict', 'update')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 30L).with("b", 20L)).optArg("conflict", "update"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #100");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #100:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #105
- /* {'id':30,'b':20} */
- Map expected_ = r.hashMap("id", 30L).with("b", 20L);
- /* tbl.get(30) */
- logger.info("About to run line #105: tbl.get(30L)");
- Object obtained = runOrCatch(tbl.get(30L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #105");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #105:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #109
- /* err('ReqlQueryLogicError', 'Conflict option `wrong` unrecognized (options are "error", "replace" and "update").', [0]) */
- Err expected_ = err("ReqlQueryLogicError", "Conflict option `wrong` unrecognized (options are \"error\", \"replace\" and \"update\").", r.array(0L));
- /* tbl.insert({'id':3, 'a':3}, conflict='wrong') */
- logger.info("About to run line #109: tbl.insert(r.hashMap('id', 3L).with('a', 3L)).optArg('conflict', 'wrong')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 3L).with("a", 3L)).optArg("conflict", "wrong"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #109");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #109:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- // mutation/insert.yaml line #120
- // tblpkey = r.db('test').table('testpkey')
- logger.info("Possibly executing: Table tblpkey = (Table) (r.db('test').table('testpkey'));");
- Table tblpkey = (Table) (r.db("test").table("testpkey"));
-
- {
- // mutation/insert.yaml line #115
- /* partial({'tables_created':1}) */
- Partial expected_ = partial(r.hashMap("tables_created", 1L));
- /* r.db('test').table_create('testpkey', primary_key='foo') */
- logger.info("About to run line #115: r.db('test').tableCreate('testpkey').optArg('primary_key', 'foo')");
- Object obtained = runOrCatch(r.db("test").tableCreate("testpkey").optArg("primary_key", "foo"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #115");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #115:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #122
- /* {'deleted':0,'replaced':0,'generated_keys':arrlen(1,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("generated_keys", arrlen(1L, uuid())).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tblpkey.insert({}) */
- logger.info("About to run line #122: tblpkey.insert(r.hashMap())");
- Object obtained = runOrCatch(tblpkey.insert(r.hashMap()),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #122");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #122:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #125
- /* [{'foo':uuid()}] */
- List expected_ = r.array(r.hashMap("foo", uuid()));
- /* tblpkey */
- logger.info("About to run line #125: tblpkey");
- Object obtained = runOrCatch(tblpkey,
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #125");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #125:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #129
- /* {'deleted':0,'replaced':0,'generated_keys':arrlen(1,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("generated_keys", arrlen(1L, uuid())).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tblpkey.insert({'b':20}, conflict='replace') */
- logger.info("About to run line #129: tblpkey.insert(r.hashMap('b', 20L)).optArg('conflict', 'replace')");
- Object obtained = runOrCatch(tblpkey.insert(r.hashMap("b", 20L)).optArg("conflict", "replace"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #129");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #129:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #135
- /* {'deleted':0,'replaced':0,'generated_keys':arrlen(1,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':1} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("generated_keys", arrlen(1L, uuid())).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 1L);
- /* tblpkey.insert({'b':20}, conflict='update') */
- logger.info("About to run line #135: tblpkey.insert(r.hashMap('b', 20L)).optArg('conflict', 'update')");
- Object obtained = runOrCatch(tblpkey.insert(r.hashMap("b", 20L)).optArg("conflict", "update"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #135");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #135:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #140
- /* partial({'tables_dropped':1}) */
- Partial expected_ = partial(r.hashMap("tables_dropped", 1L));
- /* r.db('test').table_drop('testpkey') */
- logger.info("About to run line #140: r.db('test').tableDrop('testpkey')");
- Object obtained = runOrCatch(r.db("test").tableDrop("testpkey"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #140");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #140:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #144
- /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':7} */
- Map expected_ = r.hashMap("deleted", 0L).with("replaced", 0L).with("unchanged", 0L).with("errors", 0L).with("skipped", 0L).with("inserted", 7L);
- /* tbl.for_each(lambda row: tbl2.insert(row.merge({'id':row['id'] + 100 })) ) */
- logger.info("About to run line #144: tbl.forEach(row -> tbl2.insert(row.merge(r.hashMap('id', row.bracket('id').add(100L)))))");
- Object obtained = runOrCatch(tbl.forEach(row -> tbl2.insert(row.merge(r.hashMap("id", row.bracket("id").add(100L))))),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #144");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #144:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #150
- /* partial({'errors':1,'first_error':'`r.minval` and `r.maxval` cannot be written to disk.'}) */
- Partial expected_ = partial(r.hashMap("errors", 1L).with("first_error", "`r.minval` and `r.maxval` cannot be written to disk."));
- /* tbl.insert({'value':r.minval}) */
- logger.info("About to run line #150: tbl.insert(r.hashMap('value', r.minval()))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("value", r.minval())),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #150");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #150:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #154
- /* partial({'errors':1,'first_error':'`r.minval` and `r.maxval` cannot be written to disk.'}) */
- Partial expected_ = partial(r.hashMap("errors", 1L).with("first_error", "`r.minval` and `r.maxval` cannot be written to disk."));
- /* tbl.insert({'value':r.maxval}) */
- logger.info("About to run line #154: tbl.insert(r.hashMap('value', r.maxval()))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("value", r.maxval())),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #154");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #154:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #159
- /* {'changes': [{'new_val': {'id': 666}, 'old_val': None},{'error': 'Duplicate primary key `id`:\n{\n\t"id":\t666\n}\n{\n\t"id":\t666\n}','new_val': {'id': 666},'old_val': {'id': 666}}],'deleted': 0,'errors': 1,'first_error': 'Duplicate primary key `id`:\n{\n\t"id":\t666\n}\n{\n\t"id":\t666\n}','inserted': 1,'replaced': 0,'skipped': 0,'unchanged': 0} */
- Map expected_ = r.hashMap("changes", r.array(r.hashMap("new_val", r.hashMap("id", 666L)).with("old_val", null), r.hashMap("error", "Duplicate primary key `id`:\n{\n\t\"id\":\t666\n}\n{\n\t\"id\":\t666\n}").with("new_val", r.hashMap("id", 666L)).with("old_val", r.hashMap("id", 666L)))).with("deleted", 0L).with("errors", 1L).with("first_error", "Duplicate primary key `id`:\n{\n\t\"id\":\t666\n}\n{\n\t\"id\":\t666\n}").with("inserted", 1L).with("replaced", 0L).with("skipped", 0L).with("unchanged", 0L);
- /* tbl.insert([{'id':666}, {'id':666}], return_changes="always") */
- logger.info("About to run line #159: tbl.insert(r.array(r.hashMap('id', 666L), r.hashMap('id', 666L))).optArg('return_changes', 'always')");
- Object obtained = runOrCatch(tbl.insert(r.array(r.hashMap("id", 666L), r.hashMap("id", 666L))).optArg("return_changes", "always"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #159");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #159:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #163
- /* partial({'changes':[{'old_val': None, 'new_val': {'id': 100+i, 'ordered-num': i}} for i in range(1,100)] }) */
- Partial expected_ = partial(r.hashMap("changes", LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("old_val", null).with("new_val", r.hashMap("id", 100L + i).with("ordered-num", i))).collect(Collectors.toList())));
- /* tbl.insert([{'id':100+i, 'ordered-num':i} for i in range(1,100)], return_changes="always") */
- logger.info("About to run line #163: tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap('id', r.add(100L, i)).with('ordered-num', i)).collect(Collectors.toList())).optArg('return_changes', 'always')");
- Object obtained = runOrCatch(tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("id", r.add(100L, i)).with("ordered-num", i)).collect(Collectors.toList())).optArg("return_changes", "always"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #163");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #163:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #167
- /* partial({'changes':[{'old_val': None, 'new_val': {'id': [1,"blah", 200+i], 'ordered-num': i}} for i in range(1,100)] }) */
- Partial expected_ = partial(r.hashMap("changes", LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("old_val", null).with("new_val", r.hashMap("id", r.array(1L, "blah", 200L + i)).with("ordered-num", i))).collect(Collectors.toList())));
- /* tbl.insert([{'id':[1, "blah", 200+i], 'ordered-num':i} for i in range(1,100)], return_changes="always") */
- logger.info("About to run line #167: tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap('id', r.array(1L, 'blah', r.add(200L, i))).with('ordered-num', i)).collect(Collectors.toList())).optArg('return_changes', 'always')");
- Object obtained = runOrCatch(tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("id", r.array(1L, "blah", r.add(200L, i))).with("ordered-num", i)).collect(Collectors.toList())).optArg("return_changes", "always"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #167");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #167:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #171
- /* partial({'changes':[{'old_val': None, 'new_val': {'id': [1,"blah", 300+i], 'ordered-num': i}} for i in range(1,100)] }) */
- Partial expected_ = partial(r.hashMap("changes", LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("old_val", null).with("new_val", r.hashMap("id", r.array(1L, "blah", 300L + i)).with("ordered-num", i))).collect(Collectors.toList())));
- /* tbl.insert([{'id':[1, "blah", 300+i], 'ordered-num':i} for i in range(1,100)], return_changes=true) */
- logger.info("About to run line #171: tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap('id', r.array(1L, 'blah', r.add(300L, i))).with('ordered-num', i)).collect(Collectors.toList())).optArg('return_changes', true)");
- Object obtained = runOrCatch(tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("id", r.array(1L, "blah", r.add(300L, i))).with("ordered-num", i)).collect(Collectors.toList())).optArg("return_changes", true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #171");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #171:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #175
- /* partial({'changes':[{'old_val': {'id':100+i, 'ordered-num':i}, 'new_val': {'id':100+i, 'ordered-num':i}, 'error':'Duplicate primary key `id`:\n{\n\t"id":\t'+str(100+i)+',\n\t"ordered-num":\t'+str(i)+'\n}\n{\n\t"id":\t'+str(100+i)+',\n\t"ordered-num":\t'+str(i)+'\n}'} for i in range(1,100)]}) */
- Partial expected_ = partial(r.hashMap("changes", LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("old_val", r.hashMap("id", 100L + i).with("ordered-num", i)).with("new_val", r.hashMap("id", 100L + i).with("ordered-num", i)).with("error", "Duplicate primary key `id`:\n{\n\t\"id\":\t" + str(100L + i) + ",\n\t\"ordered-num\":\t" + str(i) + "\n}\n{\n\t\"id\":\t" + str(100L + i) + ",\n\t\"ordered-num\":\t" + str(i) + "\n}")).collect(Collectors.toList())));
- /* tbl.insert([{'id':100 + i, 'ordered-num':i} for i in range(1,100)], return_changes="always") */
- logger.info("About to run line #175: tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap('id', r.add(100L, i)).with('ordered-num', i)).collect(Collectors.toList())).optArg('return_changes', 'always')");
- Object obtained = runOrCatch(tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("id", r.add(100L, i)).with("ordered-num", i)).collect(Collectors.toList())).optArg("return_changes", "always"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #175");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #175:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #179
- /* {'changes': [{'error': 'Duplicate primary key `id`:\n{\n\t"id":\t123,\n\t"ordered-num":\t23\n}\n{\n\t"id":\t123\n}', 'new_val': {'id': 123, 'ordered-num': 23}, 'old_val': {'id': 123, 'ordered-num': 23}}, {'error': 'Primary key too long (max 127 characters): "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"', 'new_val': None, 'old_val': None}, {'new_val': {'id': 321}, 'old_val': None}], 'deleted': 0, 'errors': 2, 'first_error': 'Primary key too long (max 127 characters): "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"', 'inserted': 1, 'replaced': 0, 'skipped': 0, 'unchanged': 0} */
- Map expected_ = r.hashMap("changes", r.array(r.hashMap("error", "Duplicate primary key `id`:\n{\n\t\"id\":\t123,\n\t\"ordered-num\":\t23\n}\n{\n\t\"id\":\t123\n}").with("new_val", r.hashMap("id", 123L).with("ordered-num", 23L)).with("old_val", r.hashMap("id", 123L).with("ordered-num", 23L)), r.hashMap("error", "Primary key too long (max 127 characters): \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"").with("new_val", null).with("old_val", null), r.hashMap("new_val", r.hashMap("id", 321L)).with("old_val", null))).with("deleted", 0L).with("errors", 2L).with("first_error", "Primary key too long (max 127 characters): \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"").with("inserted", 1L).with("replaced", 0L).with("skipped", 0L).with("unchanged", 0L);
- /* tbl.insert([{'id':123}, {'id':'a'*500}, {'id':321}], return_changes="always") */
- logger.info("About to run line #179: tbl.insert(r.array(r.hashMap('id', 123L), r.hashMap('id', r.mul('a', 500L)), r.hashMap('id', 321L))).optArg('return_changes', 'always')");
- Object obtained = runOrCatch(tbl.insert(r.array(r.hashMap("id", 123L), r.hashMap("id", r.mul("a", 500L)), r.hashMap("id", 321L))).optArg("return_changes", "always"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #179");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #179:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #183
- /* partial({'changes':[]}) */
- Partial expected_ = partial(r.hashMap("changes", r.array()));
- /* tbl.insert([{'id':100 + i, 'ordered-num':i} for i in range(1,100)], return_changes=true) */
- logger.info("About to run line #183: tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap('id', r.add(100L, i)).with('ordered-num', i)).collect(Collectors.toList())).optArg('return_changes', true)");
- Object obtained = runOrCatch(tbl.insert(LongStream.range(1L, 100L).boxed().map(i -> r.hashMap("id", r.add(100L, i)).with("ordered-num", i)).collect(Collectors.toList())).optArg("return_changes", true),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #183");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #183:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #186
- /* partial({'changes': [{'old_val': None, 'new_val': None, 'error': '`r.minval` and `r.maxval` cannot be written to disk.'}]}) */
- Partial expected_ = partial(r.hashMap("changes", r.array(r.hashMap("old_val", null).with("new_val", null).with("error", "`r.minval` and `r.maxval` cannot be written to disk."))));
- /* tbl.insert({'a':r.minval}, return_changes="always") */
- logger.info("About to run line #186: tbl.insert(r.hashMap('a', r.minval())).optArg('return_changes', 'always')");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("a", r.minval())).optArg("return_changes", "always"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #186");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #186:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #192
- /* partial({'inserted':1}) */
- Partial expected_ = partial(r.hashMap("inserted", 1L));
- /* tbl.insert({'id':42, 'foo':1, 'bar':1}) */
- logger.info("About to run line #192: tbl.insert(r.hashMap('id', 42L).with('foo', 1L).with('bar', 1L))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 42L).with("foo", 1L).with("bar", 1L)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #192");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #192:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #194
- /* partial({'replaced':1}) */
- Partial expected_ = partial(r.hashMap("replaced", 1L));
- /* tbl.insert({'id':42, 'foo':5, 'bar':5}, conflict=lambda id, old_row, new_row: old_row.merge(new_row.pluck("bar"))) */
- logger.info("About to run line #194: tbl.insert(r.hashMap('id', 42L).with('foo', 5L).with('bar', 5L)).optArg('conflict', (id, old_row, new_row) -> old_row.merge(new_row.pluck('bar')))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 42L).with("foo", 5L).with("bar", 5L)).optArg("conflict", (id, old_row, new_row) -> old_row.merge(new_row.pluck("bar"))),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #194");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #194:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #196
- /* {'id':42, 'foo':1, 'bar':5} */
- Map expected_ = r.hashMap("id", 42L).with("foo", 1L).with("bar", 5L);
- /* tbl.get(42) */
- logger.info("About to run line #196: tbl.get(42L)");
- Object obtained = runOrCatch(tbl.get(42L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #196");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #196:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #214
- /* partial({'first_error': 'Inserted value must be an OBJECT (got NUMBER):\n2'}) */
- Partial expected_ = partial(r.hashMap("first_error", "Inserted value must be an OBJECT (got NUMBER):\n2"));
- /* tbl.insert({'id':42, 'foo':1, 'bar':1}, conflict=lambda a,b,c: 2) */
- logger.info("About to run line #214: tbl.insert(r.hashMap('id', 42L).with('foo', 1L).with('bar', 1L)).optArg('conflict', (a, b, c) -> 2L)");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 42L).with("foo", 1L).with("bar", 1L)).optArg("conflict", (a, b, c) -> 2L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #214");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #214:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #218
- /* err("ReqlQueryLogicError", "The conflict function passed to `insert` should expect 3 arguments.") */
- Err expected_ = err("ReqlQueryLogicError", "The conflict function passed to `insert` should expect 3 arguments.");
- /* tbl.insert({'id':42}, conflict=lambda a,b: a) */
- logger.info("About to run line #218: tbl.insert(r.hashMap('id', 42L)).optArg('conflict', (a, b) -> a)");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 42L)).optArg("conflict", (a, b) -> a),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #218");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #218:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #222
- /* err("ReqlQueryLogicError", "The conflict function passed to `insert` must be deterministic.") */
- Err expected_ = err("ReqlQueryLogicError", "The conflict function passed to `insert` must be deterministic.");
- /* tbl.insert({'id':42}, conflict=lambda a,b,c: tbl.get(42)) */
- logger.info("About to run line #222: tbl.insert(r.hashMap('id', 42L)).optArg('conflict', (a, b, c) -> tbl.get(42L))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 42L)).optArg("conflict", (a, b, c) -> tbl.get(42L)),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #222");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #222:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #225
- /* partial({'replaced': 1}) */
- Partial expected_ = partial(r.hashMap("replaced", 1L));
- /* tbl.insert({'id':42}, conflict=lambda a,b,c: {'id':42, 'num':'424'}) */
- logger.info("About to run line #225: tbl.insert(r.hashMap('id', 42L)).optArg('conflict', (a, b, c) -> r.hashMap('id', 42L).with('num', '424'))");
- Object obtained = runOrCatch(tbl.insert(r.hashMap("id", 42L)).optArg("conflict", (a, b, c) -> r.hashMap("id", 42L).with("num", "424")),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #225");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #225:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #227
- /* {'id':42, 'num':'424'} */
- Map expected_ = r.hashMap("id", 42L).with("num", "424");
- /* tbl.get(42) */
- logger.info("About to run line #227: tbl.get(42L)");
- Object obtained = runOrCatch(tbl.get(42L),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #227");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #227:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #231
- /* err('ReqlQueryLogicError','Cannot convert `r.minval` to JSON.') */
- Err expected_ = err("ReqlQueryLogicError", "Cannot convert `r.minval` to JSON.");
- /* r.minval */
- logger.info("About to run line #231: r.minval()");
- Object obtained = runOrCatch(r.minval(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #231");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #231:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #234
- /* err('ReqlQueryLogicError','Cannot convert `r.maxval` to JSON.') */
- Err expected_ = err("ReqlQueryLogicError", "Cannot convert `r.maxval` to JSON.");
- /* r.maxval */
- logger.info("About to run line #234: r.maxval()");
- Object obtained = runOrCatch(r.maxval(),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #234");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #234:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
-
- {
- // mutation/insert.yaml line #238
- /* partial({'tables_dropped':1}) */
- Partial expected_ = partial(r.hashMap("tables_dropped", 1L));
- /* r.db('test').table_drop('test2') */
- logger.info("About to run line #238: r.db('test').tableDrop('test2')");
- Object obtained = runOrCatch(r.db("test").tableDrop("test2"),
- new OptArgs()
- ,conn);
- try {
- assertEquals(expected_, obtained);
- logger.info("Finished running line #238");
- } catch (Throwable ae) {
- logger.error("Whoops, got exception on line #238:" + ae.toString());
- if(obtained instanceof Throwable) {
- ae.addSuppressed((Throwable) obtained);
- }
- throw ae;
- }
- }
- }
-}
diff --git a/templates/AstSubclass.java b/templates/AstSubclass.java
index 94ccb5ec..e3504839 100644
--- a/templates/AstSubclass.java
+++ b/templates/AstSubclass.java
@@ -14,14 +14,14 @@ public class ${classname} extends ${superclass} {
public ${classname}(Object arg) {
this(new Arguments(arg), null);
}
- public ${classname}(Arguments args){
+ public ${classname}(Arguments args) {
this(args, null);
}
public ${classname}(Arguments args, OptArgs optargs) {
super(TermType.${term_name}, args, optargs);
}
%else:
- protected ${classname}(TermType termType, Arguments args, OptArgs optargs){
+ protected ${classname}(TermType termType, Arguments args, OptArgs optargs) {
super(termType, args, optargs);
}
%endif
diff --git a/templates/Enum.java b/templates/Enum.java
index a3fdb35c..99c8e949 100644
--- a/templates/Enum.java
+++ b/templates/Enum.java
@@ -9,7 +9,7 @@ public enum ${classname} {
public final ${value_type} value;
- private ${classname}(${value_type} value){
+ private ${classname}(${value_type} value) {
this.value = value;
}
@@ -19,8 +19,7 @@ public enum ${classname} {
case ${val}: return ${classname}.${key};
% endfor
default:
- throw new IllegalArgumentException(String.format(
- "%s is not a legal value for ${classname}", value));
+ throw new IllegalArgumentException(String.format("%s is not a legal value for ${classname}", value));
}
}
diff --git a/templates/TopLevel.java b/templates/TopLevel.java
index c1d0cd45..d5656724 100644
--- a/templates/TopLevel.java
+++ b/templates/TopLevel.java
@@ -6,8 +6,8 @@
import com.rethinkdb.model.MapObject;
import com.rethinkdb.gen.ast.Error;
import com.rethinkdb.gen.ast.*;
-import com.rethinkdb.ast.Util;
import com.rethinkdb.gen.exc.ReqlDriverError;
+import com.rethinkdb.utils.Internals;
import java.util.Arrays;
import java.util.ArrayList;
@@ -17,7 +17,7 @@
public class TopLevel {
public ReqlExpr expr(Object value){
- return Util.toReqlExpr(value);
+ return Internals.toReqlExpr(value);
}
public ReqlExpr row(Object... values) {
diff --git a/templates/ast/Binary.java b/templates/ast/Binary.java
index fb7cfae0..549c0d9d 100644
--- a/templates/ast/Binary.java
+++ b/templates/ast/Binary.java
@@ -1,7 +1,7 @@
<%inherit file="../AstSubclass.java"/>
<%block name="add_imports">
-import com.rethinkdb.net.Converter;
+import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.Nullable;
%block>
@@ -31,8 +31,8 @@
@Override
public Object build(){
if (binaryData != null) {
- return Converter.toBinary(binaryData);
- }else{
+ return Internals.asBinaryPseudotype(binaryData);
+ } else {
return super.build();
}
}
diff --git a/templates/ast/Datum.java b/templates/ast/Datum.java
index 9d838d45..583ba874 100644
--- a/templates/ast/Datum.java
+++ b/templates/ast/Datum.java
@@ -1,13 +1,13 @@
<%inherit file="../AstSubclass.java" />
-<%block name="member_vars">
- public final java.lang.Object datum;%block>
+<%block name="member_vars">\
+ public final java.lang.Object datum;
+%block>
<%block name="constructors">
public Datum(java.lang.Object arg) {
super(TermType.DATUM, null, null);
datum = arg;
- }
-%block>
+ }%block>
<%block name="static_factories"/>
diff --git a/templates/ast/Func.java b/templates/ast/Func.java
index a68060c8..ed7eeba8 100644
--- a/templates/ast/Func.java
+++ b/templates/ast/Func.java
@@ -2,7 +2,7 @@
<%block name="add_imports">
import com.rethinkdb.model.ReqlLambda;
-import com.rethinkdb.ast.Util;
+import com.rethinkdb.utils.Internals;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.Arrays;
import java.util.List;
@@ -25,12 +25,11 @@ protected Func(Arguments args){
%block>
<%block name="static_factories">\
public static Func fromLambda(ReqlLambda function) {
- if(function instanceof ReqlFunction0) {
- return new Func(Arguments.make(new MakeArray(Arrays.asList()),
- Util.toReqlAst(((ReqlFunction0) function).apply())));
+ if (function instanceof ReqlFunction0) {
+ return new Func(Arguments.make(new MakeArray(Arrays.asList()), Internals.toReqlAst(((ReqlFunction0) function).apply())));
}
% for i in range(1, max_arity+1):
- else if(function instanceof ReqlFunction${i}){
+ else if (function instanceof ReqlFunction${i}) {
ReqlFunction${i} func${i} = (ReqlFunction${i}) function;
% for j in range(1, i+1):
int var${j} = nextVarId();
@@ -40,9 +39,7 @@ else if(function instanceof ReqlFunction${i}){
Object appliedFunction = func${i}.apply(
${", ".join("new Var(var%s)"%(j,) for j in range(1, j+1))}
);
- return new Func(Arguments.make(
- new MakeArray(varIds),
- Util.toReqlAst(appliedFunction)));
+ return new Func(Arguments.make(new MakeArray(varIds), Internals.toReqlAst(appliedFunction)));
}
% endfor
else {
diff --git a/templates/ast/Funcall.java b/templates/ast/Funcall.java
index a35aadc3..42ef6eff 100644
--- a/templates/ast/Funcall.java
+++ b/templates/ast/Funcall.java
@@ -2,8 +2,7 @@
<%block name="special_methods">
@Override
- protected Object build()
- {
+ protected Object build() {
/*
This object should be constructed with arguments first, and the
function itself as the last parameter. This makes it easier for
diff --git a/templates/ast/MakeObj.java b/templates/ast/MakeObj.java
index ca9a9e51..5644c593 100644
--- a/templates/ast/MakeObj.java
+++ b/templates/ast/MakeObj.java
@@ -3,21 +3,21 @@
public MakeObj(Object arg) {
this(new Arguments(arg), null);
}
- public MakeObj(OptArgs opts){
+ public MakeObj(OptArgs opts) {
this(new Arguments(), opts);
}
- public MakeObj(Arguments args){
+ public MakeObj(Arguments args) {
this(args, null);
}
public MakeObj(Arguments args, OptArgs optargs) {
this(TermType.MAKE_OBJ, args, optargs);
}
- protected MakeObj(TermType termType, Arguments args, OptArgs optargs){
+ protected MakeObj(TermType termType, Arguments args, OptArgs optargs) {
super(termType, args, optargs);
}
%block>
<%block name="special_methods">\
- public static MakeObj fromMap(java.util.Map map){
+ public static MakeObj fromMap(java.util.Map map) {
return new MakeObj(OptArgs.fromMap(map));
}
%block>