aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-02-28 14:39:51 +0100
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-02-28 14:39:51 +0100
commitb5c15a4baafeac466c1565f2237d6f8cdaf9fd72 (patch)
tree029bbb50d93ae17dd20062752d53c9e38037c201
parentc7d3869e64534a06692191d0cdfecb2b30138c13 (diff)
Update model-loader to spring-boot 2.4
- update spring boot from 2.3.12 to 2.4.13 release - migrate JUnit 4 to JUnit 5 - bump version to 1.13.5 Issue-ID: AAI-3788 Change-Id: I280dd09194dfb4c9810c01933fdd18ea7f3d03a9 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--pom.xml28
-rw-r--r--src/main/resources/application.properties4
-rw-r--r--src/test/java/org/onap/aai/modelloader/TestModelLoaderApplication.java4
-rw-r--r--src/test/java/org/onap/aai/modelloader/config/TestModelLoaderConfig.java10
-rw-r--r--src/test/java/org/onap/aai/modelloader/csar/extractor/VnfCatalogExtractorTest.java8
-rw-r--r--src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfCatalogArtifactHandler.java4
-rw-r--r--src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfImageException.java2
-rw-r--r--src/test/java/org/onap/aai/modelloader/entity/model/ModelSorterTest.java15
-rw-r--r--src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactHandler.java8
-rw-r--r--src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactParser.java2
-rw-r--r--src/test/java/org/onap/aai/modelloader/entity/model/TestNamedQueryArtifactParser.java8
-rw-r--r--src/test/java/org/onap/aai/modelloader/extraction/TestArtifactInfoExtractor.java28
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java14
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java10
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java10
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestBabelArtifactConverter.java42
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java10
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java2
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestNotificationPublisher.java12
-rw-r--r--src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java2
-rw-r--r--src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java12
-rw-r--r--src/test/java/org/onap/aai/modelloader/restclient/TestBabelServiceClient.java10
-rw-r--r--src/test/java/org/onap/aai/modelloader/service/TestArtifactInfoImpl.java2
-rw-r--r--src/test/java/org/onap/aai/modelloader/service/TestModelLoaderService.java11
-rw-r--r--src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java9
-rw-r--r--src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java9
-rw-r--r--src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java2
-rw-r--r--version.properties4
28 files changed, 148 insertions, 134 deletions
diff --git a/pom.xml b/pom.xml
index 27978bb..a311908 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
<groupId>org.onap.aai.model-loader</groupId>
<artifactId>model-loader</artifactId>
<name>aai-model-loader</name>
- <version>1.12.0-SNAPSHOT</version>
+ <version>1.13.5-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
@@ -51,7 +51,7 @@
<start-class>org.onap.aai.modelloader.service.ModelLoaderApplication</start-class>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<docker.location>${basedir}/target</docker.location>
- <spring-boot.version>2.3.12.RELEASE</spring-boot.version>
+ <spring-boot.version>2.4.13</spring-boot.version>
<apache.commons-text.version>1.10.0</apache.commons-text.version>
<commons-compress.version>1.22</commons-compress.version>
<hamcrest-all.version>1.3</hamcrest-all.version>
@@ -278,12 +278,14 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>${logback.version}</version><!--$NO-MVN-MAN-VER$ -->
+ <version>${logback.version}</version>
+ <!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <version>${logback.version}</version><!--$NO-MVN-MAN-VER$ -->
+ <version>${logback.version}</version>
+ <!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
@@ -293,7 +295,8 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
- <version>20131018</version><!--$NO-MVN-MAN-VER$ -->
+ <version>20131018</version>
+ <!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
@@ -322,17 +325,22 @@
<!-- Test dependencies -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest-all.version}</version>
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 4ea6f0a..7273277 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -12,9 +12,9 @@ server.port=9500
#server.ssl.keyStoreType=
#server.ssl.keyAlias=
-server.tomcat.max-threads=200
+server.tomcat.threads.max=200
# The minimum number of threads always kept alive
-server.tomcat.min-spare-threads=25
+server.tomcat.threads.min-spare=25
# Spring Boot logging
logging.config=${logback.configurationFile}
diff --git a/src/test/java/org/onap/aai/modelloader/TestModelLoaderApplication.java b/src/test/java/org/onap/aai/modelloader/TestModelLoaderApplication.java
index 0387f2d..cd39066 100644
--- a/src/test/java/org/onap/aai/modelloader/TestModelLoaderApplication.java
+++ b/src/test/java/org/onap/aai/modelloader/TestModelLoaderApplication.java
@@ -20,9 +20,9 @@
*/
package org.onap.aai.modelloader;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for ModelLoaderApplication class.
diff --git a/src/test/java/org/onap/aai/modelloader/config/TestModelLoaderConfig.java b/src/test/java/org/onap/aai/modelloader/config/TestModelLoaderConfig.java
index e19b1e2..87fbd6a 100644
--- a/src/test/java/org/onap/aai/modelloader/config/TestModelLoaderConfig.java
+++ b/src/test/java/org/onap/aai/modelloader/config/TestModelLoaderConfig.java
@@ -20,8 +20,8 @@
*/
package org.onap.aai.modelloader.config;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.io.File;
import java.io.FileInputStream;
@@ -29,7 +29,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Properties;
import org.eclipse.jetty.util.security.Password;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.restclient.AaiRestClient;
import org.onap.sdc.utils.ArtifactTypeEnum;
@@ -157,13 +157,13 @@ public class TestModelLoaderConfig {
ModelLoaderConfig config = new ModelLoaderConfig(props, null);
AaiRestClient aaiClient = new AaiRestClient(config);
- assertFalse("Empty AAI Password should result in no basic authentication", aaiClient.useBasicAuth());
+ assertFalse(aaiClient.useBasicAuth(), "Empty AAI Password should result in no basic authentication");
props.load(new FileInputStream("src/test/resources/model-loader-no-auth-password.properties"));
config = new ModelLoaderConfig(props, null);
aaiClient = new AaiRestClient(config);
- assertFalse("No AAI Password should result in no basic authentication", aaiClient.useBasicAuth());
+ assertFalse(aaiClient.useBasicAuth(), "No AAI Password should result in no basic authentication");
}
@Test
diff --git a/src/test/java/org/onap/aai/modelloader/csar/extractor/VnfCatalogExtractorTest.java b/src/test/java/org/onap/aai/modelloader/csar/extractor/VnfCatalogExtractorTest.java
index 043edc3..b3335fc 100644
--- a/src/test/java/org/onap/aai/modelloader/csar/extractor/VnfCatalogExtractorTest.java
+++ b/src/test/java/org/onap/aai/modelloader/csar/extractor/VnfCatalogExtractorTest.java
@@ -22,8 +22,8 @@ package org.onap.aai.modelloader.csar.extractor;
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.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
@@ -32,7 +32,7 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
import org.onap.aai.modelloader.extraction.InvalidArchiveException;
@@ -86,8 +86,8 @@ public class VnfCatalogExtractorTest {
List<Artifact> vnfcArtifacts = new VnfCatalogExtractor().extract(
new ArtifactTestUtils().loadResource("compressedArtifacts/noVnfcFilesArchive.csar"),
"noVnfcFilesArchive.csar");
- assertTrue("No VNFC files should have been extracted, but " + vnfcArtifacts.size() + " were found.",
- vnfcArtifacts.isEmpty());
+ assertTrue(vnfcArtifacts.isEmpty(),
+ "No VNFC files should have been extracted, but " + vnfcArtifacts.size() + " were found.");
}
@Test
diff --git a/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfCatalogArtifactHandler.java b/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfCatalogArtifactHandler.java
index d4a0020..8145599 100644
--- a/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfCatalogArtifactHandler.java
+++ b/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfCatalogArtifactHandler.java
@@ -23,7 +23,7 @@ package org.onap.aai.modelloader.entity.catalog;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -38,7 +38,7 @@ import java.util.Properties;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
diff --git a/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfImageException.java b/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfImageException.java
index 88c1941..793ed9a 100644
--- a/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfImageException.java
+++ b/src/test/java/org/onap/aai/modelloader/entity/catalog/TestVnfImageException.java
@@ -24,7 +24,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for NotificationDataImpl class.
diff --git a/src/test/java/org/onap/aai/modelloader/entity/model/ModelSorterTest.java b/src/test/java/org/onap/aai/modelloader/entity/model/ModelSorterTest.java
index 86985d8..0c79dc5 100644
--- a/src/test/java/org/onap/aai/modelloader/entity/model/ModelSorterTest.java
+++ b/src/test/java/org/onap/aai/modelloader/entity/model/ModelSorterTest.java
@@ -26,13 +26,14 @@ import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isEmptyString;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
public class ModelSorterTest {
@@ -129,12 +130,14 @@ public class ModelSorterTest {
assertThat(new ModelSorter().sort(Arrays.asList(nq1, nq2, artifact)), is(expected));
}
- @Test(expected = BabelArtifactParsingException.class)
+ @Test
public void circularDependency() throws BabelArtifactParsingException {
- List<Artifact> modelList = new ArrayList<Artifact>();
- modelList.add(buildTestModel("aaaa", "1111", "bbbb|1111"));
- modelList.add(buildTestModel("bbbb", "1111", "aaaa|1111"));
- new ModelSorter().sort(modelList);
+ assertThrows(BabelArtifactParsingException.class, () -> {
+ List<Artifact> modelList = new ArrayList<Artifact>();
+ modelList.add(buildTestModel("aaaa", "1111", "bbbb|1111"));
+ modelList.add(buildTestModel("bbbb", "1111", "aaaa|1111"));
+ new ModelSorter().sort(modelList);
+ });
}
private ModelArtifact buildTestModel() {
diff --git a/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactHandler.java b/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactHandler.java
index 3418a6b..fac50cb 100644
--- a/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactHandler.java
+++ b/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactHandler.java
@@ -23,7 +23,7 @@ package org.onap.aai.modelloader.entity.model;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -34,8 +34,8 @@ import java.util.List;
import javax.ws.rs.core.Response;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
@@ -55,7 +55,7 @@ public class TestModelArtifactHandler {
@Mock
private AaiRestClient aaiClient;
- @Before
+ @BeforeEach
public void setupMocks() {
MockitoAnnotations.initMocks(this);
}
diff --git a/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactParser.java b/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactParser.java
index 9b90aa2..fc0556f 100644
--- a/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactParser.java
+++ b/src/test/java/org/onap/aai/modelloader/entity/model/TestModelArtifactParser.java
@@ -30,7 +30,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
import org.springframework.util.CollectionUtils;
diff --git a/src/test/java/org/onap/aai/modelloader/entity/model/TestNamedQueryArtifactParser.java b/src/test/java/org/onap/aai/modelloader/entity/model/TestNamedQueryArtifactParser.java
index 8eebd06..9ea900f 100644
--- a/src/test/java/org/onap/aai/modelloader/entity/model/TestNamedQueryArtifactParser.java
+++ b/src/test/java/org/onap/aai/modelloader/entity/model/TestNamedQueryArtifactParser.java
@@ -23,15 +23,15 @@ package org.onap.aai.modelloader.entity.model;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isEmptyString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.entity.Artifact;
public class TestNamedQueryArtifactParser {
diff --git a/src/test/java/org/onap/aai/modelloader/extraction/TestArtifactInfoExtractor.java b/src/test/java/org/onap/aai/modelloader/extraction/TestArtifactInfoExtractor.java
index 3bfb2a5..142b3c0 100644
--- a/src/test/java/org/onap/aai/modelloader/extraction/TestArtifactInfoExtractor.java
+++ b/src/test/java/org/onap/aai/modelloader/extraction/TestArtifactInfoExtractor.java
@@ -20,8 +20,8 @@
*/
package org.onap.aai.modelloader.extraction;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.onap.aai.modelloader.fixture.NotificationDataFixtureBuilder.getEmptyNotificationData;
import static org.onap.aai.modelloader.fixture.NotificationDataFixtureBuilder.getNotificationDataWithOneResource;
import static org.onap.aai.modelloader.fixture.NotificationDataFixtureBuilder.getNotificationDataWithOneService;
@@ -29,9 +29,9 @@ import static org.onap.aai.modelloader.fixture.NotificationDataFixtureBuilder.ge
import java.util.ArrayList;
import java.util.List;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.fixture.ArtifactInfoBuilder;
import org.onap.aai.modelloader.fixture.MockNotificationDataImpl;
import org.onap.sdc.api.notification.IArtifactInfo;
@@ -44,12 +44,12 @@ public class TestArtifactInfoExtractor {
private ArtifactInfoExtractor extractor;
- @Before
+ @BeforeEach
public void setup() {
extractor = new ArtifactInfoExtractor();
}
- @After
+ @AfterEach
public void tearDown() {
extractor = null;
}
@@ -60,7 +60,7 @@ public class TestArtifactInfoExtractor {
}
private void doEmptyArtifactsTest(INotificationData notificationData) {
- assertTrue("The list returned should have been empty", extractor.extract(notificationData).isEmpty());
+ assertTrue(extractor.extract(notificationData).isEmpty(), "The list returned should have been empty");
}
@Test
@@ -79,8 +79,8 @@ public class TestArtifactInfoExtractor {
List<IArtifactInfo> artifacts = extractor.extract(getNotificationDataWithOneService());
- assertEquals("One artifact should have been returned", 1, artifacts.size());
- assertEquals("The actual artifact did not match the expected one", expected, artifacts.get(0));
+ assertEquals(1, artifacts.size(), "One artifact should have been returned");
+ assertEquals(expected, artifacts.get(0), "The actual artifact did not match the expected one");
}
@Test
@@ -90,8 +90,8 @@ public class TestArtifactInfoExtractor {
List<IArtifactInfo> artifacts = extractor.extract(getNotificationDataWithOneResource());
- assertEquals("One artifact should have been returned", 1, artifacts.size());
- assertEquals("The actual artifact did not match the expected one", expectedArtifacts, artifacts);
+ assertEquals(1, artifacts.size(), "One artifact should have been returned");
+ assertEquals(expectedArtifacts, artifacts, "The actual artifact did not match the expected one");
}
@Test
@@ -102,7 +102,7 @@ public class TestArtifactInfoExtractor {
List<IArtifactInfo> artifacts = extractor.extract(getNotificationDataWithOneServiceAndResources());
- assertEquals("Two artifact should have been returned", 2, artifacts.size());
- assertEquals("The actual artifact did not match the expected one", expectedArtifacts, artifacts);
+ assertEquals(2, artifacts.size(), "Two artifact should have been returned");
+ assertEquals(expectedArtifacts, artifacts, "The actual artifact did not match the expected one");
}
}
diff --git a/src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java b/src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java
index 3710d62..1b8f33b 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java
@@ -22,7 +22,7 @@ package org.onap.aai.modelloader.notification;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
@@ -34,8 +34,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
@@ -71,7 +71,7 @@ public class ArtifactDownloadManagerVnfcTest {
private BabelServiceClientFactory mockClientFactory;
private VnfCatalogExtractor mockVnfCatalogExtractor;
- @Before
+ @BeforeEach
public void setup() throws Exception {
mockBabelClient = mock(BabelServiceClient.class);
mockDistributionClient = mock(IDistributionClient.class);
@@ -107,7 +107,7 @@ public class ArtifactDownloadManagerVnfcTest {
assertThat(downloadManager.downloadArtifacts(data, data.getServiceArtifacts(), modelArtifacts, catalogFiles),
is(true));
- assertEquals("There should have been some catalog files", 2, catalogFiles.size());
+ assertEquals(2, catalogFiles.size(), "There should have been some catalog files");
}
@Test
@@ -125,7 +125,7 @@ public class ArtifactDownloadManagerVnfcTest {
assertThat(downloadManager.downloadArtifacts(data, data.getServiceArtifacts(), modelArtifacts, catalogFiles),
is(true));
- assertEquals("There should have been some catalog files", 3, catalogFiles.size());
+ assertEquals(3, catalogFiles.size(), "There should have been some catalog files");
}
@Test
@@ -143,7 +143,7 @@ public class ArtifactDownloadManagerVnfcTest {
assertThat(downloadManager.downloadArtifacts(data, data.getServiceArtifacts(), modelArtifacts, catalogFiles),
is(true));
- assertEquals("There should not have been any catalog files", 0, catalogFiles.size());
+ assertEquals(0, catalogFiles.size(), "There should not have been any catalog files");
}
@Test
diff --git a/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java b/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java
index a63710e..2cac3c9 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java
@@ -34,9 +34,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
@@ -66,7 +66,7 @@ public class TestArtifactDeploymentManager {
private ModelArtifactHandler mockModelArtifactHandler;
private VnfCatalogArtifactHandler mockVnfCatalogArtifactHandler;
- @Before
+ @BeforeEach
public void setup() throws IOException {
configProperties = new Properties();
configProperties.load(this.getClass().getClassLoader().getResourceAsStream(CONFIG_FILE));
@@ -80,7 +80,7 @@ public class TestArtifactDeploymentManager {
ReflectionTestUtils.setField(manager, "vnfCatalogArtifactHandler", mockVnfCatalogArtifactHandler);
}
- @After
+ @AfterEach
public void tearDown() {
configProperties = null;
mockModelArtifactHandler = null;
diff --git a/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java b/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java
index 3d1cf15..561791b 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java
@@ -41,9 +41,9 @@ import java.util.List;
import java.util.Properties;
import org.hamcrest.collection.IsEmptyCollection;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
@@ -74,7 +74,7 @@ public class TestArtifactDownloadManager {
private BabelArtifactConverter mockBabelArtifactConverter;
private BabelServiceClientFactory mockClientFactory;
- @Before
+ @BeforeEach
public void setup() throws Exception {
mockBabelClient = mock(BabelServiceClient.class);
mockDistributionClient = mock(IDistributionClient.class);
@@ -92,7 +92,7 @@ public class TestArtifactDownloadManager {
ReflectionTestUtils.setField(downloadManager, "babelArtifactConverter", mockBabelArtifactConverter);
}
- @After
+ @AfterEach
public void tearDown() {
downloadManager = null;
mockDistributionClient = null;
diff --git a/src/test/java/org/onap/aai/modelloader/notification/TestBabelArtifactConverter.java b/src/test/java/org/onap/aai/modelloader/notification/TestBabelArtifactConverter.java
index 2a04ec5..1d81513 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestBabelArtifactConverter.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestBabelArtifactConverter.java
@@ -20,14 +20,16 @@
*/
package org.onap.aai.modelloader.notification;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
+
+import org.junit.jupiter.api.Test;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
@@ -42,30 +44,34 @@ import org.onap.sdc.api.notification.INotificationData;
*/
public class TestBabelArtifactConverter {
- @Test(expected = NullPointerException.class)
+ @Test
public void convert_nullToscaFiles() throws BabelArtifactParsingException {
- new BabelArtifactConverter().convertToModel(null);
- fail("An instance of ArtifactGenerationException should have been thrown");
+ assertThrows(NullPointerException.class, () -> {
+ new BabelArtifactConverter().convertToModel(null);
+ fail("An instance of ArtifactGenerationException should have been thrown");
+ });
}
@Test
public void testEmptyToscaFiles() throws BabelArtifactParsingException {
- assertTrue("Nothing should have been returned",
- new BabelArtifactConverter().convertToModel(new ArrayList<>()).isEmpty());
+ assertTrue(new BabelArtifactConverter().convertToModel(new ArrayList<>()).isEmpty(),
+ "Nothing should have been returned");
}
- @Test(expected = BabelArtifactParsingException.class)
+ @Test
public void testInvalidXml() throws IOException, BabelArtifactParsingException {
- byte[] problemXml =
- "<model xmlns=\"http://org.openecomp.aai.inventory/v10\"><rubbish>This is some xml that should cause the model artifact parser to throw an erorr</rubbish></model>"
- .getBytes();
+ assertThrows(BabelArtifactParsingException.class, () -> {
+ byte[] problemXml =
+ "<model xmlns=\"http://org.openecomp.aai.inventory/v10\"><rubbish>This is some xml that should cause the model artifact parser to throw an erorr</rubbish></model>"
+ .getBytes();
- INotificationData data = NotificationDataFixtureBuilder.getNotificationDataWithToscaCsarFile();
+ INotificationData data = NotificationDataFixtureBuilder.getNotificationDataWithToscaCsarFile();
- List<BabelArtifact> toscaArtifacts = setupTest(problemXml, data);
+ List<BabelArtifact> toscaArtifacts = setupTest(problemXml, data);
- new BabelArtifactConverter().convertToModel(toscaArtifacts);
- fail("An instance of ModelArtifactParsingException should have been thrown");
+ new BabelArtifactConverter().convertToModel(toscaArtifacts);
+ fail("An instance of ModelArtifactParsingException should have been thrown");
+ });
}
private List<BabelArtifact> setupTest(byte[] xml, INotificationData data) throws IOException {
@@ -88,7 +94,7 @@ public class TestBabelArtifactConverter {
List<Artifact> modelArtifacts = new BabelArtifactConverter().convertToModel(toscaArtifacts);
- assertEquals("There should have been 1 artifact", 1, modelArtifacts.size());
+ assertEquals(1, modelArtifacts.size(), "There should have been 1 artifact");
assertEquals(new String(xml), modelArtifacts.get(0).getPayload());
assertEquals(ArtifactType.MODEL, modelArtifacts.get(0).getType());
}
diff --git a/src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java b/src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java
index 8c4ffed..d9245d9 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java
@@ -29,9 +29,9 @@ import java.io.IOException;
import java.util.List;
import java.util.Properties;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.entity.model.BabelArtifactParsingException;
@@ -57,7 +57,7 @@ public class TestEventCallback {
private IDistributionClient mockDistributionClient;
private NotificationPublisher mockNotificationPublisher;
- @Before
+ @BeforeEach
public void setup() throws IOException {
configProperties = new Properties();
configProperties.load(this.getClass().getClassLoader().getResourceAsStream(CONFIG_FILE));
@@ -75,7 +75,7 @@ public class TestEventCallback {
ReflectionTestUtils.setField(eventCallback, "notificationPublisher", mockNotificationPublisher);
}
- @After
+ @AfterEach
public void tearDown() {
config = null;
configProperties = null;
diff --git a/src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java b/src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java
index d7441ec..4d6858a 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java
@@ -25,7 +25,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for NotificationDataImpl class
diff --git a/src/test/java/org/onap/aai/modelloader/notification/TestNotificationPublisher.java b/src/test/java/org/onap/aai/modelloader/notification/TestNotificationPublisher.java
index 253fc17..edf50a8 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestNotificationPublisher.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestNotificationPublisher.java
@@ -20,13 +20,13 @@
*/
package org.onap.aai.modelloader.notification;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.onap.sdc.api.IDistributionClient;
@@ -61,7 +61,7 @@ public class TestNotificationPublisher {
System.setProperty("CONFIG_HOME", "src/test/resources");
}
- @Before
+ @BeforeEach
public void setupMocks() {
MockitoAnnotations.initMocks(this);
when(client.getConfiguration()).thenReturn(config);
diff --git a/src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java b/src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java
index ebdfcfe..37b7e12 100644
--- a/src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java
+++ b/src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java
@@ -20,7 +20,7 @@
*/
package org.onap.aai.modelloader.restclient;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import java.io.IOException;
diff --git a/src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java b/src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java
index c5da065..fd65383 100644
--- a/src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java
+++ b/src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java
@@ -22,7 +22,7 @@ package org.onap.aai.modelloader.restclient;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import static org.apache.commons.io.IOUtils.write;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -37,9 +37,9 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
/**
@@ -51,7 +51,7 @@ public class TestAaiServiceClient {
private Server server;
private AaiRestClient aaiClient;
- @Before
+ @BeforeEach
public void startJetty() throws Exception {
server = new Server(8080);
server.setHandler(getMockHandler());
@@ -63,7 +63,7 @@ public class TestAaiServiceClient {
aaiClient = new AaiRestClient(config);
}
- @After
+ @AfterEach
public void stopJetty() throws Exception {
server.stop();
}
diff --git a/src/test/java/org/onap/aai/modelloader/restclient/TestBabelServiceClient.java b/src/test/java/org/onap/aai/modelloader/restclient/TestBabelServiceClient.java
index 51c5642..c653244 100644
--- a/src/test/java/org/onap/aai/modelloader/restclient/TestBabelServiceClient.java
+++ b/src/test/java/org/onap/aai/modelloader/restclient/TestBabelServiceClient.java
@@ -43,9 +43,9 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.service.HttpsBabelServiceClientFactory;
@@ -61,7 +61,7 @@ public class TestBabelServiceClient {
private Server server;
private String responseBody;
- @Before
+ @BeforeEach
public void startJetty() throws Exception {
List<BabelArtifact> response = new ArrayList<>();
response.add(new BabelArtifact("", null, ""));
@@ -74,7 +74,7 @@ public class TestBabelServiceClient {
server.start();
}
- @After
+ @AfterEach
public void stopJetty() throws Exception {
server.stop();
}
diff --git a/src/test/java/org/onap/aai/modelloader/service/TestArtifactInfoImpl.java b/src/test/java/org/onap/aai/modelloader/service/TestArtifactInfoImpl.java
index a791b46..d1d46f0 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestArtifactInfoImpl.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestArtifactInfoImpl.java
@@ -27,7 +27,7 @@ import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* Tests for NotificationDataImpl class
diff --git a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderService.java b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderService.java
index 1a55580..f926d8e 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderService.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderService.java
@@ -22,27 +22,24 @@ package org.onap.aai.modelloader.service;
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.IOException;
import java.util.Base64;
import javax.ws.rs.core.Response;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.util.ArtifactTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
/**
* Tests for the ModelLoaderService class.
*
*/
-@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ModelLoaderService.class, MockBabelServiceClientFactory.class})
@TestPropertySource(properties = {"CONFIG_HOME=src/test/resources",})
public class TestModelLoaderService {
@@ -50,7 +47,7 @@ public class TestModelLoaderService {
@Autowired
private ModelLoaderService service;
- @After
+ @AfterEach
public void shutdown() {
service.preShutdownOperations();
}
diff --git a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
index 976acbc..6a01bfc 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
@@ -28,20 +28,17 @@ import java.util.Base64;
import javax.ws.rs.core.Response;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.util.ArtifactTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
/**
* Tests for the ModelLoaderService class.
*
*/
-@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ModelLoaderService.class, HttpsBabelServiceClientFactory.class})
@TestPropertySource(properties = {"CONFIG_HOME=src/test/resources",})
public class TestModelLoaderServiceWithSdc {
@@ -49,7 +46,7 @@ public class TestModelLoaderServiceWithSdc {
@Autowired
private ModelLoaderService service;
- @After
+ @AfterEach
public void shutdown() {
service.preShutdownOperations();
}
diff --git a/src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java b/src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java
index 1746e05..c1a862a 100644
--- a/src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java
+++ b/src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java
@@ -23,19 +23,22 @@ package org.onap.aai.modelloader.util;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.gizmo.GizmoBulkPayload;
public class TestGizmoTranslator {
- @Test(expected = IOException.class)
+ @Test
public void translateInvalidXml() throws IOException {
- GizmoTranslator.translate("not valid XML");
+ assertThrows(IOException.class, () -> {
+ GizmoTranslator.translate("not valid XML");
+ });
}
@Test
diff --git a/src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java b/src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java
index 116e1e5..ec66a59 100644
--- a/src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java
+++ b/src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java
@@ -30,7 +30,7 @@ import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
diff --git a/version.properties b/version.properties
index 78f179d..76cb5aa 100644
--- a/version.properties
+++ b/version.properties
@@ -24,8 +24,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major=1
-minor=12
-patch=0
+minor=13
+patch=5
base_version=${major}.${minor}.${patch}