Java Code Examples for com.arangodb.ArangoDB#db()

The following examples show how to use com.arangodb.ArangoDB#db() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommunicationTest.java    From arangodb-java-driver with Apache License 2.0 6 votes vote down vote up
@Test
public void multiThreadSameDatabases() throws Exception {
    final ArangoDB arangoDB = new ArangoDB.Builder().build();
    arangoDB.getVersion();// authentication

    final ArangoDatabase db = arangoDB.db();

    final Collection<String> result = new ConcurrentLinkedQueue<>();
    final Thread t1 = new Thread(() -> {
        db.query("return sleep(0.1)", null, null, null);
        result.add("1");
    });
    final Thread t2 = new Thread(() -> {
        db.query("return sleep(0.1)", null, null, null);
        result.add("1");
    });
    t2.start();
    t1.start();
    t2.join();
    t1.join();
    assertThat(result.size(), is(2));
}
 
Example 2
Source File: CustomSerdeTest.java    From arangodb-java-driver with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void init() {
    VelocyJack velocyJack = new VelocyJack();
    velocyJack.configure((mapper) -> {
        mapper.configure(WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED, true);
        mapper.configure(USE_BIG_INTEGER_FOR_INTS, true);
    });
    ArangoDB arangoDB = new ArangoDB.Builder().serializer(velocyJack).build();

    String TEST_DB = "custom-serde-test";
    db = arangoDB.db(TEST_DB);
    if (!db.exists()) {
        db.create();
    }

    collection = db.collection(COLLECTION_NAME);
    if (!collection.exists()) {
        collection.create();
    }
}
 
Example 3
Source File: CustomTypeHintTest.java    From arangodb-java-driver with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    ArangoDB arangoDB = new ArangoDB.Builder()
            .serializer(new VelocyJack())
            .build();

    String TEST_DB = "custom-serde-test";
    db = arangoDB.db(TEST_DB);
    if (!db.exists()) {
        db.create();
    }

    collection = db.collection(COLLECTION_NAME);
    if (!collection.exists()) {
        collection.create();
    }
}