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
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;
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) {
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;
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;
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;
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;
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;
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;
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;
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;
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;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
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;
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 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;
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;
catalogFiles), is(true));
assertThat(modelFiles, is(empty()));
assertThat(catalogFiles, is(empty()));
- Mockito.verifyZeroInteractions(mockBabelClient, mockDistributionClient, mockNotificationPublisher,
+ Mockito.verifyNoInteractions(mockBabelClient, mockDistributionClient, mockNotificationPublisher,
mockBabelArtifactConverter);
}
Mockito.verify(mockNotificationPublisher).publishDownloadFailure(mockDistributionClient, data, artifact,
errorMessage);
- Mockito.verifyZeroInteractions(mockBabelClient, mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelClient, mockBabelArtifactConverter);
}
@Test
Mockito.verify(mockNotificationPublisher).publishDownloadSuccess(mockDistributionClient, data, artifactInfo);
Mockito.verify(mockNotificationPublisher).publishDeployFailure(mockDistributionClient, data, artifactInfo);
- Mockito.verifyZeroInteractions(mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelArtifactConverter);
}
@Test
Mockito.verify(mockBabelClient).postArtifact(any(), any(), any(), any());
Mockito.verify(mockNotificationPublisher).publishDeployFailure(mockDistributionClient, data, artifact);
- Mockito.verifyZeroInteractions(mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelArtifactConverter);
}
Mockito.verify(mockNotificationPublisher).publishDownloadSuccess(mockDistributionClient, data, artifact);
Mockito.verify(mockNotificationPublisher).publishDeployFailure(mockDistributionClient, data, artifact);
- Mockito.verifyZeroInteractions(mockBabelClient, mockBabelArtifactConverter);
+ Mockito.verifyNoInteractions(mockBabelClient, mockBabelArtifactConverter);
}
@Test
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,
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(
import java.io.IOException;
import java.util.List;
import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
verify(mockArtifactDownloadManager).downloadArtifacts(any(INotificationData.class), any(List.class),
any(List.class), any(List.class));
- Mockito.verifyZeroInteractions(mockArtifactDeploymentManager);
+ Mockito.verifyNoInteractions(mockArtifactDeploymentManager);
}
@SuppressWarnings("unchecked")
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;
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;
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;
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;
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);
}
};
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;
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.
*
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);
}
};
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;
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;
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;
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;
}
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) {
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;
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;