commons-codec removed 17/94417/8
authorTomasz Golabek <tomasz.golabek@nokia.com>
Wed, 28 Aug 2019 09:57:45 +0000 (11:57 +0200)
committerTomasz Golabek <tomasz.golabek@nokia.com>
Mon, 9 Sep 2019 15:15:50 +0000 (17:15 +0200)
- Substituted by java embedded mechanisms and some from guava pkg.
- org.janusgraph.janusgraph-core and org.janusgraph.janusgraph-cassandra  still keeps commons-codecs
- dependency to distribution-client in version 1.4.1 - first we need to publish that image

Change-Id: I800012bf98702aa8808ddc766ebdb53acb8ab86a
Issue-ID: SDC-2504
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
69 files changed:
asdctool/pom.xml
asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/attributes/version.rb
asdctool/src/main/java/org/openecomp/sdc/asdctool/main/SdcSchemaFileImport.java
catalog-be/pom.xml
catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java
catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtils.java
catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java
catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java
catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ArtifactServlet.java
catalog-be/src/main/java/org/openecomp/sdc/be/switchover/detector/SwitchoverDetector.java
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java
catalog-be/src/test/java/org/openecomp/sdc/ZipUtil.java
catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java
catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java
catalog-dao/pom.xml
catalog-fe/pom.xml
catalog-model/pom.xml
common-app-api/pom.xml
common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RestUtils.java
common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
common-app-api/src/test/java/org/openecomp/sdc/common/test/YamlTest.java
common-app-api/src/test/java/org/openecomp/sdc/common/util/GeneralUtilityTest.java
common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java
onboarding/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/main/java/org/openecomp/sdcrests/action/rest/services/ActionsImpl.java
openecomp-be/api/openecomp-sdc-rest-webapp/externaltesting-rest/externaltesting-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml
openecomp-be/backend/openecomp-sdc-security-util/pom.xml
openecomp-be/backend/openecomp-sdc-security-util/src/main/java/org/openecomp/sdc/securityutil/CipherUtil.java
openecomp-be/backend/openecomp-sdc-security-util/src/test/java/CipherUtilTest.java
openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml
openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml
openecomp-ui/yarn.lock
pom.xml
test-apis-ci/pom.xml
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/artifacts/HeatEnvArtifact.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/devCI/ArtifactFromCsar.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/distribution/DistributionDownloadArtifactTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/externalapi/DownloadArtifactsTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/general/BasicHttpAuthenticationTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/CsarUtilsTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportCsarResourceTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportNewResourceCITest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportToscaCapabilitiesWithProperties.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ImportUpdateResourseCsarTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/CsarParserUtils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Decoder.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/Utils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/AtomicOperationUtils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtillViaApis.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ArtifactRestUtils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/BaseRestUtils.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
test-apis-ci/src/main/java/org/openecomp/sdc/externalApis/GetAssetServlet.java
test-apis-ci/src/test/java/org/openecomp/sdc/cucumber/steps/StepsTenantIsolationCI.java
ui-ci/pom.xml
utils/webseal-simulator/pom.xml

index ced840d..ef766d7 100644 (file)
                                        <artifactId>slf4j-log4j12</artifactId>
                                        <groupId>org.slf4j</groupId>
                                </exclusion>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
                        </exclusions>
                </dependency>
 
                        <scope>compile</scope>
                </dependency>
 
-               <dependency>
-                       <groupId>commons-codec</groupId>
-                       <artifactId>commons-codec</artifactId>
-                       <version>${commons-codec}</version>
-                       <scope>compile</scope>
-               </dependency>
-
                <dependency>
                        <groupId>com.fasterxml.jackson.core</groupId>
                        <artifactId>jackson-databind</artifactId>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
                        <version>${httpclient.version}</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                        <scope>compile</scope>
                </dependency>
 
                        <groupId>org.apache.poi</groupId>
                        <artifactId>poi</artifactId>
                        <version>${apache-poi.version}</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
                <dependency>
index eb1d487..d8b7a07 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.openecomp.sdc.asdctool.main;
 
+import com.google.common.hash.Hashing;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -36,7 +37,6 @@ import java.util.Map;
 import java.util.stream.Stream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
-import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.openecomp.sdc.asdctool.enums.SchemaZipFileEnum;
 import org.openecomp.sdc.asdctool.impl.EsToCassandraDataMigrationConfig;
@@ -142,7 +142,7 @@ public class SdcSchemaFileImport {
                byte[] fileBytes = baos.toByteArray();
 
                Date date = new Date();
-               String md5Hex = DigestUtils.md5Hex(fileBytes);
+               String md5Hex = Hashing.md5().hashBytes(fileBytes).toString();
                
                SdcSchemaFilesData schemeFileData = new SdcSchemaFilesData(sdcReleaseNum, date, conformanceLevel, FILE_NAME, fileBytes, md5Hex);
                CassandraOperationStatus saveSchemaFile = schemaFilesCassandraDao.saveSchemaFile(schemeFileData);
index eb6f0c6..efd6925 100644 (file)
       <artifactId>jersey-bean-validation</artifactId>
     </dependency>
 
-    <!-- http client -->
+        <!-- http client -->
     <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
       <version>${httpclient.version}</version>
       <scope>compile</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-codec</groupId>
+          <artifactId>commons-codec</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
       <scope>compile</scope>
     </dependency>
 
-    <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-      <version>${commons-codec}</version>
-      <scope>compile</scope>
-    </dependency>
     <!-- http client END -->
 
     <dependency>
           <groupId>io.netty</groupId>
           <artifactId>netty-all</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>commons-codec</groupId>
+          <artifactId>commons-codec</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
 
           <artifactId>slf4j-log4j12</artifactId>
           <groupId>org.slf4j</groupId>
         </exclusion>
+        <exclusion>
+          <groupId>commons-codec</groupId>
+          <artifactId>commons-codec</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
 
index f94cd38..5f36d16 100644 (file)
@@ -24,7 +24,6 @@ import com.google.gson.Gson;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
@@ -856,7 +855,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
     private Either<List<HeatParameterDefinition>, ResponseFormat> extractHeatParameters(String artifactType,
             String fileName, byte[] content, boolean is64Encoded) {
         // extract heat parameters
-        String heatDecodedPayload = is64Encoded ? new String(Base64.decodeBase64(content)) : new String(content);
+        String heatDecodedPayload = is64Encoded ? new String(Base64.getDecoder().decode(content)) : new String(content);
         Either<List<HeatParameterDefinition>, ResultStatusEnum> heatParameters = ImportUtils
                 .getHeatParamsWithoutImplicitTypes(heatDecodedPayload, artifactType);
         if (heatParameters.isRight()) {
index 3d149f7..bfa9973 100644 (file)
@@ -25,7 +25,7 @@ package org.openecomp.sdc.be.components.impl;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang.StringUtils;
@@ -2248,7 +2248,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
     private Either<Boolean, ResponseFormat> extractHeatParameters(ArtifactDefinition artifactInfo) {
         // extract heat parameters
         if (artifactInfo.getPayloadData() != null) {
-            String heatDecodedPayload = new String(Base64.decodeBase64(artifactInfo.getPayloadData()));
+            String heatDecodedPayload = new String(Base64.getDecoder().decode(artifactInfo.getPayloadData()));
             Either<List<HeatParameterDefinition>, ResultStatusEnum> heatParameters = ImportUtils.getHeatParamsWithoutImplicitTypes(heatDecodedPayload, artifactInfo
                     .getArtifactType());
             if (heatParameters.isRight() && (!heatParameters.right()
@@ -2356,7 +2356,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
                 .getEsId());
         if (eitherArtifactData.isLeft()) {
             byte[] data = eitherArtifactData.left().value().getDataAsArray();
-            data = Base64.encodeBase64(data);
+            data = Base64.getEncoder().encode(data);
             payloadWrapper.setInnerElement(data);
         }
         else {
@@ -2372,9 +2372,9 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
 
     @SuppressWarnings("unchecked")
     private void validateEnvVsHeat(Wrapper<ResponseFormat> errorWrapper, ArtifactDefinition envArtifact, ArtifactDefinition heatArtifact, byte[] heatPayloadData) {
-        String envPayload = new String(Base64.decodeBase64(envArtifact.getPayloadData()));
+        String envPayload = new String(Base64.getDecoder().decode(envArtifact.getPayloadData()));
         Map<String, Object> heatEnvToscaJson = (Map<String, Object>) new Yaml().load(envPayload);
-        String heatDecodedPayload = new String(Base64.decodeBase64(heatPayloadData));
+        String heatDecodedPayload = new String(Base64.getDecoder().decode(heatPayloadData));
         Map<String, Object> heatToscaJson = (Map<String, Object>) new Yaml().load(heatDecodedPayload);
 
         Either<Map<String, Object>, ResultStatusEnum> eitherHeatEnvProperties = ImportUtils.findFirstToscaMapElement(heatEnvToscaJson, TypeUtils.ToscaTagNamesEnum.PARAMETERS);
@@ -3155,7 +3155,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
 
         if (payload != null && payload.length != 0) {
             // the generated artifacts were already decoded by the handler
-            decodedPayload = artifactInfo.getGenerated() ? payload : Base64.decodeBase64(payload);
+            decodedPayload = artifactInfo.getGenerated() ? payload : Base64.getDecoder().decode(payload);
             if (decodedPayload.length == 0) {
                 log.debug("Failed to decode the payload.");
                 ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_CONTENT);
@@ -4142,7 +4142,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
 
         if (artifactContent != null) {
             log.debug("payload is encoded. perform decode");
-            String encodedPayload = Base64.encodeBase64String(artifactContent);
+            String encodedPayload = Base64.getEncoder().encodeToString(artifactContent);
             json.put(Constants.ARTIFACT_PAYLOAD_DATA, encodedPayload);
         }
         json.put(Constants.ARTIFACT_DISPLAY_NAME, displayName);
index c40c845..9289a5d 100644 (file)
@@ -34,6 +34,7 @@ import static org.openecomp.sdc.be.components.impl.ImportUtils.getPropertyJsonSt
 import static org.openecomp.sdc.be.tosca.CsarUtils.VF_NODE_TYPE_ARTIFACTS_PATH_PATTERN;
 
 import java.util.ArrayList;
+import java.util.Base64;
 import java.util.Collection;
 import java.util.EnumMap;
 import java.util.HashMap;
@@ -49,7 +50,6 @@ import java.util.function.Function;
 import java.util.regex.Pattern;
 
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.collections4.ListUtils;
@@ -766,7 +766,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
         if (!foundArtifact.getArtifactChecksum().equals(currNewArtifact.getArtifactChecksum())) {
             foundArtifact.setPayload(currNewArtifact.getPayloadData());
             foundArtifact.setPayloadData(
-                    Base64.encodeBase64String(currNewArtifact.getPayloadData()));
+                    Base64.getEncoder().encodeToString(currNewArtifact.getPayloadData()));
             foundArtifact.setArtifactChecksum(GeneralUtility
                     .calculateMD5Base64EncodedByByteArray(currNewArtifact.getPayloadData()));
             artifactsToUpdate.add(foundArtifact);
index 9479c80..fcefb9e 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.be.datamodel.utils;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.openecomp.sdc.be.info.ArtifactTemplateInfo;
 import org.openecomp.sdc.be.model.ArtifactDefinition;
 import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
@@ -78,7 +78,7 @@ public class ArtifactUtils {
         json.put(Constants.ARTIFACT_DESCRIPTION, description);
         json.put(Constants.IS_FROM_CSAR, isFromCsar);
 
-        String encodedPayload = Base64.encodeBase64String(artifactContentent);
+        String encodedPayload = Base64.getEncoder().encodeToString(artifactContentent);
 
         json.put(Constants.ARTIFACT_PAYLOAD_DATA, encodedPayload);
         json.put(Constants.ARTIFACT_DISPLAY_NAME, displayName);
@@ -104,7 +104,7 @@ public class ArtifactUtils {
         json.put(Constants.ARTIFACT_DESCRIPTION, "created from csar");
                json.put(Constants.IS_FROM_CSAR, isFromcsar);
 
-        String encodedPayload = Base64.encodeBase64String(artifactContentent);
+        String encodedPayload = Base64.getEncoder().encodeToString(artifactContentent);
 
         json.put(Constants.ARTIFACT_PAYLOAD_DATA, encodedPayload);
         String displayName = artifactName;
index 5166ef9..164243c 100644 (file)
@@ -23,7 +23,7 @@ package org.openecomp.sdc.be.filters;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.impl.ComponentsUtils;
@@ -81,7 +81,7 @@ public class BasicAuthenticationFilter implements ContainerRequestFilter {
 
                 if ("Basic".equalsIgnoreCase(basic)) {
                     try {
-                        String credentials = new String(Base64.decodeBase64(st.nextToken()), "UTF-8");
+                        String credentials = new String(Base64.getDecoder().decode(st.nextToken()), "UTF-8");
                         log.debug("Credentials: {}", credentials);
                         checkUserCredentials(requestContext, credentials);
                     } catch (UnsupportedEncodingException e) {
index e008896..abce2d8 100644 (file)
@@ -34,6 +34,7 @@ import java.io.InputStream;
 import java.lang.reflect.Type;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,7 +42,6 @@ import java.util.function.Supplier;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -216,7 +216,7 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet {
                 Response errorResp = buildErrorResponse(responseFormat);
                 responseWrapper.setInnerElement(errorResp);
             }
-            String payloadData =  Base64.encodeBase64String(data);
+            String payloadData =  Base64.getEncoder().encodeToString(data);
             uploadResourceInfoWrapper.setPayloadData(payloadData);
 
 
@@ -474,7 +474,7 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet {
             responseWrapper.setInnerElement(errorResponse);
         } else {
             String toscaPayload = resourceInfo.getPayloadData();
-            String decodedPayload = new String(Base64.decodeBase64(toscaPayload));
+            String decodedPayload = new String(Base64.getDecoder().decode(toscaPayload));
             yamlStringWrapper.setInnerElement(decodedPayload);
         }
 
@@ -742,7 +742,7 @@ public abstract class AbstractValidationsServlet extends BeGenericServlet {
             return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_NOT_FOUND, csarUUID));
         }
 
-        byte[] decodedPayload = Base64.decodeBase64(payloadData.getBytes(StandardCharsets.UTF_8));
+        byte[] decodedPayload = Base64.getDecoder().decode(payloadData.getBytes(StandardCharsets.UTF_8));
         if (decodedPayload == null) {
             log.info("Failed to decode received csar", csarUUID);
             return Either.right(componentsUtils.getResponseFormat(ActionStatus.CSAR_NOT_FOUND, csarUUID));
index 2b55ffa..9355e84 100644 (file)
@@ -36,7 +36,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;\r
 import javax.ws.rs.core.MediaType;\r
 import javax.ws.rs.core.Response;\r
-import org.apache.commons.codec.binary.Base64;\r
+import java.util.Base64;\r
 import org.apache.commons.lang3.tuple.ImmutablePair;\r
 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;\r
 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;\r
@@ -712,7 +712,7 @@ public class ArtifactServlet extends BeGenericServlet {
             response = buildErrorResponse(actionResult.right().value());\r
         } else {\r
             byte[] file = actionResult.left().value().getRight();\r
-            String base64Contents = new String(Base64.encodeBase64(file));\r
+            String base64Contents = new String(Base64.getEncoder().encode(file));\r
             String artifactName = actionResult.left().value().getLeft();\r
             ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);\r
             ArtifactUiDownloadData artifactUiDownloadData = new ArtifactUiDownloadData();\r
index 9e0c130..f7f7414 100644 (file)
@@ -21,7 +21,7 @@
 package org.openecomp.sdc.be.switchover.detector;
 
 import com.google.common.annotations.VisibleForTesting;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
 import org.openecomp.sdc.be.config.BeEcompErrorManager;
@@ -119,7 +119,7 @@ public class SwitchoverDetector {
 
     private void setAuthorizationProperties() {
         String userInfo = switchoverDetectorConfig.getChangePriorityUser() + ":" + switchoverDetectorConfig.getChangePriorityPassword();
-        String auth = "Basic " + new String(new Base64().encode(userInfo.getBytes()));
+        String auth = "Basic " + new String(Base64.getEncoder().encode(userInfo.getBytes()));
         authHeader = new Properties();
         authHeader.put("Authorization", auth);
     }
index 2f1357e..ce2ca21 100644 (file)
@@ -22,7 +22,6 @@ package org.openecomp.sdc.be.tosca;
 
 
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.commons.lang.WordUtils;
@@ -635,7 +634,7 @@ public class CsarUtils {
                                parsedCsarArtifactPath[1], collectedWarningMessages));
                artifact.setArtifactName(
                                ValidationUtils.normalizeFileName(parsedCsarArtifactPath[parsedCsarArtifactPath.length - 1]));
-               artifact.setPayloadData(Base64.encodeBase64String(entry.getValue()));
+               artifact.setPayloadData(Base64.getEncoder().encodeToString(entry.getValue()));
                artifact.setArtifactDisplayName(artifact.getArtifactName().lastIndexOf('.') > 0
                                ? artifact.getArtifactName().substring(0, artifact.getArtifactName().lastIndexOf('.'))
                                : artifact.getArtifactName());
@@ -675,7 +674,7 @@ public class CsarUtils {
                        }
                        this.artifactLabel = ValidationUtils.normalizeArtifactLabel(artifactName);
                        if (payloadData != null) {
-                               this.payloadData = Base64.encodeBase64String(payloadData);
+                               this.payloadData = Base64.getEncoder().encodeToString(payloadData);
                                this.artifactChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(payloadData);
                        }
                        this.artifactUniqueId = artifactUniqueId;
index 87e351b..125e2a6 100644 (file)
@@ -22,7 +22,7 @@
 
 package org.openecomp.sdc;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.commons.io.output.ByteArrayOutputStream;
 
 import java.io.ByteArrayInputStream;
@@ -42,7 +42,6 @@ public class ZipUtil {
 
         String zipFileName = "/src/test/resources/config/config.zip";
 
-        zipFileName = "C:\\Git_work\\D2-SDnC\\catalog-be\\src\\test\\resources\\config\\config.zip";
         zipFileName = "src/test/resources/config/config.zip";
 
         Path path = Paths.get(zipFileName);
@@ -51,10 +50,10 @@ public class ZipUtil {
             byte[] zipAsBytes = Files.readAllBytes(path);
             // encode to base
 
-            byte[] decodedMd5 = Base64.encodeBase64(zipAsBytes);
+            byte[] decodedMd5 = Base64.getEncoder().encode(zipAsBytes);
             String decodedStr = new String(decodedMd5);
 
-            zipAsBytes = Base64.decodeBase64(decodedStr.getBytes());
+            zipAsBytes = Base64.getDecoder().decode(decodedStr.getBytes());
 
             // String str = new String(zipAsBytes);
 
index a86ed18..d043ee2 100644 (file)
@@ -28,7 +28,6 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonElement;
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.http.HttpStatus;
 import org.junit.Before;
@@ -1031,7 +1030,7 @@ public class ArtifactBusinessLogicTest extends BaseBusinessLogicMock{
         when(artifactInfo.getEsId()).thenReturn(esId);
         final Wrapper<byte[]> payloadWrapper = new Wrapper<>();
         final byte[] payloadArtifactData = "testArtifactData".getBytes();
-        final byte[] base64PayloadArtifactData = Base64.decodeBase64(payloadArtifactData);
+        final byte[] base64PayloadArtifactData = Base64.getDecoder().decode(payloadArtifactData);
         final ESArtifactData artifactData = Mockito.mock(ESArtifactData.class);
         when(artifactData.getDataAsArray()).thenReturn(base64PayloadArtifactData);
 
index 5538777..a21d22d 100644 (file)
@@ -30,8 +30,9 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonElement;
 import fj.data.Either;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
 import mockit.Deencapsulation;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.junit.Assert;
 import org.junit.Before;
@@ -529,7 +530,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock{
         artifactDefinition.setArtifactType(ArtifactTypeEnum.TOSCA_TEMPLATE.getType());
         artifactDefinition.setArtifactLabel(ARTIFACT_LABEL);
         artifactDefinition.setEsId(ES_ARTIFACT_ID);
-        artifactDefinition.setPayload(PAYLOAD);
+        artifactDefinition.setPayload(Base64.getEncoder().encode(PAYLOAD));
         artifactDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.TOSCA);
 
         when(graphLockOperation.lockComponent(any(), any())).thenReturn(StorageOperationStatus.OK);
@@ -1239,7 +1240,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock{
         artifactInfo.setArtifactName(artifactName);
         artifactInfo.setArtifactType(artifactType.getType());
         artifactInfo.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT);
-        artifactInfo.setPayload(Base64.encodeBase64(payload));
+        artifactInfo.setPayload(Base64.getEncoder().encode(payload));
         return artifactInfo;
     }
 
index 5158c43..faddd92 100644 (file)
@@ -21,7 +21,7 @@
 package org.openecomp.sdc.be.servlets;
 
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Test;
 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
 import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
@@ -76,7 +76,7 @@ public class AbstractValidationsServletTest {
         try {
             path = Paths.get(rootPath + "/src/test/resources/valid_vf.csar");
             data = Files.readAllBytes(path);
-            payloadData = Base64.encodeBase64String(data);
+            payloadData = Base64.getEncoder().encodeToString(data);
             UploadResourceInfo resourceInfo = new UploadResourceInfo();
             resourceInfo.setPayloadName(payloadName);
             resourceInfo.setPayloadData(payloadData);
index 6344e6f..0ca62ad 100644 (file)
@@ -25,7 +25,7 @@ package org.openecomp.sdc.be.servlets;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.text.StrSubstitutor;
 import org.apache.http.HttpStatus;
@@ -973,7 +973,7 @@ public class ResourceServletTest extends JerseyTest {
     }
 
     private void encodeAndSetPayload(UploadResourceInfo mdJson, String payload) {
-        byte[] encodedBase64Payload = Base64.encodeBase64(payload.getBytes());
+        byte[] encodedBase64Payload = Base64.getEncoder().encode(payload.getBytes());
         mdJson.setPayloadData(new String(encodedBase64Payload));
     }
 
index ebf97f9..9c84fd3 100644 (file)
@@ -186,6 +186,12 @@ Modifications copyright (c) 2018 Nokia
                        <artifactId>httpclient</artifactId>
                        <version>${httpclient.version}</version>
                        <scope>provided</scope>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
                <dependency>
@@ -315,12 +321,22 @@ Modifications copyright (c) 2018 Nokia
                                        <groupId>org.apache.thrift</groupId>
                                        <artifactId>libthrift</artifactId>
                                </exclusion>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
                        </exclusions>
                </dependency>
                <dependency>
                        <groupId>org.apache.cassandra</groupId>
                        <artifactId>cassandra-all</artifactId>
                        <version>3.11.3</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                        <scope>test</scope>
                </dependency>
                <dependency>
index 2f95a0b..c541b06 100644 (file)
                        <artifactId>httpclient</artifactId>
                        <version>${httpclient.version}</version>
                        <scope>compile</scope>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
                <dependency>
                        <scope>compile</scope>
                </dependency>
 
-               <dependency>
-                       <groupId>commons-codec</groupId>
-                       <artifactId>commons-codec</artifactId>
-                       <version>${commons-codec}</version>
-                       <scope>compile</scope>
-               </dependency>
                <!-- http client END -->
 
                <dependency>
                                        <artifactId>slf4j-log4j12</artifactId>
                                        <groupId>org.slf4j</groupId>
                                </exclusion>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
                        </exclusions>
                </dependency>
                <!-- System metrics -->
index e456134..3e07e31 100644 (file)
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
                        <version>${httpclient.version}</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                        <scope>provided</scope>
                </dependency>
 
index e186465..8678e9f 100644 (file)
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
                        <version>${httpclient.version}</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                        <scope>provided</scope>
                </dependency>
 
                        <scope>provided</scope>
                </dependency>
 
-               <dependency>
-                       <groupId>commons-codec</groupId>
-                       <artifactId>commons-codec</artifactId>
-                       <version>${commons-codec}</version>
-                       <scope>provided</scope>
-               </dependency>
-
                <dependency>
                        <groupId>org.glassfish.jersey.media</groupId>
                        <artifactId>jersey-media-json-jackson</artifactId>
index efac5c1..ae270c8 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.common.http.client.api;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.http.HttpHeaders;
 
 import java.nio.charset.StandardCharsets;
@@ -29,7 +29,7 @@ import java.util.Properties;
 public class RestUtils {
 
     public static void addBasicAuthHeader(Properties headers, String username, String password) {
-        byte[] credentials = Base64.encodeBase64((username + ":" + password).getBytes(StandardCharsets.UTF_8));
+        byte[] credentials = Base64.getEncoder().encode((username + ":" + password).getBytes(StandardCharsets.UTF_8));
         headers.setProperty(HttpHeaders.AUTHORIZATION, "Basic " + new String(credentials, StandardCharsets.UTF_8));
     }
 
index 5c389fc..c6ff990 100644 (file)
@@ -20,7 +20,8 @@
 
 package org.openecomp.sdc.common.rest.impl.validator;
 
-import org.apache.commons.codec.binary.Base64;
+import com.google.common.hash.Hashing;
+import java.util.Base64;
 import org.openecomp.sdc.common.api.Constants;
 import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
 import org.openecomp.sdc.common.log.wrappers.Logger;
@@ -75,8 +76,8 @@ public class RequestHeadersValidator {
         }
 
         // calculate MD5 on the data
-        String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(encodedData);
-        byte[] encodedMd5 = Base64.encodeBase64(md5.getBytes());
+        String md5 = Hashing.md5().hashBytes(encodedData).toString();
+        byte[] encodedMd5 = Base64.getEncoder().encode(md5.getBytes());
 
         // read the Content-MD5 header
         String origMd5 = request.getHeader(Constants.MD5_HEADER);
index 7ff19ac..34faffc 100644 (file)
@@ -20,7 +20,8 @@
 
 package org.openecomp.sdc.common.util;
 
-import org.apache.commons.codec.binary.Base64;
+import com.google.common.hash.Hashing;
+import java.util.Base64;
 import org.apache.commons.io.FileUtils;
 import org.openecomp.sdc.common.api.Constants;
 
@@ -49,7 +50,12 @@ public class GeneralUtility {
      * The methods contained in other common libraries do the same.
      */
     public static boolean isBase64Encoded(byte[] data) {
-        return Base64.isBase64(data);
+        try {
+            Base64.getDecoder().decode(data);
+        }catch (Exception e){
+            return false;
+        }
+        return true;
     }
 
     /**
@@ -65,7 +71,7 @@ public class GeneralUtility {
             if (isEncoded) {
                 // If no exception is caught, then it is possibly a base64
                 // encoded string
-                byte[] data = Base64.decodeBase64(str);
+                Base64.getDecoder().decode(str);
             }
 
         } catch (Exception e) {
@@ -136,29 +142,21 @@ public class GeneralUtility {
     }
 
     public static String calculateMD5Base64EncodedByByteArray(byte[] payload) {
-        String decodedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(payload);
-        byte[] encodeMd5 = Base64.encodeBase64(decodedMd5.getBytes());
+        String decodedMd5 = Hashing.md5().hashBytes(payload).toString();
+        byte[] encodeMd5 = Base64.getEncoder().encode(decodedMd5.getBytes());
         return new String(encodeMd5);
 
     }
 
-    /**
-     * @param data
-     * @return
-     */
     public static String calculateMD5Base64EncodedByString(String data) {
-        String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data);
+        String calculatedMd5 = Hashing.md5().hashBytes(data.getBytes()).toString();
 
         // encode base-64 result
-        byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes());
+        byte[] encodeBase64 = Base64.getEncoder().encode(calculatedMd5.getBytes());
         return new String(encodeBase64);
     }
 
 
-    /**
-     * @param String
-     * @return String is null or Empty
-     */
     public static boolean isEmptyString(String str) {
         return str == null || str.trim().isEmpty();
     }
index 801b6c1..a5fd9dc 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.common.util;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheConfig;
 import org.openecomp.sdc.be.config.Configuration.ApplicationL2CacheConfig;
 import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig;
@@ -65,8 +65,8 @@ public class YamlToObjectConverter {
 
     static {
 
-        org.yaml.snakeyaml.constructor.Constructor deConstructor = new org.yaml.snakeyaml.constructor.Constructor(
-                DistributionEngineConfiguration.class);
+        org.yaml.snakeyaml.constructor.Constructor deConstructor =
+                new org.yaml.snakeyaml.constructor.Constructor(DistributionEngineConfiguration.class);
         TypeDescription deDescription = new TypeDescription(DistributionEngineConfiguration.class);
         deDescription.putListPropertyType("distributionStatusTopic", DistributionStatusTopicConfig.class);
         deDescription.putListPropertyType("distribNotifServiceArtifactTypes", ComponentArtifactTypesConfig.class);
@@ -78,16 +78,16 @@ public class YamlToObjectConverter {
         yamls.put(DistributionEngineConfiguration.class.getName(), yaml);
 
         // FE conf
-        org.yaml.snakeyaml.constructor.Constructor feConfConstructor = new org.yaml.snakeyaml.constructor.Constructor(
-                org.openecomp.sdc.fe.config.Configuration.class);
+        org.yaml.snakeyaml.constructor.Constructor feConfConstructor =
+                new org.yaml.snakeyaml.constructor.Constructor(org.openecomp.sdc.fe.config.Configuration.class);
         TypeDescription feConfDescription = new TypeDescription(org.openecomp.sdc.fe.config.Configuration.class);
         feConfDescription.putListPropertyType("systemMonitoring", FeMonitoringConfig.class);
         feConfConstructor.addTypeDescription(feConfDescription);
         yamls.put(org.openecomp.sdc.fe.config.Configuration.class.getName(), new Yaml(feConfConstructor));
 
         // BE conf
-        org.yaml.snakeyaml.constructor.Constructor beConfConstructor = new org.yaml.snakeyaml.constructor.Constructor(
-                org.openecomp.sdc.be.config.Configuration.class);
+        org.yaml.snakeyaml.constructor.Constructor beConfConstructor =
+                new org.yaml.snakeyaml.constructor.Constructor(org.openecomp.sdc.be.config.Configuration.class);
         TypeDescription beConfDescription = new TypeDescription(org.openecomp.sdc.be.config.Configuration.class);
         beConfConstructor.addTypeDescription(beConfDescription);
 
@@ -101,10 +101,8 @@ public class YamlToObjectConverter {
         beConfConstructor.addTypeDescription(esDescription);
 
         // resourceDeploymentArtifacts and serviceDeploymentArtifacts
-        beConfDescription.putMapPropertyType("resourceDeploymentArtifacts", String.class,
-                ArtifactTypeConfig.class);
-        beConfDescription.putMapPropertyType("serviceDeploymentArtifacts", String.class,
-                ArtifactTypeConfig.class);
+        beConfDescription.putMapPropertyType("resourceDeploymentArtifacts", String.class, ArtifactTypeConfig.class);
+        beConfDescription.putMapPropertyType("serviceDeploymentArtifacts", String.class, ArtifactTypeConfig.class);
 
         // onboarding
         beConfDescription.putListPropertyType("onboarding", OnboardingConfig.class);
@@ -126,8 +124,8 @@ public class YamlToObjectConverter {
         yamls.put(org.openecomp.sdc.be.config.Configuration.class.getName(), new Yaml(beConfConstructor));
 
         // HEAT deployment artifact
-        org.yaml.snakeyaml.constructor.Constructor depArtHeatConstructor = new org.yaml.snakeyaml.constructor.Constructor(
-                DeploymentArtifactHeatConfiguration.class);
+        org.yaml.snakeyaml.constructor.Constructor depArtHeatConstructor =
+                new org.yaml.snakeyaml.constructor.Constructor(DeploymentArtifactHeatConfiguration.class);
         PropertyUtils propertyUtils = new PropertyUtils();
         // Skip properties which are found in YAML but not found in POJO
         propertyUtils.setSkipMissingProperties(true);
@@ -158,13 +156,15 @@ public class YamlToObjectConverter {
             config = convert(fullFileName, className);
 
         } catch (Exception e) {
-            log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file {} to object.", configFileName, e);
+            log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file {} to object.",
+                    configFileName, e);
         }
 
         return config;
     }
 
     public class MyYamlConstructor extends org.yaml.snakeyaml.constructor.Constructor {
+
         private HashMap<String, Class<?>> classMap = new HashMap<>();
 
         public MyYamlConstructor(Class<? extends Object> theRoot) {
@@ -206,7 +206,8 @@ public class YamlToObjectConverter {
 
             File f = new File(fullFileName);
             if (!f.exists()) {
-                log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "The file {} cannot be found. Ignore reading configuration.", fullFileName);
+                log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "",
+                        "The file {} cannot be found. Ignore reading configuration.", fullFileName);
                 return null;
             }
             in = Files.newInputStream(Paths.get(fullFileName));
@@ -215,7 +216,8 @@ public class YamlToObjectConverter {
 
             // System.out.println(config.toString());
         } catch (Exception e) {
-            log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file {} to object.", fullFileName, e);
+            log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file {} to object.",
+                    fullFileName, e);
         } finally {
             if (in != null) {
                 try {
@@ -259,9 +261,12 @@ public class YamlToObjectConverter {
 
     public boolean isValidYamlEncoded64(byte[] fileContents) {
         log.trace("Received Base64 data - decoding before validating...");
-        byte[] decodedFileContents = Base64.decodeBase64(fileContents);
-
-        return isValidYaml(decodedFileContents);
+        try {
+            byte[] decodedFileContents = Base64.getDecoder().decode(fileContents);
+            return isValidYaml(decodedFileContents);
+        } catch (IllegalArgumentException e) {
+            return false;
+        }
     }
 
     @SuppressWarnings("unchecked")
@@ -276,7 +281,8 @@ public class YamlToObjectConverter {
             }
 
         } catch (Exception e) {
-            log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file to object - yaml is invalid", e);
+            log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "",
+                    "Failed to convert yaml file to object - yaml is invalid", e);
             return false;
         }
         return true;
index 78465fb..707e8e1 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.common.test;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.openecomp.sdc.common.util.YamlToObjectConverter;
@@ -52,11 +52,11 @@ public class YamlTest {
 
        @Test
        public void testValidYamlBase64() {
-               assertTrue(yamlToObjectConverter.isValidYamlEncoded64(Base64.encodeBase64(validYaml.getBytes())));
+               assertTrue(yamlToObjectConverter.isValidYamlEncoded64(Base64.getEncoder().encode(validYaml.getBytes())));
        }
 
        @Test
        public void testInvalidYamlBase64() {
-               assertFalse(yamlToObjectConverter.isValidYamlEncoded64(Base64.encodeBase64(invalidYaml.getBytes())));
+               assertFalse(yamlToObjectConverter.isValidYamlEncoded64(Base64.getEncoder().encode(invalidYaml.getBytes())));
        }
 }
index b503606..4586b42 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -22,6 +22,7 @@ package org.openecomp.sdc.common.util;
 
 
 import com.google.common.collect.Lists;
+import com.google.common.hash.Hashing;
 import org.apache.commons.io.FileUtils;
 import org.junit.Test;
 
@@ -37,214 +38,212 @@ import static org.junit.Assert.assertTrue;
 
 public class GeneralUtilityTest {
 
-       @Test
-       public void validateGenerateTextFileReturnsTrueIfGeneratesTextFile() throws IOException {
+    @Test
+    public void validateGenerateTextFileReturnsTrueIfGeneratesTextFile() throws IOException {
 
-               final String fileName = "test.txt";
-               final String fileData = "test data";
-               final File expectedFile = new File(fileName);
+        final String fileName = "test.txt";
+        final String fileData = "test data";
+        final File expectedFile = new File(fileName);
 
-               boolean result = GeneralUtility.generateTextFile(fileName, fileData);
+        boolean result = GeneralUtility.generateTextFile(fileName, fileData);
 
-               String createdFileData = FileUtils.readFileToString(expectedFile);
+        String createdFileData = FileUtils.readFileToString(expectedFile);
 
-               assertTrue(result);
-               assertEquals(createdFileData ,fileData);
+        assertTrue(result);
+        assertEquals(createdFileData, fileData);
 
-               FileUtils.forceDelete(expectedFile);
-       }
+        FileUtils.forceDelete(expectedFile);
+    }
 
-       @Test
-       public void validateIsBase64EncodedReturnsProperResponseFromByteArray() {
+    @Test
+    public void validateIsBase64EncodedReturnsProperResponseFromByteArray() {
 
-               final String testString = "testDataToEncode";
-               final byte[] testBytes = testString.getBytes();
-               final byte[] testEncodedBytes = Base64.getEncoder().encode(testBytes);
+        final String testString = "testDataToEncode";
+        final byte[] testBytes = testString.getBytes();
+        final byte[] testEncodedBytes = Base64.getEncoder().encode(testBytes);
 
-               boolean result = GeneralUtility.isBase64Encoded(testEncodedBytes);
+        boolean result = GeneralUtility.isBase64Encoded(testEncodedBytes);
 
-               assertTrue(result);
-       }
+        assertTrue(result);
+    }
 
-       @Test
-       public void validateIsBase64EncodedReturnsProperResponseFromString() {
+    @Test
+    public void validateIsBase64EncodedReturnsProperResponseFromString() {
 
-               final String testString = "testDataToEncode";
-               final byte[] testBytes = testString.getBytes();
-               final byte[] testEncodedBytes = Base64.getEncoder().encode(testBytes);
-               final String testEncodedString = new String(testEncodedBytes);
+        final String testString = "testDataToEncode";
+        final byte[] testBytes = testString.getBytes();
+        final byte[] testEncodedBytes = Base64.getEncoder().encode(testBytes);
+        final String testEncodedString = new String(testEncodedBytes);
 
-               boolean result = GeneralUtility.isBase64Encoded(testEncodedString);
+        boolean result = GeneralUtility.isBase64Encoded(testEncodedString);
 
-               assertTrue(result);
-       }
+        assertTrue(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitReturnsFalseIfStringIsShorterThenLimit() {
+    @Test
+    public void validateIsExceedingLimitReturnsFalseIfStringIsShorterThenLimit() {
 
-               final String testString = "test";
-               final int limit = 5;
+        final String testString = "test";
+        final int limit = 5;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitReturnsFalseIfStringIsNull() {
+    @Test
+    public void validateIsExceedingLimitReturnsFalseIfStringIsNull() {
 
-               final String testString = null;
-               final int limit = 5;
+        final String testString = null;
+        final int limit = 5;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitReturnsFalseIfStringLengthIsEqualToLimit() {
+    @Test
+    public void validateIsExceedingLimitReturnsFalseIfStringLengthIsEqualToLimit() {
 
-               final String testString = "test";
-               final int limit = 4;
+        final String testString = "test";
+        final int limit = 4;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitReturnsTrueIfStringExceedsLimit() {
+    @Test
+    public void validateIsExceedingLimitReturnsTrueIfStringExceedsLimit() {
 
-               final String testString = "test";
-               final int limit = 3;
+        final String testString = "test";
+        final int limit = 3;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit);
 
-               assertTrue(result);
-       }
+        assertTrue(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitWithDelimiterReturnsFalseIfSumOfAllElementsLengthAndDelimiterLengthIsSmallerThenLimit() {
+    @Test
+    public void validateIsExceedingLimitWithDelimiterReturnsFalseIfSumOfAllElementsLengthAndDelimiterLengthIsSmallerThenLimit() {
 
-               final List<String> testString = Lists.newArrayList("testing","list");
-               final int limit = 15;
-               final int delimiterLength = 2;
+        final List<String> testString = Lists.newArrayList("testing", "list");
+        final int limit = 15;
+        final int delimiterLength = 2;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitWithDelimiterReturnsFalseIfListIsNull() {
+    @Test
+    public void validateIsExceedingLimitWithDelimiterReturnsFalseIfListIsNull() {
 
-               final List<String> testString = null;
-               final int limit = 15;
-               final int delimiterLength = 2;
+        final List<String> testString = null;
+        final int limit = 15;
+        final int delimiterLength = 2;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitWithDelimiterReturnsFalseIfSumOfAllElementsLengthAndDelimiterLengthIsEqualThenLimit() {
+    @Test
+    public void validateIsExceedingLimitWithDelimiterReturnsFalseIfSumOfAllElementsLengthAndDelimiterLengthIsEqualThenLimit() {
 
-               final List<String> testString = Lists.newArrayList("testing","list","equal");
-               final int limit = 18;
-               final int delimiterLength = 1;
+        final List<String> testString = Lists.newArrayList("testing", "list", "equal");
+        final int limit = 18;
+        final int delimiterLength = 1;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
-       @Test
-       public void validateIsExceedingLimitWithDelimiterReturnsTrueIfSumOfAllElementsLengthAndDelimiterLengthIsBiggerThenLimit() {
+    @Test
+    public void validateIsExceedingLimitWithDelimiterReturnsTrueIfSumOfAllElementsLengthAndDelimiterLengthIsBiggerThenLimit() {
 
-               final List<String> testString = Lists.newArrayList("long","testing","list","of","strings");
-               final int limit = 20;
-               final int delimiterLength = 2;
+        final List<String> testString = Lists.newArrayList("long", "testing", "list", "of", "strings");
+        final int limit = 20;
+        final int delimiterLength = 2;
 
-               boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
+        boolean result = GeneralUtility.isExceedingLimit(testString, limit, delimiterLength);
 
-               assertTrue(result);
-       }
+        assertTrue(result);
+    }
 
-       @Test
-       public void validateGetFilenameExtensionReturnsProperExtension() {
+    @Test
+    public void validateGetFilenameExtensionReturnsProperExtension() {
 
-               final String testFile = "test.yaml";
+        final String testFile = "test.yaml";
 
-               String extension = GeneralUtility.getFilenameExtension(testFile);
+        String extension = GeneralUtility.getFilenameExtension(testFile);
 
-               assertEquals(extension, "yaml");
-       }
+        assertEquals(extension, "yaml");
+    }
 
-       @Test
-       public void validateCalculateMD5Base64EncodedByByteArrayReturnsCorrectString() {
+    @Test
+    public void validateCalculateMD5Base64EncodedByByteArrayReturnsCorrectString() {
 
-               final String testStringToEncode = "testString";
+        final String testStringToEncode = "testString";
 
-               String result = GeneralUtility.calculateMD5Base64EncodedByByteArray(testStringToEncode.getBytes());
+        String result = GeneralUtility.calculateMD5Base64EncodedByByteArray(testStringToEncode.getBytes());
 
-               final String encodedString =
-                               org.apache.commons.codec.digest.DigestUtils.md5Hex(testStringToEncode.getBytes());
+        final String encodedString = Hashing.md5().hashBytes(testStringToEncode.getBytes()).toString();
 
-               assertArrayEquals(encodedString.getBytes(), Base64.getDecoder().decode(result));
-       }
+        assertArrayEquals(encodedString.getBytes(), Base64.getDecoder().decode(result));
+    }
 
-       @Test
-       public void validateCalculateMD5Base64EncodedByStringReturnsCorrectString() {
+    @Test
+    public void validateCalculateMD5Base64EncodedByStringReturnsCorrectString() {
 
-               final String testStringToEncode = "testString";
+        final String testStringToEncode = "testString";
 
-               String result = GeneralUtility.calculateMD5Base64EncodedByString(testStringToEncode);
+        String result = GeneralUtility.calculateMD5Base64EncodedByString(testStringToEncode);
 
-               final String encodedString =
-                               org.apache.commons.codec.digest.DigestUtils.md5Hex(testStringToEncode.getBytes());
+        final String encodedString = Hashing.md5().hashBytes(testStringToEncode.getBytes()).toString();
 
-               assertArrayEquals(encodedString.getBytes(), Base64.getDecoder().decode(result));
-       }
+        assertArrayEquals(encodedString.getBytes(), Base64.getDecoder().decode(result));
+    }
 
-       @Test
-       public void validateIsEmptyStringReturnTrueIfStringIsEmpty() {
+    @Test
+    public void validateIsEmptyStringReturnTrueIfStringIsEmpty() {
 
-               final String empty = "";
+        final String empty = "";
 
-               boolean result = GeneralUtility.isEmptyString(empty);
+        boolean result = GeneralUtility.isEmptyString(empty);
 
-               assertTrue(result);
-       }
+        assertTrue(result);
+    }
 
-       @Test
-       public void validateIsEmptyStringReturnTrueIfStringIsContainingOnlyWightSpaces() {
+    @Test
+    public void validateIsEmptyStringReturnTrueIfStringIsContainingOnlyWightSpaces() {
 
-               final String empty = "  \t ";
+        final String empty = "  \t ";
 
-               boolean result = GeneralUtility.isEmptyString(empty);
+        boolean result = GeneralUtility.isEmptyString(empty);
 
-               assertTrue(result);
-       }
+        assertTrue(result);
+    }
 
-       @Test
-       public void validateIsEmptyStringReturnFalseIfStringIsNotEmpty() {
+    @Test
+    public void validateIsEmptyStringReturnFalseIfStringIsNotEmpty() {
 
-               final String empty = "test";
+        final String empty = "test";
 
-               boolean result = GeneralUtility.isEmptyString(empty);
+        boolean result = GeneralUtility.isEmptyString(empty);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
-       @Test
-       public void validateIsEmptyStringReturnFalseIfStringIsNotEmptyAndSurroundedWithWightSpaces() {
+    @Test
+    public void validateIsEmptyStringReturnFalseIfStringIsNotEmptyAndSurroundedWithWightSpaces() {
 
-               final String empty = " \ttest  ";
+        final String empty = " \ttest  ";
 
-               boolean result = GeneralUtility.isEmptyString(empty);
+        boolean result = GeneralUtility.isEmptyString(empty);
 
-               assertFalse(result);
-       }
+        assertFalse(result);
+    }
 
 }
index 49fc553..55827bb 100644 (file)
@@ -19,7 +19,7 @@
  */
 package org.openecomp.sdc.common.util;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Before;
 import org.junit.Test;
 import org.openecomp.sdc.be.config.Configuration;
@@ -40,9 +40,7 @@ public class YamlToObjectConverterTest {
     private final String filePath = "./src/test/resources/config/common/";
     private final String fileName = "configuration.yaml";
 
-    private final String testYaml = "--- \n" +
-            "object: \n" +
-            "  key: value";
+    private final String testYaml = "--- \n" + "object: \n" + "  key: value";
 
     private YamlToObjectConverter yamlToObjectConverter;
 
@@ -68,7 +66,7 @@ public class YamlToObjectConverterTest {
 
     @Test
     public void validateIsValidYamlEncoded64ReturnsTrueIfGivenYamlIsEncoded64() {
-        boolean result = yamlToObjectConverter.isValidYamlEncoded64(Base64.encodeBase64(testYaml.getBytes()));
+        boolean result = yamlToObjectConverter.isValidYamlEncoded64(Base64.getEncoder().encode(testYaml.getBytes()));
 
         assertTrue(result);
     }
index 139db36..cde206c 100644 (file)
                 <artifactId>jackson-dataformat-yaml</artifactId>
                 <version>${jackson.version}</version>
             </dependency>
-            <dependency>
-                <groupId>commons-codec</groupId>
-                <artifactId>commons-codec</artifactId>
-                <version>${commons.codec.version}</version>
-            </dependency>
             <dependency>
                 <groupId>com.datastax.cassandra</groupId>
                 <artifactId>cassandra-driver-core</artifactId>
index aaf19e6..0b9520b 100644 (file)
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
             <version>${http.client.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
index 7154d99..6b8a0c7 100644 (file)
@@ -94,6 +94,7 @@ import static org.openecomp.sdc.action.util.ActionUtil.actionErrorLogProcessor;
 import static org.openecomp.sdc.action.util.ActionUtil.actionLogPostProcessor;
 import static org.openecomp.sdc.action.util.ActionUtil.getUtcDateStringFromTimestamp;
 
+import com.google.common.hash.Hashing;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -103,7 +104,6 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
 import org.openecomp.core.utilities.file.FileUtils;
@@ -197,7 +197,7 @@ public class ActionsImpl implements Actions {
   private static String calculateCheckSum(byte[] input) {
     String checksum = null;
     if (input != null) {
-      checksum = DigestUtils.md5Hex(input);
+      checksum = Hashing.md5().hashBytes(input).toString().toUpperCase();
     }
     return checksum;
   }
@@ -1208,7 +1208,7 @@ public class ActionsImpl implements Actions {
   private String CalcMD5CheckSum(byte[] input) {
     String checksum = null;
     if (input != null) {
-      checksum = DigestUtils.md5Hex(input).toUpperCase();
+      checksum = Hashing.md5().hashBytes(input).toString().toUpperCase();
       System.out.println("checksum : " + checksum);
     }
     return checksum;
index f97fe1d..3fe91a0 100644 (file)
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
             <version>${http.client.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>javax.inject</groupId>
index 1871031..af0598c 100644 (file)
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
             <version>${http.client.version}</version>
         </dependency>
         <dependency>
index 146c311..31e57fc 100644 (file)
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
             <version>${http.client.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
index 6e112b8..c6bddb9 100644 (file)
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
             <version>${http.client.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>javax.inject</groupId>
index 48125c0..73a9491 100644 (file)
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
             <version>${http.client.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
index 1e7b7e6..a475b93 100644 (file)
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
             <version>${http.client.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <!-- Java Stuff -->
index c655490..7897604 100644 (file)
             <version>2.9.9</version>
         </dependency>
 
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>1.11</version>
-        </dependency>
-
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
index 4f4c18c..4e41d16 100644 (file)
 package org.openecomp.sdc.securityutil;
 
 import java.security.SecureRandom;
+import java.util.Base64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.crypto.Cipher;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
-import org.apache.commons.codec.binary.Base64;
 
 public class CipherUtil {
     private static Logger log = LoggerFactory.getLogger( CipherUtil.class.getName());
@@ -64,7 +64,7 @@ public class CipherUtil {
             log.error("encrypt failed", ex);
             throw new CipherUtilException(ex);
         }
-        return Base64.encodeBase64String(addAll(iv, finalByte));
+        return Base64.getEncoder().encodeToString(addAll(iv, finalByte));
     }
 
     /**
@@ -79,7 +79,7 @@ public class CipherUtil {
      */
 
     public static String decryptPKC(String message, String base64key) throws CipherUtilException {
-        byte[] encryptedMessage = Base64.decodeBase64(message);
+        byte[] encryptedMessage = Base64.getDecoder().decode(message);
         Cipher cipher;
         byte[] decrypted;
         try {
@@ -97,7 +97,7 @@ public class CipherUtil {
     }
 
     private static SecretKeySpec getSecretKeySpec(String keyString) {
-        byte[] key = Base64.decodeBase64(keyString);
+        byte[] key = Base64.getDecoder().decode(keyString);
         return new SecretKeySpec(key, ALGORITHM);
     }
 
index 888c888..ce8865f 100644 (file)
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.commons.lang.RandomStringUtils;
 import org.junit.Test;
 import org.openecomp.sdc.securityutil.CipherUtil;
@@ -34,7 +34,7 @@ public class CipherUtilTest {
     @Test
     public void encryptDecryptPKC() throws CipherUtilException {
         String generatedKey = RandomStringUtils.randomAlphabetic(16);
-        String base64Key = Base64.encodeBase64String(generatedKey.getBytes());
+        String base64Key = Base64.getEncoder().encodeToString(generatedKey.getBytes());
         String encrypted = CipherUtil.encryptPKC(DATA, base64Key);
         assertNotEquals(DATA, encrypted);
         String decrypted = CipherUtil.decryptPKC(encrypted, base64Key);
index 5896889..991a1a5 100644 (file)
             <artifactId>gson</artifactId>
             <version>${gson.version}</version>
         </dependency>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>${commons.codec.version}</version>
-        </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
index 22a0e0a..dba5761 100644 (file)
                <dependency>
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
-            <version>${http.client.version}</version>
+      <version>${http.client.version}</version>
                        <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-codec</groupId>
+          <artifactId>commons-codec</artifactId>
+        </exclusion>
+      </exclusions>
                </dependency>
                <dependency>
                        <groupId>org.apache.httpcomponents</groupId>
index b936780..229effa 100644 (file)
@@ -2,38 +2,6 @@
 # yarn lockfile v1
 
 
-"@angular/common@~2.4.8":
-  version "2.4.10"
-  resolved "https://registry.yarnpkg.com/@angular/common/-/common-2.4.10.tgz#a3a682d2228fa30ec23dd0eb57c8e887fba26997"
-
-"@angular/core@~2.4.8":
-  version "2.4.10"
-  resolved "https://registry.yarnpkg.com/@angular/core/-/core-2.4.10.tgz#0b8320a65065965d998645b1f5cd3cf769b441ea"
-
-"@angular/forms@~2.4.8":
-  version "2.4.10"
-  resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-2.4.10.tgz#062133aaade1f3b3c962f1593208c541b622fd06"
-
-"@angular/http@^2.4.8":
-  version "2.4.10"
-  resolved "https://registry.yarnpkg.com/@angular/http/-/http-2.4.10.tgz#ff6beade5b39c989ebf2393c49b34eebd43e9555"
-
-"@angular/platform-browser-dynamic@~2.4.8":
-  version "2.4.10"
-  resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-2.4.10.tgz#8df25dec2b06adc690cc9bc26448deccaebcd8ec"
-
-"@angular/platform-browser@~2.4.8":
-  version "2.4.10"
-  resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-2.4.10.tgz#cbf25608148fb4ffef96cc5005ba5d7b3e093906"
-
-"@angular/router@~3.2.1":
-  version "3.2.4"
-  resolved "https://registry.yarnpkg.com/@angular/router/-/router-3.2.4.tgz#dfec71ad072ec031364ba5d08bd6fe03fd5beadc"
-
-"@angular/upgrade@^2.4.8":
-  version "2.4.10"
-  resolved "https://registry.yarnpkg.com/@angular/upgrade/-/upgrade-2.4.10.tgz#b69a3ee324d4450eb1696ddc9bded1a6ec06ca52"
-
 "@babel/code-frame@7.0.0-beta.44":
   version "7.0.0-beta.44"
   resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9"
@@ -7591,19 +7559,21 @@ on-headers@~1.0.1:
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.1.tgz#928f5d0f470d49342651ea6794b0857c100693f7"
 
-onap-ui-common@1.0.100:
-  version "1.0.100"
-  resolved "https://registry.yarnpkg.com/onap-ui-common/-/onap-ui-common-1.0.100.tgz#c0dae1d3d1c3fd2b866340d27a1179ed10a3a860"
-  integrity sha512-d+eaYgVgrj9B8/3iVDlkxO2jiE7wXFrvMogxxHsyM8E0Fa7wXGEGwohA4JD5nGydT84dU2vPzwkby7SZNgGpKA==
+onap-ui-common@1.0.101:
+  version "1.0.101"
+  resolved "https://registry.yarnpkg.com/onap-ui-common/-/onap-ui-common-1.0.101.tgz#c79b8fb903b7d2d3f959e3b5c27b561b563d961b"
 
-onap-ui-react@^0.1.1:
-  version "0.1.1"
-  resolved "https://registry.yarnpkg.com/onap-ui-react/-/onap-ui-react-0.1.1.tgz#3640bdb9fb10f85104ad9dd57a9f320b0703abf3"
-  integrity sha512-hax7WzSMIPll9fHvKVjFbn2dIOh39fWuiy0VQKONq/ccU3f/y08Y6EzJo7rzWcwjt8bp2KDhqNZky0HwIquc6w==
+onap-ui-common@^1.0.101:
+  version "1.0.105"
+  resolved "https://registry.yarnpkg.com/onap-ui-common/-/onap-ui-common-1.0.105.tgz#099ca3229a5cf3bd81339d737a71b1b0d24d8fa2"
+
+onap-ui-react@^1.0.0:
+  version "1.0.2"
+  resolved "https://registry.yarnpkg.com/onap-ui-react/-/onap-ui-react-1.0.2.tgz#e99dc5a924f84a991c71a3e9c05a44a915830168"
   dependencies:
     "@storybook/react" "^3.1.5"
     http-loader "0.0.1"
-    onap-ui-common "1.0.100"
+    onap-ui-common "1.0.101"
     prop-types "^15.6.0"
     react "15.6.2"
     react-dom "15.6.2"
@@ -9437,12 +9407,6 @@ rx@4.1.0:
   version "4.1.0"
   resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
 
-rxjs@5.4.2:
-  version "5.4.2"
-  resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.2.tgz#2a3236fcbf03df57bae06fd6972fd99e5c08fcf7"
-  dependencies:
-    symbol-observable "^1.0.1"
-
 rxjs@^5.5.2:
   version "5.5.11"
   resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.11.tgz#f733027ca43e3bec6b994473be4ab98ad43ced87"
@@ -9535,28 +9499,6 @@ scss-tokenizer@^0.2.3:
     js-base64 "^2.1.8"
     source-map "^0.4.2"
 
-sdc-ui@1.6.62:
-  version "1.6.62"
-  resolved "https://registry.yarnpkg.com/sdc-ui/-/sdc-ui-1.6.62.tgz#738b14d3e2d2280f9be69b1fdb91b7c815e60dca"
-  dependencies:
-    "@angular/common" "~2.4.8"
-    "@angular/core" "~2.4.8"
-    "@angular/forms" "~2.4.8"
-    "@angular/http" "^2.4.8"
-    "@angular/platform-browser" "~2.4.8"
-    "@angular/platform-browser-dynamic" "~2.4.8"
-    "@angular/router" "~3.2.1"
-    "@angular/upgrade" "^2.4.8"
-    "@storybook/react" "^3.1.5"
-    http-loader "0.0.1"
-    prop-types "^15.6.0"
-    react "15.6.2"
-    react-dom "15.6.2"
-    reflect-metadata "^0.1.3"
-    rxjs "5.4.2"
-    svg-react-loader "^0.4.4"
-    zone.js "^0.8.18"
-
 select-hose@^2.0.0:
   version "2.0.0"
   resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca"
@@ -10261,7 +10203,7 @@ symbol-observable@1.0.1:
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4"
 
-symbol-observable@^1.0.1, symbol-observable@^1.0.3, symbol-observable@^1.1.0:
+symbol-observable@^1.0.3, symbol-observable@^1.1.0:
   version "1.2.0"
   resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
 
@@ -11391,7 +11333,3 @@ yeoman-generator@^2.0.5:
     text-table "^0.2.0"
     through2 "^2.0.0"
     yeoman-environment "^2.0.5"
-
-zone.js@^0.8.18:
-  version "0.8.26"
-  resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.26.tgz#7bdd72f7668c5a7ad6b118148b4ea39c59d08d2d"
diff --git a/pom.xml b/pom.xml
index 409eb41..76c4395 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,6 @@ Modifications copyright (c) 2018-2019 Nokia
         <!-- logback -->
         <logback.version>1.2.3</logback.version>
         <slf4j-api.version>1.7.25</slf4j-api.version>
-        <commons-codec>1.10</commons-codec>
         <commons-logging>1.2</commons-logging>
         <janino.version>3.0.6</janino.version>
 
@@ -124,7 +123,7 @@ Modifications copyright (c) 2018-2019 Nokia
         <maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
 
         <!-- parser-->
-        <sdc-tosca-parser.version>1.3.5</sdc-tosca-parser.version>
+        <sdc-tosca-parser.version>1.6.2</sdc-tosca-parser.version>
 
         <!-- sonar -->
         <sonar.language>java</sonar.language>
index a2800f1..d0e0f50 100644 (file)
             <scope>compile</scope>
         </dependency>
 
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>${commons-codec}</version>
-            <scope>compile</scope>
-        </dependency>
-
         <!-- Gson -->
         <dependency>
             <groupId>com.google.code.gson</groupId>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
             <version>${httpclient.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
             <scope>compile</scope>
         </dependency>
 
                     <artifactId>slf4j-log4j12</artifactId>
                     <groupId>org.slf4j</groupId>
                 </exclusion>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.onap.sdc.sdc-tosca</groupId>
             <artifactId>sdc-tosca</artifactId>
-            <version>1.4.6</version>
+            <version>1.6.2</version>
             <scope>compile</scope>
         </dependency>
 
         </dependency>
 
         <dependency>
-            <groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
+            <groupId>org.onap.sdc.sdc-distribution-client</groupId>
             <artifactId>sdc-distribution-client</artifactId>
-            <version>1.2.2 </version>
+            <version>1.4.1</version>
             <scope>test</scope>
         </dependency>
 
index 80e0a54..7646567 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.artifacts;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
@@ -173,7 +173,7 @@ public class HeatEnvArtifact extends ComponentBaseTest {
 
                ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(heatEnvDownloadResponse.getResponse(), ArtifactUiDownloadData.class);
                byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
-               byte[] decodeBase64 = Base64.decodeBase64(fromUiDownload);
+               byte[] decodeBase64 = Base64.getDecoder().decode(fromUiDownload);
                Yaml yaml = new Yaml();
 
                InputStream inputStream = new ByteArrayInputStream(decodeBase64);
index 7a69d37..7dcf659 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.devCI;
 
-import org.apache.commons.codec.digest.DigestUtils;
+import com.google.common.hash.Hashing;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition;
@@ -205,7 +205,7 @@ public class ArtifactFromCsar {
  
                        // md5Hex converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
                        // The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
-                       crunchifyValue = DigestUtils.md5Hex(IOUtils.toByteArray(crunchifyInputStream));
+                       crunchifyValue = Hashing.md5().hashBytes(IOUtils.toByteArray(crunchifyInputStream)).toString();
                } catch (IOException e) {
                        e.printStackTrace();
                } finally {
index 94715b2..b340a4c 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.distribution;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
@@ -201,7 +201,7 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
                String actualContents = restResponse.getResponse();
 
                // Contents - comparing decoded content
-               AssertJUnit.assertEquals(artifactDetails.getPayload(), Base64.encodeBase64String(actualContents.getBytes()));
+               AssertJUnit.assertEquals(artifactDetails.getPayload(), Base64.getEncoder().encodeToString(actualContents.getBytes()));
 
                // validating checksum
                String actualPayloadChecksum = GeneralUtility.calculateMD5Base64EncodedByByteArray(actualContents.getBytes());
@@ -368,7 +368,7 @@ public class DistributionDownloadArtifactTest extends ComponentBaseTest {
 
                String actualContents = restResponse.getResponse();
 
-               assertEquals(artifactDetails.getPayload(), Base64.encodeBase64String(actualContents.getBytes()));
+               assertEquals(artifactDetails.getPayload(), Base64.getEncoder().encodeToString(actualContents.getBytes()));
 
                // validating checksum
                byte[] bytes = actualContents.getBytes();
index e49c912..f0e5b60 100644 (file)
@@ -21,7 +21,7 @@
 package org.openecomp.sdc.ci.tests.execute.externalapi;
 
 import com.google.gson.Gson;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -348,7 +348,7 @@ public class DownloadArtifactsTest extends ComponentBaseTest {
                String payloadName = "VF_RI2_G4_withArtifacts.csar";
                Path path = Paths.get(rootPath + "/src/main/resources/ci/VF_RI2_G4_withArtifacts.csar");
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetailsVF_01.setPayloadData(payloadData);
 
                resourceDetailsVF_01.setPayloadName(payloadName);
index 404ed04..bd1714f 100644 (file)
@@ -21,7 +21,7 @@
 //US505653
 package org.openecomp.sdc.ci.tests.execute.general;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -295,7 +295,7 @@ public class BasicHttpAuthenticationTest extends ComponentBaseTest {
        @Test
        public void sendAuthenticatedRequestTest_InvalidHeader() throws Exception, Exception {
                String userCredentials = USER + ":" + PASSWORD;
-               byte[] encodeBase64 = Base64.encodeBase64(userCredentials.getBytes());
+               byte[] encodeBase64 = Base64.getEncoder().encode(userCredentials.getBytes());
                String encodedUserCredentials = new String(encodeBase64);
                Map<String, String> authorizationHeader = new HashMap<String, String>();
                authorizationHeader.put(HttpHeaderEnum.AUTHORIZATION.getValue(), encodedUserCredentials);
index 5650275..908eac8 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.execute.imports;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -444,7 +444,7 @@ public class CsarUtilsTest extends ComponentBaseTest {
                assertNotNull(artifactUiDownloadData);
 
                byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
-               byte[] decodeBase64 = Base64.decodeBase64(fromUiDownload);
+               byte[] decodeBase64 = Base64.getDecoder().decode(fromUiDownload);
 
                return decodeBase64;
        }
index 3f017f4..c84b2a5 100644 (file)
@@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.imports;
 import com.google.gson.Gson;
 import com.google.gson.JsonParser;
 import com.google.gson.reflect.TypeToken;
-import org.apache.commons.codec.binary.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
@@ -213,7 +212,7 @@ public class ExportToscaTest extends ComponentBaseTest {
                String payloadData = null;
                path = Paths.get(rootPath + "/src/test/resources/CI/csars/jsonPropertyTypeTest.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setCsarUUID(payloadName);
                resourceDetails.setPayloadName(payloadName);
@@ -383,7 +382,7 @@ public class ExportToscaTest extends ComponentBaseTest {
                ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(toscaTemplate.getResponse(),
                                ArtifactUiDownloadData.class);
                byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
-               byte[] decodeBase64 = Base64.decodeBase64(fromUiDownload);
+               byte[] decodeBase64 = Base64.getDecoder().decode(fromUiDownload);
                Yaml yaml = new Yaml();
 
                InputStream inputStream = new ByteArrayInputStream(decodeBase64);
index eed1058..1ce10e3 100644 (file)
@@ -21,7 +21,6 @@
 package org.openecomp.sdc.ci.tests.execute.imports;
 
 import com.google.gson.Gson;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.WordUtils;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -737,7 +736,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
 
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                // create new resource from Csar
@@ -755,7 +754,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                // change composition (resource should be updated)
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_b.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                // change name
                resourceDetails.setName("test1");
@@ -782,7 +781,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                // wrong RI (without node types, resource shouldn't be updated)
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_c.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                // change name
                resourceDetails.setName("test3");
@@ -797,7 +796,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                resourceDetails = ElementFactory.getDefaultImportResource();
                path = Paths.get(rootPath + "/src/main/resources/ci/VF_RI2_G4_withArtifacts.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setPayloadName("VF_RI2_G4_withArtifacts.csar");
                resourceDetails.setName("test4");
@@ -813,7 +812,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                resourceDetails.setCsarUUID("VF_RI2_G4_withArtifacts_b.csar");
                path = Paths.get(rootPath + "/src/main/resources/ci/VF_RI2_G4_withArtifacts_b.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setPayloadName("VF_RI2_G4_withArtifacts_b.csar");
                resourceDetails.setName("test5");
@@ -834,7 +833,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
 
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                // create new resource from Csar
@@ -851,7 +850,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                // change composition and update resource
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_b.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setUniqueId(resource.getUniqueId());
                // change name
@@ -879,7 +878,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                // shouldn't be updated)
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_c.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                // change name
                resourceDetails.setName("test3");
@@ -1059,7 +1058,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
 
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                // create new resource from Csar
@@ -1077,7 +1076,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                // change composition (add new RI with specified property values)
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_d.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                // change name
                resourceDetails.setName("test1");
@@ -1092,7 +1091,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                // change composition (add new specified property values to existing RI)
                path = Paths.get(rootPath + "/src/main/resources/ci/valid_vf_f.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                // change name
                resourceDetails.setName("test2");
@@ -1445,7 +1444,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
 
                path = Paths.get(rootPath + "/src/test/resources/CI/csars/vmmc_relate_by_cap_name.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                // create new resource from Csar
@@ -1471,7 +1470,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
 
                path = Paths.get(rootPath + "/src/test/resources/CI/csars/vf_relate_by_cap_name.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                // create new resource from Csar
@@ -1644,7 +1643,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                String payloadName = "ImportArtifactsToVFC.csar";
                Path path = Paths.get(rootPath + "/src/test/resources/CI/csars/ImportArtifactsToVFC.csar");
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setPayloadName(payloadName);
                resourceDetails.setResourceType(ResourceTypeEnum.VF.name());
@@ -1663,7 +1662,7 @@ public class ImportCsarResourceTest extends ComponentBaseTest {
                payloadName = "ImportArtifactsToVFC_empty.csar";
                path = Paths.get(rootPath + "/src/test/resources/CI/csars/ImportArtifactsToVFC_empty.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setName(resourceDetails.getName()+"2");
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setPayloadName(payloadName);
index f529f00..9c24bd0 100644 (file)
@@ -21,7 +21,6 @@
 package org.openecomp.sdc.ci.tests.execute.imports;
 
 import com.google.gson.Gson;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.http.HttpStatus;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -161,7 +160,7 @@ public class ImportNewResourceCITest extends ComponentBaseTest {
                 + "  org.openecomp.resource.importResource4test:\r\n" + "    derived_from: tosca.nodes.Root\r\n"
                 + "    description: someDesc";
 
-        String encodedPayload = new String(Base64.encodeBase64(payload.getBytes()));
+        String encodedPayload = new String(Base64.getEncoder().encode(payload.getBytes()));
 
         String json = "{\r\n" + "  \"resourceName\": \"importResource4test\",\r\n"
                 + "  \"payloadName\": \"importResource4test.yml\",\r\n"
index 4338a1b..339eb16 100644 (file)
@@ -21,7 +21,7 @@
 package org.openecomp.sdc.ci.tests.execute.imports;
 
 import com.google.gson.Gson;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.junit.Rule;
 import org.junit.rules.TestName;
@@ -196,7 +196,7 @@ public class ImportToscaCapabilitiesWithProperties extends ComponentBaseTest {
                ImportReqDetails resourceDetails = ElementFactory.getDefaultImportResource();
                Path path = Paths.get(rootPath + "/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop.csar");
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                resourceDetails.setPayloadName(payloadName);
@@ -231,7 +231,7 @@ public class ImportToscaCapabilitiesWithProperties extends ComponentBaseTest {
                Path path = Paths
                                .get(rootPath + "/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop_failed.csar");
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                resourceDetails.setPayloadName(payloadName);
@@ -274,7 +274,7 @@ public class ImportToscaCapabilitiesWithProperties extends ComponentBaseTest {
                resourceDetails = ElementFactory.getDefaultImportResource();
                Path path = Paths.get(rootPath + "/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1.csar");
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                resourceDetails.setPayloadName(payloadName);
@@ -322,7 +322,7 @@ public class ImportToscaCapabilitiesWithProperties extends ComponentBaseTest {
                Path path = Paths
                                .get(rootPath + "/src/test/resources/CI/csars/vf_with_cap_prop_override_cap_type_prop1_failed.csar");
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                resourceDetails.setPayloadName(payloadName);
@@ -344,7 +344,7 @@ public class ImportToscaCapabilitiesWithProperties extends ComponentBaseTest {
 
                Path path = Paths.get(rootPath + "/src/test/resources/CI/csars/" + payloadName);
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                resourceDetails.setPayloadName(payloadName);
index 473e4f2..ecc1858 100644 (file)
@@ -21,7 +21,7 @@
 package org.openecomp.sdc.ci.tests.execute.imports;
 
 import com.google.gson.Gson;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.junit.Rule;
 import org.junit.rules.TestName;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -73,7 +73,7 @@ public class ImportUpdateResourseCsarTest extends ComponentBaseTest {
                String rootPath = System.getProperty("user.dir");
                Path path = Paths.get(rootPath + csarFolderPath + "orig2G.csar");
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setPayloadName(payloadName);
                resourceDetails.setName("TEST01");
@@ -87,7 +87,7 @@ public class ImportUpdateResourseCsarTest extends ComponentBaseTest {
                // update scar with new artifacts
                path = Paths.get(rootPath + csarFolderPath + "orig2G_update.csar");
                data = Files.readAllBytes(path);
-               payloadData = Base64.encodeBase64String(data);
+               payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setDescription("update");
                resourceDetails.setCsarVersion("2");
                updateResource = ResourceRestUtils.updateResource(resourceDetails, sdncModifierDetails,
@@ -270,7 +270,7 @@ public class ImportUpdateResourseCsarTest extends ComponentBaseTest {
 
                Path path = Paths.get(rootPath + csarFolderPath + payloadName);
                byte[] data = Files.readAllBytes(path);
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
 
                resourceDetails.setPayloadName(payloadName);
index fc717ca..2006a56 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
@@ -62,7 +62,7 @@ public class CsarParserUtils {
                ArtifactUiDownloadData artifactUiDownloadData = ResponseParser.parseToObject(csarResponse.getResponse(),
                                ArtifactUiDownloadData.class);
                byte[] fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
-               return Base64.decodeBase64(fromUiDownload);
+               return Base64.getDecoder().decode(fromUiDownload);
        }
        
        public static List<TypeHeatMetaDefinition> getListTypeHeatMetaDefinition(File csarFileLocation) throws Exception {
index 3b11388..7640c35 100644 (file)
 
 package org.openecomp.sdc.ci.tests.utils;
 
-import org.apache.commons.codec.binary.Base64;
-
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
+import java.util.Base64;
 
 public class Decoder {
 
        public static String encode(byte[] byteArrayToEncode) {
 
-               byte[] bytesEncoded = Base64.encodeBase64(byteArrayToEncode);
+               byte[] bytesEncoded = Base64.getEncoder().encode(byteArrayToEncode);
                String strEncoded = new String(bytesEncoded);
                return strEncoded;
        }
 
        public static String decode(String strEncoded) throws IOException {
 
-               byte[] byteDecoded = Base64.decodeBase64(strEncoded);
+               byte[] byteDecoded = Base64.getDecoder().decode(strEncoded);
                String decoded = new String(byteDecoded);
 
                return decoded;
index ea6ef62..035a0ba 100644 (file)
@@ -60,91 +60,8 @@ public final class Utils {
        String acceptHeaderDate = "application/json";
 
        public Utils() {
-               /*
-                * super();
-                * 
-                * StartTest.enableLogger(); logger =
-                * Logger.getLogger(Utils.class.getName());
-                */
-
        }
 
-       // public String serviceTopologyPattern = "/topology/topology/%s";
-       // public String serviceTopologyTemplatePattern =
-       // "/topologytemplate/topologytemplate/%s";
-       //
-       // public String serviceTopologySearchPattern =
-       // "topology/topology/_search?q=%s";
-       // public String serviceTopologyTemplateSearchPattern =
-       // "topologytemplate/topologytemplate/_search?q=%s";
-       //
-       // public ArtifactTypeEnum getFileTypeByExtension(String fileName) {
-       //
-       // String fileExtension = null;
-       // if (fileName.matches("(.*)\\.(.*)")) {
-       // System.out.println(fileName.substring(fileName.lastIndexOf(".") + 1));
-       // fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
-       // }
-       //
-       // switch (fileExtension) {
-       // case "sh":
-       // return ArtifactTypeEnum.SHELL_SCRIPT;
-       // case "png":
-       // return ArtifactTypeEnum.ICON;
-       // case "ppp":
-       // return ArtifactTypeEnum.PUPPET;
-       // case "yang":
-       // return ArtifactTypeEnum.YANG;
-       // default:
-       // return ArtifactTypeEnum.UNKNOWN;
-       // }
-       //
-       // }
-       //
-       // public ArrayList<String> getScriptList (List<UploadArtifactInfo>
-       // artifactsList){
-       //
-       // ArrayList<String> scriptNameArray = new ArrayList<>();
-       // if (artifactsList != null){
-       // for (UploadArtifactInfo fileInArtifactsList : artifactsList){
-       // String artifactFileName = fileInArtifactsList.getArtifactName();
-       // ArtifactTypeEnum artifactFileType =
-       // fileInArtifactsList.getArtifactType();
-       // if (! artifactFileType.equals(ArtifactTypeEnum.ICON)){
-       // scriptNameArray.add(artifactFileName);
-       // }
-       // continue;
-       // }
-       // return scriptNameArray;
-       // }
-       // return null;
-       // }
-       //
-       //
-       // public String getYamlFileLocation(File testResourcesPath) {
-       // File[] files = testResourcesPath.listFiles();
-       // if (files.length == 0){
-       // return null;
-       // }else{
-       // for (int i = 0; i < files.length; i++){
-       // if (files[i].isFile()){
-       // return files[i].getAbsoluteFile().toString();
-       // }
-       // }
-       // }
-       // return null;
-       // }
-       //
-       // public String readFileContentToString (String fileName) throws
-       // IOException {
-       //
-       // Path path = Paths.get(fileName);
-       // String stringFromFile = new String(Files.readAllBytes(path));
-       // return stringFromFile;
-       //
-       //
-       // }
-       //
        @SuppressWarnings("unchecked")
        public ToscaNodeTypeInfo parseToscaNodeYaml(String fileContent) {
 
@@ -186,31 +103,6 @@ public final class Utils {
                return result;
        }
 
-       //
-       //
-       // public ArtifactsMetadata getArtifactsMetadata(String response){
-       // ArtifactsMetadata artifactsMetadata = new ArtifactsMetadata();
-       //
-       // artifactsMetadata.setId(getJsonObjectValueByKey(response, "id"));
-       // artifactsMetadata.setName(getJsonObjectValueByKey(response, "name"));
-       // artifactsMetadata.setType(getJsonObjectValueByKey(response, "type"));
-       //
-       // artifactsMetadata.setCreator(getJsonObjectValueByKey(response,
-       // "creator"));
-       // artifactsMetadata.setCreationTime(getJsonObjectValueByKey(response,
-       // "creationTime"));
-       // artifactsMetadata.setLastUpdateTime(getJsonObjectValueByKey(response,
-       // "lastUpdateTime"));
-       // artifactsMetadata.setChecksum(getJsonObjectValueByKey(response,
-       // "checksum"));
-       // artifactsMetadata.setDescription(getJsonObjectValueByKey(response,
-       // "description"));
-       // artifactsMetadata.setLastUpdater(getJsonObjectValueByKey(response,
-       // "lastUpdater"));
-       //
-       // return artifactsMetadata;
-       // }
-       //
        public static String getJsonObjectValueByKey(String metadata, String key) {
                JsonElement jelement = new JsonParser().parse(metadata);
 
@@ -239,314 +131,7 @@ public final class Utils {
                }
                return config;
        }
-       // public void uploadNormativeTypes() throws IOException{
-       // Config config = getConfig();
-       // String[] normativeTypes = {"root", "compute", "blockStorage",
-       // "softwareComponent", "DBMS", "database", "network", "objectStorage",
-       // "webServer", "webApplication"};
-       // for( String normativeType : normativeTypes ){
-       // uploadComponent(config.getComponentsConfigDir()+File.separator+"normativeTypes"+File.separator+normativeType);
-       // }
-       //
-       // }
-       //
-       // public void uploadApacheComponent() throws IOException{
-       // Config config = getConfig();
-       // uploadComponent(config.getComponentsConfigDir()+File.separator+"apache");
-       // }
-       //
-       // public void uploadComponent(String componentDir) throws IOException{
-       //
-       // //*********************************************upload*************************************************************
-       // Config config = getConfig();
-       // ZipDirectory zipDirectory = new ZipDirectory();
-       // System.out.println(config.getEsHost());
-       //
-       // List<UploadArtifactInfo> artifactsList = new
-       // ArrayList<UploadArtifactInfo>();
-       //
-       //// read test resources and zip it as byte array
-       // byte[] zippedAsByteArray = zipDirectory.zip(componentDir, artifactsList);
-       //
-       //// encode zipped directory using base64
-       // String payload = Decoder.encode(zippedAsByteArray);
-       //
-       //// zip name build as testName with ".zip" extension
-       // String payloadZipName = getPayloadZipName(componentDir);
-       //
-       //// build json
-       // UploadResourceInfo resourceInfo = new UploadResourceInfo(payload,
-       // payloadZipName, "description", "category/mycategory", null,
-       // artifactsList);
-       // String json = new Gson().toJson(resourceInfo);
-       //
-       //// calculate md5 on the content of json
-       // String jsonMd5 =
-       // org.apache.commons.codec.digest.DigestUtils.md5Hex(json);
-       //
-       //// encode the md5 to base64, sent as header in post http request
-       // String encodedMd5 = Decoder.encode(jsonMd5.getBytes());
-       //
-       //// upload component to Elastic Search DB
-       // String url = null;
-       // HttpRequest http = new HttpRequest();
-       //
-       // url = String.format(Urls.UPLOAD_ZIP_URL, config.getCatalogFeHost(),
-       // config.getCatalogFePort());
-       //
-       //// Prepare headers to post upload component request
-       // HeaderData headerData = new HeaderData(encodedMd5, "application/json",
-       // "att", "test", "testIvanovich", "RoyalSeal", "Far_Far_Away",
-       // "getResourceArtifactListTest");
-       //
-       // MustHeaders headers = new MustHeaders(headerData);
-       // System.out.println("headers:"+headers.getMap());
-       //
-       // RestResponse response = http.httpSendPost(url, json, headers.getMap());
-       //
-       // assertEquals("upload component failed with code " +
-       // response.getErrorCode().intValue(),response.getErrorCode().intValue(),
-       // 204);
-       // }
-       //
-       // private String getPayloadZipName(String componentDir) {
-       // String payloadName;
-       // if( componentDir.contains( File.separator) ){
-       // String delimiter = null;
-       // if( File.separator.equals("\\")){
-       // delimiter ="\\\\";
-       // }
-       // else{
-       // delimiter = File.separator;
-       // }
-       // String[] split = componentDir.split(delimiter);
-       // payloadName = split[split.length-1];
-       // }
-       // else{
-       // payloadName = componentDir;
-       // }
-       // return payloadName+".zip";
-       // }
-       //
-       //
-       //
-       // public List<UploadArtifactInfo> createArtifactsList(String srcDir) {
-       //
-       // List<UploadArtifactInfo> artifactsList = new
-       // ArrayList<UploadArtifactInfo>();
-       // File srcFile = new File(srcDir);
-       // addFileToList(srcFile, artifactsList);
-       //
-       // return artifactsList;
-       // }
-       //
-       // public void addFileToList(File srcFile, List<UploadArtifactInfo>
-       // artifactsList) {
-       //
-       // File[] files = srcFile.listFiles();
-       //
-       // for (int i = 0; i < files.length; i++) {
-       // // if the file is directory, use recursion
-       // if (files[i].isDirectory()) {
-       // addFileToList(files[i], artifactsList);
-       // continue;
-       // }
-       //
-       // String fileName = files[i].getName();
-       // String artifactPath = fileName;
-       //
-       // if ( ! files[i].getName().matches("(.*)\\.y(?)ml($)")) {
-       // UploadArtifactInfo uploadArtifactInfo = new UploadArtifactInfo();
-       // uploadArtifactInfo.setArtifactName(files[i].getName());
-       // String parent = files[i].getParent();
-       //
-       // if (parent != null) {
-       // System.out.println(parent);
-       // int lastSepartor = parent.lastIndexOf(File.separator);
-       // if (lastSepartor > -1) {
-       // String actualParent = parent.substring(lastSepartor + 1);
-       // artifactPath = actualParent + "/" + artifactPath;
-       // }
-       // }
-       //
-       // uploadArtifactInfo.setArtifactPath(artifactPath);
-       // uploadArtifactInfo.setArtifactType(getFileTypeByExtension(fileName));
-       // uploadArtifactInfo.setArtifactDescription("description");
-       // artifactsList.add(uploadArtifactInfo);
-       //
-       // System.out.println("artifact list: " + artifactsList);
-       //
-       // }
-       //
-       // }
-       // }
-       //
-       //
-       // public String buildArtifactListUrl (String nodesType, String
-       // templateVersion, String artifactName) throws FileNotFoundException{
-       // //"http://172.20.43.132/sdc2/v1/catalog/resources/tosca.nodes.Root/1.0.0.wd03-SNAPSHOT/artifacts/wxs_baseline_compare.sh"
-       // Config config = getConfig();
-       // return "\"http://" + config.getCatalogBeHost() + ":" +
-       // config.getCatalogBePort() + "/sdc2/v1/catalog/resources/" +nodesType +
-       // "/" + templateVersion + "/artifacts/" + artifactName +"\"";
-       // }
-       //
-       //
-       // public void addTopologyToES(String testFolder, String
-       // serviceTopologyPattern) throws IOException{
-       // Config config = getConfig();
-       // String url = String.format(Urls.ES_URL, config.getEsHost(),
-       // config.getEsPort()) + serviceTopologyPattern;
-       // String sourceDir =
-       // config.getResourceConfigDir()+File.separator+testFolder;
-       // Path filePath = FileSystems.getDefault().getPath(sourceDir,
-       // "topology.txt");
-       // postFileContentsToUrl(url, filePath);
-       // }
-       //
-       // public void addTopologyTemplateToES(String testFolder, String
-       // serviceTopologyTemplatePattern) throws IOException{
-       // Config config = getConfig();
-       // String url = String.format(Urls.ES_URL, config.getEsHost(),
-       // config.getEsPort()) + serviceTopologyTemplatePattern;
-       // String sourceDir =
-       // config.getResourceConfigDir()+File.separator+testFolder;
-       // Path filePath = FileSystems.getDefault().getPath(sourceDir,
-       // "topologyTemplate.txt");
-       // postFileContentsToUrl(url, filePath);
-       // }
-       //
-       //
-       // public void postFileContentsToUrl(String url, Path filePath) throws
-       // IOException {
-       // HttpClientContext localContext = HttpClientContext.create();
-       // CloseableHttpResponse response = null;
-       //
-       // byte[] fileContent = Files.readAllBytes(filePath);
-       //
-       // try(CloseableHttpClient httpClient = HttpClients.createDefault()){
-       // HttpPost httpPost = new HttpPost(url);
-       // StringEntity entity = new StringEntity(new String(fileContent) ,
-       // ContentType.APPLICATION_JSON);
-       // httpPost.setEntity(entity);
-       // response = httpClient.execute(httpPost, localContext);
-       //
-       // }
-       // finally{
-       // response.close();
-       // }
-       //
-       //
-       // }
-       //
-       //
-       //// public boolean isPatternInEsDb(String patternToSearch)throws
-       // IOException{
-       //// Config config = getConfig();
-       //// String url = String.format(Urls.GET_SEARCH_DATA_FROM_ES,
-       // config.getEsHost(), config.getEsPort(),patternToSearch);
-       //// HttpRequest httpRequest = new HttpRequest();
-       //// RestResponse restResponse = httpRequest.httpSendGet(url);
-       //// if (restResponse.getErrorCode() == 200){
-       //// return true;
-       //// }
-       //// if (restResponse.getErrorCode() == 404){
-       //// return false;
-       //// }
-       ////
-       //// return false;
-       //// }
-       //
-       // public static RestResponse deleteAllDataFromEs() throws IOException{
-       // return deleteFromEsDbByPattern("_all");
-       // }
-       //
 
-       //
-       // public List<String> buildIdArrayListByTypesIndex (String index, String
-       // types) throws IOException{
-       //
-       // Config config = getConfig();
-       // HttpRequest http = new HttpRequest();
-       // RestResponse getResponce =
-       // http.httpSendGet(String.format(Urls.GET_ID_LIST_BY_INDEX_FROM_ES,
-       // config.getEsHost(), config.getEsPort(), index, types), null);
-       //
-       // List <String> idArray = new ArrayList<String>();
-       //
-       // JsonElement jelement = new JsonParser().parse(getResponce.getResponse());
-       // JsonObject jobject = jelement.getAsJsonObject();
-       // JsonObject hitsObject = (JsonObject) jobject.get("hits");
-       // JsonArray hitsArray = (JsonArray) hitsObject.get("hits");
-       // for (int i = 0; i < hitsArray.size(); i ++){
-       // JsonObject idObject = (JsonObject) hitsArray.get(i);
-       // String id = idObject.get("_id").toString();
-       // id = id.replace("\"", "");
-       // idArray.add(id);
-       // }
-       //
-       // return idArray;
-       // }
-       //
-       // public List<String> buildCategoriesTagsListFromJson(String
-       // categoriesTagsJson){
-       //
-       // ArrayList<String> categoriesTagsArray = new ArrayList<>();
-       // JsonElement jelement = new JsonParser().parse(categoriesTagsJson);
-       // JsonArray jArray = jelement.getAsJsonArray();
-       // for (int i = 0; i < jArray.size(); i ++){
-       // JsonObject categoriesTagsObject = (JsonObject) jArray.get(i);
-       // String categories = categoriesTagsObject.get("name").toString();
-       // categoriesTagsArray.add(categories);
-       // }
-       //
-       // return categoriesTagsArray;
-       // }
-       //
-       // public ArrayList <String> getCategoriesFromDb() throws Exception{
-       //
-       // ArrayList<String> categoriesFromDbArrayList = new ArrayList<>();
-       // RestResponse restResponse = new RestResponse();
-       // String contentTypeHeaderData = "application/json";
-       // String acceptHeaderDate = "application/json";
-       //
-       // Map<String, String> headersMap = new HashMap<String,String>();
-       // headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(),contentTypeHeaderData);
-       // headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), acceptHeaderDate);
-       //
-       // HttpRequest httpRequest = new HttpRequest();
-       // String url = String.format(Urls.QUERY_NEO4J,
-       // Config.instance().getNeoHost(), Config.instance().getNeoPort());
-       // String body = "{\"statements\" : [ { \"statement\" : \"MATCH
-       // (category:category) return (category)\"} ]}";
-       // restResponse = httpRequest.httpSendPostWithAuth(url, body, headersMap,
-       // Config.instance().getNeoDBusername(),
-       // Config.instance().getNeoDBpassword());
-       //
-       // if (restResponse.getResponse()==null){
-       // return categoriesFromDbArrayList;
-       // }else{
-       // JsonElement jelement = new
-       // JsonParser().parse(restResponse.getResponse());
-       // JsonObject jobject = jelement.getAsJsonObject();
-       // JsonArray resultsArray = (JsonArray) jobject.get("results");
-       // JsonObject resObject = (JsonObject) resultsArray.get(0);
-       // JsonArray dataArray = (JsonArray) resObject.get("data");
-       // for (int i = 0; i < dataArray.size(); i ++){
-       // JsonObject rowObject = (JsonObject) dataArray.get(i);
-       // JsonArray rowArray = (JsonArray) rowObject.get("row");
-       // JsonObject nameObject = (JsonObject) rowArray.get(0);
-       // String name = nameObject.get("name").toString();
-       //// name = name.replace("\"", "");
-       // categoriesFromDbArrayList.add(name);
-       // }
-       //
-       //
-       // }
-       //
-       // return categoriesFromDbArrayList;
-       // }
-       //
        public static void compareArrayLists(List<String> actualArraylList, List<String> expectedArrayList,
                        String message) {
 
index 8e5079d..8505bf0 100644 (file)
@@ -23,7 +23,7 @@ package org.openecomp.sdc.ci.tests.utils.general;
 import com.aventstack.extentreports.Status;
 import com.google.gson.Gson;
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.commons.lang3.tuple.Pair;
 import org.json.JSONException;
 import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
@@ -821,7 +821,7 @@ public final class AtomicOperationUtils {
                Path path = Paths.get(csarFilePath + File.separator + csarFileName);
                byte[] data = Files.readAllBytes(path);
                String payloadName = csarFileName;
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setCsarUUID(payloadName);
                resourceDetails.setPayloadName(payloadName);
@@ -836,7 +836,7 @@ public final class AtomicOperationUtils {
                Path path = Paths.get(csarFilePath + File.separator + csarFileName);
                data = Files.readAllBytes(path);
                String payloadName = csarFileName;
-               String payloadData = Base64.encodeBase64String(data);
+               String payloadData = Base64.getEncoder().encodeToString(data);
                ImportReqDetails resourceDetails = new ImportReqDetails(resource, payloadName, payloadData);
                resourceDetails.setPayloadData(payloadData);
                resourceDetails.setCsarUUID(payloadName);
index f9ce645..48a2fd0 100644 (file)
@@ -22,7 +22,7 @@ package org.openecomp.sdc.ci.tests.utils.general;
 
 import com.google.gson.Gson;
 import fj.data.Either;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.Resource;
 import org.openecomp.sdc.be.model.User;
@@ -86,7 +86,7 @@ public class OnboardingUtillViaApis {
                @SuppressWarnings("unchecked")
                Map<String, String> fromJson = gson.fromJson(payload, Map.class);
                String string = fromJson.get("base64Contents").toString();
-               byte[] byteArray = Base64.decodeBase64(string.getBytes(StandardCharsets.UTF_8));
+               byte[] byteArray = Base64.getDecoder().decode(string.getBytes(StandardCharsets.UTF_8));
                File downloadedFile = new File(file.getAbsolutePath());
                FileOutputStream fos = new FileOutputStream(downloadedFile);
                fos.write(byteArray);
index 7daf1bd..6d4c903 100644 (file)
@@ -20,8 +20,9 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
+import com.google.common.hash.Hashing;
 import com.google.gson.Gson;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -892,9 +893,9 @@ public class ArtifactRestUtils extends BaseRestUtils {
        }
        
        public static String calculateMD5 (String data){
-               String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data);
+               String calculatedMd5 = Hashing.md5().hashBytes(data.getBytes()).toString();
                // encode base-64 result
-               byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes());
+               byte[] encodeBase64 = Base64.getEncoder().encode(calculatedMd5.getBytes());
                String encodeBase64Str = new String(encodeBase64);
                return encodeBase64Str;
 
index 56859ff..4a3cb8c 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
@@ -46,7 +46,7 @@ public class BaseRestUtils extends BaseValidationUtils {
        public static final String acceptJsonHeader = "application/json";
        public static final String acceptOctetHeader = "application/octet-stream";
        public static final String acceptMultipartHeader = "application/octet-stream";
-       public static final String authorizationHeader = "Basic " + Base64.encodeBase64String("ci:123456".getBytes());
+       public static final String authorizationHeader = "Basic " + Base64.getEncoder().encodeToString("ci:123456".getBytes());
        public static final String acceptOctetStream = "application/octet-stream";
        public static final String ecomp = "ecomp";
        public static final String authorizationPrefixString = "Basic ";
@@ -258,7 +258,7 @@ public class BaseRestUtils extends BaseValidationUtils {
 
        public static Map<String, String> addAuthorizeHeader(String userName, String password) {
                String userCredentials = userName + ":" + password;
-               encodeBase64 = Base64.encodeBase64(userCredentials.getBytes());
+               encodeBase64 = Base64.getEncoder().encode(userCredentials.getBytes());
                String encodedUserCredentials = authorizationPrefixString + new String(encodeBase64);
                Map<String, String> authorizationHeader = new HashMap<>();
                authorizationHeader.put(HttpHeaderEnum.AUTHORIZATION.getValue(), encodedUserCredentials);
index 30e54d3..3288aa9 100644 (file)
 
 package org.openecomp.sdc.ci.tests.utils.rest;
 
-//import com.fasterxml.jackson.databind.DeserializationFeature;
-//import com.fasterxml.jackson.databind.ObjectMapper;
-//import com.fasterxml.jackson.databind.module.SimpleModule;
-//import com.google.gson.*;
-//import org.apache.commons.codec.binary.Base64;
-//import org.apache.log4j.Logger;
-//import org.codehaus.jackson.JsonNode;
-//
-//import org.json.JSONArray;
-//import org.json.JSONException;
-//import org.json.simple.JSONObject;
-//import org.json.simple.JSONValue;
-//import org.openecomp.sdc.be.model.*;
-//import org.openecomp.sdc.be.model.category.CategoryDefinition;
-//import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserializer;;
-//import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
-//import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure;
-//import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject;
-//import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus;
-//import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
-//import org.openecomp.sdc.ci.tests.tosca.datatypes.VfModuleDefinition;
-//import org.openecomp.sdc.ci.tests.utils.Utils;
-//import org.yaml.snakeyaml.Yaml;
-//
-//import java.io.ByteArrayInputStream;
-//import java.io.IOException;
-//import java.io.InputStream;
-//import java.text.ParseException;
-//import java.util.*;
-
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.exc.InvalidFormatException;
 import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.google.common.hash.Hashing;
 import com.google.gson.*;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -398,9 +368,9 @@ public class ResponseParser {
        }
 
        public static String calculateMD5(String data) {
-               String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data);
+               String calculatedMd5 = Hashing.md5().hashBytes(data.getBytes()).toString();
                // encode base-64 result
-               byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes());
+               byte[] encodeBase64 = Base64.getEncoder().encode(calculatedMd5.getBytes());
                String encodeBase64Str = new String(encodeBase64);
                return encodeBase64Str;
 
index 917d980..a7e9919 100644 (file)
@@ -22,7 +22,7 @@ package org.openecomp.sdc.externalApis;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpGet;
@@ -263,7 +263,7 @@ public class GetAssetServlet extends ComponentBaseTest {
                res = new byte[len];
                inputStream.read(res, 0, len);
                fromUiDownload = artifactUiDownloadData.getBase64Contents().getBytes();
-               assertEquals(Base64.encodeBase64(res), fromUiDownload);
+               assertEquals(Base64.getEncoder().encode(res), fromUiDownload);
                fileName = assetResponse.getFirstHeader(Constants.CONTENT_DISPOSITION_HEADER).getValue();
                assertEquals(fileName, new StringBuilder().append("attachment; filename=\"")
                                .append(artifactUiDownloadData.getArtifactName()).append("\"").toString());
index 9f5e201..99c19b0 100644 (file)
@@ -38,14 +38,21 @@ import org.apache.http.entity.StringEntity;
 import org.mockserver.integration.ClientAndServer;
 import org.mockserver.model.Header;
 import org.mockserver.model.HttpRequest;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.consumer.IConfiguration;
-import org.openecomp.sdc.api.consumer.IFinalDistrStatusMessage;
-import org.openecomp.sdc.api.consumer.INotificationCallback;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.IConfiguration;
+import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
+import org.onap.sdc.api.consumer.INotificationCallback;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.http.HttpAsdcClient;
+import org.onap.sdc.http.HttpAsdcResponse;
+import org.onap.sdc.http.IHttpAsdcClient;
+import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.utils.ArtifactTypeEnum;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.utils.DistributionStatusEnum;
 import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;
 import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao;
 import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum;
@@ -53,13 +60,6 @@ import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
 import org.openecomp.sdc.common.datastructure.FunctionalInterfaces;
 import org.openecomp.sdc.common.datastructure.Wrapper;
 import org.openecomp.sdc.cucumber.spring.ImportTableConfig;
-import org.openecomp.sdc.http.HttpAsdcClient;
-import org.openecomp.sdc.http.HttpAsdcResponse;
-import org.openecomp.sdc.http.IHttpAsdcClient;
-import org.openecomp.sdc.impl.DistributionClientFactory;
-import org.openecomp.sdc.utils.ArtifactTypeEnum;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
 import java.util.*;
index 22ffc25..e54e7d8 100644 (file)
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty</artifactId>
                                </exclusion>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
                        </exclusions>
                </dependency>
 
                        <artifactId>selenium-server</artifactId>
                        <version>2.53.1</version>
                        <scope>runtime</scope>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
                <dependency>
                        <artifactId>httpclient</artifactId>
                        <version>${httpclient.version}</version>
                        <scope>compile</scope>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+                               </exclusion>
+                       </exclusions>
                </dependency>
 
                <dependency>
                </dependency>
 
                <dependency>
-                       <groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
+                       <groupId>org.onap.sdc.sdc-distribution-client</groupId>
                        <artifactId>sdc-distribution-client</artifactId>
-                       <version>1.2.3</version>
+                       <version>1.4.1</version>
                        <scope>compile</scope>
                </dependency>
 
                        <scope>compile</scope>
                </dependency>
 
-               <dependency>
-                       <groupId>commons-codec</groupId>
-                       <artifactId>commons-codec</artifactId>
-                       <version>${commons-codec}</version>
-                       <scope>compile</scope>
-               </dependency>
-
                <dependency>
                        <groupId>com.aventstack</groupId>
                        <artifactId>extentreports</artifactId>
index 6f405cb..5861a6f 100644 (file)
                        <groupId>org.apache.httpcomponents</groupId>
                        <artifactId>httpclient</artifactId>
                        <version>4.5.3</version>
+      <exclusions>
+        <exclusion>
+                                       <groupId>commons-codec</groupId>
+                                       <artifactId>commons-codec</artifactId>
+        </exclusion>
+      </exclusions>
                </dependency>
 
 
                        <version>2.4</version>
                </dependency>
 
-               <dependency>
-                       <groupId>commons-codec</groupId>
-                       <artifactId>commons-codec</artifactId>
-                       <version>1.9</version>
-                       <scope>compile</scope>
-               </dependency>
-
                <dependency>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-proxy</artifactId>