Skip to content

Commit

Permalink
Merge pull request #59 from furlaneto/master
Browse files Browse the repository at this point in the history
Updates json-b version and added junit 5 for drivers
  • Loading branch information
otaviojava committed Jan 19, 2018
2 parents e979ae4 + 4b64a31 commit 51182f9
Show file tree
Hide file tree
Showing 80 changed files with 475 additions and 610 deletions.
6 changes: 0 additions & 6 deletions arangodb-driver/pom.xml
Expand Up @@ -33,12 +33,6 @@
<arango.driver>4.3.2</arango.driver>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jnosql.diana</groupId>
<artifactId>diana-document</artifactId>
Expand Down
Expand Up @@ -15,12 +15,12 @@
package org.jnosql.diana.arangodb.document;

import org.jnosql.diana.api.document.DocumentQuery;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.jnosql.diana.api.document.query.DocumentQueryBuilder.select;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class AQLUtilsTest {

Expand Down
Expand Up @@ -20,16 +20,14 @@
import org.jnosql.diana.api.document.DocumentDeleteQuery;
import org.jnosql.diana.api.document.DocumentEntity;
import org.jnosql.diana.api.document.Documents;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Random;

import static org.jnosql.diana.api.document.DocumentCondition.eq;
import static org.jnosql.diana.api.document.query.DocumentQueryBuilder.delete;
import static org.jnosql.diana.arangodb.document.DocumentConfigurationUtils.getConfiguration;

Expand All @@ -42,7 +40,7 @@ public class ArangoDBDocumentCollectionManagerAsyncTest {
private Random random;
private String KEY_NAME = "_key";

@Before
@BeforeEach
public void setUp() {
random = new Random();
entityManagerAsync = getConfiguration().getAsync("database");
Expand Down
Expand Up @@ -17,17 +17,16 @@

import org.jnosql.diana.api.document.DocumentCollectionManager;
import org.jnosql.diana.api.document.DocumentCollectionManagerAsync;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;

public class ArangoDBDocumentCollectionManagerFactoryTest {

private ArangoDBDocumentCollectionManagerFactory managerFactory;

@Before
@BeforeEach
public void setUp() {
managerFactory = DocumentConfigurationUtils.getConfiguration();
}
Expand Down
Expand Up @@ -21,8 +21,8 @@
import org.jnosql.diana.api.document.DocumentEntity;
import org.jnosql.diana.api.document.DocumentQuery;
import org.jnosql.diana.api.document.Documents;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -33,17 +33,13 @@

import static java.util.Arrays.asList;
import static java.util.Collections.singletonMap;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.jnosql.diana.api.document.query.DocumentQueryBuilder.delete;
import static org.jnosql.diana.api.document.query.DocumentQueryBuilder.select;
import static org.jnosql.diana.arangodb.document.DocumentConfigurationUtils.getConfiguration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.*;

public class ArangoDBDocumentCollectionManagerTest {

Expand All @@ -52,7 +48,7 @@ public class ArangoDBDocumentCollectionManagerTest {
private Random random;
private String KEY_NAME = "_key";

@Before
@BeforeEach
public void setUp() {
random = new Random();
entityManager = getConfiguration().get("database");
Expand Down
Expand Up @@ -16,10 +16,9 @@
package org.jnosql.diana.arangodb.document;

import org.jnosql.diana.api.document.DocumentCollectionManagerFactory;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;

public class ArangoDBDocumentConfigurationTest {

Expand Down
Expand Up @@ -15,17 +15,16 @@
package org.jnosql.diana.arangodb.key;

import org.jnosql.diana.api.key.BucketManagerFactory;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;

public class ArangoDBConfigurationTest {

private ArangoDBKeyValueConfiguration configuration;

@Before
@BeforeEach
public void setUp() {
configuration = new ArangoDBKeyValueConfiguration();
}
Expand Down
Expand Up @@ -19,22 +19,18 @@
import org.jnosql.diana.api.key.BucketManager;
import org.jnosql.diana.api.key.BucketManagerFactory;
import org.jnosql.diana.api.key.KeyValueEntity;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.*;

public class ArangoDBKeyValueEntityManagerTest {
private BucketManager keyValueEntityManager;
Expand All @@ -47,7 +43,7 @@ public class ArangoDBKeyValueEntityManagerTest {
private User userSoro = new User("soro");
private KeyValueEntity keyValueSoro = KeyValueEntity.of("soro", Value.of(userSoro));

@Before
@BeforeEach
public void init() {
keyValueEntityManagerFactory = ArangoDBTestUtils.get();
keyValueEntityManager = keyValueEntityManagerFactory.getBucketManager("users-entity");
Expand Down
6 changes: 0 additions & 6 deletions cassandra-driver/pom.xml
Expand Up @@ -66,12 +66,6 @@
<maven.compile.sourceLevel>1.8</maven.compile.sourceLevel>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jnosql.diana</groupId>
<artifactId>diana-column</artifactId>
Expand Down
Expand Up @@ -20,10 +20,10 @@
import org.jnosql.diana.api.column.Column;
import org.jnosql.diana.api.column.ColumnEntity;
import org.jnosql.diana.api.column.Columns;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.HashMap;
Expand All @@ -41,17 +41,17 @@ public class CassandraColumnFamilyManagerAsyncTest {
public static final ConsistencyLevel CONSISTENCY_LEVEL = ConsistencyLevel.ONE;
private CassandraColumnFamilyManagerAsync columnEntityManager;

@BeforeClass
@BeforeAll
public static void before() throws InterruptedException, IOException, TTransportException {
EmbeddedCassandraServerHelper.startEmbeddedCassandra();
}

@AfterClass
@AfterAll
public static void end(){
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
}

@Before
@BeforeEach
public void setUp() throws InterruptedException, IOException, TTransportException {

CassandraConfiguration cassandraConfiguration = new CassandraConfiguration();
Expand Down
Expand Up @@ -20,34 +20,33 @@
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
import org.jnosql.diana.api.column.ColumnFamilyManager;
import org.jnosql.diana.api.column.ColumnFamilyManagerAsync;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class CassandraColumnFamilyManagerFactoryTest {

private CassandraColumnFamilyManagerFactory subject;

@BeforeClass
@BeforeAll
public static void before() throws InterruptedException, IOException, TTransportException {
EmbeddedCassandraServerHelper.startEmbeddedCassandra();
}

@AfterClass
@AfterAll
public static void end(){
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
}

@Before
@BeforeEach
public void setUp() throws InterruptedException, IOException, TTransportException {
Map<String, String> configurations = new HashMap<>();
configurations.put("cassandra-hoster-1", "localhost");
Expand Down
Expand Up @@ -27,11 +27,10 @@
import org.jnosql.diana.api.column.ColumnEntity;
import org.jnosql.diana.api.column.ColumnQuery;
import org.jnosql.diana.api.column.Columns;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.time.Month;
Expand All @@ -48,33 +47,30 @@
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static java.util.stream.Collectors.toList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.jnosql.diana.api.column.query.ColumnQueryBuilder.delete;
import static org.jnosql.diana.api.column.query.ColumnQueryBuilder.select;
import static org.jnosql.diana.cassandra.column.Constants.COLUMN_FAMILY;
import static org.jnosql.diana.cassandra.column.Constants.KEY_SPACE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;

import static org.junit.jupiter.api.Assertions.*;

public class CassandraColumnFamilyManagerTest {

public static final ConsistencyLevel CONSISTENCY_LEVEL = ConsistencyLevel.ONE;
private CassandraColumnFamilyManager columnEntityManager;

@BeforeClass
@BeforeAll
public static void before() throws InterruptedException, IOException, TTransportException {
EmbeddedCassandraServerHelper.startEmbeddedCassandra();
}

@AfterClass
@AfterAll
public static void end() {
EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();
}

@Before
@BeforeEach
public void setUp() throws InterruptedException, IOException, TTransportException {
CassandraConfiguration cassandraConfiguration = new CassandraConfiguration();
CassandraColumnFamilyManagerFactory entityManagerFactory = cassandraConfiguration.get();
Expand Down Expand Up @@ -189,7 +185,7 @@ public void shouldDeleteColumnFamily() {
ColumnDeleteQuery deleteQuery = delete().from(COLUMN_FAMILY).where("id").eq(10L).build();
columnEntityManager.delete(deleteQuery);
List<ColumnEntity> entities = columnEntityManager.cql("select * from newKeySpace.newColumnFamily where id=10;");
Assert.assertTrue(entities.isEmpty());
assertTrue(entities.isEmpty());
}

@Test
Expand All @@ -200,7 +196,7 @@ public void shouldDeleteColumnFamilyWithConsistencyLevel() {
ColumnDeleteQuery deleteQuery = delete().from(COLUMN_FAMILY).where("id").eq(10L).build();
columnEntityManager.delete(deleteQuery, CONSISTENCY_LEVEL);
List<ColumnEntity> entities = columnEntityManager.cql("select * from newKeySpace.newColumnFamily where id=10;");
Assert.assertTrue(entities.isEmpty());
assertTrue(entities.isEmpty());
}

@Test
Expand Down Expand Up @@ -244,8 +240,8 @@ public void shouldSupportUDT() {
Column column = columnEntity.find("name").get();
udt = UDT.class.cast(column);
List<Column> udtColumns = (List<Column>) udt.get();
Assert.assertEquals("name", udt.getName());
Assert.assertEquals("fullname", udt.getUserType());
assertEquals("name", udt.getName());
assertEquals("fullname", udt.getUserType());
assertThat(udtColumns, Matchers.containsInAnyOrder(Column.of("firstname", "Ada"),
Column.of("lastname", "Lovelace")));
}
Expand All @@ -269,8 +265,8 @@ public void shouldSupportAnUDTElement() {
Column column = columnEntity.find("name").get();
udt = UDT.class.cast(column);
List<Column> udtColumns = (List<Column>) udt.get();
Assert.assertEquals("name", udt.getName());
Assert.assertEquals("fullname", udt.getUserType());
assertEquals("name", udt.getName());
assertEquals("fullname", udt.getUserType());
assertThat(udtColumns, Matchers.containsInAnyOrder(Column.of("firstname", "Ioda")));
}

Expand All @@ -290,7 +286,7 @@ public void shouldSupportDate() {
.build();

ColumnEntity entity1 = columnEntityManager.singleResult(query).get();
Assert.assertNotNull(entity1);
assertNotNull(entity1);

}

Expand Down

0 comments on commit 51182f9

Please sign in to comment.