aboutsummaryrefslogtreecommitdiffstats
path: root/common-be-tests-utils/src/main
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2022-01-11 18:02:46 +0000
committervasraz <vasyl.razinkov@est.tech>2022-01-11 18:02:46 +0000
commit33a4259fb3abbb2ccd8509b9e7288e61f1807b15 (patch)
treea3297f930350cd74448b85616374e766625e83a4 /common-be-tests-utils/src/main
parent74274107d682939fb7a3f63d5d690ecfb581a87d (diff)
Remove test-jar generation
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: Icc9f423b93a01fbcca3f45c4e8783d40aa6d6936 Issue-ID: SDC-3840
Diffstat (limited to 'common-be-tests-utils/src/main')
-rw-r--r--common-be-tests-utils/src/main/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java116
-rw-r--r--common-be-tests-utils/src/main/resources/artifacts/pnfSoftwareInformation/pnf-sw-information.yaml8
-rw-r--r--common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.cert0
-rw-r--r--common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.key0
-rw-r--r--common-be-tests-utils/src/main/resources/certificateManager/fakeCert2.cert0
-rw-r--r--common-be-tests-utils/src/main/resources/certificateManager/fakeCert3.key0
-rw-r--r--common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.cert24
-rw-r--r--common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.key28
-rw-r--r--common-be-tests-utils/src/main/resources/certificateManager/signerTest/fileToSign.txt1
-rw-r--r--common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToNotReduce.csarbin0 -> 24301 bytes
-rw-r--r--common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-2-files.zipbin0 -> 3154 bytes
-rw-r--r--common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-3-files.zipbin0 -> 23905 bytes
-rw-r--r--common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce.csarbin0 -> 25876 bytes
-rw-r--r--common-be-tests-utils/src/main/resources/mockito-extensions/org.mockito.plugins.MockMaker1
-rw-r--r--common-be-tests-utils/src/main/resources/persistentVolumeArtifactStorageManager/dummy.csarbin0 -> 25876 bytes
-rw-r--r--common-be-tests-utils/src/main/resources/s3StoreArtifactStorageManager/dummy.csarbin0 -> 25876 bytes
16 files changed, 178 insertions, 0 deletions
diff --git a/common-be-tests-utils/src/main/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java b/common-be-tests-utils/src/main/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java
new file mode 100644
index 0000000000..2e3b906a5d
--- /dev/null
+++ b/common-be-tests-utils/src/main/java/org/openecomp/sdc/be/test/util/TestResourcesHandler.java
@@ -0,0 +1,116 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.test.util;
+
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.Path;
+
+import static org.junit.Assert.fail;
+
+/**
+ * Util class for handling test resources.
+ */
+public class TestResourcesHandler {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestResourcesHandler.class);
+
+ private TestResourcesHandler() {
+
+ }
+
+ /**
+ * Gets the input stream of a resource file
+ *
+ * @param resourcePath The resource file path
+ * @return
+ * The resource input stream
+ */
+ public static InputStream getResourceAsStream(final String resourcePath) {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath);
+ }
+
+ public static InputStream getResourceAsStream(final Path resourcePath) {
+ return getResourceAsStream(resourcePath.toString());
+ }
+
+ /**
+ * Reads a file and coverts it to a byte array.
+ *
+ * @param resourcePath The resource file path
+ * @return
+ * The resource file byte array
+ * @throws IOException
+ * When the file was not found or the input stream could not be opened
+ */
+ public static byte[] getResourceAsByteArray(final String resourcePath) throws IOException {
+ try(final InputStream inputStream = getResourceAsStream(resourcePath)) {
+ if (inputStream == null) {
+ throw new IOException(String.format("Could not find the resource on path \"%s\"", resourcePath));
+ }
+ return IOUtils.toByteArray(inputStream);
+ } catch (final IOException ex) {
+ throw new IOException(String.format("Could not open the input stream for resource on path \"%s\"", resourcePath), ex);
+ }
+ }
+
+ public static byte[] getResourceAsByteArray(final Path resourcePath) throws IOException {
+ return getResourceAsByteArray(resourcePath.toString());
+ }
+
+ /**
+ * Reads a file in the given path.
+ * The method forces an assertion fail if the resource could not be loaded.
+ * @param resourcePath The resource file path
+ * @return
+ * The resource file byte array
+ */
+ public static byte[] getResourceBytesOrFail(final String resourcePath) {
+ try {
+ return getResourceAsByteArray(resourcePath);
+ } catch (final IOException e) {
+ final String errorMsg = String.format("Could not load resource '%s'", resourcePath);
+ LOGGER.error(errorMsg, e);
+ fail(errorMsg);
+ }
+
+ return null;
+ }
+
+ public static byte[] getResourceBytesOrFail(final Path resourcePath) {
+ return getResourceBytesOrFail(resourcePath.toString());
+ }
+
+ /**
+ * Gets the input stream of a resource file
+ *
+ * @param resourcePath The resource file path
+ * @return
+ * The resource input stream
+ */
+ public static URL getFileUrl(final String resourcePath) {
+ return Thread.currentThread().getContextClassLoader().getResource(resourcePath);
+ }
+}
diff --git a/common-be-tests-utils/src/main/resources/artifacts/pnfSoftwareInformation/pnf-sw-information.yaml b/common-be-tests-utils/src/main/resources/artifacts/pnfSoftwareInformation/pnf-sw-information.yaml
new file mode 100644
index 0000000000..31f4bc6173
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/artifacts/pnfSoftwareInformation/pnf-sw-information.yaml
@@ -0,0 +1,8 @@
+description: "pnf software information"
+provider: "Ericsson"
+version: "1.0"
+pnf_software_information:
+ - description: "first software version of PNF"
+ pnf_software_version: "version1"
+ - description: "second software version of PNF"
+ pnf_software_version: "version2"
diff --git a/common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.cert b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.cert
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.cert
diff --git a/common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.key b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.key
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert1.key
diff --git a/common-be-tests-utils/src/main/resources/certificateManager/fakeCert2.cert b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert2.cert
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert2.cert
diff --git a/common-be-tests-utils/src/main/resources/certificateManager/fakeCert3.key b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert3.key
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/certificateManager/fakeCert3.key
diff --git a/common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.cert b/common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.cert
new file mode 100644
index 0000000000..ae7d518ab0
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.cert
@@ -0,0 +1,24 @@
+-----BEGIN CERTIFICATE-----
+MIIEAzCCAuugAwIBAgIUZqdsy8mtirp4AGnTopg9rb3NXcEwDQYJKoZIhvcNAQEL
+BQAwgY8xCzAJBgNVBAYTAkVVMRAwDgYDVQQIDAdOb3doZXJlMRIwEA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7JjbTAD
+aYH1sx00hH13U8GMZInnmenmwziOQgBwhhCjLMblUY2vQ4O5MGwZG0VW2e3mUcq1
+HBC69yRMx9jQ+Iof6+rHnCLZXTjcl+65IxXSbKhofvpPJMVXFlmV3TdDdONuvKpS
+051z/ISD6/SEWEvF9ZwAnZvJ/5yPqGzKgyC7rp8zJL+N3VLfr+la1D1w7qgoyFTi
+drptEMCzLOk4OuM8PX8l2kY0G+gQD1o=
+-----END CERTIFICATE-----
diff --git a/common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.key b/common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.key
new file mode 100644
index 0000000000..a31579a407
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/certificateManager/realCert/realCert1.key
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDQFiun47jquloM
+cIekKitGAfWoYz0Y9IpP5fOgKJMMmsKYGP4gtsV8PvRLavdQuqZWMvAZW2CHL//i
+qIrXi+GIDBPR5NZcChhHHjRsLyys1Of3019QT+KqVYt2gecwgFmvTIQpPlCP2iHh
+EShT/VxwMf8LgFKv8Tj+By8YC7l/wO065Xd0Y42jGDi423yYzxTd5a730NNn8uQ5
+SX1htwEkzjhH3R7dYMHzi7s5dpeUd+Kfs8EConftnMil2LNKMGbuw8/Tk1i1cWXC
+4mBBs/GN4Jph1YV8vkz6b5ecDxGozkAVDJLHTq4nNHSHyoyQjCahcyC79XX2Qq9/
+ONzGDd6DAgMBAAECggEANLj5VK+JIcgXmsFETN72WeWTNZf3WgRTqwzLXpAJOg9Y
+MKtccDN+9A0LXrR6dzTjgkGjvfj+CyKpReeITja97PeKagr+GRHhtts7UxHc0uma
+4JrosnObLadBD8S4K/zJPHY5oi2MwfX10Y3EVwuByVeRlHtt9/A5jXuKfiAyXuCw
+42AT6GUFxntwcKhJSQEcy2B9FwvnF5BDDQKyRVD1McrIj/g7+fi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src/main/resources/certificateManager/signerTest/fileToSign.txt b/common-be-tests-utils/src/main/resources/certificateManager/signerTest/fileToSign.txt
new file mode 100644
index 0000000000..cf3472103d
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/certificateManager/signerTest/fileToSign.txt
@@ -0,0 +1 @@
+This is a file to be signed.
diff --git a/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToNotReduce.csar b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToNotReduce.csar
new file mode 100644
index 0000000000..d44041382e
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToNotReduce.csar
Binary files differ
diff --git a/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-2-files.zip b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-2-files.zip
new file mode 100644
index 0000000000..be48e8a674
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-2-files.zip
Binary files differ
diff --git a/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-3-files.zip b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-3-files.zip
new file mode 100644
index 0000000000..fecb45aaaf
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce-3-files.zip
Binary files differ
diff --git a/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce.csar b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce.csar
new file mode 100644
index 0000000000..73b28f52fd
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/csarSizeReducer/dummyToReduce.csar
Binary files differ
diff --git a/common-be-tests-utils/src/main/resources/mockito-extensions/org.mockito.plugins.MockMaker b/common-be-tests-utils/src/main/resources/mockito-extensions/org.mockito.plugins.MockMaker
new file mode 100644
index 0000000000..ca6ee9cea8
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/mockito-extensions/org.mockito.plugins.MockMaker
@@ -0,0 +1 @@
+mock-maker-inline \ No newline at end of file
diff --git a/common-be-tests-utils/src/main/resources/persistentVolumeArtifactStorageManager/dummy.csar b/common-be-tests-utils/src/main/resources/persistentVolumeArtifactStorageManager/dummy.csar
new file mode 100644
index 0000000000..73b28f52fd
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/persistentVolumeArtifactStorageManager/dummy.csar
Binary files differ
diff --git a/common-be-tests-utils/src/main/resources/s3StoreArtifactStorageManager/dummy.csar b/common-be-tests-utils/src/main/resources/s3StoreArtifactStorageManager/dummy.csar
new file mode 100644
index 0000000000..73b28f52fd
--- /dev/null
+++ b/common-be-tests-utils/src/main/resources/s3StoreArtifactStorageManager/dummy.csar
Binary files differ