summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-11-08 09:49:07 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-11-08 10:09:22 +0100
commit315cc50d39facda91c937dbb72d4d28b89524afe (patch)
tree48d71c0bfdf917e8f6b27e743d218389cd680936
parent26092e3d55ec4d7be061fbedce43d7b27439af01 (diff)
Upgrade spring boot to 2.6
- upgrade spring boot (2.5.15 -> 2.6.15) - migrate aai-schema-ingest module to JUnit 5 Issue-ID: AAI-4048 Change-Id: I72a59891fdbcdea9b54f6c02aae09fcc7a26947a Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--aai-annotations/pom.xml4
-rw-r--r--aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java6
-rw-r--r--aai-core/pom.xml8
-rw-r--r--aai-failover/pom.xml6
-rw-r--r--aai-parent/pom.xml19
-rw-r--r--aai-rest/src/test/java/org/onap/aai/restclient/RestClientTest.java9
-rw-r--r--aai-schema-abstraction/pom.xml21
-rw-r--r--aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/json/JsonSchemaProviderTest.java121
-rw-r--r--aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaProviderTest.java10
-rw-r--r--aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java10
-rw-r--r--aai-schema-ingest/pom.xml33
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java2
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java2
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java78
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java89
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java77
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java77
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java9
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java13
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java17
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java16
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java16
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java4
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java29
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java8
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java7
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java29
-rw-r--r--aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java7
-rw-r--r--aai-utils/pom.xml21
-rw-r--r--aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java30
54 files changed, 414 insertions, 508 deletions
diff --git a/aai-annotations/pom.xml b/aai-annotations/pom.xml
index 19567ef4..17d034c4 100644
--- a/aai-annotations/pom.xml
+++ b/aai-annotations/pom.xml
@@ -38,8 +38,8 @@
</properties>
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
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 c988ddfa..81c5fb57 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,11 +20,16 @@
package org.onap.aai.annotations;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
+
public class AnnotationsTest {
public AnnotationsTest() {
}
+ @Test
@Metadata(
isKey = false,
description = "",
@@ -44,5 +49,6 @@ public class AnnotationsTest {
maximumDepth = "",
crossEntityReference = "")
public void testAnnotation() {
+ assertTrue(true);
}
}
diff --git a/aai-core/pom.xml b/aai-core/pom.xml
index 4ce7f76d..41772b96 100644
--- a/aai-core/pom.xml
+++ b/aai-core/pom.xml
@@ -204,10 +204,10 @@ limitations under the License.
<version>2.7.14</version>
</dependency>
<dependency>
- <groupId>org.springframework.kafka</groupId>
- <artifactId>spring-kafka-test</artifactId>
- <scope>test</scope>
- </dependency>
+ <groupId>org.springframework.kafka</groupId>
+ <artifactId>spring-kafka-test</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
diff --git a/aai-failover/pom.xml b/aai-failover/pom.xml
index 4b5f1d76..98526e8e 100644
--- a/aai-failover/pom.xml
+++ b/aai-failover/pom.xml
@@ -25,12 +25,6 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.9.1</version>
</dependency>
</dependencies>
</project>
diff --git a/aai-parent/pom.xml b/aai-parent/pom.xml
index add636e1..9ffc0379 100644
--- a/aai-parent/pom.xml
+++ b/aai-parent/pom.xml
@@ -86,9 +86,7 @@ limitations under the License.
Please don't upgrade to 2.3.0 or above for nexus iq or security scans
as it could potentially break our code
-->
- <spring.boot.version>2.5.15</spring.boot.version>
- <spring.version>5.3.39</spring.version>
- <spring.test.version>${spring.version}</spring.test.version>
+ <spring.boot.version>2.6.15</spring.boot.version>
<json.path.version>2.2.0</json.path.version>
<json.version>20190722</json.version>
<junit.version>4.12</junit.version>
@@ -140,13 +138,6 @@ limitations under the License.
<scope>import</scope>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-framework-bom</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring.boot.version}</version>
@@ -496,9 +487,9 @@ limitations under the License.
</dependency>
<dependency>
- <groupId>io.swagger</groupId>
+ <groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
- <version>${io.swagger.version}</version>
+ <version>2.2.25</version>
</dependency>
<dependency>
@@ -508,9 +499,9 @@ limitations under the License.
</dependency>
<dependency>
- <groupId>io.swagger</groupId>
+ <groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
- <version>${io.swagger.version}</version>
+ <version>2.2.25</version>
</dependency>
<dependency>
diff --git a/aai-rest/src/test/java/org/onap/aai/restclient/RestClientTest.java b/aai-rest/src/test/java/org/onap/aai/restclient/RestClientTest.java
index 36b8fb3e..bf32e91c 100644
--- a/aai-rest/src/test/java/org/onap/aai/restclient/RestClientTest.java
+++ b/aai-rest/src/test/java/org/onap/aai/restclient/RestClientTest.java
@@ -20,6 +20,13 @@
package org.onap.aai.restclient;
-public class RestClientTest {
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
+public class RestClientTest {
+ @Test
+ public void test() {
+ assertTrue(true);
+ }
}
diff --git a/aai-schema-abstraction/pom.xml b/aai-schema-abstraction/pom.xml
index 140db51c..8384809c 100644
--- a/aai-schema-abstraction/pom.xml
+++ b/aai-schema-abstraction/pom.xml
@@ -94,8 +94,19 @@
<artifactId>rest-client</artifactId>
</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.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -103,6 +114,12 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <version>5.14.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/json/JsonSchemaProviderTest.java b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/json/JsonSchemaProviderTest.java
index a4c7546d..3fb98718 100644
--- a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/json/JsonSchemaProviderTest.java
+++ b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/json/JsonSchemaProviderTest.java
@@ -21,12 +21,7 @@
package org.onap.aai.schemaif.json;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -39,8 +34,8 @@ import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.schemaif.SchemaProviderException;
import org.onap.aai.schemaif.definitions.EdgeSchema;
import org.onap.aai.schemaif.definitions.PropertySchema;
@@ -59,7 +54,7 @@ public class JsonSchemaProviderTest {
JsonSchemaProviderConfig config = new JsonSchemaProviderConfig();
- @Before
+ @BeforeEach
public void init() {
config.setSchemaServiceBaseUrl("https://testurl.com:8443");
config.setSchemaServiceCertFile("/c/certfile");
@@ -528,66 +523,74 @@ public class JsonSchemaProviderTest {
}
}
- @Test(expected = SchemaProviderException.class)
- public void testSchemaValidateBadEdge() throws SchemaProviderException {
- SchemaServiceResponse schema;
-
- try {
- String testSchema = readFile("src/test/resources/json/badEdgeSchema.json");
- schema = SchemaServiceResponse.fromJson(testSchema);
- } catch (Exception ex) {
- fail();
- return;
- }
+ @Test
+ public void testSchemaValidateBadEdge() {
+ assertThrows(SchemaProviderException.class, () -> {
+ SchemaServiceResponse schema;
+
+ try {
+ String testSchema = readFile("src/test/resources/json/badEdgeSchema.json");
+ schema = SchemaServiceResponse.fromJson(testSchema);
+ } catch (Exception ex) {
+ fail();
+ return;
+ }
- schema.getData().validate();
+ schema.getData().validate();
+ });
}
- @Test(expected = SchemaProviderException.class)
- public void testSchemaValidateBadVertex() throws SchemaProviderException {
- SchemaServiceResponse schema;
-
- try {
- String testSchema = readFile("src/test/resources/json/badVertexSchema.json");
- schema = SchemaServiceResponse.fromJson(testSchema);
- } catch (Exception ex) {
- fail();
- return;
- }
+ @Test
+ public void testSchemaValidateBadVertex() {
+ assertThrows(SchemaProviderException.class, () -> {
+ SchemaServiceResponse schema;
+
+ try {
+ String testSchema = readFile("src/test/resources/json/badVertexSchema.json");
+ schema = SchemaServiceResponse.fromJson(testSchema);
+ } catch (Exception ex) {
+ fail();
+ return;
+ }
- System.out.println("Validate");
- schema.getData().validate();
- System.out.println("Validate done");
+ System.out.println("Validate");
+ schema.getData().validate();
+ System.out.println("Validate done");
+ });
}
- @Test(expected = SchemaProviderException.class)
- public void testSchemaValidateBadType() throws SchemaProviderException {
- SchemaServiceResponse schema;
-
- try {
- String testSchema = readFile("src/test/resources/json/badTypeSchema.json");
- schema = SchemaServiceResponse.fromJson(testSchema);
- } catch (Exception ex) {
- fail();
- return;
- }
+ @Test
+ public void testSchemaValidateBadType() {
+ assertThrows(SchemaProviderException.class, () -> {
+ SchemaServiceResponse schema;
+
+ try {
+ String testSchema = readFile("src/test/resources/json/badTypeSchema.json");
+ schema = SchemaServiceResponse.fromJson(testSchema);
+ } catch (Exception ex) {
+ fail();
+ return;
+ }
- schema.getData().validate();
+ schema.getData().validate();
+ });
}
- @Test(expected = SchemaProviderException.class)
- public void testSchemaValidateBadProp() throws SchemaProviderException {
- SchemaServiceResponse schema;
-
- try {
- String testSchema = readFile("src/test/resources/json/badPropSchema.json");
- schema = SchemaServiceResponse.fromJson(testSchema);
- } catch (Exception ex) {
- fail();
- return;
- }
+ @Test
+ public void testSchemaValidateBadProp() {
+ assertThrows(SchemaProviderException.class, () -> {
+ SchemaServiceResponse schema;
+
+ try {
+ String testSchema = readFile("src/test/resources/json/badPropSchema.json");
+ schema = SchemaServiceResponse.fromJson(testSchema);
+ } catch (Exception ex) {
+ fail();
+ return;
+ }
- schema.getData().validate();
+ schema.getData().validate();
+ });
}
static String readFile(String path) throws IOException {
diff --git a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaProviderTest.java b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaProviderTest.java
index 222be0e9..8d6a744b 100644
--- a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaProviderTest.java
+++ b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaProviderTest.java
@@ -21,22 +21,22 @@
package org.onap.aai.schemaif.oxm;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Set;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.aai.schemaif.SchemaProviderException;
import org.onap.aai.schemaif.definitions.EdgeSchema;
import org.onap.aai.schemaif.definitions.PropertySchema;
import org.onap.aai.schemaif.definitions.VertexSchema;
import org.onap.aai.schemaif.definitions.types.DataType.Type;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
@Test
diff --git a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java
index 08cf880e..701d4e15 100644
--- a/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java
+++ b/aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java
@@ -27,11 +27,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.junit.Before;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.AAIConfigTranslator;
@@ -40,7 +40,7 @@ import org.onap.aai.setup.SchemaLocationsBean;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.setup.Translator;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class OxmSchemaServiceSetup {
@Mock
@@ -56,7 +56,7 @@ public class OxmSchemaServiceSetup {
private OxmEdgeRulesLoader edgeLoader;
private OxmSchemaLoader vertexLoader;
- @Before
+ @BeforeEach
public void schemaBeanMockSetup() throws Exception {
schemaVersionList.add(new SchemaVersion("v13"));
diff --git a/aai-schema-ingest/pom.xml b/aai-schema-ingest/pom.xml
index cf908b19..bc722c1f 100644
--- a/aai-schema-ingest/pom.xml
+++ b/aai-schema-ingest/pom.xml
@@ -127,23 +127,22 @@ limitations under the License.
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- TODO: Migrate tests to junit 5 and remove this dependency -->
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- </exclusion>
- </exclusions>
- </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.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
index c3222168..e2b5e75f 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
@@ -51,7 +51,6 @@ import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.Translator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -76,7 +75,6 @@ public class EdgeIngestor {
private Set<Translator> translators;
- @Autowired
public EdgeIngestor(Set<Translator> translatorSet) {
this.translators = translatorSet;
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
index 15b495ad..8db80999 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
@@ -52,7 +52,6 @@ import org.onap.aai.setup.SchemaVersions;
import org.onap.aai.setup.Translator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
@@ -86,7 +85,6 @@ public class NodeIngestor {
* @param translatorSet
*/
- @Autowired
public NodeIngestor(Set<Translator> translatorSet) {
this.translators = translatorSet;
this.caseFormatStore = new CaseFormatStore();
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
index 50b9dc2f..15587c28 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/ConfigTranslator.java
@@ -33,7 +33,6 @@ import org.apache.commons.io.IOUtils;
import org.onap.aai.edges.JsonIngestor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
/**
* Converts the contents of the schema config file
@@ -46,7 +45,6 @@ public abstract class ConfigTranslator extends Translator {
protected SchemaLocationsBean schemaLocationsBean;
- @Autowired
public ConfigTranslator(SchemaLocationsBean schemaLocationsBean, SchemaConfigVersions schemaConfigVersions) {
super(schemaConfigVersions);
this.schemaLocationsBean = schemaLocationsBean;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java
index 7308e377..01d8ddd0 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/DefaultVersionValidationModule.java
@@ -29,7 +29,6 @@ import java.util.Map;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -42,7 +41,6 @@ public class DefaultVersionValidationModule implements VersionValidationModule {
private ConfigTranslator config;
- @Autowired
public DefaultVersionValidationModule(ConfigTranslator config) {
this.config = config;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java
index a1e95557..bb9d738f 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/VersionValidator.java
@@ -20,7 +20,6 @@
package org.onap.aai.validation;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@@ -34,7 +33,6 @@ public class VersionValidator {
private SchemaErrorStrategy strat;
private VersionValidationModule verMod;
- @Autowired
public VersionValidator(SchemaErrorStrategy strategy, VersionValidationModule verMod) {
this.strat = strategy;
this.verMod = verMod;
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java
index 620bc726..067d329b 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/EdgeRuleValidator.java
@@ -30,7 +30,6 @@ import org.onap.aai.edges.enums.EdgeField;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.validation.SchemaErrorStrategy;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@@ -48,7 +47,6 @@ public class EdgeRuleValidator {
protected final CousinDefaultingValidationModule defaultsValidator;
protected final NodeTypesValidationModule typeValidator;
- @Autowired
public EdgeRuleValidator(ConfigTranslator config, SchemaErrorStrategy strat,
EdgeFieldsValidationModule fieldValidator, UniqueLabelValidationModule labelValidator,
SingleContainmentValidationModule containsValidator, CousinDefaultingValidationModule defaultsValidator,
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java
index 0de66249..5b574732 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/edges/NodeTypesValidationModule.java
@@ -26,7 +26,6 @@ import java.util.Set;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaVersion;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -39,7 +38,6 @@ import org.springframework.stereotype.Component;
public class NodeTypesValidationModule {
private NodeIngestor ni;
- @Autowired
public NodeTypesValidationModule(NodeIngestor ni) {
this.ni = ni;
}
diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java b/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java
index 13de6715..ab951e49 100644
--- a/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java
+++ b/aai-schema-ingest/src/main/java/org/onap/aai/validation/nodes/NodeValidator.java
@@ -26,7 +26,6 @@ import java.util.Map.Entry;
import org.onap.aai.setup.ConfigTranslator;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.validation.SchemaErrorStrategy;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
@@ -38,7 +37,6 @@ public class NodeValidator {
private SchemaErrorStrategy strat;
private DuplicateNodeDefinitionValidationModule dupChecker;
- @Autowired
public NodeValidator(ConfigTranslator translator, SchemaErrorStrategy strategy,
DuplicateNodeDefinitionValidationModule dupChecker) {
this.translator = translator;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java
index 6f896f88..319d62d6 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.google.common.collect.Multimap;
import java.util.Collection;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.EdgesConfiguration;
import org.onap.aai.edges.enums.AAIDirection;
import org.onap.aai.edges.enums.MultiplicityRule;
@@ -43,9 +40,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {EdgesConfiguration.class, TestUtilConfigTranslator.class})
@TestPropertySource(
properties = {
@@ -58,9 +53,6 @@ public class EdgeIngestorLocalTest {
@Autowired
EdgeIngestor edgeIngestor;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void getRulesTest1() throws EdgeRuleNotFoundException {
EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
@@ -159,11 +151,12 @@ public class EdgeIngestorLocalTest {
}
@Test
- public void getRulesNoneFound() throws EdgeRuleNotFoundException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface").build();
- edgeIngestor.getRules(q);
+ public void getRulesNoneFound() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface").build();
+ edgeIngestor.getRules(q);
+ });
+ assertTrue(exception.getMessage().contains("No rules found for"));
}
@Test
@@ -218,11 +211,12 @@ public class EdgeIngestorLocalTest {
// }
@Test
- public void getRuleNoneFoundTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rule found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
- edgeIngestor.getRule(q);
+ public void getRuleNoneFoundTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No rule found for"));
}
// @Test
@@ -234,19 +228,21 @@ public class EdgeIngestorLocalTest {
// }
@Test
- public void getRuleAmbiguousDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("Multiple defaults found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleAmbiguousDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("Multiple defaults found."));
}
@Test
- public void getRuleNoDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("No default found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleNoDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No default found."));
}
// @Test
@@ -360,16 +356,16 @@ public class EdgeIngestorLocalTest {
// }
@Test
- public void getAllRulesTest() throws EdgeRuleNotFoundException {
- Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
- assertTrue(res.size() == 4);
- assertTrue(res.containsKey("bar|foo"));
- assertTrue(res.get("bar|foo").size() == 2);
- assertTrue(res.containsKey("baz|foo"));
- assertTrue(res.containsKey("foo|quux"));
-
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for version v9.");
- edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ public void getAllRulesTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
+ assertTrue(res.size() == 4);
+ assertTrue(res.containsKey("bar|foo"));
+ assertTrue(res.get("bar|foo").size() == 2);
+ assertTrue(res.containsKey("baz|foo"));
+ assertTrue(res.containsKey("foo|quux"));
+ edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ });
+ assertTrue(exception.getMessage().contains("No rules found for version v9."));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
index 99693c16..932c9e28 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.google.common.collect.Multimap;
import java.util.Collection;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.EdgesConfiguration;
import org.onap.aai.edges.enums.AAIDirection;
import org.onap.aai.edges.enums.MultiplicityRule;
@@ -43,9 +40,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {MockProvider.class, EdgesConfiguration.class})
@TestPropertySource(
properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties",
@@ -56,9 +51,6 @@ public class EdgeIngestorTest {
@Autowired
EdgeIngestor edgeIngestor;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void getRulesTest1() throws EdgeRuleNotFoundException {
EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
@@ -161,11 +153,12 @@ public class EdgeIngestorTest {
}
@Test
- public void getRulesNoneFound() throws EdgeRuleNotFoundException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("bogus-value").build();
- edgeIngestor.getRules(q);
+ public void getRulesNoneFound() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("bogus-value").build();
+ edgeIngestor.getRules(q);
+ });
+ assertTrue(exception.getMessage().contains("No rules found for"));
}
@Test
@@ -237,35 +230,39 @@ public class EdgeIngestorTest {
}
@Test
- public void getRuleNoneFoundTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rule found for");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
- edgeIngestor.getRule(q);
+ public void getRuleNoneFoundTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("l-interface", "nonexistent").build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No rule found for"));
}
@Test
- public void getRuleTooManyPairsTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("No way to select single rule from these pairs:");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
- edgeIngestor.getRule(q);
+ public void getRuleTooManyPairsTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("foo").build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No way to select single rule from these pairs:"));
}
@Test
- public void getRuleAmbiguousDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("Multiple defaults found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleAmbiguousDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("seed", "plant").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("Multiple defaults found."));
}
@Test
- public void getRuleNoDefaultTest() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException {
- thrown.expect(AmbiguousRuleChoiceException.class);
- thrown.expectMessage("No default found.");
- EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
- edgeIngestor.getRule(q);
+ public void getRuleNoDefaultTest() {
+ Throwable exception = assertThrows(AmbiguousRuleChoiceException.class, () -> {
+ EdgeRuleQuery q = new EdgeRuleQuery.Builder("apple", "orange").version(new SchemaVersion("v11")).build();
+ edgeIngestor.getRule(q);
+ });
+ assertTrue(exception.getMessage().contains("No default found."));
}
@Test
@@ -382,16 +379,16 @@ public class EdgeIngestorTest {
}
@Test
- public void getAllRulesTest() throws EdgeRuleNotFoundException {
- Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
- assertTrue(res.size() == 4);
- assertTrue(res.containsKey("bar|foo"));
- assertTrue(res.get("bar|foo").size() == 2);
- assertTrue(res.containsKey("baz|foo"));
- assertTrue(res.containsKey("foo|quux"));
-
- thrown.expect(EdgeRuleNotFoundException.class);
- thrown.expectMessage("No rules found for version v9.");
- edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ public void getAllRulesTest() {
+ Throwable exception = assertThrows(EdgeRuleNotFoundException.class, () -> {
+ Multimap<String, EdgeRule> res = edgeIngestor.getAllRules(new SchemaVersion("v10"));
+ assertTrue(res.size() == 4);
+ assertTrue(res.containsKey("bar|foo"));
+ assertTrue(res.get("bar|foo").size() == 2);
+ assertTrue(res.containsKey("baz|foo"));
+ assertTrue(res.containsKey("foo|quux"));
+ edgeIngestor.getAllRules(new SchemaVersion("v9"));
+ });
+ assertTrue(exception.getMessage().contains("No rules found for version v9."));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
index 543ce273..fa7f04cd 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
@@ -20,12 +20,10 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.google.common.collect.Multimap;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.EdgesConfiguration;
import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
import org.onap.aai.setup.SchemaVersion;
@@ -34,9 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {EdgesConfiguration.class, ConfigTranslatorForWiringTest.class})
@TestPropertySource(
properties = {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
index c1894f00..3396b93c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java
@@ -20,7 +20,7 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
@@ -29,8 +29,8 @@ import java.io.InputStream;
import java.util.List;
import java.util.Scanner;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.enums.EdgeType;
public class EdgeRuleQueryTest {
@@ -38,7 +38,7 @@ public class EdgeRuleQueryTest {
private String readStart = "$.rules.[?]";
/* **** DATA SETUP **** */
- @Before
+ @BeforeEach
public void setup() {
InputStream is = getClass().getResourceAsStream("/edgeRules/test.json");
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
index 3fdabfd1..798a32f6 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java
@@ -20,13 +20,13 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.HashMap;
import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class EdgeRuleTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
index c67be641..66fbcceb 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java
@@ -22,14 +22,14 @@ package org.onap.aai.edges;
import static com.jayway.jsonpath.Criteria.where;
import static com.jayway.jsonpath.Filter.filter;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.Filter;
+import org.junit.jupiter.api.Test;
import java.util.*;
-import org.junit.Test;
import org.onap.aai.setup.SchemaVersion;
public class JsonIngestorTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
index 4e3d61dd..b1063107 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java
@@ -20,9 +20,9 @@
package org.onap.aai.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TypeAlphabetizerTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java
index f26e603a..90d614b6 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java
@@ -22,7 +22,8 @@ package org.onap.aai.nodes;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -43,10 +44,7 @@ import javax.xml.transform.stream.StreamResult;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.TestUtilConfigTranslator;
@@ -55,10 +53,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
import org.w3c.dom.Document;
-@RunWith(SpringRunner.class)
@TestPropertySource(
properties = {
"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test-local-node.properties"})
@@ -68,11 +64,6 @@ import org.w3c.dom.Document;
@SpringBootTest
public class NodeIngestorLocalTest {
-
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Autowired
NodeIngestor nodeIngestor;
@@ -90,37 +81,37 @@ public class NodeIngestorLocalTest {
@Test
public void testGetContextForVersion11() {
- DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
-
- // should work bc Foo is valid in test_network_v10 schema
- DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
-
- foo10.set("fooId", "bar");
- assertEquals("bar", foo10.get("fooId"));
-
- // should work bc Bar is valid in test_business_v10 schema
- DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
- bar10.set("barId", "bar2");
- assertEquals("bar2", bar10.get("barId"));
- XSDOutputResolver outputResolver10 = new XSDOutputResolver();
- ctx10.generateSchema(outputResolver10);
-
- DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
-
- // should work bc Foo.quantity is valid in test_network_v11 schema
- DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
- foo11.set("quantity", "12");
- assertEquals("12", foo11.get("quantity"));
-
- DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
- quux11.set("qManagerName", "some guy");
- assertEquals("some guy", quux11.get("qManagerName"));
- XSDOutputResolver outputResolver11 = new XSDOutputResolver();
- ctx11.generateSchema(outputResolver11);
-
- thrown.expect(IllegalArgumentException.class);
- // should fail bc Quux not in v10 test schema
- ctx10.newDynamicEntity("Quux");
+ assertThrows(IllegalArgumentException.class, () -> {
+ DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
+
+ // should work bc Foo is valid in test_network_v10 schema
+ DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
+
+ foo10.set("fooId", "bar");
+ assertEquals("bar", foo10.get("fooId"));
+
+ // should work bc Bar is valid in test_business_v10 schema
+ DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
+ bar10.set("barId", "bar2");
+ assertEquals("bar2", bar10.get("barId"));
+ XSDOutputResolver outputResolver10 = new XSDOutputResolver();
+ ctx10.generateSchema(outputResolver10);
+
+ DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
+
+ // should work bc Foo.quantity is valid in test_network_v11 schema
+ DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
+ foo11.set("quantity", "12");
+ assertEquals("12", foo11.get("quantity"));
+
+ DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
+ quux11.set("qManagerName", "some guy");
+ assertEquals("some guy", quux11.get("qManagerName"));
+ XSDOutputResolver outputResolver11 = new XSDOutputResolver();
+ ctx11.generateSchema(outputResolver11);
+ // should fail bc Quux not in v10 test schema
+ ctx10.newDynamicEntity("Quux");
+ });
}
@Test
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
index 053004bd..6e62505b 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
@@ -22,7 +22,8 @@ package org.onap.aai.nodes;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -43,10 +44,7 @@ import javax.xml.transform.stream.StreamResult;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.restclient.MockProvider;
import org.onap.aai.setup.SchemaVersion;
@@ -55,10 +53,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.w3c.dom.Document;
-@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(
properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties",
"spring.main.allow-bean-definition-overriding=true"})
@@ -70,44 +66,39 @@ public class NodeIngestorTest {
@Autowired
NodeIngestor nodeIngestor;
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void testGetContextForVersion() {
- DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
-
- // should work bc Foo is valid in test_network_v10 schema
- DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
-
- foo10.set("fooId", "bar");
- assertEquals("bar", foo10.get("fooId"));
-
- // should work bc Bar is valid in test_business_v10 schema
- DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
- bar10.set("barId", "bar2");
- assertEquals("bar2", bar10.get("barId"));
- XSDOutputResolver outputResolver10 = new XSDOutputResolver();
- ctx10.generateSchema(outputResolver10);
-
- DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
-
- // should work bc Foo.quantity is valid in test_network_v11 schema
- DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
- foo11.set("quantity", "12");
- assertEquals("12", foo11.get("quantity"));
-
- DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
- quux11.set("qManagerName", "some guy");
- assertEquals("some guy", quux11.get("qManagerName"));
- XSDOutputResolver outputResolver11 = new XSDOutputResolver();
- ctx11.generateSchema(outputResolver11);
-
- thrown.expect(IllegalArgumentException.class);
- // should fail bc Quux not in v10 test schema
- ctx10.newDynamicEntity("Quux");
+ assertThrows(IllegalArgumentException.class, () -> {
+ DynamicJAXBContext ctx10 = nodeIngestor.getContextForVersion(new SchemaVersion("v10"));
+
+ // should work bc Foo is valid in test_network_v10 schema
+ DynamicEntity foo10 = ctx10.newDynamicEntity("Foo");
+
+ foo10.set("fooId", "bar");
+ assertEquals("bar", foo10.get("fooId"));
+
+ // should work bc Bar is valid in test_business_v10 schema
+ DynamicEntity bar10 = ctx10.newDynamicEntity("Bar");
+ bar10.set("barId", "bar2");
+ assertEquals("bar2", bar10.get("barId"));
+ XSDOutputResolver outputResolver10 = new XSDOutputResolver();
+ ctx10.generateSchema(outputResolver10);
+
+ DynamicJAXBContext ctx11 = nodeIngestor.getContextForVersion(new SchemaVersion("v11"));
+
+ // should work bc Foo.quantity is valid in test_network_v11 schema
+ DynamicEntity foo11 = ctx11.newDynamicEntity("Foo");
+ foo11.set("quantity", "12");
+ assertEquals("12", foo11.get("quantity"));
+
+ DynamicEntity quux11 = ctx11.newDynamicEntity("Quux");
+ quux11.set("qManagerName", "some guy");
+ assertEquals("some guy", quux11.get("qManagerName"));
+ XSDOutputResolver outputResolver11 = new XSDOutputResolver();
+ ctx11.generateSchema(outputResolver11);
+ // should fail bc Quux not in v10 test schema
+ ctx10.newDynamicEntity("Quux");
+ });
}
@Test
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
index 7ae0a2cd..07631ce2 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
@@ -20,12 +20,11 @@
package org.onap.aai.nodes;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
@@ -33,9 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ConfigTranslatorForWiringTest.class, NodesConfiguration.class})
@TestPropertySource(
properties = {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
index d2921c73..5ef0ebeb 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
@@ -21,7 +21,7 @@
package org.onap.aai.restclient;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
@@ -124,7 +124,7 @@ public class MockRestClient extends RestClient {
String result = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
String message = String.format("Unable to find the %s in src/test/resources", filename);
- assertNotNull(message, inputStream);
+ assertNotNull(inputStream, message);
JsonObject payload = JsonParser.parseString(result).getAsJsonObject();
return payload;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java
index 4b12936e..743fe70d 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java
@@ -23,19 +23,16 @@ package org.onap.aai.restclient;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@Ignore
-@RunWith(SpringJUnit4ClassRunner.class)
+@Disabled
@TestPropertySource(locations = "/schemaService/schema-service-rest.properties")
@ContextConfiguration(
classes = {RestClientFactoryConfiguration.class, SchemaServiceRestClient.class, RestClientFactory.class,
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
index 8136ac0b..d34ea712 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/ConfigTranslatorWiringTest.java
@@ -20,22 +20,19 @@
package org.onap.aai.setup;
-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;
import java.util.List;
import java.util.Map;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {SchemaLocationsBean.class, SchemaConfigVersions.class, ConfigTranslatorForWiringTest.class})
@TestPropertySource(
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
index 4d7bf692..e4bd1fe2 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanDefaultInjectionTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.setup;
-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;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {SchemaLocationsBean.class})
+@SpringJUnitConfig(classes = {SchemaLocationsBean.class})
public class SchemaLocationsBeanDefaultInjectionTest {
@Autowired
SchemaLocationsBean bean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
index bfaa917e..f4cfef2a 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanEnvVarInjectionTest.java
@@ -20,18 +20,15 @@
package org.onap.aai.setup;
-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;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
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 = {SchemaLocationsBean.class})
+@SpringJUnitConfig(classes = {SchemaLocationsBean.class})
@TestPropertySource(properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest2.properties"})
public class SchemaLocationsBeanEnvVarInjectionTest {
@Autowired
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
index 78df3891..82e7d491 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterTest.java
@@ -20,17 +20,14 @@
package org.onap.aai.setup;
-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;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:forWiringTests/testContext.xml"})
+@SpringJUnitConfig(locations = {"classpath:forWiringTests/testContext.xml"})
public class SchemaLocationsBeanXMLSetterTest {
@Autowired
SchemaLocationsBean bean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
index 2a5068f2..2d4c0812 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaLocationsBeanXMLSetterWithPropFileTest.java
@@ -20,19 +20,16 @@
package org.onap.aai.setup;
-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;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-@Ignore("Support of schema ingest via context configuration with prop file is removed as it won't work with spring boot 2")
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:forWiringTests/testUsingPropFileContext.xml"})
+@Disabled("Support of schema ingest via context configuration with prop file is removed as it won't work with spring boot 2")
+@SpringJUnitConfig(locations = {"classpath:forWiringTests/testUsingPropFileContext.xml"})
public class SchemaLocationsBeanXMLSetterWithPropFileTest {
@Autowired
SchemaLocationsBean bean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
index ecc188f7..336dd583 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanOverrideTest.java
@@ -20,35 +20,25 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.IOException;
import java.util.List;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.restclient.MockProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(
properties = {
"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-override-test.properties"})
@ContextConfiguration(classes = {MockProvider.class, SchemaVersionsBean.class, SchemaConfigVersions.class})
@SpringBootTest
public class SchemaVersionsBeanOverrideTest {
-
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Autowired
SchemaVersionsBean SchemaVersionsBean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java
index 981be806..322a6b37 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/setup/SchemaVersionsBeanTest.java
@@ -20,34 +20,24 @@
package org.onap.aai.setup;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.IOException;
import java.util.List;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.restclient.MockProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(
properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties"})
@ContextConfiguration(classes = {MockProvider.class, SchemaVersionsBean.class})
@SpringBootTest
public class SchemaVersionsBeanTest {
-
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Autowired
SchemaVersionsBean SchemaVersionsBean;
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
index fa6d8edc..0022e151 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
@@ -20,9 +20,9 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class CheckEverythingStrategyTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
index 0dc68c48..043e9c71 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
@@ -1,4 +1,4 @@
-/**
+/**
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
@@ -20,29 +20,26 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
public class FailFastStrategyTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
@Test
public void test() {
- FailFastStrategy strat = new FailFastStrategy();
+ String testError = "hi i'm a problem";
+ Throwable exception = assertThrows(AAISchemaValidationException.class, () -> {
+ FailFastStrategy strat = new FailFastStrategy();
- // simulate no issues found
- assertTrue(strat.isOK());
- assertTrue("No errors found.".equals(strat.getErrorMsg()));
+ // simulate no issues found
+ assertTrue(strat.isOK());
+ assertTrue("No errors found.".equals(strat.getErrorMsg()));
- // simulate an issue found
- String testError = "hi i'm a problem";
- thrown.expect(AAISchemaValidationException.class);
- thrown.expectMessage(testError);
- strat.notifyOnError(testError);
+ // simulate an issue found
+ strat.notifyOnError(testError);
+ });
+ assertTrue(exception.getMessage().contains(testError));
}
}
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
index 4c6882c8..bcf79d2d 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.BadNodeConfigForValidationTest;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, BadNodeConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultVersionValidationModule.class, VersionValidator.class})
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
index a74f7ba9..f2bb85a3 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
@@ -20,19 +20,16 @@
package org.onap.aai.validation;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, GoodConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultVersionValidationModule.class, VersionValidator.class})
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
index 58940af5..466e4b90 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java
@@ -20,7 +20,7 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
@@ -29,8 +29,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.JsonIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -38,7 +38,7 @@ public class CousinDefaultingValidationModuleTest {
private static List<DocumentContext> ctxs;
private static CousinDefaultingValidationModule validator;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
Map<SchemaVersion, List<String>> testRules = new HashMap<>();
List<String> testFiles = new ArrayList<>();
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
index a4c70b81..08298f2f 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java
@@ -20,20 +20,17 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.enums.EdgeField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {DefaultEdgeFieldsValidationModule.class})
@SpringBootTest
public class DefaultEdgeFieldsValidationModuleTest {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
index b1bf3146..60c04aab 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.BadEdgeConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, BadEdgeConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
index 60943219..53cad53c 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, GoodConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultEdgeFieldsValidationModule.class, UniqueLabelValidationModule.class,
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
index e80e2fea..191a10d0 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
@@ -20,13 +20,12 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.setup.SchemaVersion;
import org.onap.aai.testutils.TestUtilConfigTranslator;
@@ -34,9 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, TestUtilConfigTranslator.class, NodeTypesValidationModule.class})
@TestPropertySource(
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
index a704d80b..d34772e3 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java
@@ -20,14 +20,14 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import java.util.*;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.JsonIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -36,7 +36,7 @@ public class SingleContainmentValidationModuleTest {
private static SingleContainmentValidationModule validator;
public static final SchemaVersion LATEST = new SchemaVersion("v14");
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() {
Map<SchemaVersion, List<String>> testRules = new TreeMap<>();
List<String> testFiles = new ArrayList<>();
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
index 76e52036..22553b9e 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java
@@ -20,14 +20,14 @@
package org.onap.aai.validation.edges;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import com.jayway.jsonpath.DocumentContext;
import java.util.*;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
import org.onap.aai.edges.JsonIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -36,7 +36,7 @@ public class UniqueLabelValidationModuleTest {
private static UniqueLabelValidationModule validator;
public static final SchemaVersion LATEST = new SchemaVersion("v14");
- @BeforeClass
+ @BeforeAll
public static void setup() {
Map<SchemaVersion, List<String>> testRules = new TreeMap<>();
List<String> testFiles = new ArrayList<>();
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
index 93cb2ab3..69956297 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.nodes;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.BadNodeConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -32,9 +31,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {BadNodeConfigForValidationTest.class, NodesConfiguration.class, CheckEverythingStrategy.class,
DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
index c2e7b7ba..aa8aabc3 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
@@ -20,6 +20,8 @@
package org.onap.aai.validation.nodes;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -32,11 +34,8 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.setup.SchemaVersion;
@@ -45,34 +44,28 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.w3c.dom.Document;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {SchemaIncompleteTranslator.class, NodesConfiguration.class})
@TestPropertySource(
properties = {
"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test-local.properties"})
@SpringBootTest
-@Ignore
+@Disabled
public class NodeValidatorSchemaIncompleteTest {
@Autowired
NodeIngestor ni;
- // set thrown.expect to whatever a specific test needs
- // this establishes a default of expecting no exceptions to be thrown
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
// Throws a NullPointerException because a JavaType is referenced, but not defined
@Test
- public void testIncompleteCombinedSchema() throws TransformerException, IOException, IllegalStateException {
- thrown.expect(NullPointerException.class);
+ public void testIncompleteCombinedSchema() {
+ assertThrows(NullPointerException.class, () -> {
- // TODO Change for Exception
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- printDocument(ni.getSchema(new SchemaVersion("v12")), buffer);
+ // TODO Change for Exception
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ printDocument(ni.getSchema(new SchemaVersion("v12")), buffer);
+ });
}
public static void printDocument(Document doc, OutputStream out) throws IOException, TransformerException {
diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
index 893dd04c..d8a69333 100644
--- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
+++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
@@ -20,10 +20,9 @@
package org.onap.aai.validation.nodes;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
import org.onap.aai.config.NodesConfiguration;
import org.onap.aai.testutils.GoodConfigForValidationTest;
import org.onap.aai.validation.CheckEverythingStrategy;
@@ -31,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = {NodesConfiguration.class, GoodConfigForValidationTest.class, CheckEverythingStrategy.class,
DefaultDuplicateNodeDefinitionValidationModule.class, NodeValidator.class})
diff --git a/aai-utils/pom.xml b/aai-utils/pom.xml
index f5bc33f6..2ce63f68 100644
--- a/aai-utils/pom.xml
+++ b/aai-utils/pom.xml
@@ -88,11 +88,22 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <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.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
diff --git a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java
index f3b9f621..bcfdbebc 100644
--- a/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java
+++ b/aai-utils/src/test/java/org/onap/aaiutils/oxm/OxmModelLoaderTest.java
@@ -20,35 +20,33 @@
package org.onap.aaiutils.oxm;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.regex.Pattern;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
public class OxmModelLoaderTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void shouldLoadOxmModelsWhichMatchToPattern() throws Exception {
OxmModelLoader.loadModels("classpath*:test_aai_oxm*.xml", Pattern.compile("test_aai_oxm_(.*).xml"));
- Assert.assertTrue(OxmModelLoader.getVersionContextMap().size() == 2);
- Assert.assertFalse(OxmModelLoader.getVersionContextMap().containsKey("v7"));
- Assert.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v8"));
- Assert.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v9"));
+ Assertions.assertTrue(OxmModelLoader.getVersionContextMap().size() == 2);
+ Assertions.assertFalse(OxmModelLoader.getVersionContextMap().containsKey("v7"));
+ Assertions.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v8"));
+ Assertions.assertTrue(OxmModelLoader.getVersionContextMap().containsKey("v9"));
}
@Test
- public void shouldReportAnErrorWhenOxmModelsAreNotAvailable() throws Exception {
- thrown.expect(Exception.class);
- thrown.expectMessage("Failed to load schema");
+ public void shouldReportAnErrorWhenOxmModelsAreNotAvailable() {
+ Throwable exception = assertThrows(Exception.class, () ->
- OxmModelLoader.loadModels("classpath*:non_existing_aai_oxm*.xml",
- Pattern.compile("non_existing_aai_oxm_(.*).xml"));
+ OxmModelLoader.loadModels("classpath*:non_existing_aai_oxm*.xml",
+ Pattern.compile("non_existing_aai_oxm_(.*).xml")));
+ assertTrue(exception.getMessage().contains("Failed to load schema"));
}
}