</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>
<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>
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 = "",
<!-- End of NARAD profile -->
</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>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-aaf-auth</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<artifactId>hamcrest-core</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.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<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>
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;
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;
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"})
@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/");
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;
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;
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;
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;
@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;
@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() {
// 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");
}
protected abstract void addParam(Map<String, Object> params);
+ public void initOnapQueryTest(SchemaVersion version) {
+ this.version = version;
+ }
+
}
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);
}
<artifactId>spring-test</artifactId>
<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>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<version>1.3</version>
<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>
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;
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})
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
XSDElementTest x = new XSDElementTest();
x.setUp();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
// PowerMockito.mockStatic(GenerateXsd.class);
XSDElementTest x = new XSDElementTest();
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)",
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());
}
}
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;
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}",
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;
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();
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;
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;
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(
String toNode = "complex";
SchemaVersion v10 = new SchemaVersion("v10");
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String json = "{" + " \"rules\": [" + " {" + " \"from\": \"availability-zone\","
+ " \"to\": \"complex\","
bw.close();
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
File edges = new File(EDGEFILENAME);
edges.delete();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
}
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;
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}",
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;
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String container = "p-interfaces";
String queryProps[] = {
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";
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));
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;
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;
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
@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);
}
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;
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}",
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;
this.result = result;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
String container = "p-interfaces";
String queryProps[] = {
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";
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();
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;
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;
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
@Autowired
SchemaConfigVersions schemaConfigVersions;
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
XSDElementTest x = new XSDElementTest();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
NodeGetOperation.checklist.clear();
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;
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}",
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;
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();
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;
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}",
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;
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();
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";
@Autowired
EdgeIngestor edgeIngestor;
- @Before
+ @BeforeEach
public void setUpBeforeClass() throws Exception {
v = schemaConfigVersions.getDefaultVersion();
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
DeleteOperation.deletePaths.put("/cloud-infrastructure/pservers/pserver/{hostname}",
PutRelationPathSet.add(opId, path);
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
File edges = new File(EDGEFILENAME);
edges.delete();
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;
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;
return testXML;
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
setUp(0);
}
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();
}
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;
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;
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
@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();
e.printStackTrace();
}
boolean matchFound = fileContent.contains((YAMLRelationshipList()));
- assertTrue("RelationshipListFormat:\n", matchFound);
+ assertTrue(matchFound, "RelationshipListFormat:\n");
}
@Test
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;
/**
* 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'}"},
/**
* 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;
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theResponse = new Api.HttpVerb.Response();
}
/**
* 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));
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;
/**
* 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",
/**
* 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;
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theVerb = new Api.HttpVerb();
}
/**
* 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);
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;
/**
* Parameters for the test cases all following same pattern.
*/
- @Parameters
public static Collection<String[]> testConditions() {
String inputs[][] = {
{"name1", "type1", "ref1",
/**
* 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;
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theProperty = new Definition.Property();
}
/**
* 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);
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;
/**
* 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=[]}"},
/**
* 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;
/**
* Initialise the test object.
*/
- @Before
+ @BeforeEach
public void setUp() throws Exception {
theDefinition = new Definition();
}
/**
* 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);
<groupId>ch.qos.logback</groupId>
<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>
<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>
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;
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(
@TestPropertySource(locations = "classpath:application-test.properties")
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
@Import(SchemaServiceTestConfiguration.class)
-
-@RunWith(SpringRunner.class)
public class SchemaServiceTest {
private HttpHeaders headers;
@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();
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;
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 =
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);
}
<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>
<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>
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;
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 {
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;
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;
* dependentOn relationship matches what is listed in the edge rules.
*
*/
- @Ignore
+ @Disabled
@Test
public void testSchemaValidationAgainstEdgeRules() throws XPathExpressionException, IOException,
SAXException, ParserConfigurationException, ParseException {