summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2022-11-16 15:03:38 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2022-11-16 15:03:38 +0000
commit0b4016fbde53d49f9511a4253e22285681840572 (patch)
tree284fc336fe2d9e1f4d93335293143f739d371bbd
parent50889fa7107127868a9a4391218772ff58d0ac2e (diff)
Replace deprecated methods in model-loader
- junit's assertThat was deprecated in favour of hamcrest - apache-commons now requires a Charset argument Issue-ID: AAI-3604 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de> Change-Id: I10bf46922e44b3a3adcc14eab6486401a5cf14e1
-rw-r--r--src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java2
-rw-r--r--src/main/java/org/onap/aai/modelloader/extraction/VnfCatalogExtractor.java4
-rw-r--r--src/test/java/org/onap/aai/modelloader/csar/extractor/VnfCatalogExtractorTest.java7
-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.java3
-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.java3
-rw-r--r--src/test/java/org/onap/aai/modelloader/entity/model/TestNamedQueryArtifactParser.java3
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java3
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java3
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java17
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java3
-rw-r--r--src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java2
-rw-r--r--src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java3
-rw-r--r--src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java5
-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.java4
-rw-r--r--src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java4
-rw-r--r--src/test/java/org/onap/aai/modelloader/util/ArtifactTestUtils.java4
-rw-r--r--src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java3
-rw-r--r--src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java4
23 files changed, 66 insertions, 37 deletions
diff --git a/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java b/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java
index 77693bc..a49288d 100644
--- a/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java
+++ b/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java
@@ -28,10 +28,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
+
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jetty.util.security.Password;
import org.onap.sdc.api.consumer.IConfiguration;
-import org.springframework.core.env.Environment;
/**
* Properties for the Model Loader
diff --git a/src/main/java/org/onap/aai/modelloader/extraction/VnfCatalogExtractor.java b/src/main/java/org/onap/aai/modelloader/extraction/VnfCatalogExtractor.java
index 0e27d57..3dbdfcc 100644
--- a/src/main/java/org/onap/aai/modelloader/extraction/VnfCatalogExtractor.java
+++ b/src/main/java/org/onap/aai/modelloader/extraction/VnfCatalogExtractor.java
@@ -21,10 +21,12 @@
package org.onap.aai.modelloader.extraction;
import java.io.IOException;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.regex.Pattern;
+
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.compress.utils.SeekableInMemoryByteChannel;
@@ -75,7 +77,7 @@ public class VnfCatalogExtractor {
ZipArchiveEntry entry = enumeration.nextElement();
if (fileShouldBeExtracted(entry)) {
vnfcFiles.add(new VnfCatalogArtifact(ArtifactType.VNF_CATALOG_XML,
- IOUtils.toString(zipFile.getInputStream(entry))));
+ IOUtils.toString(zipFile.getInputStream(entry), Charset.defaultCharset())));
}
}
} catch (IOException e) {
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 bd8c33f..043edc3 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
@@ -21,16 +21,17 @@
package org.onap.aai.modelloader.csar.extractor;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
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.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
+
import org.junit.Test;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
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 cead699..d4a0020 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
@@ -22,7 +22,7 @@ package org.onap.aai.modelloader.entity.catalog;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -34,8 +34,10 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
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 c8b14f7..88c1941 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
@@ -22,7 +22,7 @@ package org.onap.aai.modelloader.entity.catalog;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
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 8f4bf8d..86985d8 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
@@ -24,13 +24,14 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
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.Assert.assertThat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+
import org.junit.Test;
import org.onap.aai.modelloader.entity.Artifact;
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 5ccd1d2..3418a6b 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
@@ -21,19 +21,19 @@
package org.onap.aai.modelloader.entity.model;
import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.isEmptyString;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+
import javax.ws.rs.core.Response;
+
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
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 aef0acc..9b90aa2 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
@@ -23,12 +23,13 @@ package org.onap.aai.modelloader.entity.model;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
-import static org.junit.Assert.assertThat;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
+
import org.junit.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 1d2d385..8eebd06 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
@@ -21,15 +21,16 @@
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.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
+
import org.junit.Test;
import org.onap.aai.modelloader.entity.Artifact;
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 c0de0ee..3710d62 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/ArtifactDownloadManagerVnfcTest.java
@@ -21,8 +21,8 @@
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.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
@@ -33,6 +33,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
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 b50bd0d..a63710e 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDeploymentManager.java
@@ -21,7 +21,7 @@
package org.onap.aai.modelloader.notification;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
@@ -33,6 +33,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
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 f8b3de9..3d1cf15 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestArtifactDownloadManager.java
@@ -22,8 +22,8 @@ package org.onap.aai.modelloader.notification;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsEmptyCollection.empty;
-import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.Mockito.doNothing;
@@ -39,6 +39,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import org.hamcrest.collection.IsEmptyCollection;
import org.junit.After;
import org.junit.Before;
@@ -109,7 +110,7 @@ public class TestArtifactDownloadManager {
catalogFiles), is(true));
assertThat(modelFiles, is(empty()));
assertThat(catalogFiles, is(empty()));
- Mockito.verifyZeroInteractions(mockBabelClient, mockDistributionClient, mockNotificationPublisher,
+ Mockito.verifyNoInteractions(mockBabelClient, mockDistributionClient, mockNotificationPublisher,
mockBabelArtifactConverter);
}
@@ -129,7 +130,7 @@ public class TestArtifactDownloadManager {
Mockito.verify(mockNotificationPublisher).publishDownloadFailure(mockDistributionClient, data, artifact,
errorMessage);
- Mockito.verifyZeroInteractions(mockBabelClient, mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelClient, mockBabelArtifactConverter);
}
@Test
@@ -147,7 +148,7 @@ public class TestArtifactDownloadManager {
Mockito.verify(mockNotificationPublisher).publishDownloadSuccess(mockDistributionClient, data, artifactInfo);
Mockito.verify(mockNotificationPublisher).publishDeployFailure(mockDistributionClient, data, artifactInfo);
- Mockito.verifyZeroInteractions(mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelArtifactConverter);
}
@Test
@@ -167,7 +168,7 @@ public class TestArtifactDownloadManager {
Mockito.verify(mockBabelClient).postArtifact(any(), any(), any(), any());
Mockito.verify(mockNotificationPublisher).publishDeployFailure(mockDistributionClient, data, artifact);
- Mockito.verifyZeroInteractions(mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelArtifactConverter);
}
@@ -189,7 +190,7 @@ public class TestArtifactDownloadManager {
Mockito.verify(mockNotificationPublisher).publishDownloadSuccess(mockDistributionClient, data, artifact);
Mockito.verify(mockNotificationPublisher).publishDeployFailure(mockDistributionClient, data, artifact);
- Mockito.verifyZeroInteractions(mockBabelClient, mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelClient, mockBabelArtifactConverter);
}
@Test
@@ -246,7 +247,7 @@ public class TestArtifactDownloadManager {
Mockito.verify(mockDistributionClient).download(artifact);
Mockito.verify(mockNotificationPublisher).publishDownloadSuccess(mockDistributionClient, data, artifact);
- Mockito.verifyZeroInteractions(mockBabelClient, mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelClient, mockBabelArtifactConverter);
}
private void setupValidModelQuerySpecMocks(ArtifactTestUtils artifactTestUtils, INotificationData data,
@@ -332,7 +333,7 @@ public class TestArtifactDownloadManager {
Mockito.verify(mockDistributionClient).download(artifact);
Mockito.verify(mockNotificationPublisher).publishDownloadSuccess(mockDistributionClient, data, artifact);
Mockito.verify(mockNotificationPublisher).publishDeployFailure(mockDistributionClient, data, artifact);
- Mockito.verifyZeroInteractions(mockBabelClient, mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelClient, mockBabelArtifactConverter);
}
private IDistributionClientDownloadResult createDistributionClientDownloadResult(
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 8276d90..8c4ffed 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestEventCallback.java
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -96,7 +97,7 @@ public class TestEventCallback {
verify(mockArtifactDownloadManager).downloadArtifacts(any(INotificationData.class), any(List.class),
any(List.class), any(List.class));
- Mockito.verifyZeroInteractions(mockArtifactDeploymentManager);
+ Mockito.verifyNoInteractions(mockArtifactDeploymentManager);
}
@SuppressWarnings("unchecked")
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 c045910..d7441ec 100644
--- a/src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java
+++ b/src/test/java/org/onap/aai/modelloader/notification/TestNotificationDataImpl.java
@@ -23,7 +23,7 @@ package org.onap.aai.modelloader.notification;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
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 91aa182..ebdfcfe 100644
--- a/src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java
+++ b/src/test/java/org/onap/aai/modelloader/restclient/TestAaiRestClient.java
@@ -21,7 +21,6 @@
package org.onap.aai.modelloader.restclient;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -30,9 +29,11 @@ import java.nio.file.Paths;
import java.util.Properties;
import java.util.stream.IntStream;
import java.util.stream.Stream;
+
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.parsers.DocumentBuilderFactory;
+
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.entity.ArtifactType;
import org.onap.aai.modelloader.entity.model.ModelArtifact;
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 00bee09..c5da065 100644
--- a/src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java
+++ b/src/test/java/org/onap/aai/modelloader/restclient/TestAaiServiceClient.java
@@ -25,11 +25,14 @@ import static org.apache.commons.io.IOUtils.write;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.nio.charset.Charset;
import java.util.Properties;
+
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.MediaType;
+
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
@@ -99,7 +102,7 @@ public class TestAaiServiceClient {
HttpServletResponse response) throws IOException, ServletException {
response.setStatus(SC_OK);
response.setContentType("text/json;charset=utf-8");
- write("", response.getOutputStream());
+ write("", response.getOutputStream(), Charset.defaultCharset());
request.setHandled(true);
}
};
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 8da5f89..51c5642 100644
--- a/src/test/java/org/onap/aai/modelloader/restclient/TestBabelServiceClient.java
+++ b/src/test/java/org/onap/aai/modelloader/restclient/TestBabelServiceClient.java
@@ -24,19 +24,21 @@ import static javax.servlet.http.HttpServletResponse.SC_OK;
import static org.apache.commons.io.IOUtils.write;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
-import com.google.gson.Gson;
import java.io.IOException;
import java.net.URISyntaxException;
+import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
@@ -48,6 +50,8 @@ import org.onap.aai.babel.service.data.BabelArtifact;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.service.HttpsBabelServiceClientFactory;
+import com.google.gson.Gson;
+
/**
* Local testing of the Babel service client.
*
@@ -124,7 +128,7 @@ public class TestBabelServiceClient {
HttpServletResponse response) throws IOException, ServletException {
response.setStatus(SC_OK);
response.setContentType("text/xml;charset=utf-8");
- write(responseBody, response.getOutputStream());
+ write(responseBody, response.getOutputStream(), Charset.defaultCharset());
request.setHandled(true);
}
};
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 ec55f15..a791b46 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestArtifactInfoImpl.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestArtifactInfoImpl.java
@@ -24,8 +24,8 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertThat;
import org.junit.Test;
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 f38cf77..1a55580 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderService.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderService.java
@@ -21,12 +21,14 @@
package org.onap.aai.modelloader.service;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.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;
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 d23b3ef..976acbc 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
@@ -21,11 +21,13 @@
package org.onap.aai.modelloader.service;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
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;
diff --git a/src/test/java/org/onap/aai/modelloader/util/ArtifactTestUtils.java b/src/test/java/org/onap/aai/modelloader/util/ArtifactTestUtils.java
index 50074f1..e5db2a5 100644
--- a/src/test/java/org/onap/aai/modelloader/util/ArtifactTestUtils.java
+++ b/src/test/java/org/onap/aai/modelloader/util/ArtifactTestUtils.java
@@ -22,6 +22,8 @@ package org.onap.aai.modelloader.util;
import java.io.IOException;
import java.net.URL;
+import java.nio.charset.Charset;
+
import org.apache.commons.io.IOUtils;
import org.onap.aai.babel.service.data.BabelArtifact;
@@ -53,7 +55,7 @@ public class ArtifactTestUtils {
}
public static String loadResourceAsString(String resourceName) throws IOException {
- return IOUtils.toString(getResource(resourceName));
+ return IOUtils.toString(getResource(resourceName), Charset.defaultCharset());
}
private static URL getResource(String resourceName) {
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 97d7a19..1746e05 100644
--- a/src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java
+++ b/src/test/java/org/onap/aai/modelloader/util/TestGizmoTranslator.java
@@ -22,11 +22,12 @@
package org.onap.aai.modelloader.util;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+
import org.junit.Test;
import org.onap.aai.modelloader.gizmo.GizmoBulkPayload;
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 81a4833..116e1e5 100644
--- a/src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java
+++ b/src/test/java/org/onap/aai/modelloader/util/TestJsonXmlConverter.java
@@ -21,13 +21,15 @@
package org.onap.aai.modelloader.util;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.io.ByteArrayInputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;