aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-11-13 09:58:26 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-11-13 11:30:56 +0100
commitde80a9de71edd6005f15355a24dd6ce9781b99bf (patch)
treefaf06557102e6bb1f435301e1d6c2730842d631b
parentccf10e681044664888d7e0e0b50623bdbe92de5a (diff)
Migrate the schema-service from JUnit 4 to JUnit 5
Issue-ID: AAI-4053 Change-Id: I100c96c9d231f1d5c232886bc00bf3e05cc209b3 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--aai-annotations/pom.xml15
-rw-r--r--aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java7
-rw-r--r--aai-queries/pom.xml38
-rw-r--r--aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java21
-rw-r--r--aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java48
-rw-r--r--aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java32
-rw-r--r--aai-schema-gen/pom.xml40
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java46
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java23
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java25
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java29
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java29
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java19
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java23
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java23
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java25
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java16
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java8
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java25
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java21
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java21
-rw-r--r--aai-schema-service/pom.xml23
-rw-r--r--aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java16
-rw-r--r--aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java5
-rw-r--r--aai-schema/pom.xml26
-rw-r--r--aai-schema/src/test/java/org/onap/aai/schema/ValidateEdgeRulesTest.java4
-rw-r--r--aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java10
31 files changed, 377 insertions, 325 deletions
diff --git a/aai-annotations/pom.xml b/aai-annotations/pom.xml
index 01f908e..d01c820 100644
--- a/aai-annotations/pom.xml
+++ b/aai-annotations/pom.xml
@@ -37,8 +37,13 @@
</properties>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <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>
</dependencies>
@@ -53,6 +58,12 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ </plugin>
</plugins>
</build>
diff --git a/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java b/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java
index 9ff262d..508f94e 100644
--- a/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java
+++ b/aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java
@@ -20,15 +20,12 @@
package org.onap.aai.annotations;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AnnotationsTest {
- public AnnotationsTest() {
- }
-
@Metadata(
isKey = false,
description = "",
diff --git a/aai-queries/pom.xml b/aai-queries/pom.xml
index 32906e9..a42c60c 100644
--- a/aai-queries/pom.xml
+++ b/aai-queries/pom.xml
@@ -96,11 +96,6 @@
</profiles>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-core</artifactId>
<scope>compile</scope>
@@ -109,6 +104,10 @@
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-aaf-auth</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -122,8 +121,20 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-junit</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -146,6 +157,21 @@
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>3.0.0</version>
</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.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java b/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java
index 99d74a1..d538d21 100644
--- a/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java
+++ b/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java
@@ -20,7 +20,7 @@
package org.onap.aai.queries;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.IOException;
import java.io.InputStream;
@@ -28,9 +28,8 @@ import java.nio.charset.Charset;
import java.util.Map;
import org.apache.commons.io.IOUtils;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Rule;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.aai.config.IntrospectionConfig;
import org.onap.aai.config.RestBeanConfig;
import org.onap.aai.config.SpringContextAware;
@@ -48,13 +47,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.rules.SpringClassRule;
-import org.springframework.test.context.junit4.rules.SpringMethodRule;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
@ContextConfiguration(
classes = {SchemaLocationsBean.class, SchemaVersions.class, AAIConfigTranslator.class,
EdgeIngestor.class, EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
IntrospectionConfig.class, RestBeanConfig.class, GremlinServerSingleton.class})
+@ExtendWith(SpringExtension.class)
@TestPropertySource(
properties = {"schema.uri.base.path = /aai",
"schema.ingest.file = src/test/resources/application-test.properties"})
@@ -89,13 +88,7 @@ public abstract class AAISetup {
@Value("${schema.uri.base.path}")
protected String basePath;
- @ClassRule
- public static final SpringClassRule springClassRule = new SpringClassRule();
-
- @Rule
- public final SpringMethodRule springMethodRule = new SpringMethodRule();
-
- @BeforeClass
+ @BeforeAll
public static void setupBundleconfig() throws Exception {
System.setProperty("AJSC_HOME", "./");
System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
@@ -107,7 +100,7 @@ public abstract class AAISetup {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(filename);
String message = String.format("Unable to find the %s in src/test/resources", filename);
- assertNotNull(message, inputStream);
+ assertNotNull(inputStream, message);
String resource = IOUtils.toString(inputStream, Charset.defaultCharset());
return resource;
diff --git a/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java b/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java
index 84051b0..21a3312 100644
--- a/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java
+++ b/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java
@@ -20,8 +20,8 @@
package org.onap.aai.queries;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import java.io.IOException;
@@ -33,12 +33,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.onap.aai.config.IntrospectionConfig;
@@ -65,25 +62,18 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.rules.SpringClassRule;
-import org.springframework.test.context.junit4.rules.SpringMethodRule;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
-@RunWith(Parameterized.class)
@ContextConfiguration(
classes = {SchemaLocationsBean.class, SchemaConfigVersions.class, AAIConfigTranslator.class,
EdgeIngestor.class, EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
GremlinServerSingleton.class, IntrospectionConfig.class})
+@ExtendWith(SpringExtension.class)
@TestPropertySource(
properties = {"schema.uri.base.path = /aai", "schema.source.name = onap",
"schema.ingest.file = src/test/resources/application-test.properties"})
public abstract class OnapQueryTest {
- @ClassRule
- public static final SpringClassRule springClassRule = new SpringClassRule();
-
- @Rule
- public final SpringMethodRule springMethodRule = new SpringMethodRule();
-
protected Logger logger;
protected Graph graph;
protected GremlinGroovyShell shell;
@@ -109,17 +99,8 @@ public abstract class OnapQueryTest {
@Autowired
protected GremlinServerSingleton gremlinServerSingleton;
- @Parameterized.Parameter(value = 0)
public SchemaVersion version;
- @Parameterized.Parameters(name = "Version.{0}")
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] {{new SchemaVersion("v11")}, {new SchemaVersion("v12")},
- {new SchemaVersion("v13")}, {new SchemaVersion("v14")}, {new SchemaVersion("v15")},
- {new SchemaVersion("v16")}, {new SchemaVersion("v17")}, {new SchemaVersion("v18")},
- {new SchemaVersion("v19")}, {new SchemaVersion("v20")}});
- }
-
protected String query;
LinkedHashMap<String, Object> params;
@@ -127,25 +108,24 @@ public abstract class OnapQueryTest {
@Autowired
private Environment env;
- @BeforeClass
+ @BeforeAll
public static void setupBundleconfig() {
System.setProperty("AJSC_HOME", "./");
System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
}
- @Before
+ @BeforeEach
public void setUp() throws AAIException, NoEdgeRuleFoundException, EdgeRuleNotFoundException,
AmbiguousRuleChoiceException, IOException {
System.setProperty("AJSC_HOME", ".");
System.setProperty("BUNDLECONFIG_DIR", "src/main/resources");
logger = LoggerFactory.getLogger(getClass());
- MockitoAnnotations.initMocks(this);
+ MockitoAnnotations.openMocks(this);
graph = TinkerGraph.open();
gts = graph.traversal();
createGraph();
shell = new GremlinGroovyShell();
- loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, version);
- setUpQuery();
+
}
protected void setUpQuery() {
@@ -184,7 +164,7 @@ public abstract class OnapQueryTest {
// java.lang.AssertionError: Expected all the vertices to be found
// Expected :[v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12]]
// Actual :[v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12]]
- assertEquals("Expected all the vertices to be found", nonDuplicateExpectedResult, vertices);
+ assertEquals(nonDuplicateExpectedResult, vertices, "Expected all the vertices to be found");
}
@@ -202,4 +182,8 @@ public abstract class OnapQueryTest {
protected abstract void addParam(Map<String, Object> params);
+ public void initOnapQueryTest(SchemaVersion version) {
+ this.version = version;
+ }
+
}
diff --git a/aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java b/aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java
index 373e251..3bd7e04 100644
--- a/aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java
+++ b/aai-queries/src/test/java/org/onap/aai/queries/VnfToEsrSystemInfoQueryTest.java
@@ -20,25 +20,49 @@
package org.onap.aai.queries;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
+import java.util.stream.Stream;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.junit.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.ModelType;
import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.onap.aai.setup.SchemaVersion;
public class VnfToEsrSystemInfoQueryTest extends OnapQueryTest {
public VnfToEsrSystemInfoQueryTest() {
super();
}
- @Test
- public void run() {
+ public static Stream<Arguments> data() {
+ return Stream.of(
+ Arguments.of(new SchemaVersion("v11")),
+ Arguments.of(new SchemaVersion("v12")),
+ Arguments.of(new SchemaVersion("v13")),
+ Arguments.of(new SchemaVersion("v14")),
+ Arguments.of(new SchemaVersion("v15")),
+ Arguments.of(new SchemaVersion("v16")),
+ Arguments.of(new SchemaVersion("v17")),
+ Arguments.of(new SchemaVersion("v18")),
+ Arguments.of(new SchemaVersion("v19")),
+ Arguments.of(new SchemaVersion("v20"))
+ );
+
+ }
+
+ @ParameterizedTest
+ @MethodSource("data")
+ public void run(SchemaVersion version) {
+ loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, version);
+ setUpQuery();
super.run();
assertTrue(true);
}
diff --git a/aai-schema-gen/pom.xml b/aai-schema-gen/pom.xml
index ceb0a86..b7723e7 100644
--- a/aai-schema-gen/pom.xml
+++ b/aai-schema-gen/pom.xml
@@ -646,12 +646,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.3</version>
@@ -683,6 +677,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -720,9 +718,35 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-junit</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
+ <artifactId>mockito-core</artifactId>
+ <version>4.11.0</version>
+ <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.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java
index 9b28e3b..c9b8a64 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/GenerateXsdTest.java
@@ -21,16 +21,15 @@
package org.onap.aai.schemagen;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.BufferedWriter;
import java.io.FileWriter;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.schemagen.genxsd.HTMLfromOXM;
@@ -46,12 +45,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaLocationsBean.class, TestUtilConfigTranslatorforBusiness.class,
EdgeIngestor.class, NodeIngestor.class, SwaggerGenerationConfiguration.class,
SchemaConfigVersions.class})
@@ -73,7 +70,7 @@ public class GenerateXsdTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
XSDElementTest x = new XSDElementTest();
x.setUp();
@@ -88,7 +85,7 @@ public class GenerateXsdTest {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
// PowerMockito.mockStatic(GenerateXsd.class);
XSDElementTest x = new XSDElementTest();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java
index 4729af4..cc8b642 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteFootnoteSetTest.java
@@ -22,24 +22,21 @@ package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DeleteFootnoteSetTest {
String targetNode;
String flavor;
String result;
DeleteFootnoteSet footnotes = null;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {
{"vserver", "(1)",
@@ -57,33 +54,40 @@ public class DeleteFootnoteSetTest {
return (Arrays.asList(inputs));
}
- public DeleteFootnoteSetTest(String targetNode, String flavor, String result) {
- super();
+ public void initDeleteFootnoteSetTest(String targetNode, String flavor, String result) {
this.targetNode = targetNode;
this.flavor = flavor;
this.result = result;
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
footnotes = new DeleteFootnoteSet(this.targetNode);
}
- @Test
- public void testDeleteFootnoteSet() {
- assertThat(footnotes.targetNode, is(this.targetNode));
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testDeleteFootnoteSet(String targetNode, String flavor, String result) {
+ DeleteFootnoteSet footnoteSet = new DeleteFootnoteSet(targetNode);
+ assertEquals(targetNode, footnoteSet.targetNode);
+ // initDeleteFootnoteSetTest(targetNode, flavor, result);
+ // assertThat(footnotes.targetNode, is(this.targetNode));
}
- @Test
- public void testAdd() {
- footnotes.add(this.flavor);
- assertThat(footnotes.footnotes.size(), is(1));
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testAdd(String targetNode, String flavor, String result) {
+ DeleteFootnoteSet footnoteSet = new DeleteFootnoteSet(targetNode);
+ footnoteSet.add(flavor);
+ assertEquals(1, footnoteSet.footnotes.size());
}
- @Test
- public void testToString() {
- footnotes.add(this.flavor);
- assertThat(footnotes.toString(), is(this.result));
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String targetNode, String flavor, String result) {
+ DeleteFootnoteSet footnoteSet = new DeleteFootnoteSet(targetNode);
+ footnoteSet.add(flavor);
+ assertEquals(result, footnoteSet.toString());
}
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java
index 08f5c81..dd9675f 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/DeleteOperationTest.java
@@ -21,18 +21,15 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DeleteOperationTest {
private String useOpId;
private String xmlRootElementName;
@@ -41,7 +38,6 @@ public class DeleteOperationTest {
private String pathParams;
private String result;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -65,9 +61,8 @@ public class DeleteOperationTest {
return Arrays.asList(inputs);
}
- public DeleteOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initDeleteOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -76,13 +71,15 @@ public class DeleteOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initDeleteOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
DeleteOperation delete =
new DeleteOperation(useOpId, xmlRootElementName, tag, path, pathParams);
String modResult = delete.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java
index 046f961..da2e271 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/EdgeDescriptionTest.java
@@ -21,8 +21,8 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.Multimap;
@@ -35,11 +35,10 @@ import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+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 org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.EdgeRule;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
@@ -49,12 +48,10 @@ import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class})
@TestPropertySource(
@@ -72,7 +69,7 @@ public class EdgeDescriptionTest {
String toNode = "complex";
SchemaVersion v10 = new SchemaVersion("v10");
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String json = "{" + " \"rules\": [" + " {" + " \"from\": \"availability-zone\","
+ " \"to\": \"complex\","
@@ -133,13 +130,13 @@ public class EdgeDescriptionTest {
bw.close();
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
File edges = new File(EDGEFILENAME);
edges.delete();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java
index aad62ce..5044166 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/GetOperationTest.java
@@ -21,21 +21,18 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Vector;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
public class GetOperationTest {
private static final Logger logger = LoggerFactory.getLogger("GetOperationTest.class");
private String useOpId;
@@ -45,7 +42,6 @@ public class GetOperationTest {
private String pathParams;
private String result;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -67,9 +63,8 @@ public class GetOperationTest {
return Arrays.asList(inputs);
}
- public GetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initGetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -78,7 +73,7 @@ public class GetOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String container = "p-interfaces";
String queryProps[] = {
@@ -91,8 +86,10 @@ public class GetOperationTest {
GetOperation.addContainerProps(container, containerProps);
}
- @Test
- public void testAddContainerProps() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testAddContainerProps(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
String container = this.xmlRootElementName;
String prop = " - name: " + container
+ "\n in: query\n description:\n required: false\n type: string";
@@ -106,8 +103,10 @@ public class GetOperationTest {
assertThat(GetOperation.containers.get(container).get(0), is(prop));
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
GetOperation get = new GetOperation(useOpId, xmlRootElementName, tag, path, pathParams);
String modResult = get.toString();
assertThat(modResult, is(this.result));
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java
index 46f90ce..4baf8f0 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/HTMLfromOXMTest.java
@@ -21,7 +21,7 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.io.BufferedWriter;
import java.io.File;
@@ -32,10 +32,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.schemagen.SwaggerGenerationConfiguration;
@@ -47,13 +46,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.w3c.dom.Element;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforBusiness.class, EdgeIngestor.class, NodeIngestor.class,
SwaggerGenerationConfiguration.class
@@ -73,19 +70,19 @@ public class HTMLfromOXMTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpContext() throws Exception {
}
- @BeforeClass
+ @BeforeAll
public static void setupBundleconfig() throws Exception {
System.setProperty("AJSC_HOME", ".");
System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
System.setProperty("aai.service.name", SERVICE_NAME);
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
setUp(0);
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java
index fc75150..c690ca8 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodeGetOperationTest.java
@@ -21,21 +21,18 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
import java.util.Vector;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
public class NodeGetOperationTest {
private static final Logger logger = LoggerFactory.getLogger("NodeGetOperationTest.class");
private String useOpId;
@@ -45,7 +42,6 @@ public class NodeGetOperationTest {
private String pathParams;
private String result;
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -67,9 +63,8 @@ public class NodeGetOperationTest {
return Arrays.asList(inputs);
}
- public NodeGetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initNodeGetOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -78,7 +73,7 @@ public class NodeGetOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String container = "p-interfaces";
String queryProps[] = {
@@ -91,8 +86,10 @@ public class NodeGetOperationTest {
NodeGetOperation.addContainerProps(container, containerProps);
}
- @Test
- public void testAddContainerProps() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testAddContainerProps(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initNodeGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
String container = this.xmlRootElementName;
String prop = " - name: " + container
+ "\n in: query\n description:\n required: false\n type: string";
@@ -109,8 +106,10 @@ public class NodeGetOperationTest {
NodeGetOperation.containers.get(container).get(0), is(prop));
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initNodeGetOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
NodeGetOperation get =
new NodeGetOperation(useOpId, xmlRootElementName, tag, path, pathParams);
String modResult = get.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
index d87bdf7..87e967e 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
@@ -21,7 +21,7 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.io.BufferedWriter;
import java.io.File;
@@ -32,10 +32,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.schemagen.SwaggerGenerationConfiguration;
@@ -47,13 +46,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.w3c.dom.Element;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforEdges.class, EdgeIngestor.class, NodeIngestor.class,
SwaggerGenerationConfiguration.class
@@ -74,7 +71,7 @@ public class NodesYAMLfromOXMTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
XSDElementTest x = new XSDElementTest();
@@ -90,7 +87,7 @@ public class NodesYAMLfromOXMTest {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
NodeGetOperation.checklist.clear();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
index d939a74..3735636 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
@@ -21,19 +21,16 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.onap.aai.setup.SchemaVersion;
-@RunWith(Parameterized.class)
public class PatchOperationTest {
private String useOpId;
private String xmlRootElementName;
@@ -43,7 +40,6 @@ public class PatchOperationTest {
private String result;
private static SchemaVersion v = new SchemaVersion("v16");
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -67,9 +63,8 @@ public class PatchOperationTest {
return Arrays.asList(inputs);
}
- public PatchOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initPatchOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -78,13 +73,15 @@ public class PatchOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initPatchOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
PatchOperation patch =
new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams, v, "/aai");
String modResult = patch.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java
index c5b9408..c2ab69c 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutOperationTest.java
@@ -21,19 +21,16 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
import org.onap.aai.setup.SchemaVersion;
-@RunWith(Parameterized.class)
public class PutOperationTest {
private String useOpId;
private String xmlRootElementName;
@@ -43,7 +40,6 @@ public class PutOperationTest {
private String result;
private static SchemaVersion v = new SchemaVersion("v14");
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
"/network/generic-vnfs/generic-vnf/{vnf-id}",
@@ -69,9 +65,8 @@ public class PutOperationTest {
return Arrays.asList(inputs);
}
- public PutOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
+ public void initPutOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
String pathParams, String result) {
- super();
this.useOpId = useOpId;
this.xmlRootElementName = xmlRootElementName;
this.tag = tag;
@@ -80,13 +75,15 @@ public class PutOperationTest {
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Test
- public void testToString() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testToString(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
+ initPutOperationTest(useOpId, xmlRootElementName, tag, path, pathParams, result);
PutOperation put =
new PutOperation(useOpId, xmlRootElementName, tag, path, pathParams, v, "/aai");
String modResult = put.toString();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java
index b955f96..637039f 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PutRelationPathSetTest.java
@@ -22,30 +22,27 @@ package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.schemagen.GenerateXsd;
import org.onap.aai.setup.SchemaConfigVersions;
import org.onap.aai.setup.SchemaVersion;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaConfigVersions.class, EdgeIngestor.class})
+@SpringJUnitConfig(classes = {SchemaConfigVersions.class, EdgeIngestor.class})
@TestPropertySource(properties = {"schema.uri.base.path = /aai"})
-@Ignore("This test needs to get major rework done as it is written very poorly")
+@Disabled("This test needs to get major rework done as it is written very poorly")
public class PutRelationPathSetTest {
private static final String EDGEFILENAME =
"src/test/resources/dbedgerules/EdgeDescriptionRules_test.json";
@@ -66,7 +63,7 @@ public class PutRelationPathSetTest {
@Autowired
EdgeIngestor edgeIngestor;
- @Before
+ @BeforeEach
public void setUpBeforeClass() throws Exception {
v = schemaConfigVersions.getDefaultVersion();
@@ -139,7 +136,7 @@ public class PutRelationPathSetTest {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
DeleteOperation.deletePaths.put("/cloud-infrastructure/pservers/pserver/{hostname}",
@@ -167,7 +164,7 @@ public class PutRelationPathSetTest {
PutRelationPathSet.add(opId, path);
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
File edges = new File(EDGEFILENAME);
edges.delete();
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
index 1442ba9..f2ce481 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
@@ -23,11 +23,11 @@ package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.both;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsIn.in;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.hamcrest.core.Every.everyItem;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.io.StringReader;
@@ -42,10 +42,10 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.apache.commons.lang.StringUtils;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -65,11 +65,11 @@ public class XSDElementTest {
return testXML;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
setUp(0);
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java
index e750da2..2938b57 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDJavaTypeTest.java
@@ -21,17 +21,17 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.HashMap;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
public class XSDJavaTypeTest extends XSDElementTest {
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
index f04b351..7fff5fa 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
@@ -21,9 +21,9 @@
package org.onap.aai.schemagen.genxsd;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.Multimap;
@@ -38,10 +38,9 @@ import java.nio.file.Paths;
import java.util.SortedSet;
import java.util.TreeSet;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.EdgeRule;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
@@ -55,14 +54,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(
+@SpringJUnitConfig(
classes = {SchemaConfigVersions.class, SchemaLocationsBean.class,
TestUtilConfigTranslatorforBusiness.class, EdgeIngestor.class, NodeIngestor.class,
SwaggerGenerationConfiguration.class
@@ -90,14 +87,14 @@ public class YAMLfromOXMTest {
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
System.setProperty("AJSC_HOME", ".");
System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
System.setProperty("aai.service.name", SERVICE_NAME);
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
XSDElementTest x = new XSDElementTest();
x.setUp();
@@ -230,7 +227,7 @@ public class YAMLfromOXMTest {
e.printStackTrace();
}
boolean matchFound = fileContent.contains((YAMLRelationshipList()));
- assertTrue("RelationshipListFormat:\n", matchFound);
+ assertTrue(matchFound, "RelationshipListFormat:\n");
}
@Test
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java
index 2a39149..b0526e5 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbResponseTest.java
@@ -26,13 +26,10 @@ import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class ApiHttpVerbResponseTest {
Api.HttpVerb.Response theResponse = null;
String responseCode;
@@ -42,7 +39,6 @@ public class ApiHttpVerbResponseTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"200", "OK", "Response{responseCode='200', description='OK'}"},
{"400", "Bad Request", "Response{responseCode='400', description='Bad Request'}"},
@@ -56,8 +52,7 @@ public class ApiHttpVerbResponseTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public ApiHttpVerbResponseTest(String responseCode, String description, String result) {
- super();
+ public void initApiHttpVerbResponseTest(String responseCode, String description, String result) {
this.responseCode = responseCode;
this.description = description;
this.result = result;
@@ -66,7 +61,7 @@ public class ApiHttpVerbResponseTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theResponse = new Api.HttpVerb.Response();
}
@@ -74,8 +69,10 @@ public class ApiHttpVerbResponseTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testApiHttpVerbResponse() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testApiHttpVerbResponse(String responseCode, String description, String result) {
+ initApiHttpVerbResponseTest(responseCode, description, result);
theResponse.setResponseCode(this.responseCode);
theResponse.setDescription(this.description);
assertThat(theResponse.toString(), is(this.result));
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java
index c714d82..3f3e804 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/ApiHttpVerbTest.java
@@ -30,13 +30,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class ApiHttpVerbTest {
Api.HttpVerb theVerb = null;
List<String> tags;
@@ -50,7 +47,6 @@ public class ApiHttpVerbTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"tag1,tag2", "typeA", "summaryB", "operationC", "consumesD,consumesE",
"producesF,producesG",
@@ -64,9 +60,8 @@ public class ApiHttpVerbTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public ApiHttpVerbTest(String tags, String type, String summary, String operationId,
+ public void initApiHttpVerbTest(String tags, String type, String summary, String operationId,
String consumes, String produces, String result) {
- super();
this.tags = Arrays.asList(tags.split(","));
this.type = type;
this.summary = summary;
@@ -80,7 +75,7 @@ public class ApiHttpVerbTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theVerb = new Api.HttpVerb();
}
@@ -88,8 +83,10 @@ public class ApiHttpVerbTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testApiHttpVerb() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testApiHttpVerb(String tags, String type, String summary, String operationId, String consumes, String produces, String result) {
+ initApiHttpVerbTest(tags, type, summary, operationId, consumes, produces, result);
theVerb.setTags(this.tags);
theVerb.setType(this.type);
theVerb.setSummary(this.summary);
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java
index fef3344..8b2e46f 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionPropertyTest.java
@@ -26,13 +26,10 @@ import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
import java.util.Collection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DefinitionPropertyTest {
Definition.Property theProperty = null;
String propertyName;
@@ -43,7 +40,6 @@ public class DefinitionPropertyTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {
{"name1", "type1", "ref1",
@@ -58,9 +54,8 @@ public class DefinitionPropertyTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public DefinitionPropertyTest(String propertyName, String propertyType,
+ public void initDefinitionPropertyTest(String propertyName, String propertyType,
String propertyReference, String result) {
- super();
this.propertyName = propertyName;
this.propertyType = propertyType;
this.propertyReference = propertyReference;
@@ -70,7 +65,7 @@ public class DefinitionPropertyTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theProperty = new Definition.Property();
}
@@ -78,8 +73,10 @@ public class DefinitionPropertyTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testDefinitionProperty() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testDefinitionProperty(String propertyName, String propertyType, String propertyReference, String result) {
+ initDefinitionPropertyTest(propertyName, propertyType, propertyReference, result);
theProperty.setPropertyName(this.propertyName);
theProperty.setPropertyType(this.propertyType);
theProperty.setPropertyReference(this.propertyReference);
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java
index 98169d8..fe3f8cd 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/swagger/DefinitionTest.java
@@ -28,13 +28,10 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
-@RunWith(Parameterized.class)
public class DefinitionTest {
Definition theDefinition = null;
String definitionName;
@@ -44,7 +41,6 @@ public class DefinitionTest {
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {{"name1", "desc1",
"Definition{definitionName='name1', definitionDescription='desc1', propertyList=[]}"},
@@ -58,8 +54,7 @@ public class DefinitionTest {
/**
* Constructor for the test cases all following same pattern.
*/
- public DefinitionTest(String definitionName, String definitionDescription, String result) {
- super();
+ public void initDefinitionTest(String definitionName, String definitionDescription, String result) {
this.definitionName = definitionName;
this.definitionDescription = definitionDescription;
this.result = result;
@@ -68,7 +63,7 @@ public class DefinitionTest {
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theDefinition = new Definition();
}
@@ -76,8 +71,10 @@ public class DefinitionTest {
/**
* Perform the test on the test object.
*/
- @Test
- public void testDefinitionProperty() {
+ @MethodSource("testConditions")
+ @ParameterizedTest
+ public void testDefinitionProperty(String definitionName, String definitionDescription, String result) {
+ initDefinitionTest(definitionName, definitionDescription, result);
theDefinition.setDefinitionName(this.definitionName);
theDefinition.setDefinitionDescription(this.definitionDescription);
diff --git a/aai-schema-service/pom.xml b/aai-schema-service/pom.xml
index a5ef621..eaef1e0 100644
--- a/aai-schema-service/pom.xml
+++ b/aai-schema-service/pom.xml
@@ -327,11 +327,6 @@
<artifactId>logback-access</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
@@ -401,12 +396,28 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </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>
</dependencies>
<build>
diff --git a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java
index c687a58..49c3c33 100644
--- a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java
+++ b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTest.java
@@ -20,17 +20,16 @@
package org.onap.aai.schemaservice;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
import java.io.UnsupportedEncodingException;
import java.util.Base64;
import java.util.Collections;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.schemaservice.config.PropertyPasswordConfiguration;
import org.onap.aai.util.AAIConfig;
@@ -45,7 +44,6 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
@SpringBootTest(
@@ -54,8 +52,6 @@ import org.springframework.web.client.RestTemplate;
@TestPropertySource(locations = "classpath:application-test.properties")
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
@Import(SchemaServiceTestConfiguration.class)
-
-@RunWith(SpringRunner.class)
public class SchemaServiceTest {
private HttpHeaders headers;
@@ -72,14 +68,14 @@ public class SchemaServiceTest {
@LocalServerPort
protected int randomPort;
- @BeforeClass
+ @BeforeAll
public static void setupConfig() throws AAIException {
System.setProperty("AJSC_HOME", "./");
System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
System.out.println("Current directory: " + System.getProperty("user.dir"));
}
- @Before
+ @BeforeEach
public void setup() throws AAIException, UnsupportedEncodingException {
AAIConfig.init();
diff --git a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java
index 938d509..e5a8632 100644
--- a/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java
+++ b/aai-schema-service/src/test/java/org/onap/aai/schemaservice/SchemaServiceTestConfiguration.java
@@ -38,6 +38,7 @@ import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
+import org.springframework.core.env.Profiles;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -63,7 +64,7 @@ public class SchemaServiceTestConfiguration {
RestTemplate restTemplate = null;
- if (env.acceptsProfiles("one-way-ssl", "two-way-ssl")) {
+ if (env.acceptsProfiles(Profiles.of("one-way-ssl", "two-way-ssl"))) {
char[] trustStorePassword =
env.getProperty("server.ssl.trust-store-password").toCharArray();
char[] keyStorePassword =
@@ -73,7 +74,7 @@ public class SchemaServiceTestConfiguration {
String trustStore = env.getProperty("server.ssl.trust-store");
SSLContextBuilder sslContextBuilder = SSLContextBuilder.create();
- if (env.acceptsProfiles("two-way-ssl")) {
+ if (env.acceptsProfiles(Profiles.of("two-way-ssl"))) {
sslContextBuilder = sslContextBuilder
.loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword);
}
diff --git a/aai-schema/pom.xml b/aai-schema/pom.xml
index a078d38..7588df7 100644
--- a/aai-schema/pom.xml
+++ b/aai-schema/pom.xml
@@ -51,9 +51,15 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-junit</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
@@ -69,12 +75,28 @@
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</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>
</dependencies>
<build>
<plugins>
diff --git a/aai-schema/src/test/java/org/onap/aai/schema/ValidateEdgeRulesTest.java b/aai-schema/src/test/java/org/onap/aai/schema/ValidateEdgeRulesTest.java
index 694f4b9..c09aae2 100644
--- a/aai-schema/src/test/java/org/onap/aai/schema/ValidateEdgeRulesTest.java
+++ b/aai-schema/src/test/java/org/onap/aai/schema/ValidateEdgeRulesTest.java
@@ -20,7 +20,7 @@
package org.onap.aai.schema;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.FileReader;
@@ -37,7 +37,7 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class ValidateEdgeRulesTest {
diff --git a/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java b/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java
index c228e77..60619f1 100644
--- a/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java
+++ b/aai-schema/src/test/java/org/onap/aai/schema/ValidateOXMTest.java
@@ -20,8 +20,8 @@
package org.onap.aai.schema;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.*;
import java.nio.file.Path;
@@ -44,8 +44,8 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
@@ -472,7 +472,7 @@ public class ValidateOXMTest {
* dependentOn relationship matches what is listed in the edge rules.
*
*/
- @Ignore
+ @Disabled
@Test
public void testSchemaValidationAgainstEdgeRules() throws XPathExpressionException, IOException,
SAXException, ParserConfigurationException, ParseException {