Skip to content

Commit

Permalink
pom: Migrate junit4 -> junit5 #TASK-5174
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfeSanahuja committed Feb 20, 2024
1 parent 99ef041 commit 05636c9
Show file tree
Hide file tree
Showing 24 changed files with 90 additions and 160 deletions.
16 changes: 0 additions & 16 deletions commons-datastore/commons-datastore-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.junit.jupiter</groupId>-->
<!-- <artifactId>junit-jupiter-api</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand All @@ -52,12 +42,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;
import org.junit.Before;
import org.junit.jupiter.api.BeforeEach;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.rules.ExpectedException;

import java.util.*;
Expand All @@ -37,7 +37,7 @@ public class ObjectMapTest {
@Rule
public ExpectedException thrown = ExpectedException.none();

@Before
@BeforeEach
public void setUp() throws Exception {
objectMap = new ObjectMap();
objectMap.put("string", "hello");
Expand Down Expand Up @@ -175,7 +175,7 @@ public void testGetBoolean() throws Exception {
public void testGetList() throws Exception {
List<Object> list = objectMap.getList("list");
System.out.println(list);
System.out.println((String)list.get(0));
System.out.println((String) list.get(0));
}

@Test
Expand Down Expand Up @@ -226,10 +226,10 @@ public void testGetMap() throws Exception {

@Test
public void testContainsKey() {
assertEquals("{\"l2\":{\"l3\":{\"l4\":\"value\"}}}" ,objectMap.getNestedMap("l1").toJson());
assertEquals("{\"l3\":{\"l4\":\"value\"}}" ,objectMap.getNestedMap("l1.l2").toJson());
assertEquals("{\"l4\":\"value\"}" ,objectMap.getNestedMap("l1.l2.l3").toJson());
assertEquals("value" ,objectMap.getNested("l1.l2.l3.l4"));
assertEquals("{\"l2\":{\"l3\":{\"l4\":\"value\"}}}", objectMap.getNestedMap("l1").toJson());
assertEquals("{\"l3\":{\"l4\":\"value\"}}", objectMap.getNestedMap("l1.l2").toJson());
assertEquals("{\"l4\":\"value\"}", objectMap.getNestedMap("l1.l2.l3").toJson());
assertEquals("value", objectMap.getNested("l1.l2.l3.l4"));
assertEquals("value", objectMap.getNested("map.key"));

assertEquals("a", objectMap.getNested("myModel.key1"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.rules.ExpectedException;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.opencb.commons.datastore.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.rules.ExpectedException;

/**
Expand Down Expand Up @@ -29,9 +29,20 @@ enum TestQueryParam implements QueryParam {
Type type;
String description;

@Override public String key() {return key;}
@Override public String description() {return description;}
@Override public Type type() {return type;}
@Override
public String key() {
return key;
}

@Override
public String description() {
return description;
}

@Override
public Type type() {
return type;
}
}

@Test
Expand Down
17 changes: 0 additions & 17 deletions commons-datastore/commons-datastore-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.junit.jupiter</groupId>-->
<!-- <artifactId>junit-jupiter-api</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand All @@ -71,13 +61,6 @@
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

<!--TODO Review -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.opencb.commons.datastore.mongodb;

import org.bson.Document;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.bson.conversions.Bson;
import org.hamcrest.CoreMatchers;
import org.junit.*;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.Test;
import org.junit.rules.ExpectedException;
import org.opencb.commons.datastore.core.DataResult;
import org.opencb.commons.datastore.core.ObjectMap;
Expand Down Expand Up @@ -56,7 +58,7 @@ public class MongoDBCollectionTest {
public static final List<String> NAMES = Arrays.asList("John", "Jack", "Javi");
public static final List<String> SURNAMES = Arrays.asList("Doe", "Davis", null);

@BeforeClass
@BeforeAll
public static void beforeClass() throws Exception {
mongoDataStoreManager = new MongoDataStoreManager("localhost", 27017);

Expand All @@ -70,13 +72,13 @@ public static void beforeClass() throws Exception {
mongoDBCollectionRemoveTest = createTestCollection("remove_test", 50);
}

@Before
@BeforeEach
public void setUp() throws Exception {


}

@AfterClass
@AfterAll
public static void afterClass() throws Exception {
// mongoDataStoreManager.drop("datastore_test");
mongoDataStore.close();
Expand Down Expand Up @@ -388,7 +390,7 @@ public void testFind8() throws Exception {
}

@Test
@Ignore
@Disabled
public void testPermanentCursor() throws Exception {
Document query = new Document();
QueryOptions queryOptions = new QueryOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.internal.MongoClientImpl;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.Collections;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.opencb.commons.datastore.mongodb;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.opencb.commons.datastore.core.QueryParam;

import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;

import static org.junit.Assert.assertEquals;

/**
* Created by imedina on 17/01/16.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

package org.opencb.commons.datastore.mongodb;

import org.junit.After;
import org.junit.jupiter.api.AfterEach;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
* Created by imedina on 27/03/14.
Expand All @@ -29,14 +29,14 @@ public class MongoDataStoreManagerTest {
private MongoDataStoreManager mongoDataStoreManager;
private MongoDataStore mongoDataStore;

@Before
@BeforeEach
public void setUp() throws Exception {
mongoDataStoreManager = new MongoDataStoreManager("127.0.0.1", 27017);
mongoDataStoreManager.get("test").getDb().drop();
mongoDataStore = mongoDataStoreManager.get("test", MongoDBConfiguration.builder().init().build());
}

@After
@AfterEach
public void tearDown() throws Exception {
mongoDataStoreManager.close("test");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package org.opencb.commons.datastore.mongodb;

import org.junit.AfterClass;
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.Test;

import java.util.Arrays;
import java.util.List;
Expand All @@ -31,7 +31,7 @@ public class MongoDataStoreTest {
private static MongoDataStoreManager mongoDataStoreManager;
private static MongoDataStore mongoDataStore;

@BeforeClass
@BeforeAll
public static void setUp() throws Exception {
mongoDataStoreManager = new MongoDataStoreManager("localhost", 27017);

Expand All @@ -41,7 +41,7 @@ public static void setUp() throws Exception {
mongoDataStore.createCollection("JUnitTest");
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
mongoDataStoreManager.close("datastore_test");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import com.mongodb.client.ClientSession;
import com.mongodb.client.TransactionBody;
import org.bson.Document;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;
import org.opencb.commons.datastore.core.DataResult;
import org.opencb.commons.datastore.core.DataStoreServerAddress;
import org.opencb.commons.datastore.core.QueryOptions;
Expand All @@ -19,7 +18,7 @@ public class TransactionTest {
private MongoDataStoreManager mongoDataStoreManager;
private MongoDataStore mongoDataStore;

@Before
@BeforeEach
public void setUp() throws Exception {
List<DataStoreServerAddress> dataStoreServerAddressList = new ArrayList<>(1);
dataStoreServerAddressList.add(new DataStoreServerAddress("127.0.0.1", 27017));
Expand All @@ -31,13 +30,13 @@ public void setUp() throws Exception {
.setReplicaSet("rs-test").init().build());
}

@After
@AfterEach
public void tearDown() throws Exception {
mongoDataStoreManager.close("test");
}

@Test
@Ignore
@Disabled
public void testGet() throws Exception {
ClientSession clientSession = mongoDataStore.startSession();

Expand Down
21 changes: 0 additions & 21 deletions commons-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,10 @@
<module>commons-datastore-solr</module>
</modules>
<dependencies>
<!--TODO Review -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.junit.jupiter</groupId>-->
<!-- <artifactId>junit-jupiter-api</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
15 changes: 0 additions & 15 deletions commons-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>junit</groupId>-->
<!-- <artifactId>junit</artifactId>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.junit.jupiter</groupId>-->
<!-- <artifactId>junit-jupiter-api</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand All @@ -75,11 +65,6 @@
</dependency>

<!--TODO Review -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand Down
Loading

0 comments on commit 05636c9

Please sign in to comment.