diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-05-13 22:29:24 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2018-05-13 20:48:31 +0000 |
commit | 2924a3dbb7e0f50b239287fb11f6ec8c2235522a (patch) | |
tree | 09d3ff88fce749f2b0665a047afcefd9ab2ce167 /catalog-be/src | |
parent | 12368941ba74929ab71a6baab04e1692c256af74 (diff) |
Raise JUnit coverage common-be
Change-Id: If7b31082105378901e9a09e26a8cc1b5737eb425
Issue-ID: SDC-1298
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src')
403 files changed, 6868 insertions, 3116 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java index eed347f781..1ea8ff9541 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/api/AuditEventFactory.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.auditing.api; +import java.util.List; + import org.javatuples.Pair; import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; -import java.util.List; - public interface AuditEventFactory { String getLogMessage(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactory.java index 8636c1b01d..2ccc7910fa 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactory.java @@ -1,5 +1,8 @@ package org.openecomp.sdc.be.auditing.impl; +import java.util.Collections; +import java.util.List; + import org.apache.commons.lang.StringUtils; import org.javatuples.Pair; import org.openecomp.sdc.be.auditing.api.AuditEventFactory; @@ -7,9 +10,6 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; -import java.util.Collections; -import java.util.List; - public abstract class AuditBaseEventFactory implements AuditEventFactory { //TODO imanzon: Check if requestId and serviceInstanceId fields are required for all tables. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingLogFormatUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingLogFormatUtil.java index ee4b70c0f6..92baba260c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingLogFormatUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingLogFormatUtil.java @@ -20,6 +20,12 @@ package org.openecomp.sdc.be.auditing.impl; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Formatter; +import java.util.Locale; +import java.util.Map; + import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; @@ -28,12 +34,6 @@ import org.slf4j.LoggerFactory; import org.slf4j.Marker; import org.slf4j.MarkerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Formatter; -import java.util.Locale; -import java.util.Map; - public class AuditingLogFormatUtil { // When adding any new fields here, please keep the convention <fieldName>= diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java index 19eab0a409..daf16390ae 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditingManager.java @@ -20,6 +20,9 @@ package org.openecomp.sdc.be.auditing.impl; +import java.util.Map; +import java.util.Map.Entry; + import org.openecomp.sdc.be.auditing.api.AuditEventFactory; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -36,9 +39,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.Map; -import java.util.Map.Entry; - @Component public class AuditingManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java index 8c6b7dd3fb..9a71adb0cb 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java @@ -1,9 +1,21 @@ package org.openecomp.sdc.be.components.csar; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import fj.data.Either; +import static org.openecomp.sdc.be.tosca.CsarUtils.ARTIFACTS_PATH; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -50,21 +62,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; -import static org.openecomp.sdc.be.tosca.CsarUtils.ARTIFACTS_PATH; +import fj.data.Either; @org.springframework.stereotype.Component("csarArtifactsAndGroupsBusinessLogic") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/AaiRequestHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/AaiRequestHandler.java index 0519f435e3..2730ee413b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/AaiRequestHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/AaiRequestHandler.java @@ -1,5 +1,14 @@ package org.openecomp.sdc.be.components.distribution.engine; +import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.util.Properties; +import java.util.UUID; + +import javax.annotation.PostConstruct; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; + import org.apache.http.conn.ConnectTimeoutException; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.common.api.Constants; @@ -14,14 +23,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import java.net.ConnectException; -import java.net.SocketTimeoutException; -import java.util.Properties; -import java.util.UUID; - @Component public class AaiRequestHandler { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ArtifactInfoImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ArtifactInfoImpl.java index 9c46c68cd8..9a5bc33fb3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ArtifactInfoImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ArtifactInfoImpl.java @@ -20,18 +20,18 @@ package org.openecomp.sdc.be.components.distribution.engine; -import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; - import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; + public class ArtifactInfoImpl implements IArtifactInfo { private String artifactName; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java index 3251f3d047..c52bad9abb 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponse.java @@ -20,11 +20,11 @@ package org.openecomp.sdc.be.components.distribution.engine; -import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; - import java.util.ArrayList; import java.util.List; +import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; + public class CambriaErrorResponse { public static final int HTTP_OK = 200; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java index d6fee9a9d3..ffac7843fd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandler.java @@ -20,6 +20,25 @@ package org.openecomp.sdc.be.components.distribution.engine; +import java.io.IOException; +import java.net.MalformedURLException; +import java.security.GeneralSecurityException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.http.HttpStatus; +import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + import com.att.nsa.apiClient.credentials.ApiCredential; import com.att.nsa.apiClient.http.HttpException; import com.att.nsa.apiClient.http.HttpObjectNotFoundException; @@ -37,25 +56,8 @@ import com.att.nsa.cambria.client.CambriaPublisher.message; import com.att.nsa.cambria.client.CambriaTopicManager; import com.google.common.annotations.VisibleForTesting; import com.google.gson.Gson; -import fj.data.Either; -import org.apache.http.HttpStatus; -import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import java.io.IOException; -import java.net.MalformedURLException; -import java.security.GeneralSecurityException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import fj.data.Either; @Component("cambriaHandler") public class CambriaHandler { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DME2EndpointIteratorCreator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DME2EndpointIteratorCreator.java index 94fff3cfaa..780a40c118 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DME2EndpointIteratorCreator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DME2EndpointIteratorCreator.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.components.distribution.engine; +import org.springframework.stereotype.Component; + import com.att.aft.dme2.api.DME2Exception; import com.att.aft.dme2.api.DME2Manager; import com.att.aft.dme2.iterator.DME2EndpointIterator; import com.att.aft.dme2.iterator.factory.DME2EndpointIteratorFactory; -import org.springframework.stereotype.Component; - @Component public class DME2EndpointIteratorCreator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java index 7d2d4680b5..19878c3cfe 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java @@ -20,6 +20,19 @@ package org.openecomp.sdc.be.components.distribution.engine; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.annotation.Resource; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation; @@ -36,14 +49,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.annotation.Resource; -import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - @Component("distributionEngine") public class DistributionEngine implements IDistributionEngine { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java index 9599879006..48533f1518 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java @@ -20,26 +20,32 @@ package org.openecomp.sdc.be.components.distribution.engine; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; -import org.openecomp.sdc.common.config.EcompErrorName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicBoolean; - @Component("distribution-engine-cluster-health") public class DistributionEngineClusterHealth { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTask.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTask.java index 1759f69b3e..043efdf81d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTask.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTask.java @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.components.distribution.engine; -import fj.data.Either; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; @@ -30,14 +38,7 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; +import fj.data.Either; public class DistributionEngineInitTask implements Runnable { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTask.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTask.java index b4f4863284..d41d334bff 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTask.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTask.java @@ -20,10 +20,11 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.att.nsa.cambria.client.CambriaConsumer; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.openecomp.sdc.be.components.distribution.engine.report.DistributionCompleteReporter; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -35,10 +36,11 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; +import com.att.nsa.cambria.client.CambriaConsumer; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import fj.data.Either; public class DistributionEnginePollingTask implements Runnable { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapClientFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapClientFactory.java index 3d35a84d7a..9c4f8e1457 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapClientFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapClientFactory.java @@ -1,18 +1,20 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.att.nsa.mr.client.MRClientFactory; -import com.att.nsa.mr.client.MRConsumer; -import fj.data.Either; +import java.io.File; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Properties; + import org.openecomp.sdc.be.config.DmaapConsumerConfiguration; import org.openecomp.sdc.security.SecurityUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.io.File; -import java.io.IOException; -import java.security.GeneralSecurityException; -import java.util.Properties; +import com.att.nsa.mr.client.MRClientFactory; +import com.att.nsa.mr.client.MRConsumer; + +import fj.data.Either; /** * Allows to create DMAAP client of type MRConsumer according received configuration parameters diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java index e0661f4b22..ef81b39f24 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java @@ -1,6 +1,11 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.att.nsa.mr.client.MRConsumer; +import java.lang.Thread.UncaughtExceptionHandler; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; + import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DmaapConsumerConfiguration; import org.slf4j.Logger; @@ -8,11 +13,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.lang.Thread.UncaughtExceptionHandler; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; +import com.att.nsa.mr.client.MRConsumer; /** * Allows consuming DMAAP topic according to received consumer parameters diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java index ba5e9f7c9c..a215efd30d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealth.java @@ -1,17 +1,9 @@ package org.openecomp.sdc.be.components.distribution.engine; -import org.apache.commons.validator.routines.UrlValidator; -import org.apache.http.client.utils.URIUtils; -import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.config.DmaapConsumerConfiguration; -import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; +import static org.apache.commons.lang3.StringUtils.countMatches; +import static org.apache.commons.lang3.StringUtils.isNotBlank; +import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_DMAAP_ENGINE; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; import java.io.IOException; import java.net.InetAddress; import java.net.URI; @@ -22,8 +14,18 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import static org.apache.commons.lang3.StringUtils.*; -import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_DMAAP_ENGINE; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + +import org.apache.commons.validator.routines.UrlValidator; +import org.apache.http.client.utils.URIUtils; +import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.config.DmaapConsumerConfiguration; +import org.openecomp.sdc.common.api.HealthCheckInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; @Component("dmaapHealth") public class DmaapHealth { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentMessageBusData.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentMessageBusData.java index 67977b6361..d3937a4ed2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentMessageBusData.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentMessageBusData.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.distribution.engine; -import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; - import java.util.ArrayList; import java.util.List; +import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; + /** * a pojo which holds all the necessary data to communicate with the message bus * this class is a reflection ot the {@link OperationalEnvironmentEntry} class diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java index 822464c631..dc83b72101 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngine.java @@ -1,14 +1,22 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.att.aft.dme2.api.DME2Exception; -import com.att.aft.dme2.iterator.DME2EndpointIterator; -import com.att.aft.dme2.iterator.domain.DME2EndpointReference; -import com.att.aft.dme2.manager.registry.DME2Endpoint; -import com.att.nsa.apiClient.credentials.ApiCredential; -import com.google.common.annotations.VisibleForTesting; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import static org.apache.commons.lang3.StringUtils.isEmpty; +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.runMethodWithTimeOut; + +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; + import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; import org.openecomp.sdc.be.components.distribution.engine.IDmaapNotificationData.DmaapActionEnum; @@ -31,22 +39,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; -import java.lang.Thread.UncaughtExceptionHandler; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collectors; +import com.att.aft.dme2.api.DME2Exception; +import com.att.aft.dme2.iterator.DME2EndpointIterator; +import com.att.aft.dme2.iterator.domain.DME2EndpointReference; +import com.att.aft.dme2.manager.registry.DME2Endpoint; +import com.att.nsa.apiClient.credentials.ApiCredential; +import com.google.common.annotations.VisibleForTesting; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; -import static org.apache.commons.lang3.StringUtils.isEmpty; -import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.runMethodWithTimeOut; +import fj.data.Either; /** * Allows to consume DMAAP topic and handle received notifications diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactory.java index 29579c64b7..43a86ebf71 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ExecutorFactory.java @@ -1,15 +1,16 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.google.common.util.concurrent.ThreadFactoryBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - import java.lang.Thread.UncaughtExceptionHandler; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; @Component("executorFactory") /** * Allows to create next kinds of single thread executors: SingleThreadExecutor and SingleThreadScheduledExecutor diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstance.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstance.java index 9c478e7d9b..a4757300ac 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstance.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/JsonContainerResourceInstance.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.be.components.distribution.engine; -import org.openecomp.sdc.be.model.ComponentInstance; - import java.util.List; +import org.openecomp.sdc.be.model.ComponentInstance; + public class JsonContainerResourceInstance { private String resourceInstanceName; private String resourceName; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorService.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorService.java index dc58a24e5f..4955cf41f8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorService.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/NotificationExecutorService.java @@ -20,12 +20,17 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.google.common.util.concurrent.ThreadFactoryBuilder; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionNotificationTopicConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.*; +import com.google.common.util.concurrent.ThreadFactoryBuilder; public class NotificationExecutorService { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java index f3d17979ba..7ea80263bd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java @@ -20,12 +20,20 @@ package org.openecomp.sdc.be.components.distribution.engine; -import fj.data.Either; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; @@ -37,8 +45,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; -import java.util.stream.Collectors; +import fj.data.Either; @Component("serviceDistributionArtifactsBuilder") public class ServiceDistributionArtifactsBuilder { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCall.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCall.java index 7a25c2ed69..c962583356 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCall.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/UebHealthCheckCall.java @@ -20,11 +20,11 @@ package org.openecomp.sdc.be.components.distribution.engine; +import java.util.concurrent.Callable; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.Callable; - public class UebHealthCheckCall implements Callable<Boolean> { CambriaHandler cambriaHandler = new CambriaHandler(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java index 8f0865f2ac..e712a01a6f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java @@ -20,18 +20,18 @@ package org.openecomp.sdc.be.components.distribution.engine; -import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupInstance; -import org.openecomp.sdc.be.model.GroupInstanceProperty; -import org.openecomp.sdc.be.model.GroupProperty; -import org.openecomp.sdc.common.api.Constants; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.GroupInstanceProperty; +import org.openecomp.sdc.be.model.GroupProperty; +import org.openecomp.sdc.common.api.Constants; + public class VfModuleArtifactPayload { private String vfModuleModelName, vfModuleModelInvariantUUID, vfModuleModelVersion, vfModuleModelUUID, vfModuleModelCustomizationUUID, vfModuleModelDescription; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/report/MsoDistributionCompleteReporter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/report/MsoDistributionCompleteReporter.java index 4e06b0ed0e..ef47f5e665 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/report/MsoDistributionCompleteReporter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/report/MsoDistributionCompleteReporter.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.components.distribution.engine.report; +import javax.annotation.Resource; + import org.openecomp.sdc.be.components.distribution.engine.DistributionStatusNotification; import org.openecomp.sdc.be.components.distribution.engine.rest.MSORestClient; import org.springframework.stereotype.Component; -import javax.annotation.Resource; - @Component public class MsoDistributionCompleteReporter implements DistributionCompleteReporter { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java index 76263f942d..27488d6f0e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/rest/MSORestClient.java @@ -1,13 +1,18 @@ package org.openecomp.sdc.be.components.distribution.engine.rest; -import com.google.common.annotations.VisibleForTesting; -import com.google.gson.Gson; +import java.util.Properties; + import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.eclipse.jetty.util.URIUtil; import org.openecomp.sdc.be.components.distribution.engine.DistributionStatusNotificationEnum; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.common.http.client.api.*; +import org.openecomp.sdc.common.http.client.api.HttpExecuteException; +import org.openecomp.sdc.common.http.client.api.HttpRequest; +import org.openecomp.sdc.common.http.client.api.HttpResponse; +import org.openecomp.sdc.common.http.client.api.Responses; +import org.openecomp.sdc.common.http.client.api.RestUtils; +import org.openecomp.sdc.common.http.client.api.RetryHandlers; import org.openecomp.sdc.common.http.config.BasicAuthorization; import org.openecomp.sdc.common.http.config.ExternalServiceConfig; import org.openecomp.sdc.common.http.config.HttpClientConfig; @@ -15,7 +20,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.Properties; +import com.google.common.annotations.VisibleForTesting; +import com.google.gson.Gson; @Component public class MSORestClient { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java index 670350a733..adcd31be77 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java @@ -20,8 +20,34 @@ package org.openecomp.sdc.be.components.health; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; +import static java.lang.String.format; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR; +import static org.apache.http.HttpStatus.SC_OK; +import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_BE; +import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_CASSANDRA; +import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_DCAE; +import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_ES; +import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_ON_BOARDING; +import static org.openecomp.sdc.common.api.Constants.HC_COMPONENT_TITAN; +import static org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus.DOWN; +import static org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus.UP; +import static org.openecomp.sdc.common.impl.ExternalConfiguration.getAppVersion; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.annotation.Resource; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineClusterHealth; @@ -46,27 +72,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.stream.Collectors; - -import static java.lang.String.format; -import static java.util.concurrent.TimeUnit.SECONDS; -import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR; -import static org.apache.http.HttpStatus.SC_OK; -import static org.openecomp.sdc.common.api.Constants.*; -import static org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus.DOWN; -import static org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus.UP; -import static org.openecomp.sdc.common.impl.ExternalConfiguration.getAppVersion; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; @Component("healthCheckBusinessLogic") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java index 50331a71d3..90f2148195 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java @@ -20,7 +20,10 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.List; + +import javax.servlet.ServletContext; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -41,7 +44,6 @@ import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.converters.StringConvertor; import org.openecomp.sdc.be.model.tosca.validators.StringValidator; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -49,8 +51,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.util.List; +import fj.data.Either; @Component("additionalInformationBusinessLogic") public class AdditionalInformationBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactResolverImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactResolverImpl.java index e79efbcfc1..b7dfabf071 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactResolverImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactResolverImpl.java @@ -20,6 +20,14 @@ package org.openecomp.sdc.be.components.impl; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.components.ArtifactsResolver; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -30,14 +38,6 @@ import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - @org.springframework.stereotype.Component("artifact-resolver") public class ArtifactResolverImpl implements ArtifactsResolver { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java index c9250ae70f..c8fc13d31e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java @@ -20,10 +20,28 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.annotations.VisibleForTesting; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.XMLConstants; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParserFactory; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -109,26 +127,11 @@ import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.yaml.snakeyaml.Yaml; -import javax.servlet.http.HttpServletRequest; -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.function.Predicate; -import java.util.function.Supplier; -import java.util.stream.Collectors; +import com.google.common.annotations.VisibleForTesting; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import fj.data.Either; @org.springframework.stereotype.Component("artifactBusinessLogic") public class ArtifactsBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java index 6756108387..bc813b9abb 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java @@ -20,7 +20,11 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -35,10 +39,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; +import fj.data.Either; /** * This class holds the business logic relevant for attributes manipulation. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java index e401cb14f5..4b15081968 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java @@ -20,8 +20,14 @@ package org.openecomp.sdc.be.components.impl; -import com.google.gson.JsonElement; -import fj.data.Either; +import static org.apache.commons.collections.CollectionUtils.isEmpty; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.validation.UserValidations; @@ -37,7 +43,16 @@ import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.GroupProperty; +import org.openecomp.sdc.be.model.IComplexDefaultValue; +import org.openecomp.sdc.be.model.IPropertyInputCommon; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation; @@ -68,13 +83,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.function.Function; +import com.google.gson.JsonElement; -import static org.apache.commons.collections.CollectionUtils.isEmpty; +import fj.data.Either; public abstract class BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java index caf051ec81..b350c7b4c9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java @@ -20,7 +20,14 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +import javax.annotation.Resource; + import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -28,18 +35,12 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; +import fj.data.Either; @Component("capabilityTypeImportManager") public class CapabilityTypeImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java index 31db9651c6..b4147b8fc5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java @@ -1,18 +1,5 @@ package org.openecomp.sdc.be.components.impl; -import com.datastax.driver.core.Cluster; -import com.datastax.driver.core.KeyspaceMetadata; -import com.datastax.driver.core.Metadata; -import com.datastax.driver.core.Session; -import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils; -import org.openecomp.sdc.be.dao.cassandra.schema.Table; -import org.openecomp.sdc.common.util.GeneralUtility; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; import java.io.FileInputStream; import java.io.InputStream; import java.util.ArrayList; @@ -23,6 +10,21 @@ import java.util.Map; import java.util.Properties; import java.util.Set; +import javax.annotation.PostConstruct; + +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils; +import org.openecomp.sdc.be.dao.cassandra.schema.Table; +import org.openecomp.sdc.common.util.GeneralUtility; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.Session; + @Component("cassandra-health-check") public class CassandraHealthCheck { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java index fa662898d8..dc836611ff 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java @@ -20,7 +20,13 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum; import org.openecomp.sdc.be.datamodel.utils.NodeTypeConvertUtils; @@ -39,12 +45,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.yaml.snakeyaml.Yaml; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; +import fj.data.Either; @Component("categoriesImportManager") public class CategoriesImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java index 055e479d0d..88e5853489 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java @@ -20,13 +20,28 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.CapabilityTypeDefinition; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.GroupTypeDefinition; +import org.openecomp.sdc.be.model.PolicyTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.exception.ResponseFormat; @@ -35,16 +50,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.yaml.snakeyaml.Yaml; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.function.BiFunction; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.stream.Collectors; +import fj.data.Either; @Component("commonImportManager") public class CommonImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java index 4688aa4b8f..deb6c3de2f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java @@ -20,7 +20,14 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -39,7 +46,21 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapReqDef; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.IComponentInstanceConnectedElement; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Operation; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ComponentCache; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; @@ -58,13 +79,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; +import fj.data.Either; public abstract class ComponentBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index 9d9d00818c..306fadda1f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -20,8 +20,23 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.collect.Sets; -import fj.data.Either; +import static org.openecomp.sdc.be.components.property.GetInputUtils.isGetInputValueForInput; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; @@ -48,8 +63,25 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ForwardingPathUtils; import org.openecomp.sdc.be.info.CreateAndAssotiateInfo; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.IComponentInstanceOperation; @@ -70,12 +102,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.*; -import java.util.Map.Entry; -import java.util.function.BiConsumer; -import java.util.stream.Collectors; +import com.google.common.collect.Sets; -import static org.openecomp.sdc.be.components.property.GetInputUtils.isGetInputValueForInput; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java index 90f807475f..b591c9e1b9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; @@ -31,14 +39,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; +import fj.data.Either; /** * This class holds the logic of arranging resource instance on the canvas for imported VF diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java index 44ab4220c8..8ab124c994 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java @@ -20,7 +20,8 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.Date; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -34,14 +35,13 @@ import org.openecomp.sdc.be.resources.data.ConsumerData; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.openecomp.sdc.be.user.Role; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.Date; +import fj.data.Either; @Component("ConsumerBusinessLogic") public class ConsumerBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java index 6fbc22454d..2609dfcbff 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java @@ -20,7 +20,19 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; @@ -32,13 +44,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.StringReader; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import fj.data.Either; public class CsarValidationUtils { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java index aa5cb4e2ba..e423e729de 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java @@ -20,7 +20,16 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum; import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; @@ -36,14 +45,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; +import fj.data.Either; @Component("dataTypeImportManager") public class DataTypeImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java index 5469d79653..af5c03b4b8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java @@ -20,7 +20,12 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.apache.http.HttpStatus; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; @@ -41,7 +46,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; +import fj.data.Either; @Component("distributionMonitoringBusinessLogic") public class DistributionMonitoringBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java index ac72c98252..998ef6274f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java @@ -20,7 +20,20 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.function.Predicate; +import java.util.stream.Collectors; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; @@ -77,19 +90,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.function.Predicate; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component("elementsBusinessLogic") public class ElementBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java index 7233ba7657..d8626ff591 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; @@ -15,9 +18,7 @@ import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import fj.data.Either; /** * Created by yavivi on 04/02/2018. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java index a2fd6c4953..313a117add 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java @@ -20,7 +20,22 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static java.util.stream.Collectors.toList; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.io.FilenameUtils; @@ -72,21 +87,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static java.util.stream.Collectors.toList; +import fj.data.Either; @org.springframework.stereotype.Component("groupBusinessLogic") public class GroupBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java index cdd1b30656..d852ac3c3c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java @@ -1,5 +1,8 @@ package org.openecomp.sdc.be.components.impl; +import java.util.List; +import java.util.Set; + import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -10,9 +13,6 @@ import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Set; - @Component public class GroupTypeBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java index 5cdb589d2a..0485e3a968 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum; import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; @@ -38,13 +46,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; +import fj.data.Either; @Component("groupTypeImportManager") public class GroupTypeImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java index 3db76a9398..4b9203de42 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java @@ -20,10 +20,19 @@ package org.openecomp.sdc.be.components.impl; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import fj.data.Either; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Consumer; +import java.util.function.Function; + import org.apache.commons.lang3.StringEscapeUtils; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; @@ -43,18 +52,11 @@ import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.representer.Representer; import org.yaml.snakeyaml.resolver.Resolver; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Consumer; -import java.util.function.Function; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; + +import fj.data.Either; public final class ImportUtils { private ImportUtils() { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index 7b51e92ba2..ca8b2e1fd9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.inject.Inject; + import org.openecomp.sdc.be.components.property.PropertyDecelerationOrchestrator; import org.openecomp.sdc.be.components.validation.ComponentValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -47,13 +55,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.inject.Inject; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; +import fj.data.Either; @Component("inputsBusinessLogic") public class InputsBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java index cfc2505942..6d23cac8db 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java @@ -20,7 +20,14 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.InterfaceDefinition; @@ -32,12 +39,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import fj.data.Either; @Component("interfaceLifecycleTypeImportManager") public class InterfaceLifecycleTypeImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java index c04eb2911d..85f8c57c9f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java @@ -17,8 +17,15 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.collect.Sets; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; @@ -49,14 +56,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; +import com.google.common.collect.Sets; + +import fj.data.Either; @Component("interfaceOperationBusinessLogic") public class InterfaceOperationBusinessLogic extends ComponentBusinessLogic{ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/MonitoringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/MonitoringBusinessLogic.java index 43cf9bdec8..31701c7916 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/MonitoringBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/MonitoringBusinessLogic.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.impl.MonitoringDao; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -30,6 +29,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; +import fj.data.Either; + @Component("monitoringBusinessLogic") public class MonitoringBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java index fee8ba187c..a65a23e5f4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java @@ -1,6 +1,8 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.List; +import java.util.Set; + import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; @@ -13,8 +15,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Set; +import fj.data.Either; @Component public class PolicyTypeBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java index fed588ff9c..7efff56003 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java @@ -20,7 +20,12 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +import javax.annotation.Resource; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum; import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; @@ -36,10 +41,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; +import fj.data.Either; @Component("policyTypeImportManager") public class PolicyTypeImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java index ab6ff24676..f6a789b248 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java @@ -20,7 +20,14 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -47,13 +54,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component("productBusinessLogic") public class ProductBusinessLogic extends ComponentBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java index 9cc4b9cd3e..aeab3cd592 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java @@ -20,8 +20,14 @@ package org.openecomp.sdc.be.components.impl; -import com.google.gson.JsonElement; -import fj.data.Either; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Supplier; + +import javax.servlet.ServletContext; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -51,12 +57,9 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Supplier; +import com.google.gson.JsonElement; + +import fj.data.Either; @Component("propertyBusinessLogic") public class PropertyBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index bac9bb62a5..fd1a272174 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -21,9 +21,26 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.collect.Sets; -import com.google.gson.Gson; -import fj.data.Either; +import static org.openecomp.sdc.be.tosca.CsarUtils.VF_NODE_TYPE_ARTIFACTS_PATH_PATTERN; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import javax.servlet.ServletContext; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -40,7 +57,6 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; import org.openecomp.sdc.be.components.merge.resource.MergeResourceBLFactory; import org.openecomp.sdc.be.components.merge.resource.MergeResourceBusinessLogic; -import org.openecomp.sdc.be.components.validation.InterfaceOperationValidation; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -134,24 +150,9 @@ import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.parser.ParserException; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.Collection; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.function.Function; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import com.google.gson.Gson; -import static org.openecomp.sdc.be.tosca.CsarUtils.VF_NODE_TYPE_ARTIFACTS_PATH_PATTERN; +import fj.data.Either; @org.springframework.stereotype.Component("resourceBusinessLogic") public class ResourceBusinessLogic extends ComponentBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java index 97dcf35c96..6d6d80b840 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java @@ -20,7 +20,21 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.function.Function; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import javax.servlet.ServletContext; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.auditing.api.AuditEventFactory; @@ -70,19 +84,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; import org.yaml.snakeyaml.Yaml; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.function.Function; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import fj.data.Either; @Component("resourceImportManager") public class ResourceImportManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index 14db1408b7..48cbb35fdd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -20,10 +20,23 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.base.Strings; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.function.Function; +import java.util.stream.Collectors; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -92,21 +105,11 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.function.Function; -import java.util.stream.Collectors; +import com.google.common.base.Strings; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import fj.data.Either; @org.springframework.stereotype.Component("serviceBusinessLogic") public class ServiceBusinessLogic extends ComponentBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java index 236be437af..94d4373795 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.components.impl.generic; -import fj.data.Either; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -17,9 +20,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component public class GenericTypeBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtils.java index 30a93fa0bc..50f64e2f3f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtils.java @@ -1,14 +1,14 @@ package org.openecomp.sdc.be.components.impl.utils; +import java.util.List; +import java.util.Map; +import java.util.Objects; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import java.util.List; -import java.util.Map; -import java.util.Objects; - public class PolicyTypeImportUtils { private PolicyTypeImportUtils() { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperation.java index df98a7f707..1b6f49df8b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperation.java @@ -1,5 +1,10 @@ package org.openecomp.sdc.be.components.impl.version; +import static org.apache.commons.collections.CollectionUtils.isEmpty; + +import java.util.List; +import java.util.Map; + import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -9,11 +14,6 @@ import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import java.util.List; -import java.util.Map; - -import static org.apache.commons.collections.CollectionUtils.isEmpty; @org.springframework.stereotype.Component public class GroupMembersUpdateOperation implements PostChangeVersionOperation { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperation.java index 8824b2e097..1d27228c50 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperation.java @@ -1,5 +1,10 @@ package org.openecomp.sdc.be.components.impl.version; +import static org.apache.commons.collections.CollectionUtils.isEmpty; + +import java.util.List; +import java.util.function.UnaryOperator; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; @@ -10,11 +15,6 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; -import java.util.function.UnaryOperator; - -import static org.apache.commons.collections.CollectionUtils.isEmpty; - @org.springframework.stereotype.Component public class PolicyTargetsUpdateOperation implements PostChangeVersionOperation { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestrator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestrator.java index ee37536886..375d8e6e12 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestrator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestrator.java @@ -1,14 +1,14 @@ package org.openecomp.sdc.be.components.impl.version; +import java.util.Iterator; +import java.util.List; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Iterator; -import java.util.List; - @org.springframework.stereotype.Component public class PostChangeVersionOperationOrchestrator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java index c229d87593..42fe6baab8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.Arrays; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; @@ -45,7 +45,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; +import fj.data.Either; public class CertificationChangeTransition extends LifeCycleTransition { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java index dfd7beeaf1..4a8bbb5790 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java @@ -20,7 +20,13 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; @@ -31,7 +37,15 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Operation; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; @@ -46,7 +60,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.*; +import fj.data.Either; public class CertificationRequestTransition extends LifeCycleTransition { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java index 0d9631e6ee..9015ca0367 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java @@ -20,7 +20,8 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.Arrays; + import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -42,7 +43,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; +import fj.data.Either; public class CheckinTransition extends LifeCycleTransition { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java index e5afcaeae5..3d1ba33df2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.Arrays; +import java.util.List; + import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -30,7 +32,11 @@ import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; @@ -43,8 +49,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; -import java.util.List; +import fj.data.Either; public class CheckoutTransition extends LifeCycleTransition { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java index 4270295e36..dc25243883 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java @@ -20,7 +20,10 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -42,9 +45,7 @@ import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import fj.data.Either; public abstract class LifeCycleTransition { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java index 5e65edecbb..703e0f9aa5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java @@ -20,7 +20,11 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.PostConstruct; + import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; @@ -59,9 +63,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.PostConstruct; -import java.util.HashMap; -import java.util.Map; +import fj.data.Either; @org.springframework.stereotype.Component("lifecycleBusinessLogic") public class LifecycleBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java index 9444faa27a..07b5dc0e40 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.Arrays; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; @@ -44,7 +44,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; +import fj.data.Either; public class UndoCheckoutTransition extends LifeCycleTransition { private static final Logger log = LoggerFactory.getLogger(CheckoutTransition.class); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java index e6dd6457cf..9c140b36c7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.components.merge; -import fj.data.Either; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -9,9 +12,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; +import fj.data.Either; @Component public class GlobalInputsFilteringBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogic.java index 4bd799805f..eb359e949e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogic.java @@ -1,6 +1,7 @@ package org.openecomp.sdc.be.components.merge; -import fj.data.Either; +import java.util.List; + import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; import org.openecomp.sdc.be.components.merge.resource.MergeResourceBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -10,7 +11,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.List; +import fj.data.Either; @Component public class GlobalTypesMergeBusinessLogic implements MergeResourceBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/RelationsComparator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/RelationsComparator.java index 058d4c2555..ab47837a2a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/RelationsComparator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/RelationsComparator.java @@ -1,15 +1,15 @@ package org.openecomp.sdc.be.components.merge; +import java.util.List; +import java.util.Map; +import java.util.Optional; + import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.Resource; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.Map; -import java.util.Optional; - @Component public class RelationsComparator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java index 0f68f9f409..8b48b0897a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java @@ -1,6 +1,8 @@ package org.openecomp.sdc.be.components.merge; -import fj.data.Either; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.exception.SdcActionException; @@ -13,8 +15,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; -import java.util.Map; +import fj.data.Either; @org.springframework.stereotype.Component public class TopologyComparator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/CapabilityResolver.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/CapabilityResolver.java index 0a467ef876..5d616c10f9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/CapabilityResolver.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/CapabilityResolver.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.components.merge.capability; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; -import java.util.List; -import java.util.Map; - public interface CapabilityResolver { /** diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolver.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolver.java index 8400b32f9b..d09a00c112 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolver.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolver.java @@ -1,5 +1,13 @@ package org.openecomp.sdc.be.components.merge.capability; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Predicate; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.components.merge.utils.MergeInstanceUtils; import org.openecomp.sdc.be.dao.utils.MapUtil; @@ -7,10 +15,6 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Collectors; - @org.springframework.stereotype.Component public class SimpleCapabilityResolver implements CapabilityResolver { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogic.java index 82deee598d..1e1bc862cf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogic.java @@ -1,15 +1,15 @@ package org.openecomp.sdc.be.components.merge.heat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** * Created by chaya on 9/14/2017. */ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java index be5e5367b8..96ad87c608 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.be.components.merge.input; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.components.merge.instance.ComponentsMergeCommand; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.utils.MapUtil; @@ -10,10 +14,7 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInputsMergeBL implements ComponentsMergeCommand { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogic.java index e0e7947226..e49d2b2c87 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogic.java @@ -1,5 +1,12 @@ package org.openecomp.sdc.be.components.merge.input; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; @@ -7,9 +14,6 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import java.util.*; -import java.util.stream.Collectors; - @org.springframework.stereotype.Component public class InputsValuesMergingBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java index e7117a2aeb..caf73187e1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java @@ -1,6 +1,8 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.List; +import java.util.Map; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.components.merge.capability.CapabilityResolver; import org.openecomp.sdc.be.components.merge.property.DataDefinitionsValuesMergingBusinessLogic; @@ -16,8 +18,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; -import java.util.Map; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentCapabilitiesPropertiesMergeBL implements ComponentsMergeCommand { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java index d16fa251e2..5571bdca44 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; @@ -12,10 +16,7 @@ import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; +import fj.data.Either; /** * Created by chaya on 9/20/2017. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMerge.java index afad19baf2..b43e263580 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMerge.java @@ -1,6 +1,12 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import static org.apache.commons.collections.MapUtils.isNotEmpty; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.CapabilityDefinition; @@ -9,12 +15,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import static org.apache.commons.collections.MapUtils.isNotEmpty; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInstanceCapabiliteisPropertiesMerge implements ComponentInstanceMergeInterface { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java index 20a5abc591..5824b43bf7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java @@ -1,6 +1,12 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + import org.javatuples.Pair; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -19,12 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInstanceForwardingPathMerge implements ComponentInstanceMergeInterface { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMerge.java index 3938281ad2..f66eaa8061 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMerge.java @@ -1,6 +1,8 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.merge.heat.HeatEnvArtifactsMergeBusinessLogic; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -15,8 +17,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.List; -import java.util.Map; +import fj.data.Either; /** * Created by chaya on 9/20/2017. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java index 2e289456e6..c2332055ab 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.components.merge.property.DataDefinitionsValuesMergingBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -11,9 +14,7 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInstanceInputsMergeBL implements ComponentsMergeCommand { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java index d17469a287..111b1b3738 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java @@ -1,6 +1,7 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.List; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; @@ -14,7 +15,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.List; +import fj.data.Either; /** * Created by chaya on 9/12/2017. */ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeInterface.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeInterface.java index f4bcfdab5c..1d2849b94c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeInterface.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeInterface.java @@ -1,11 +1,12 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.exception.ResponseFormat; +import fj.data.Either; + /** * Created by chaya on 9/20/2017. */ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java index 99b1d389ed..fe2de7882e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.components.merge.property.DataDefinitionsValuesMergingBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -10,9 +13,7 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInstancePropertiesMergeBL implements ComponentsMergeCommand { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java index b63cc38690..82e6b6368e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java @@ -1,10 +1,18 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import java.util.ArrayList; +import java.util.List; + import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; @@ -12,8 +20,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.List; +import fj.data.Either; /** * Created by chaya on 9/20/2017. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolder.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolder.java index ac0959897d..636bdda854 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolder.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/DataForMergeHolder.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; + import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogic.java index 139ac386a1..bc2f71e2ef 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogic.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.components.merge.property; +import java.util.Collections; +import java.util.List; + import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.springframework.stereotype.Component; -import java.util.Collections; -import java.util.List; - @Component public class DataDefinitionsValuesMergingBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/MergePropertyData.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/MergePropertyData.java index df65c1161f..63a7a1b3a0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/MergePropertyData.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/MergePropertyData.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.merge.property; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; - import java.util.ArrayList; import java.util.List; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; + /** * A POJO which represents an instance property data definition (a {@link org.openecomp.sdc.be.model.ComponentInstanceProperty} or {@link org.openecomp.sdc.be.model.ComponentInstanceInput}) * that its value needs to be merged during an upgrade of a VSP. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java index 318840d60a..7356b446a4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java @@ -1,7 +1,14 @@ package org.openecomp.sdc.be.components.merge.property; -import com.google.gson.Gson; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -14,9 +21,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.*; -import java.util.stream.Collectors; +import com.google.gson.Gson; + +import fj.data.Either; @Component public class PropertyDataValueMergeBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilder.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilder.java index df3030567d..09f26a39ee 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilder.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyInstanceMergeDataBuilder.java @@ -1,15 +1,15 @@ package org.openecomp.sdc.be.components.merge.property; -import org.openecomp.sdc.be.dao.utils.MapUtil; -import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; -import org.openecomp.sdc.be.model.InputDefinition; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import org.openecomp.sdc.be.dao.utils.MapUtil; +import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.InputDefinition; + public class PropertyInstanceMergeDataBuilder { private final static PropertyInstanceMergeDataBuilder INSTANCE = new PropertyInstanceMergeDataBuilder(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyValueMerger.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyValueMerger.java index 9fcb864fe9..88601bb521 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyValueMerger.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyValueMerger.java @@ -1,13 +1,13 @@ package org.openecomp.sdc.be.components.merge.property; -import org.apache.commons.lang.StringUtils; -import org.openecomp.sdc.be.components.impl.ImportUtils; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import org.apache.commons.lang.StringUtils; +import org.openecomp.sdc.be.components.impl.ImportUtils; + public abstract class PropertyValueMerger { abstract Object merge(Object oldVal, Object newVal, List<String> someStrings); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMerger.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMerger.java index ce0ed0eed2..39381e7322 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMerger.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/ScalarPropertyValueMerger.java @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.components.merge.property; -import org.springframework.stereotype.Component; - import java.util.List; +import org.springframework.stereotype.Component; + @Component("scalar-prop-value-merger") public class ScalarPropertyValueMerger extends PropertyValueMerger { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/MergeResourceBLFactory.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/MergeResourceBLFactory.java index cdfeded356..9d11eb9aaf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/MergeResourceBLFactory.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/MergeResourceBLFactory.java @@ -1,13 +1,14 @@ package org.openecomp.sdc.be.components.merge.resource; -import fj.data.Either; import org.openecomp.sdc.be.components.merge.GlobalTypesMergeBusinessLogic; import org.openecomp.sdc.be.components.merge.TopologyComparator; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Resource; import org.springframework.stereotype.Component; +import fj.data.Either; + @Component public class MergeResourceBLFactory { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogic.java index 0ffe693187..f9901222c9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogic.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.components.merge.resource; +import java.util.List; + import org.openecomp.sdc.be.components.merge.instance.ComponentsMergeCommand; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Resource; @@ -7,8 +9,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.List; - @Component public class ResourceDataMergeBusinessLogic implements MergeResourceBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java index 4ff7e06db5..132ad10f42 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java @@ -1,6 +1,14 @@ package org.openecomp.sdc.be.components.merge.utils; -import fj.data.Either; +import static java.util.function.Function.identity; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; @@ -14,10 +22,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import com.google.common.annotations.VisibleForTesting; -import java.util.*; -import java.util.stream.Collectors; -import static java.util.function.Function.identity; +import fj.data.Either; /** * This class is Utils class but it should be bean diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java index 469ae31f2d..492d0a1c42 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.components.path; -import fj.data.Either; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.impl.ResponseFormatManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -15,9 +18,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +import fj.data.Either; @Component("forwardingPathValidator") public class ForwardingPathValidator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDecelerator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDecelerator.java index f59831621c..660c7b71b9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDecelerator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDecelerator.java @@ -1,6 +1,11 @@ package org.openecomp.sdc.be.components.property; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -15,11 +20,7 @@ import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInstanceInputPropertyDecelerator extends DefaultPropertyDecelerator<ComponentInstance, ComponentInstanceInput> { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDecelerator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDecelerator.java index ab4c4e29c2..81e7fc0283 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDecelerator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDecelerator.java @@ -1,6 +1,11 @@ package org.openecomp.sdc.be.components.property; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -15,11 +20,7 @@ import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import fj.data.Either; @org.springframework.stereotype.Component public class ComponentInstancePropertyDecelerator extends DefaultPropertyDecelerator<ComponentInstance, ComponentInstanceProperty> { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDecelerator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDecelerator.java index e053096480..28bb30de73 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDecelerator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDecelerator.java @@ -1,7 +1,17 @@ package org.openecomp.sdc.be.components.property; -import com.google.gson.Gson; -import fj.data.Either; +import static org.openecomp.sdc.common.api.Constants.GET_INPUT; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.json.simple.JSONObject; @@ -24,17 +34,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; +import com.google.gson.Gson; -import static org.openecomp.sdc.common.api.Constants.GET_INPUT; +import fj.data.Either; public abstract class DefaultPropertyDecelerator<PROPERTYOWNER extends PropertiesOwner, PROPERTYTYPE extends PropertyDataDefinition> implements PropertyDecelerator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDecelerator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDecelerator.java index be3c82fa09..a2a146be91 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDecelerator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDecelerator.java @@ -1,6 +1,14 @@ package org.openecomp.sdc.be.components.property; -import fj.data.Either; +import static org.openecomp.sdc.be.components.property.GetInputUtils.isGetInputValueForInput; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -15,14 +23,7 @@ import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Collectors; - -import static org.openecomp.sdc.be.components.property.GetInputUtils.isGetInputValueForInput; +import fj.data.Either; @org.springframework.stereotype.Component public class PolicyPropertyDecelerator extends DefaultPropertyDecelerator<PolicyDefinition, PropertyDataDefinition> { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerationOrchestrator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerationOrchestrator.java index ea311cebb5..373dd4a76c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerationOrchestrator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerationOrchestrator.java @@ -1,6 +1,8 @@ package org.openecomp.sdc.be.components.property; -import fj.data.Either; +import java.util.Arrays; +import java.util.List; + import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.be.model.Component; @@ -11,8 +13,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; -import java.util.List; +import fj.data.Either; @org.springframework.stereotype.Component public class PropertyDecelerationOrchestrator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerator.java index 9255763f2c..8314309f8c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PropertyDecelerator.java @@ -1,12 +1,13 @@ package org.openecomp.sdc.be.components.property; -import fj.data.Either; +import java.util.List; + import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.List; +import fj.data.Either; public interface PropertyDecelerator { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AbstractScheduleTaskRunner.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AbstractScheduleTaskRunner.java index df6cb3f6b9..8ab616e7e5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AbstractScheduleTaskRunner.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AbstractScheduleTaskRunner.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.components.scheduledtasks; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public abstract class AbstractScheduleTaskRunner { private static final Logger log = LoggerFactory.getLogger(AbstractScheduleTaskRunner.class); public abstract ExecutorService getExecutorService(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTask.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTask.java index a2659f4559..e89c02e9b3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTask.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTask.java @@ -20,6 +20,17 @@ package org.openecomp.sdc.be.components.scheduledtasks; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.CleanComponentsConfiguration; @@ -30,16 +41,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - @Component("asdcComponentsCleaner") public class AsdcComponentsCleanerTask extends AbstractScheduleTaskRunner implements Runnable { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java index a09a78165e..d26b212658 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java @@ -20,7 +20,10 @@ package org.openecomp.sdc.be.components.scheduledtasks; -import fj.data.Either; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; @@ -32,9 +35,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import fj.data.Either; @Component("componentsCleanBusinessLogic") public class ComponentsCleanBusinessLogic extends BaseBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManager.java index eac4ecf813..8fd7fbf922 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManager.java @@ -20,8 +20,20 @@ package org.openecomp.sdc.be.components.scheduledtasks; -import com.google.common.annotations.VisibleForTesting; -import fj.data.Either; +import static org.apache.commons.collections.CollectionUtils.isEmpty; +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.convertToFunction; + +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.annotation.Resource; + import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.openecomp.sdc.be.components.distribution.engine.EnvironmentsEngine; @@ -37,18 +49,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.annotation.Resource; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; +import com.google.common.annotations.VisibleForTesting; -import static org.apache.commons.collections.CollectionUtils.isEmpty; -import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.convertToFunction; +import fj.data.Either; @Component("recoveryThreadManager") public class RecoveryThreadManager extends AbstractScheduleTaskRunner { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java index 83f5a5de95..f7c639f6e0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/utils/Utils.java @@ -1,15 +1,16 @@ package org.openecomp.sdc.be.components.utils; -import org.apache.tinkerpop.shaded.minlog.Log; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.validation.constraints.NotNull; import java.security.SecureRandom; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.validation.constraints.NotNull; + +import org.apache.tinkerpop.shaded.minlog.Log; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class Utils { private static final Logger log = LoggerFactory.getLogger(Utils.class); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java index 002ae50cde..c2722b5de0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java @@ -20,16 +20,19 @@ package org.openecomp.sdc.be.components.validation; +import static java.util.stream.Collectors.toList; + +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import java.util.List; -import java.util.Optional; -import java.util.Set; - import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentParametersView; @@ -41,12 +44,6 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.common.util.ValidationUtils; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static java.util.stream.Collectors.toList; - @org.springframework.stereotype.Component public final class ComponentValidations { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java index 439c8bd53a..aa58c14227 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java @@ -16,7 +16,14 @@ package org.openecomp.sdc.be.components.validation; -import fj.data.Either; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; @@ -35,13 +42,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import fj.data.Either; @Component("interfaceOperationValidation") public class InterfaceOperationValidation { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java index c1934ae1c4..c1af08308e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.be.components.validation; -import fj.data.Either; +import java.util.Collections; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -15,10 +19,7 @@ import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Collections; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import fj.data.Either; /** * Provides specific functionality for policy diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java index ec5a1c3078..c9ae17c3be 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.be.components.validation; -import fj.data.Either; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Resource; + import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.distribution.engine.IDistributionEngine; import org.openecomp.sdc.be.components.impl.ActivationRequestInformation; @@ -19,9 +23,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Resource; -import java.util.Arrays; -import java.util.List; +import fj.data.Either; /** * Created by chaya on 10/18/2017. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java index e2e671f872..a0c8d9fcf7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/UserValidations.java @@ -1,6 +1,7 @@ package org.openecomp.sdc.be.components.validation; -import fj.data.Either; +import java.util.List; + import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -13,7 +14,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; +import fj.data.Either; @org.springframework.stereotype.Component public class UserValidations { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtils.java index 9f0d7a3281..83103309de 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/ArtifactUtils.java @@ -20,14 +20,6 @@ package org.openecomp.sdc.be.datamodel.utils; -import org.apache.commons.codec.binary.Base64; -import org.openecomp.sdc.be.info.ArtifactTemplateInfo; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.util.ValidationUtils; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -35,6 +27,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; +import org.apache.commons.codec.binary.Base64; +import org.openecomp.sdc.be.info.ArtifactTemplateInfo; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.util.ValidationUtils; public class ArtifactUtils { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java index 27b1b7ed9a..78b2354615 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverter.java @@ -16,15 +16,15 @@ package org.openecomp.sdc.be.datamodel.utils; +import java.util.List; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition; import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationParamDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; import org.openecomp.sdc.be.model.Operation; -import java.util.List; -import java.util.stream.Collectors; - public class InterfaceUIDataConverter { private InterfaceUIDataConverter () { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java index 624a8b623a..26da552f07 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/UiComponentDataConverter.java @@ -20,17 +20,22 @@ package org.openecomp.sdc.be.datamodel.utils; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.ui.model.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; +import org.openecomp.sdc.be.ui.model.UiComponentMetadata; +import org.openecomp.sdc.be.ui.model.UiResourceDataTransfer; +import org.openecomp.sdc.be.ui.model.UiResourceMetadata; +import org.openecomp.sdc.be.ui.model.UiServiceDataTransfer; +import org.openecomp.sdc.be.ui.model.UiServiceMetadata; public class UiComponentDataConverter { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogic.java index 2c2adaa970..20378e0b86 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogic.java @@ -20,30 +20,41 @@ package org.openecomp.sdc.be.distribution; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import static org.apache.commons.lang.BooleanUtils.isTrue; +import static org.openecomp.sdc.be.components.distribution.engine.DistributionEngineInitTask.buildTopicName; +import static org.openecomp.sdc.be.config.ConfigurationManager.getConfigurationManager; + +import java.util.List; + +import javax.annotation.Resource; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; -import org.openecomp.sdc.be.components.distribution.engine.*; +import org.openecomp.sdc.be.components.distribution.engine.CambriaErrorResponse; +import org.openecomp.sdc.be.components.distribution.engine.CambriaHandler; +import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineInitTask; +import org.openecomp.sdc.be.components.distribution.engine.IDistributionEngine; +import org.openecomp.sdc.be.components.distribution.engine.SubscriberTypeEnum; import org.openecomp.sdc.be.components.impl.ResponseFormatManager; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.distribution.api.client.*; +import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; +import org.openecomp.sdc.be.distribution.api.client.RegistrationRequest; +import org.openecomp.sdc.be.distribution.api.client.ServerListResponse; +import org.openecomp.sdc.be.distribution.api.client.TopicRegistrationResponse; +import org.openecomp.sdc.be.distribution.api.client.TopicUnregistrationResponse; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import javax.ws.rs.core.Response; -import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; -import static org.apache.commons.lang.BooleanUtils.isTrue; -import static org.openecomp.sdc.be.components.distribution.engine.DistributionEngineInitTask.buildTopicName; -import static org.openecomp.sdc.be.config.ConfigurationManager.getConfigurationManager; +import fj.data.Either; @Component("distributionBusinessLogic") public class DistributionBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionCatalogServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionCatalogServlet.java index 984a831c8e..ead0e987a9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionCatalogServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionCatalogServlet.java @@ -20,33 +20,42 @@ package org.openecomp.sdc.be.distribution.servlet; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; -import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; import org.openecomp.sdc.be.servlets.BeGenericServlet; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Map; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * This Servlet serves external users to download artifacts. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java index b5c322f90b..3d4e048838 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/distribution/servlet/DistributionServlet.java @@ -20,9 +20,20 @@ package org.openecomp.sdc.be.distribution.servlet; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import javax.annotation.Resource; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.distribution.AuditHandler; @@ -37,7 +48,6 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.servlets.BeGenericServlet; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.util.HttpUtil; import org.openecomp.sdc.exception.ResponseFormat; @@ -45,14 +55,17 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.annotation.Resource; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ResponseHeader; /** * This Servlet serves external users for distribution purposes. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java index 6ffa3a7c34..8aee1fbb0e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/EcompIntImpl.java @@ -20,7 +20,11 @@ package org.openecomp.sdc.be.ecomp; -import fj.data.Either; +import java.util.LinkedList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + import org.openecomp.portalsdk.core.onboarding.crossapi.IPortalRestAPIService; import org.openecomp.portalsdk.core.onboarding.exception.PortalAPIException; import org.openecomp.portalsdk.core.restful.domain.EcompRole; @@ -40,9 +44,7 @@ import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.web.context.ContextLoader; -import javax.servlet.http.HttpServletRequest; -import java.util.LinkedList; -import java.util.List; +import fj.data.Either; public class EcompIntImpl implements IPortalRestAPIService { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java index b02a4a52cd..eb227a5d06 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java @@ -20,15 +20,30 @@ package org.openecomp.sdc.be.ecomp.converters; -import fj.data.Either; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.distribution.servlet.DistributionCatalogServlet; -import org.openecomp.sdc.be.externalapi.servlet.representation.*; +import org.openecomp.sdc.be.externalapi.servlet.representation.ArtifactMetadata; +import org.openecomp.sdc.be.externalapi.servlet.representation.AssetMetadata; +import org.openecomp.sdc.be.externalapi.servlet.representation.ResourceAssetDetailedMetadata; +import org.openecomp.sdc.be.externalapi.servlet.representation.ResourceAssetMetadata; +import org.openecomp.sdc.be.externalapi.servlet.representation.ResourceInstanceMetadata; +import org.openecomp.sdc.be.externalapi.servlet.representation.ServiceAssetDetailedMetadata; +import org.openecomp.sdc.be.externalapi.servlet.representation.ServiceAssetMetadata; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -37,7 +52,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.*; +import fj.data.Either; @org.springframework.stereotype.Component("asset-metadata-utils") public class AssetMetadataConverter { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java index 590be72f1f..f0c8ec214f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java @@ -20,16 +20,17 @@ package org.openecomp.sdc.be.ecomp.converters; -import fj.data.Either; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + import org.openecomp.portalsdk.core.restful.domain.EcompRole; import org.openecomp.portalsdk.core.restful.domain.EcompUser; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.user.Role; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import fj.data.Either; public final class EcompUserConverter { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java index b634abba82..f98c737f9d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java @@ -20,15 +20,27 @@ package org.openecomp.sdc.be.externalapi.servlet; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -45,25 +57,16 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Map; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * This Servlet serves external users operations on artifacts. * diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java index 27f82dfda3..92862b5bd8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServlet.java @@ -20,9 +20,26 @@ package org.openecomp.sdc.be.externalapi.servlet; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ElementBusinessLogic; @@ -44,19 +61,14 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * This Servlet serves external users for retrieving component metadata. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java index 0651291fc4..67922ca92d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java @@ -20,11 +20,27 @@ package org.openecomp.sdc.be.externalapi.servlet; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.io.IOException; +import java.util.Arrays; +import java.util.EnumMap; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.lang3.StringUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import org.elasticsearch.common.Strings; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; @@ -43,7 +59,11 @@ import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter; import org.openecomp.sdc.be.externalapi.servlet.representation.AssetMetadata; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; @@ -51,7 +71,6 @@ import org.openecomp.sdc.be.servlets.AbstractValidationsServlet; import org.openecomp.sdc.be.servlets.RepresentationUtils; import org.openecomp.sdc.be.utils.CommonBeUtils; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.util.ValidationUtils; @@ -59,19 +78,17 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefsServlet.java index 7e48890c7d..a459e3d7e0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefsServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefsServlet.java @@ -1,6 +1,23 @@ package org.openecomp.sdc.be.externalapi.servlet; -import fj.data.Either; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.ExternalRefsBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dto.ExternalRefDTO; @@ -13,13 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.List; -import java.util.Map; +import fj.data.Either; @Path("/v1/catalog") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ServiceActivationServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ServiceActivationServlet.java index 3f1bf18edb..e5f6dcd126 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ServiceActivationServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ServiceActivationServlet.java @@ -1,9 +1,21 @@ package org.openecomp.sdc.be.externalapi.servlet; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.io.IOException; +import java.util.EnumMap; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -21,15 +33,15 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.IOException; -import java.util.EnumMap; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Created by chaya on 10/17/2017. diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java index 841cd3225d..a13cc51b3e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java @@ -20,9 +20,20 @@ package org.openecomp.sdc.be.filters; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.StringTokenizer; + +import javax.annotation.Priority; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.ResponseBuilder; +import javax.ws.rs.core.Response.Status; + import org.apache.commons.codec.binary.Base64; import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -36,18 +47,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.annotation.Priority; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.ResponseBuilder; -import javax.ws.rs.core.Response.Status; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.StringTokenizer; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import fj.data.Either; @Priority(10) public class BasicAuthenticationFilter implements ContainerRequestFilter { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java index 60409b3ee0..9a46514331 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java @@ -20,7 +20,20 @@ package org.openecomp.sdc.be.filters; -import com.google.gson.GsonBuilder; +import java.io.IOException; +import java.util.UUID; + +import javax.annotation.Priority; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; +import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.container.ContainerResponseFilter; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -29,7 +42,6 @@ import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.util.ThreadLocalsHolder; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -37,18 +49,7 @@ import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.web.context.WebApplicationContext; -import javax.annotation.Priority; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; -import java.io.IOException; -import java.util.UUID; +import com.google.gson.GsonBuilder; @Provider @Priority(1) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java index b80ee4c324..c94915467c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java @@ -20,8 +20,20 @@ package org.openecomp.sdc.be.filters; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Priority; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.ResponseBuilder; +import javax.ws.rs.core.Response.Status; + import org.openecomp.sdc.be.components.health.HealthCheckBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -34,18 +46,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.annotation.Priority; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.ResponseBuilder; -import javax.ws.rs.core.Response.Status; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; @Priority(11) public class ComponentsAvailabilityFilter implements ContainerRequestFilter { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java index 56027048aa..41681a7c4f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java @@ -20,13 +20,13 @@ package org.openecomp.sdc.be.impl; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import fj.data.Either; +import java.lang.reflect.Type; +import java.util.Collections; +import java.util.EnumMap; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.auditing.api.AuditEventFactory; import org.openecomp.sdc.be.auditing.impl.AuditAuthRequestEventFactory; @@ -74,12 +74,14 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.http.HttpServletRequest; -import java.lang.reflect.Type; -import java.util.Collections; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; + +import fj.data.Either; @org.springframework.stereotype.Component("componentUtils") public class ComponentsUtils { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/DownloadArtifactLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/DownloadArtifactLogic.java index b268554ee3..445f8d9fd9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/DownloadArtifactLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/DownloadArtifactLogic.java @@ -20,9 +20,17 @@ package org.openecomp.sdc.be.impl; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; + import org.apache.commons.io.IOUtils; import org.apache.http.HttpStatus; import org.eclipse.jgit.util.Base64; @@ -35,15 +43,10 @@ import org.openecomp.sdc.common.api.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.StreamingOutput; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import fj.data.Either; public class DownloadArtifactLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java index 2158508e56..ec3e146164 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.impl; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.SetMultimap; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -10,6 +8,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.javatuples.Pair; import org.openecomp.sdc.be.components.impl.ResponseFormatManager; @@ -25,6 +24,9 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Service; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.SetMultimap; + public class ForwardingPathUtils { public static final String FORWARDING_PATH_NODE_NAME = "Forwarding Path"; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ServletUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ServletUtils.java index c8128a33fc..6e078cf675 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ServletUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ServletUtils.java @@ -20,11 +20,12 @@ package org.openecomp.sdc.be.impl; -import com.google.gson.Gson; +import javax.annotation.Resource; + import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.springframework.stereotype.Component; -import javax.annotation.Resource; +import com.google.gson.Gson; @Component("servletUtils") public class ServletUtils { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/WebAppContextWrapper.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/WebAppContextWrapper.java index 02759289b2..7d4c09d852 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/WebAppContextWrapper.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/WebAppContextWrapper.java @@ -20,11 +20,11 @@ package org.openecomp.sdc.be.impl; +import javax.servlet.ServletContext; + import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; -import javax.servlet.ServletContext; - public class WebAppContextWrapper { public WebApplicationContext getWebAppContext(ServletContext context) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java index 9b8e81cc7b..141dd7b66d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java @@ -20,9 +20,12 @@ package org.openecomp.sdc.be.info; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -35,7 +38,10 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.*; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +import fj.data.Either; public class ArtifactTemplateInfo { public static final String TYPE = "type"; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java index 5d635f05ff..da7f178862 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.be.info; -import org.openecomp.sdc.be.model.ArtifactType; - import java.util.List; +import org.openecomp.sdc.be.model.ArtifactType; + public class ArtifactTypesInfo { Integer heatDefaultTimeout = 60; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java index f49315c0d0..1f36382edc 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java @@ -20,12 +20,12 @@ package org.openecomp.sdc.be.info; +import java.util.List; + import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupProperty; -import java.util.List; - public class GroupDefinitionInfo { private String name; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java index e4b6f35cba..d5da29f77d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java @@ -20,10 +20,14 @@ package org.openecomp.sdc.be.info; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.model.ArtifactDefinition; - -import java.util.*; public class MergedArtifactInfo { private List<ArtifactDefinition> createdArtifact; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java index 766581bd62..2aef7808ae 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.info; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; - import java.util.EnumMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; + public class NodeTypeInfoToUpdateArtifacts { private String nodeName; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java index 4d27713e22..f49722aa42 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java @@ -1,14 +1,15 @@ package org.openecomp.sdc.be.info; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; public final class OperationalEnvInfo { @JsonIgnore diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java index fba6632698..5fd51e3dee 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.info; -import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + public final class Relationship { @JsonProperty("related-to") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/GroupTypeMixin.java b/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/GroupTypeMixin.java index 216e55a2b1..0b0b8627c0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/GroupTypeMixin.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/GroupTypeMixin.java @@ -1,10 +1,11 @@ package org.openecomp.sdc.be.mixin; -import com.fasterxml.jackson.annotation.JsonProperty; import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition; import org.openecomp.sdc.be.view.Mixin; import org.openecomp.sdc.be.view.MixinTarget; +import com.fasterxml.jackson.annotation.JsonProperty; + @MixinTarget(target = GroupTypeDataDefinition.class) public abstract class GroupTypeMixin extends Mixin { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/PolicyTypeMixin.java b/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/PolicyTypeMixin.java index 0fd86e1ced..b0081728d3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/PolicyTypeMixin.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/mixin/PolicyTypeMixin.java @@ -1,10 +1,11 @@ package org.openecomp.sdc.be.mixin; -import com.fasterxml.jackson.annotation.JsonProperty; import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition; import org.openecomp.sdc.be.view.Mixin; import org.openecomp.sdc.be.view.MixinTarget; +import com.fasterxml.jackson.annotation.JsonProperty; + @MixinTarget(target = PolicyTypeDataDefinition.class) public abstract class PolicyTypeMixin extends Mixin { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/monitoring/EsGateway.java b/catalog-be/src/main/java/org/openecomp/sdc/be/monitoring/EsGateway.java index ba6596d1a2..c3b4f6e049 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/monitoring/EsGateway.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/monitoring/EsGateway.java @@ -20,6 +20,12 @@ package org.openecomp.sdc.be.monitoring; +import java.net.URI; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.api.Response; import org.eclipse.jetty.proxy.ProxyServlet; @@ -30,11 +36,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.net.URI; - public class EsGateway extends ProxyServlet { private static final long serialVersionUID = 1L; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java index b67469d469..a995d61fb5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AbstractValidationsServlet.java @@ -20,10 +20,24 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; -import com.google.gson.JsonSyntaxException; -import fj.data.Either; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.zip.ZipInputStream; + +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; @@ -60,22 +74,11 @@ import org.slf4j.Logger; import org.springframework.web.context.WebApplicationContext; import org.yaml.snakeyaml.Yaml; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Response; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Type; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.zip.ZipInputStream; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; + +import fj.data.Either; public abstract class AbstractValidationsServlet extends BeGenericServlet { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AdditionalInformationServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AdditionalInformationServlet.java index f6d89e9065..f06781094d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AdditionalInformationServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AdditionalInformationServlet.java @@ -20,9 +20,22 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.AdditionalInformationBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -31,19 +44,19 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Additional Information Servlet", description = "Additional Information Servlet") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ArtifactServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ArtifactServlet.java index fa7ed4b547..ad4009d914 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ArtifactServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ArtifactServlet.java @@ -20,27 +20,7 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; -import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.ArtifactUiDownloadData; -import org.openecomp.sdc.be.model.Operation; -import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.exception.ResponseFormat; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.Map; import javax.inject.Singleton; import javax.servlet.ServletContext; @@ -56,7 +36,30 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.Map; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; +import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ArtifactUiDownloadData; +import org.openecomp.sdc.be.model.Operation; +import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Root resource (exposed at "/" path) */ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java index 09ebb1cd31..90b5316b25 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/AttributeServlet.java @@ -20,11 +20,21 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.AttributeBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -36,13 +46,16 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Web Servlet for actions on Attributes * diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java index 937ec871e9..9d23184335 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java @@ -20,11 +20,16 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.module.SimpleModule; -import fj.data.Either; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Supplier; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.ResponseBuilder; + import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; @@ -59,14 +64,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.ResponseBuilder; -import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Supplier; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; + +import fj.data.Either; public class BeGenericServlet extends BasicServlet { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java index aa10ce0dd4..516ba57637 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java @@ -20,14 +20,20 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.util.List; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.be.components.health.HealthCheckBusinessLogic; import org.openecomp.sdc.be.components.impl.MonitoringBusinessLogic; @@ -37,21 +43,21 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; import org.openecomp.sdc.common.api.HealthCheckWrapper; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.monitoring.MonitoringEvent; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.List; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.TRACE, trim = false) @Path("/") @Api(value = "BE Monitoring", description = "BE Monitoring") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentExceptionMapper.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentExceptionMapper.java index 8ed68fa032..fb226bb842 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentExceptionMapper.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentExceptionMapper.java @@ -1,15 +1,16 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Component; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; @Component @Provider diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java index 536fdc3c7e..072ab0c984 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentInstanceServlet.java @@ -20,17 +20,30 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.io.InputStream; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; @@ -56,28 +69,18 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.InputStream; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Root resource (exposed at "/" path) .json diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java index 16fa67e7cf..e1abe42f2e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ComponentServlet.java @@ -20,13 +20,26 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -46,24 +59,14 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Component Servlet", description = "Component Servlet") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigMgrServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigMgrServlet.java index f8aa39c478..f307baa3b6 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigMgrServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigMgrServlet.java @@ -20,7 +20,18 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; + import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.common.api.Constants; @@ -28,11 +39,7 @@ import org.openecomp.sdc.common.servlets.BasicServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; +import com.jcabi.aspects.Loggable; /** * Root resource (exposed at "/" path) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigServlet.java index a56065fcdf..daa21acfa2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConfigServlet.java @@ -20,14 +20,6 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.common.api.ConfigurationSource; -import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.servlets.BasicServlet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.GET; @@ -36,6 +28,15 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.common.servlets.BasicServlet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.jcabi.aspects.Loggable; + /** * Root resource (exposed at "/" path) */ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java index fda31e5032..038a9de7f6 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ConsumerServlet.java @@ -20,10 +20,21 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -32,19 +43,20 @@ import org.openecomp.sdc.be.model.ConsumerDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.google.gson.Gson; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/consumers") @Api(value = "Consumer Servlet", description = "Consumer Servlet") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CsarBuildServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CsarBuildServlet.java index faf02dc5ca..2dca0081d5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CsarBuildServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/CsarBuildServlet.java @@ -20,10 +20,6 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import org.openecomp.sdc.be.resources.data.ESArtifactData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -31,6 +27,12 @@ import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; +import org.openecomp.sdc.be.resources.data.ESArtifactData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.jcabi.aspects.Loggable; + @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/services") public class CsarBuildServlet extends ToscaDaoServlet { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DefaultExceptionMapper.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DefaultExceptionMapper.java index 40de94bd6a..c362956b9d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DefaultExceptionMapper.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DefaultExceptionMapper.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.servlets; -import org.eclipse.jetty.http.HttpStatus; -import org.springframework.stereotype.Component; - import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; +import org.eclipse.jetty.http.HttpStatus; +import org.springframework.stereotype.Component; + @Component @Provider public class DefaultExceptionMapper implements ExceptionMapper<Exception> { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java index dca41210cc..7ab36560c3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DistributionServiceServlet.java @@ -20,12 +20,20 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import javax.annotation.Resource; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.DistributionMonitoringBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -33,20 +41,18 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.info.DistributionStatusListResponse; import org.openecomp.sdc.be.info.DistributionStatusOfServiceListResponce; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.annotation.Resource; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Root resource (exposed at "/" path) */ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java index 1a6fb20b46..06f0fed43a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ElementServlet.java @@ -20,9 +20,27 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.ElementBusinessLogic; import org.openecomp.sdc.be.components.scheduledtasks.ComponentsCleanBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -32,8 +50,12 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.info.ArtifactTypesInfo; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactType; +import org.openecomp.sdc.be.model.Category; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.PropertyScope; import org.openecomp.sdc.be.model.Tag; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.catalog.CatalogComponent; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; @@ -41,22 +63,18 @@ import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.ui.model.UiCategories; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Path("/v1/") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java index 100fd36e27..0309e23e72 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupServlet.java @@ -20,27 +20,7 @@ package org.openecomp.sdc.be.servlets; -import com.google.common.reflect.TypeToken; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; -import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.info.GroupDefinitionInfo; -import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupProperty; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.exception.ResponseFormat; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.List; import javax.inject.Singleton; import javax.servlet.ServletContext; @@ -57,7 +37,30 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.List; + +import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; +import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.info.GroupDefinitionInfo; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupProperty; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.reflect.TypeToken; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Root resource (exposed at "/" path) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupTypesEndpoint.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupTypesEndpoint.java index a056b1d454..ef6c1c5d1d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupTypesEndpoint.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/GroupTypesEndpoint.java @@ -1,17 +1,6 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic; -import org.openecomp.sdc.be.mixin.GroupTypeMixin; -import org.openecomp.sdc.be.model.GroupTypeDefinition; -import org.openecomp.sdc.be.view.ResponseView; -import org.openecomp.sdc.common.api.Constants; -import org.springframework.stereotype.Controller; +import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -20,7 +9,21 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; -import java.util.List; + +import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic; +import org.openecomp.sdc.be.mixin.GroupTypeMixin; +import org.openecomp.sdc.be.model.GroupTypeDefinition; +import org.openecomp.sdc.be.view.ResponseView; +import org.openecomp.sdc.common.api.Constants; +import org.springframework.stereotype.Controller; + +import com.jcabi.aspects.Loggable; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java index 1d627e6fd3..0ebed157df 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/InputsServlet.java @@ -20,14 +20,24 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.util.Arrays; +import java.util.List; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.InputsBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -41,28 +51,20 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Arrays; -import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Api(value = "Input Catalog", description = "Input Servlet") @Path("/v1/catalog") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/LifecycleServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/LifecycleServlet.java index 5720c56c38..2bcea2564e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/LifecycleServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/LifecycleServlet.java @@ -20,10 +20,19 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoBase; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; @@ -37,18 +46,19 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.ui.model.UiComponentMetadata; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Lifecycle Actions Servlet", description = "Lifecycle Actions Servlet") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyServlet.java index b6e15cef9a..4842d66db7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyServlet.java @@ -1,11 +1,24 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.components.impl.PolicyBusinessLogic; import org.openecomp.sdc.be.components.impl.ResourceImportManager; @@ -17,25 +30,20 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.ServletUtils; import org.openecomp.sdc.be.model.PolicyDefinition; +import org.openecomp.sdc.be.model.PolicyTargetDTO; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.datastructure.Wrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - - -import org.openecomp.sdc.be.model.PolicyTargetDTO; +import com.jcabi.aspects.Loggable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Provides REST API to create, retrieve, update, delete a policy diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpoint.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpoint.java index aa4bfa87c7..d440ca6872 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpoint.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpoint.java @@ -1,11 +1,14 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.PolicyTypeBusinessLogic; import org.openecomp.sdc.be.mixin.PolicyTypeMixin; import org.openecomp.sdc.be.model.PolicyTypeDefinition; @@ -15,14 +18,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.jcabi.aspects.Loggable; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java index 05ece30535..9633f44f29 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ProductServlet.java @@ -20,28 +20,42 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.ProductBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Map; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PropertyServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PropertyServlet.java index 14d2628926..557091e3a1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PropertyServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/PropertyServlet.java @@ -20,12 +20,29 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -41,25 +58,22 @@ import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyCons import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.resources.data.EntryData; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Resource Property Servlet", description = "Resource Property Servlet") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java index ea6b34a1ea..1a3b988a46 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RepresentationUtils.java @@ -20,17 +20,6 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter.SerializeExceptFilter; -import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; -import com.google.common.collect.ImmutableMap; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -38,6 +27,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @@ -50,6 +40,18 @@ import org.openecomp.sdc.common.api.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter.SerializeExceptFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import com.google.common.collect.ImmutableMap; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + public class RepresentationUtils { private static final Logger log = LoggerFactory.getLogger(RepresentationUtils.class); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RequirementsServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RequirementsServlet.java index e8769cca9b..612d626e59 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RequirementsServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/RequirementsServlet.java @@ -20,15 +20,17 @@ package org.openecomp.sdc.be.servlets; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; @@ -37,11 +39,10 @@ import org.slf4j.LoggerFactory; import com.jcabi.aspects.Loggable; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) public class RequirementsServlet extends BeGenericServlet { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServlet.java index 5d4001eec5..d33bb8e490 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServlet.java @@ -20,10 +20,15 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.jcabi.aspects.Loggable; -import fj.data.Either; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -36,14 +41,11 @@ import org.openecomp.sdc.common.api.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog/resources/available") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceInterfaceOperationServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceInterfaceOperationServlet.java index b51fc00cc1..68aa70796e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceInterfaceOperationServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceInterfaceOperationServlet.java @@ -16,14 +16,29 @@ package org.openecomp.sdc.be.servlets; -import com.google.common.collect.Sets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.components.impl.InterfaceOperationBusinessLogic; @@ -46,27 +61,15 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; +import com.google.common.collect.Sets; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog/resources/{resourceId}/interfaceOperations") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java index 2508423d03..ca07b31c32 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourceUploadServlet.java @@ -20,8 +20,24 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import io.swagger.annotations.*; +import java.io.File; + +import javax.annotation.Resource; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; import org.openecomp.sdc.be.components.impl.ResourceImportManager; @@ -31,21 +47,18 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.UploadResourceInfo; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.datastructure.Wrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.annotation.Resource; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.File; +import com.jcabi.aspects.Loggable; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; /** * Root resource (exposed at "/" path) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourcesServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourcesServlet.java index db0d4fb537..ef9446454d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourcesServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ResourcesServlet.java @@ -20,9 +20,29 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.json.JSONObject; import org.openecomp.sdc.be.components.impl.CsarValidationUtils; @@ -40,24 +60,19 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.servlets.ResourceUploadServlet.ResourceAuthorityTypeEnum; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Resources Catalog", description = "Resources Servlet") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceForwardingPathServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceForwardingPathServlet.java index f794e8c90b..d51ef4cb5e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceForwardingPathServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceForwardingPathServlet.java @@ -1,15 +1,8 @@ package org.openecomp.sdc.be.servlets; -import com.google.common.collect.Sets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; import java.util.Collections; import java.util.Set; + import javax.inject.Singleton; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -25,6 +18,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; + import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -42,6 +36,16 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.collect.Sets; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog/services/{serviceId}/paths") @Consumes(MediaType.APPLICATION_JSON) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java index 49a1a82e59..ba5a706c7b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ServiceServlet.java @@ -20,19 +20,39 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.reflect.TypeToken; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.*; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; -import com.fasterxml.jackson.databind.ObjectMapper; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datamodel.ServiceRelations; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.DistributionStatusEnum; +import org.openecomp.sdc.be.model.GroupInstanceProperty; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.datastructure.Wrapper; @@ -40,17 +60,16 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.reflect.TypeToken; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/StorageExceptionMapper.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/StorageExceptionMapper.java index fce8dd009e..930cb909b9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/StorageExceptionMapper.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/StorageExceptionMapper.java @@ -1,17 +1,18 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Component; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; @Component @Provider diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ToscaDaoServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ToscaDaoServlet.java index a30cd3c7b2..52fb809c27 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ToscaDaoServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ToscaDaoServlet.java @@ -20,19 +20,18 @@ package org.openecomp.sdc.be.servlets; +import javax.servlet.ServletContext; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.impl.DownloadArtifactLogic; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.info.ServletJsonResponse; import org.openecomp.sdc.be.resources.api.IResourceUploader; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.slf4j.Logger; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.ws.rs.core.Response; - public abstract class ToscaDaoServlet extends BeGenericServlet { public abstract Logger getLogger(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java index 9829566a12..b586327426 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java @@ -20,12 +20,20 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -33,21 +41,19 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Map; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Types Fetch Servlet", description = "Types Fetch Servlet") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java index 92f15c4a1d..8cb3cbdfc6 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java @@ -20,13 +20,24 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.glassfish.jersey.media.multipart.FormDataParam; import org.openecomp.sdc.be.components.impl.CapabilityTypeImportManager; @@ -49,39 +60,15 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Collectors; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog/uploadType") @Api(value = "Catalog Types Upload") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/UserAdminServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/UserAdminServlet.java index c9ea5dd951..7f7c1a8bbd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/UserAdminServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/UserAdminServlet.java @@ -20,22 +20,10 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.user.UserBusinessLogic; -import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.exception.ResponseFormat; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.List; import javax.inject.Singleton; import javax.servlet.ServletContext; @@ -52,10 +40,25 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.List; + +import org.openecomp.sdc.be.config.BeEcompErrorManager; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.user.UserBusinessLogic; +import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.jcabi.aspects.Loggable; + +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/user") @Api(value = "User Administration", description = "User admininstarator operations") diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/switchover/detector/SwitchoverDetector.java b/catalog-be/src/main/java/org/openecomp/sdc/be/switchover/detector/SwitchoverDetector.java index fb5710cc20..c461970de1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/switchover/detector/SwitchoverDetector.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/switchover/detector/SwitchoverDetector.java @@ -20,6 +20,18 @@ package org.openecomp.sdc.be.switchover.detector; +import java.net.InetAddress; +import java.util.Properties; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + import org.apache.commons.codec.binary.Base64; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -31,17 +43,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import java.net.InetAddress; -import java.util.Properties; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; - @Component("switchover-detector") public class SwitchoverDetector { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ArtifactTypes.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ArtifactTypes.java index be56ff3b73..e52dc3a59c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ArtifactTypes.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ArtifactTypes.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.be.tosca; -import org.onap.sdc.generator.data.ArtifactType; - import java.util.List; +import org.onap.sdc.generator.data.ArtifactType; + public class ArtifactTypes { private List<ArtifactType> artifactTypes; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java index 4dbbf925d3..f544eed42d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertor.java @@ -20,33 +20,55 @@ package org.openecomp.sdc.be.tosca; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import fj.data.Either; +import static org.apache.commons.collections.CollectionUtils.isNotEmpty; +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNoneBlank; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.tosca.ToscaUtils.SubstituitionEntry; -import org.openecomp.sdc.be.tosca.model.*; +import org.openecomp.sdc.be.tosca.model.SubstitutionMapping; +import org.openecomp.sdc.be.tosca.model.ToscaCapability; +import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate; +import org.openecomp.sdc.be.tosca.model.ToscaNodeType; +import org.openecomp.sdc.be.tosca.model.ToscaProperty; +import org.openecomp.sdc.be.tosca.model.ToscaRequirement; +import org.openecomp.sdc.be.tosca.model.ToscaTemplateCapability; import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; -import static org.apache.commons.collections.CollectionUtils.isNotEmpty; -import static org.apache.commons.lang3.StringUtils.*; +import fj.data.Either; /** * Allows to convert requirements\capabilities of a component to requirements\capabilities of a substitution mappings section of a tosca template diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java index 3c95539ec5..2cf7319633 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java @@ -20,8 +20,6 @@ package org.openecomp.sdc.be.tosca; -import com.google.gson.Gson; -import fj.data.Either; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.File; @@ -43,6 +41,7 @@ import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.output.ByteArrayOutputStream; @@ -50,6 +49,11 @@ import org.apache.commons.lang.WordUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.commons.lang3.tuple.Triple; +import org.onap.sdc.generator.data.AdditionalParams; +import org.onap.sdc.generator.data.Artifact; +import org.onap.sdc.generator.data.ArtifactType; +import org.onap.sdc.generator.data.GenerationData; +import org.onap.sdc.generator.impl.ArtifactGenerationServiceImpl; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo; @@ -89,15 +93,14 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.util.GeneralUtility; import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; -import org.onap.sdc.generator.data.AdditionalParams; -import org.onap.sdc.generator.data.Artifact; -import org.onap.sdc.generator.data.ArtifactType; -import org.onap.sdc.generator.data.GenerationData; -import org.onap.sdc.generator.impl.ArtifactGenerationServiceImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.google.gson.Gson; + +import fj.data.Either; + /** * @author tg851x diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index 8ca49262df..9f5ebdf7ca 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.tosca; import static org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil.addInterfaceDefinitionElement; import static org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil.addInterfaceTypeElement; -import fj.data.Either; import java.beans.IntrospectionException; import java.util.ArrayList; import java.util.Collection; @@ -36,6 +35,7 @@ import java.util.Optional; import java.util.Set; import java.util.function.Supplier; import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; @@ -102,6 +102,8 @@ import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.representer.Represent; import org.yaml.snakeyaml.representer.Representer; +import fj.data.Either; + @org.springframework.stereotype.Component("tosca-export-handler") public class ToscaExportHandler { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaRepresentation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaRepresentation.java index 49fd91cfed..4dc60fc871 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaRepresentation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaRepresentation.java @@ -20,11 +20,11 @@ package org.openecomp.sdc.be.tosca; +import java.util.List; + import org.apache.commons.lang3.tuple.Triple; import org.openecomp.sdc.be.model.Component; -import java.util.List; - public class ToscaRepresentation { private String mainYaml; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java index 8abaaf73f8..5119177477 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java @@ -20,14 +20,18 @@ package org.openecomp.sdc.be.tosca; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; -import java.lang.reflect.Field; -import java.util.*; - public class ToscaUtils { public static boolean isComplexVfc(Component component) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplate.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplate.java index 2b3889e45e..f13fd1c963 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplate.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaTemplate.java @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; + import org.apache.commons.lang3.tuple.Triple; import org.openecomp.sdc.be.model.Component; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java index c4905d005e..eb187e0120 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.tosca.utils; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition; @@ -13,7 +20,7 @@ import org.openecomp.sdc.be.tosca.CapabiltyRequirementConvertor; import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate; import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement; -import java.util.*; +import fj.data.Either; /** * @author KATYR diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java index 02e7c895b9..01733db988 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java @@ -16,12 +16,12 @@ package org.openecomp.sdc.be.tosca.utils; -import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; + import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; import org.openecomp.sdc.be.model.Component; @@ -35,6 +35,8 @@ import org.openecomp.sdc.be.tosca.model.ToscaLifecycleOperationDefinition; import org.openecomp.sdc.be.tosca.model.ToscaNodeType; import org.openecomp.sdc.be.tosca.model.ToscaProperty; +import com.fasterxml.jackson.databind.ObjectMapper; + /** * @author KATYR * @since March 20, 2018 diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java index 8fe8afce18..82c7623fe2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtil.java @@ -17,6 +17,7 @@ package org.openecomp.sdc.be.tosca.utils; import java.io.File; + import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.tosca.CsarUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/IUserBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/IUserBusinessLogic.java index ee454d72f3..c3a7182657 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/IUserBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/user/IUserBusinessLogic.java @@ -20,13 +20,15 @@ package org.openecomp.sdc.be.user; -import fj.data.Either; +import java.util.List; + +import javax.servlet.ServletContext; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.exception.ResponseFormat; -import javax.servlet.ServletContext; -import java.util.List; +import fj.data.Either; /** * diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java index 324019a5e8..794de4ab38 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java @@ -20,7 +20,14 @@ package org.openecomp.sdc.be.user; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.ServletContext; + import org.apache.tinkerpop.gremlin.structure.Edge; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -34,7 +41,6 @@ import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.UserRoleEnum; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.kpi.api.ASDCKpiApi; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -42,12 +48,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import fj.data.Either; @Component("userBusinessLogic") public class UserBusinessLogic implements IUserBusinessLogic { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/view/MixinModelWriter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/view/MixinModelWriter.java index e3d6ca6e10..c7754ed418 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/view/MixinModelWriter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/view/MixinModelWriter.java @@ -1,12 +1,5 @@ package org.openecomp.sdc.be.view; -import com.fasterxml.jackson.databind.ObjectMapper; - -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; @@ -16,6 +9,14 @@ import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; + +import com.fasterxml.jackson.databind.ObjectMapper; + /** * A class that is then responsible for converting a message payload with a dedicated mixin from an instance of a specific Java type into a json representation. */ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java index ea041359fd..f8676660d9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java @@ -20,13 +20,14 @@ package org.openecomp.sdc.common.transaction.api; -import fj.data.Either; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; import org.openecomp.sdc.common.transaction.api.TransactionUtils.ESActionTypeEnum; import org.openecomp.sdc.common.transaction.api.TransactionUtils.TransactionCodeEnum; +import fj.data.Either; + public interface ITransactionSdnc { TransactionCodeEnum finishTransaction(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/RollbackHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/RollbackHandler.java index a44073971e..8be443bdda 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/RollbackHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/RollbackHandler.java @@ -20,14 +20,14 @@ package org.openecomp.sdc.common.transaction.api; +import java.util.Stack; + import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; import org.openecomp.sdc.common.transaction.api.TransactionUtils.LogMessages; import org.openecomp.sdc.common.util.MethodActivationStatusEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Stack; - public abstract class RollbackHandler implements IDBType { // TODO test using slf4j-test and make this final diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/ESRollbackHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/ESRollbackHandler.java index e17819fcb0..add15d3c49 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/ESRollbackHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/ESRollbackHandler.java @@ -20,11 +20,9 @@ package org.openecomp.sdc.common.transaction.impl; -import fj.data.Either; import org.openecomp.sdc.be.dao.api.ResourceUploadStatus; import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; import org.openecomp.sdc.be.resources.data.ESArtifactData; -import org.openecomp.sdc.be.resources.exception.ResourceDAOException; import org.openecomp.sdc.be.tosca.CsarUtils; import org.openecomp.sdc.common.transaction.api.RollbackHandler; import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; @@ -34,6 +32,8 @@ import org.openecomp.sdc.common.util.MethodActivationStatusEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fj.data.Either; + public class ESRollbackHandler extends RollbackHandler { private static final Logger log = LoggerFactory.getLogger(CsarUtils.class); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/CommitManager.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/CommitManager.java index f366ae214f..d8706929ba 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/CommitManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/CommitManager.java @@ -20,8 +20,9 @@ package org.openecomp.sdc.common.transaction.mngr; +import java.util.List; + import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.transaction.api.ICommitHandler; import org.openecomp.sdc.common.transaction.api.TransactionUtils; import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; @@ -29,8 +30,6 @@ import org.openecomp.sdc.common.transaction.api.TransactionUtils.LogMessages; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - public class CommitManager { // TODO test using slf4j-test and make this final diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java index f218744b84..d4c5291dfe 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java @@ -20,8 +20,11 @@ package org.openecomp.sdc.common.transaction.mngr; -import com.google.common.collect.EvictingQueue; -import com.google.common.collect.Queues; +import java.util.Queue; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.annotation.Resource; + import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.common.transaction.api.ITransactionSdnc; @@ -31,9 +34,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.Queue; -import java.util.concurrent.atomic.AtomicInteger; +import com.google.common.collect.EvictingQueue; +import com.google.common.collect.Queues; @Component("transactionManager") public class TransactionManager { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java index bc7b5bde03..1dda1499d5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java @@ -20,14 +20,25 @@ package org.openecomp.sdc.common.transaction.mngr; -import fj.data.Either; +import java.util.ArrayList; +import java.util.List; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.resources.data.ESArtifactData; -import org.openecomp.sdc.common.config.EcompErrorName; -import org.openecomp.sdc.common.transaction.api.*; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.*; +import org.openecomp.sdc.common.transaction.api.ICommitHandler; +import org.openecomp.sdc.common.transaction.api.IDBAction; +import org.openecomp.sdc.common.transaction.api.ITransactionSdnc; +import org.openecomp.sdc.common.transaction.api.RollbackHandler; +import org.openecomp.sdc.common.transaction.api.TransactionUtils; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.ActionTypeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.ESActionTypeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.LogMessages; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.TransactionCodeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.TransactionStatusEnum; import org.openecomp.sdc.common.transaction.impl.ESAction; import org.openecomp.sdc.common.transaction.impl.ESRollbackHandler; import org.openecomp.sdc.common.transaction.impl.TitanCommitHandler; @@ -36,8 +47,7 @@ import org.openecomp.sdc.common.util.MethodActivationStatusEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; +import fj.data.Either; public class TransactionSdncImpl implements ITransactionSdnc { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java b/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java index 2088e8071a..d87f01d1fb 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/ElementOperationMock.java @@ -20,7 +20,10 @@ package org.openecomp.sdc; -import fj.data.Either; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -35,9 +38,7 @@ import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.CategoryData; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import fj.data.Either; public class ElementOperationMock implements IElementOperation { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/ErrorConfigurationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/ErrorConfigurationTest.java index 7f5b7f9853..9b8237c8fb 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/ErrorConfigurationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/ErrorConfigurationTest.java @@ -20,6 +20,10 @@ package org.openecomp.sdc; +import static org.junit.Assert.assertTrue; + +import java.io.File; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.config.ErrorConfiguration; @@ -33,10 +37,6 @@ import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; - -import static org.junit.Assert.assertTrue; - public class ErrorConfigurationTest { ConfigurationSource configurationSource = null; private static final Logger log = LoggerFactory.getLogger(ErrorConfigurationTest.class); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/TestExternalConfiguration.java b/catalog-be/src/test/java/org/openecomp/sdc/TestExternalConfiguration.java index 4698c0eea9..b6b0069c65 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/TestExternalConfiguration.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/TestExternalConfiguration.java @@ -20,6 +20,8 @@ package org.openecomp.sdc; +import java.io.IOException; + import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.common.api.BasicConfiguration; import org.openecomp.sdc.common.api.ConfigurationListener; @@ -29,8 +31,6 @@ import org.openecomp.sdc.common.impl.ConfigFileChangeListener; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import java.io.IOException; - public class TestExternalConfiguration<T extends Object> { public static void main(String[] args) throws IOException { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/ZipUtil.java b/catalog-be/src/test/java/org/openecomp/sdc/ZipUtil.java index 9ee123a840..0b95bae9b5 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/ZipUtil.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/ZipUtil.java @@ -20,9 +20,6 @@ package org.openecomp.sdc; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.output.ByteArrayOutputStream; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.file.Files; @@ -33,6 +30,9 @@ import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.io.output.ByteArrayOutputStream; + public class ZipUtil { public static void main(String[] args) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/DummyConfigurationManager.java b/catalog-be/src/test/java/org/openecomp/sdc/be/DummyConfigurationManager.java index 84c6fc118d..a6c8dc4f0c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/DummyConfigurationManager.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/DummyConfigurationManager.java @@ -1,13 +1,13 @@ package org.openecomp.sdc.be; +import static org.mockito.Mockito.mock; + import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; import org.openecomp.sdc.common.api.ConfigurationListener; import org.openecomp.sdc.common.api.ConfigurationSource; -import static org.mockito.Mockito.mock; - public class DummyConfigurationManager { private DistributionEngineConfiguration distributionConfigurationMock = mock(DistributionEngineConfiguration.class); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditAuthRequestEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditAuthRequestEventFactoryTest.java new file mode 100644 index 0000000000..db70cfd7eb --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditAuthRequestEventFactoryTest.java @@ -0,0 +1,35 @@ +package org.openecomp.sdc.be.auditing.impl; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +public class AuditAuthRequestEventFactoryTest { + + private AuditAuthRequestEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditAuthRequestEventFactory(build, "mock", "mock", "mock", "mock"); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditAuthRequestEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditAuthRequestEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactoryTest.java index 9bdf784f1c..e59ae40d80 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactoryTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditBaseEventFactoryTest.java @@ -1,9 +1,5 @@ package org.openecomp.sdc.be.auditing.impl; -import org.junit.Test; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.common.api.Constants; - import static org.junit.Assert.assertEquals; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DESIGNER_USER_ROLE; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_EMAIL; @@ -13,6 +9,10 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_ID; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_LAST_NAME; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_UID; +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.common.api.Constants; + public class AuditBaseEventFactoryTest { private User user = new User(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditConsumerEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditConsumerEventFactoryTest.java new file mode 100644 index 0000000000..b550aea646 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditConsumerEventFactoryTest.java @@ -0,0 +1,54 @@ +package org.openecomp.sdc.be.auditing.impl; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.model.ConsumerDefinition; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +import mockit.Deencapsulation; + +public class AuditConsumerEventFactoryTest { + + private AuditConsumerEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditConsumerEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, build, new User(), + new ConsumerDefinition()); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditConsumerEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditConsumerEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testBuildConsumerName() throws Exception { + ConsumerDefinition consumer = null; + String result; + + // test 1 + consumer = null; + result = Deencapsulation.invoke(AuditConsumerEventFactory.class, "buildConsumerName", + new Object[] { ConsumerDefinition.class }); + Assert.assertEquals("", result); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditConsumerEventFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditConsumerEventFuncTest.java index 0a90ffd915..bf3c7c4e2a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditConsumerEventFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditConsumerEventFuncTest.java @@ -1,28 +1,5 @@ package org.openecomp.sdc.be.auditing.impl; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.auditing.api.AuditEventFactory; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.model.ConsumerDefinition; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; -import org.openecomp.sdc.be.resources.data.auditing.ConsumerEvent; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import org.openecomp.sdc.common.util.ThreadLocalsHolder; - -import java.util.EnumMap; - import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; @@ -44,6 +21,29 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_ID; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.modifier; +import java.util.EnumMap; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.auditing.api.AuditEventFactory; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.model.ConsumerDefinition; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.ConsumerEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; + @RunWith(MockitoJUnitRunner.class) public class AuditConsumerEventFuncTest { private AuditingManager auditingManager; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditEcompOpEnvEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditEcompOpEnvEventFactoryTest.java new file mode 100644 index 0000000000..b181bbf448 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditEcompOpEnvEventFactoryTest.java @@ -0,0 +1,32 @@ +package org.openecomp.sdc.be.auditing.impl; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; + +public class AuditEcompOpEnvEventFactoryTest { + + private AuditEcompOpEnvEventFactory createTestSubject() { + return new AuditEcompOpEnvEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, "", "", "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditEcompOpEnvEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditEcompOpEnvEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditResourceEventFactoryManangerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditResourceEventFactoryManangerTest.java new file mode 100644 index 0000000000..bad63c7e01 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditResourceEventFactoryManangerTest.java @@ -0,0 +1,42 @@ +package org.openecomp.sdc.be.auditing.impl; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditResourceEventFactoryManangerTest { + + private AuditResourceEventFactoryMananger createTestSubject() { + return new AuditResourceEventFactoryMananger(); + } + + @Test + public void testCreateResourceEventFactory() throws Exception { + AuditingActionEnum action = null; + CommonAuditData commonFields = null; + ResourceAuditData prevParams = null; + ResourceAuditData currParams = null; + String resourceType = ""; + String resourceName = ""; + String invariantUuid = ""; + User modifier = null; + String artifactData = ""; + String comment = ""; + String did = ""; + String toscaNodeType = ""; + AuditBaseEventFactory result; + + for (AuditingActionEnum iterable_element : AuditingActionEnum.values()) { + try { + result = AuditResourceEventFactoryMananger.createResourceEventFactory(iterable_element, commonFields, prevParams, + currParams, resourceType, resourceName, invariantUuid, modifier, artifactData, comment, did, + toscaNodeType); + } catch (Exception UnsupportedOperationException) { + continue; + } + } + // default test + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditingLogFormatUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditingLogFormatUtilTest.java new file mode 100644 index 0000000000..37f810699b --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/AuditingLogFormatUtilTest.java @@ -0,0 +1,96 @@ +package org.openecomp.sdc.be.auditing.impl; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; + +import mockit.Deencapsulation; + +public class AuditingLogFormatUtilTest { + + private AuditingLogFormatUtil createTestSubject() { + return new AuditingLogFormatUtil(); + } + + @Test + public void testGetModifier() throws Exception { + String modifierName = "mock"; + String modifierUid = "mock"; + String result; + + // test 0 + result = Deencapsulation.invoke(AuditingLogFormatUtil.class, "getModifier", + new Object[] { modifierName, modifierUid }); + Assert.assertEquals("mock(mock)", result); + + // test 1 + result = Deencapsulation.invoke(AuditingLogFormatUtil.class, "getModifier", + new Object[] { modifierName, String.class }); + Assert.assertEquals("", result); + + // test 2 + modifierUid = ""; + result = Deencapsulation.invoke(AuditingLogFormatUtil.class, "getModifier", + new Object[] { modifierName, modifierUid }); + Assert.assertEquals("", result); + + // test 3 + result = Deencapsulation.invoke(AuditingLogFormatUtil.class, "getModifier", + new Object[] { String.class, modifierUid }); + Assert.assertEquals("", result); + + // test 4 + modifierName = ""; + result = Deencapsulation.invoke(AuditingLogFormatUtil.class, "getModifier", + new Object[] { modifierName, modifierUid }); + Assert.assertEquals("", result); + } + + @Test + public void testGetUser() throws Exception { + String userData = ""; + String result; + + // default test + result = Deencapsulation.invoke(AuditingLogFormatUtil.class, "getUser", new Object[] { userData }); + } + + @Test + public void testLogAuditEvent() throws Exception { + Map<AuditingFieldsKeysEnum, Object> auditingFields = null; + String result; + + // default test + HashMap<AuditingFieldsKeysEnum, Object> hashMap = new HashMap<AuditingFieldsKeysEnum, Object>(); + result = Deencapsulation.invoke(AuditingLogFormatUtil.class, "logAuditEvent", + new Object[] { hashMap.getClass() }); + } + + @Test + public void testLogAuditEvent_1() throws Exception { + String formattedString = ""; + Map<AuditingFieldsKeysEnum, Object> auditingFields = new HashMap<>(); + + // default test + Deencapsulation.invoke(AuditingLogFormatUtil.class, "logAuditEvent", new Object[] { formattedString }); + + auditingFields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_NAME, "mock"); + Deencapsulation.invoke(AuditingLogFormatUtil.class, "logAuditEvent", auditingFields); + + for ( AuditingFieldsKeysEnum enumValue : AuditingFieldsKeysEnum.values()) { + auditingFields.put(enumValue, "mock"); + } + + Deencapsulation.invoke(AuditingLogFormatUtil.class, "logAuditEvent", auditingFields); + + auditingFields = new HashMap<>(); + for (AuditingActionEnum iterable_element : AuditingActionEnum.values()) { + auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, iterable_element.getName()); + Deencapsulation.invoke(AuditingLogFormatUtil.class, "logAuditEvent", auditingFields); + } + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java index a774dea352..e41e34bb35 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditCategoryEventFuncTest.java @@ -1,5 +1,26 @@ package org.openecomp.sdc.be.auditing.impl.category; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.CATEGORY; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DESCRIPTION; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_ADD_CATEGORY_LOG_STR; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.GROUPING_NAME; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.MODIFIER_UID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.REQUEST_ID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.RESOURCE_TYPE; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SERVICE_INSTANCE_ID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_OK; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SUB_CATEGORY; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.modifier; + +import java.util.EnumMap; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,27 +42,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.util.ThreadLocalsHolder; -import java.util.EnumMap; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.CATEGORY; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DESCRIPTION; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_ADD_CATEGORY_LOG_STR; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.GROUPING_NAME; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.MODIFIER_UID; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.REQUEST_ID; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.RESOURCE_TYPE; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SERVICE_INSTANCE_ID; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_OK; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SUB_CATEGORY; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.modifier; - @RunWith(MockitoJUnitRunner.class) public class AuditCategoryEventFuncTest { private AuditingManager auditingManager; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditGetCategoryHierarchyEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditGetCategoryHierarchyEventFactoryTest.java new file mode 100644 index 0000000000..f5f6dde66a --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/category/AuditGetCategoryHierarchyEventFactoryTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.auditing.impl.category; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +public class AuditGetCategoryHierarchyEventFactoryTest { + + private AuditGetCategoryHierarchyEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditGetCategoryHierarchyEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, build, + new User(), ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditGetCategoryHierarchyEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditGetCategoryHierarchyEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditCreateTopicDistribEngineEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditCreateTopicDistribEngineEventFactoryTest.java new file mode 100644 index 0000000000..c50ea24fb4 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditCreateTopicDistribEngineEventFactoryTest.java @@ -0,0 +1,24 @@ +package org.openecomp.sdc.be.auditing.impl.distribution; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +public class AuditCreateTopicDistribEngineEventFactoryTest { + + private AuditCreateTopicDistribEngineEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditCreateTopicDistribEngineEventFactory(build, "", "", "", "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditCreateTopicDistribEngineEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEngineFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEngineFuncTest.java index 199597b82c..29285e7aa0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEngineFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEngineFuncTest.java @@ -1,28 +1,5 @@ package org.openecomp.sdc.be.auditing.impl.distribution; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.auditing.api.AuditEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; -import org.openecomp.sdc.be.resources.data.auditing.DistributionEngineEvent; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import org.openecomp.sdc.common.util.ThreadLocalsHolder; - -import java.util.EnumMap; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyMap; @@ -44,6 +21,29 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SERVICE_INSTANCE import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_OK; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; +import java.util.EnumMap; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.auditing.api.AuditEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionEngineEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; + @RunWith(MockitoJUnitRunner.class) public class AuditDistrEngineFuncTest { private AuditingManager auditingManager; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEventFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEventFuncTest.java index 09a168a132..ceb25e44b7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEventFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistrEventFuncTest.java @@ -1,34 +1,5 @@ package org.openecomp.sdc.be.auditing.impl.distribution; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.auditing.api.AuditEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; -import org.openecomp.sdc.be.resources.data.auditing.AuditingGetUebClusterEvent; -import org.openecomp.sdc.be.resources.data.auditing.DistributionDeployEvent; -import org.openecomp.sdc.be.resources.data.auditing.DistributionDownloadEvent; -import org.openecomp.sdc.be.resources.data.auditing.DistributionNotificationEvent; -import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; -import org.openecomp.sdc.be.resources.data.auditing.model.OperationalEnvAuditData; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import org.openecomp.sdc.common.util.ThreadLocalsHolder; - -import java.util.EnumMap; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyMap; @@ -63,6 +34,35 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.VNF_WORKLOAD_CON import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.user; +import java.util.EnumMap; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.auditing.api.AuditEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGetUebClusterEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionDeployEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionDownloadEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionNotificationEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; +import org.openecomp.sdc.be.resources.data.auditing.model.OperationalEnvAuditData; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; + @RunWith(MockitoJUnitRunner.class) public class AuditDistrEventFuncTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribDeployEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribDeployEventFactoryTest.java new file mode 100644 index 0000000000..6a314da699 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribDeployEventFactoryTest.java @@ -0,0 +1,36 @@ +package org.openecomp.sdc.be.auditing.impl.distribution; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +public class AuditDistribDeployEventFactoryTest { + + private AuditDistribDeployEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditDistribDeployEventFactory(build, "", "", new User(), "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditDistribDeployEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditDistribDeployEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribDownloadEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribDownloadEventFactoryTest.java new file mode 100644 index 0000000000..3aaeb6fddd --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribDownloadEventFactoryTest.java @@ -0,0 +1,36 @@ +package org.openecomp.sdc.be.auditing.impl.distribution; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; +import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; + +public class AuditDistribDownloadEventFactoryTest { + + private AuditDistribDownloadEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditDistribDownloadEventFactory(build, new DistributionData("", "")); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditDistribDownloadEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditDistribDownloadEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribNotificationEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribNotificationEventFactoryTest.java new file mode 100644 index 0000000000..06b45a4736 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribNotificationEventFactoryTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.auditing.impl.distribution; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; +import org.openecomp.sdc.be.resources.data.auditing.model.OperationalEnvAuditData; + +public class AuditDistribNotificationEventFactoryTest { + + private AuditDistribNotificationEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditDistribNotificationEventFactory(build, "", "", "", new User(), "", "", "", + new OperationalEnvAuditData("", "", "")); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditDistribNotificationEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditDistribNotificationEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribStatusEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribStatusEventFactoryTest.java new file mode 100644 index 0000000000..a9b5e68394 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditDistribStatusEventFactoryTest.java @@ -0,0 +1,35 @@ +package org.openecomp.sdc.be.auditing.impl.distribution; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +public class AuditDistribStatusEventFactoryTest { + + private AuditDistribStatusEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditDistribStatusEventFactory(build, "", "", "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditDistribStatusEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditDistribStatusEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditGetUebClusterEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditGetUebClusterEventFactoryTest.java new file mode 100644 index 0000000000..10608ab651 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/distribution/AuditGetUebClusterEventFactoryTest.java @@ -0,0 +1,35 @@ +package org.openecomp.sdc.be.auditing.impl.distribution; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; + +public class AuditGetUebClusterEventFactoryTest { + + private AuditGetUebClusterEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData build = newBuilder.build(); + return new AuditGetUebClusterEventFactory(build, ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditGetUebClusterEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditGetUebClusterEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/ecompopenv/AuditEcompOpEnvEventTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/ecompopenv/AuditEcompOpEnvEventTest.java index f859b75607..8dd66800e2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/ecompopenv/AuditEcompOpEnvEventTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/ecompopenv/AuditEcompOpEnvEventTest.java @@ -1,5 +1,23 @@ package org.openecomp.sdc.be.auditing.impl.ecompopenv; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_CREATE_OP_ENV_LOG_STR; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_UNKNOWN_NOTIFICATION_OP_ENV_LOG_STR; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_UNSUPPORTED_TYPE_OP_ENV_LOG_STR; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_ACTION; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_ID; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_NAME; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_TYPE; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.TENANT_CONTEXT; +import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; + +import java.util.EnumMap; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -20,24 +38,6 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; import org.openecomp.sdc.be.resources.data.auditing.EcompOperationalEnvironmentEvent; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import java.util.EnumMap; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_CREATE_OP_ENV_LOG_STR; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_UNKNOWN_NOTIFICATION_OP_ENV_LOG_STR; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.EXPECTED_UNSUPPORTED_TYPE_OP_ENV_LOG_STR; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_ACTION; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_ID; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_NAME; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_TYPE; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.TENANT_CONTEXT; -import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; - @RunWith(MockitoJUnitRunner.class) public class AuditEcompOpEnvEventTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditActivateServiceExternalApiEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditActivateServiceExternalApiEventFactoryTest.java new file mode 100644 index 0000000000..908399aa50 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditActivateServiceExternalApiEventFactoryTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.auditing.impl.externalapi; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditActivateServiceExternalApiEventFactoryTest { + + private AuditActivateServiceExternalApiEventFactory createTestSubject() { + Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditActivateServiceExternalApiEventFactory(commonAuData, "", "", "", "", + resAuData, resAuData, "", new User(), ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditActivateServiceExternalApiEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditChangeLifecycleExternalApiEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditChangeLifecycleExternalApiEventFactoryTest.java new file mode 100644 index 0000000000..d639471c77 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditChangeLifecycleExternalApiEventFactoryTest.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.be.auditing.impl.externalapi; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditChangeLifecycleExternalApiEventFactoryTest { + + private AuditChangeLifecycleExternalApiEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditChangeLifecycleExternalApiEventFactory(commonAuData, "", "", "", "", + resAuData, resAuData, "", new User(), ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditChangeLifecycleExternalApiEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditCreateResourceExternalApiEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditCreateResourceExternalApiEventFactoryTest.java new file mode 100644 index 0000000000..414920ea4b --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditCreateResourceExternalApiEventFactoryTest.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.be.auditing.impl.externalapi; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditCreateResourceExternalApiEventFactoryTest { + + private AuditCreateResourceExternalApiEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditCreateResourceExternalApiEventFactory(commonAuData, "", "", "", "", + resAuData, resAuData, "", new User(), ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditCreateResourceExternalApiEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditDownloadArtifactExternalApiEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditDownloadArtifactExternalApiEventFactoryTest.java new file mode 100644 index 0000000000..bf5f03c9ea --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditDownloadArtifactExternalApiEventFactoryTest.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.be.auditing.impl.externalapi; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditDownloadArtifactExternalApiEventFactoryTest { + + private AuditDownloadArtifactExternalApiEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditDownloadArtifactExternalApiEventFactory(commonAuData, "", "", "", "", + resAuData, resAuData, "", new User(), ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditDownloadArtifactExternalApiEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditExternalApiEventFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditExternalApiEventFuncTest.java index 7ddc9a0606..1ddda9ea5f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditExternalApiEventFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/externalapi/AuditExternalApiEventFuncTest.java @@ -1,28 +1,5 @@ package org.openecomp.sdc.be.auditing.impl.externalapi; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.auditing.api.AuditEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; -import org.openecomp.sdc.be.resources.data.auditing.ExternalApiEvent; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; - -import java.util.EnumMap; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyMap; @@ -54,6 +31,29 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_OK; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.modifier; +import java.util.EnumMap; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.auditing.api.AuditEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.ExternalApiEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; + @RunWith(MockitoJUnitRunner.class) public class AuditExternalApiEventFuncTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditArtifactResourceAdminEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditArtifactResourceAdminEventFactoryTest.java new file mode 100644 index 0000000000..51c9553b93 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditArtifactResourceAdminEventFactoryTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.auditing.impl.resourceadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditArtifactResourceAdminEventFactoryTest { + + private AuditArtifactResourceAdminEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditArtifactResourceAdminEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, commonAuData, + resAuData, resAuData, "", "", "", new User(), "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditArtifactResourceAdminEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditCertificationResourceAdminEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditCertificationResourceAdminEventFactoryTest.java new file mode 100644 index 0000000000..a9de5b01ab --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditCertificationResourceAdminEventFactoryTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.auditing.impl.resourceadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditCertificationResourceAdminEventFactoryTest { + + private AuditCertificationResourceAdminEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditCertificationResourceAdminEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, commonAuData, + resAuData, resAuData, "", "", "", new User(), "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditCertificationResourceAdminEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditCreateUpdateResourceAdminEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditCreateUpdateResourceAdminEventFactoryTest.java new file mode 100644 index 0000000000..357d2e2694 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditCreateUpdateResourceAdminEventFactoryTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.auditing.impl.resourceadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditCreateUpdateResourceAdminEventFactoryTest { + + private AuditCreateUpdateResourceAdminEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditCreateUpdateResourceAdminEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, commonAuData, + resAuData, resAuData, "", "", "", new User(), "", "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditCreateUpdateResourceAdminEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditDistStateChangeRequestResourceAdminEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditDistStateChangeRequestResourceAdminEventFactoryTest.java new file mode 100644 index 0000000000..20b65c5b6c --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditDistStateChangeRequestResourceAdminEventFactoryTest.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.be.auditing.impl.resourceadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditDistStateChangeRequestResourceAdminEventFactoryTest { + + private AuditDistStateChangeRequestResourceAdminEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditDistStateChangeRequestResourceAdminEventFactory(commonAuData, resAuData, + resAuData, "", "", "", new User(), "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditDistStateChangeRequestResourceAdminEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditDistStateChangeResourceAdminEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditDistStateChangeResourceAdminEventFactoryTest.java new file mode 100644 index 0000000000..d3900ee9c9 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditDistStateChangeResourceAdminEventFactoryTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.auditing.impl.resourceadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditDistStateChangeResourceAdminEventFactoryTest { + + private AuditDistStateChangeResourceAdminEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + return new AuditDistStateChangeResourceAdminEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, commonAuData, + resAuData, resAuData, "", "", "", new User(), "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditDistStateChangeResourceAdminEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditImportResourceAdminEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditImportResourceAdminEventFactoryTest.java new file mode 100644 index 0000000000..ff033dabaf --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditImportResourceAdminEventFactoryTest.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.be.auditing.impl.resourceadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; + +public class AuditImportResourceAdminEventFactoryTest { + + private AuditImportResourceAdminEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData.Builder newBuilder2 = ResourceAuditData.newBuilder(); + ResourceAuditData resAuData = newBuilder2.build(); + new AuditImportResourceAdminEventFactory(commonAuData, resAuData, resAuData, "", "", "", new User(), ""); + return new AuditImportResourceAdminEventFactory(commonAuData, resAuData, + resAuData, "", "", "", new User(), "", "", "", ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditImportResourceAdminEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditResourceAdminEventFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditResourceAdminEventFuncTest.java index 18bd41c765..8478803f16 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditResourceAdminEventFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/resourceadmin/AuditResourceAdminEventFuncTest.java @@ -1,33 +1,5 @@ package org.openecomp.sdc.be.auditing.impl.resourceadmin; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.auditing.api.AuditEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; -import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; -import org.openecomp.sdc.common.api.ConfigurationSource; -import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import org.openecomp.sdc.common.util.ThreadLocalsHolder; - -import java.util.EnumMap; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyMap; @@ -62,6 +34,34 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.TOSCA_NODE_TYPE; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.modifier; +import java.util.EnumMap; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.auditing.api.AuditEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; + @RunWith(MockitoJUnitRunner.class) public class AuditResourceAdminEventFuncTest { private AuditingManager auditingManager; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditGetUsersListEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditGetUsersListEventFactoryTest.java new file mode 100644 index 0000000000..8b74764b8b --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditGetUsersListEventFactoryTest.java @@ -0,0 +1,35 @@ +package org.openecomp.sdc.be.auditing.impl.usersadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; + +public class AuditGetUsersListEventFactoryTest { + + private AuditGetUsersListEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + return new AuditGetUsersListEventFactory(commonAuData, new User(), ""); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditGetUsersListEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditGetUsersListEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserAccessEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserAccessEventFactoryTest.java new file mode 100644 index 0000000000..df6245d336 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserAccessEventFactoryTest.java @@ -0,0 +1,35 @@ +package org.openecomp.sdc.be.auditing.impl.usersadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; + +public class AuditUserAccessEventFactoryTest { + + private AuditUserAccessEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + return new AuditUserAccessEventFactory(commonAuData, new User()); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditUserAccessEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditUserAccessEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserAdminEventFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserAdminEventFactoryTest.java new file mode 100644 index 0000000000..6c46902aeb --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserAdminEventFactoryTest.java @@ -0,0 +1,37 @@ +package org.openecomp.sdc.be.auditing.impl.usersadmin; + +import org.junit.Test; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; + +public class AuditUserAdminEventFactoryTest { + + private AuditUserAdminEventFactory createTestSubject() { + org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder newBuilder = CommonAuditData.newBuilder(); + CommonAuditData commonAuData = newBuilder.build(); + return new AuditUserAdminEventFactory(AuditingActionEnum.ACTIVATE_SERVICE_BY_API, commonAuData, new User(), + new User(), new User()); + } + + @Test + public void testGetLogMessage() throws Exception { + AuditUserAdminEventFactory testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getLogMessage(); + } + + @Test + public void testGetDbEvent() throws Exception { + AuditUserAdminEventFactory testSubject; + AuditingGenericEvent result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDbEvent(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserEventFuncTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserEventFuncTest.java index 4a5b1bbd59..f454a4b164 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserEventFuncTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/auditing/impl/usersadmin/AuditUserEventFuncTest.java @@ -1,32 +1,5 @@ package org.openecomp.sdc.be.auditing.impl.usersadmin; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.auditing.api.AuditEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditAuthRequestEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; -import org.openecomp.sdc.be.resources.data.auditing.AuthEvent; -import org.openecomp.sdc.be.resources.data.auditing.GetUsersListEvent; -import org.openecomp.sdc.be.resources.data.auditing.UserAccessEvent; -import org.openecomp.sdc.be.resources.data.auditing.UserAdminEvent; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; - -import java.util.EnumMap; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyMap; @@ -59,6 +32,33 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.init; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.modifier; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.user; +import java.util.EnumMap; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.auditing.api.AuditEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditAuthRequestEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.AuthEvent; +import org.openecomp.sdc.be.resources.data.auditing.GetUsersListEvent; +import org.openecomp.sdc.be.resources.data.auditing.UserAccessEvent; +import org.openecomp.sdc.be.resources.data.auditing.UserAdminEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; + @RunWith(MockitoJUnitRunner.class) public class AuditUserEventFuncTest { @Mock diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/AuditingManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/AuditingManagerTest.java index 06c22bca69..b9f65f5b88 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/AuditingManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/AuditingManagerTest.java @@ -20,6 +20,12 @@ package org.openecomp.sdc.be.components; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +import java.util.EnumMap; +import java.util.UUID; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,12 +38,6 @@ import org.openecomp.sdc.be.dao.impl.AuditingDao; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.util.ThreadLocalsHolder; -import java.util.EnumMap; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class AuditingManagerTest extends BeConfDependentTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java index bbd827eb23..a8c014754c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java @@ -1,7 +1,15 @@ package org.openecomp.sdc.be.components; -import com.google.common.collect.Sets; -import fj.data.Either; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContext; + import org.junit.Before; import org.mockito.Mockito; import org.openecomp.sdc.ElementOperationMock; @@ -47,14 +55,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.google.common.collect.Sets; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; +import fj.data.Either; public class BaseServiceBusinessLogicTest { private static final Logger log = LoggerFactory.getLogger(ServiceBusinessLogicTest.class); private static final String SERVICE_CATEGORY = "Mobility"; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ComponentBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ComponentBusinessLogicTest.java index d7bfdcd1a4..95a649fbe8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ComponentBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ComponentBusinessLogicTest.java @@ -20,7 +20,13 @@ package org.openecomp.sdc.be.components; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -42,12 +48,7 @@ import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class ComponentBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/GroupBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/GroupBusinessLogicTest.java index c114f340b8..a2dfd907da 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/GroupBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/GroupBusinessLogicTest.java @@ -20,6 +20,10 @@ package org.openecomp.sdc.be.components; +import static org.mockito.Mockito.when; + +import javax.servlet.ServletContext; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -42,10 +46,6 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import javax.servlet.ServletContext; - -import static org.mockito.Mockito.when; /** * tests GroupBusinessLogic class * @author ns019t diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java index 04c2100ed8..11d2496211 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java @@ -20,17 +20,17 @@ package org.openecomp.sdc.be.components; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + import org.junit.Test; import org.openecomp.sdc.be.components.health.HealthCheckBusinessLogic; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; public class HealthCheckBusinessLogicTest { HealthCheckBusinessLogic healthCheckBusinessLogic = new HealthCheckBusinessLogic(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java index 18116a4d56..f38848c1be 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/InterfaceOperationTestUtils.java @@ -16,15 +16,15 @@ package org.openecomp.sdc.be.components; +import java.util.HashMap; +import java.util.Map; + import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Operation; -import java.util.HashMap; -import java.util.Map; - public interface InterfaceOperationTestUtils { default InterfaceDefinition createInterface(String uniqueID, String description, String type, diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PathTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PathTest.java index f9412c1643..a218b8bb41 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PathTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PathTest.java @@ -1,9 +1,16 @@ package org.openecomp.sdc.be.components; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + import org.junit.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.auditing.impl.AuditingManager; @@ -23,16 +30,11 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.exception.ResponseFormat; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class PathTest extends BaseServiceBusinessLogicTest { public static final String fromNode = "fromNode"; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java index 38aaf92335..120077efc9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java @@ -20,8 +20,19 @@ package org.openecomp.sdc.be.components; -import fj.data.Either; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContext; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -52,17 +63,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; +import junit.framework.Assert; public class PropertyBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java index 82389822f3..6488482e06 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java @@ -20,7 +20,16 @@ package org.openecomp.sdc.be.components; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Before; import org.junit.BeforeClass; @@ -55,15 +64,7 @@ import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.PolicyException; import org.openecomp.sdc.exception.ResponseFormat; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ResourceImportManagerTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceTestUtils.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceTestUtils.java index e750d3ab51..e74a84c809 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceTestUtils.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceTestUtils.java @@ -20,14 +20,14 @@ package org.openecomp.sdc.be.components; +import java.util.ArrayList; +import java.util.List; + import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import java.util.ArrayList; -import java.util.List; - public class ResourceTestUtils { public static Resource prepareResource(int resourceIndex) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java index bbb381bad3..f9c75d488e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceBusinessLogicTest.java @@ -20,7 +20,23 @@ package org.openecomp.sdc.be.components; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.servlet.ServletContext; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Before; import org.junit.Ignore; @@ -71,21 +87,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ServiceBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java index fe7152608c..86b8b56901 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.be.components; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -31,10 +35,7 @@ import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.common.util.ThreadLocalsHolder; import org.openecomp.sdc.exception.ResponseFormat; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.when; +import fj.data.Either; /** * Created by chaya on 10/26/2017. diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/AaiMockRequestHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/AaiMockRequestHandlerTest.java deleted file mode 100644 index 7df88c1cd9..0000000000 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/AaiMockRequestHandlerTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.openecomp.sdc.be.components.distribution.engine; - -import org.apache.http.HttpStatus; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.sdc.be.components.BeConfDependentTest; -import org.openecomp.sdc.be.info.OperationalEnvInfo; -import org.openecomp.sdc.common.http.client.api.HttpResponse; - -import static org.junit.Assert.assertTrue; - -public class AaiMockRequestHandlerTest extends BeConfDependentTest { - - @Ignore - @Test - public void testGetOperationalEnvJson() { - String id = "OEid4"; - AaiRequestHandler aaiRequestHandler = new AaiRequestHandler(); - aaiRequestHandler.init(); - HttpResponse<String> resp = aaiRequestHandler.getOperationalEnvById(id); - - if (resp.getStatusCode() == HttpStatus.SC_OK) { - try { - String response = resp.getResponse(); - System.out.println("The rest response is:"); - System.out.println(response); - - OperationalEnvInfo operationalEnvInfo = OperationalEnvInfo.createFromJson(response); - - System.out.println(String.format("Get \"%s\" operational environment. %s", id, operationalEnvInfo)); - System.out.println(operationalEnvInfo); - } - catch (Exception e) { - System.out.println(String.format("Json convert to OperationalEnvInfo failed with exception %s", e)); - System.out.println(HttpStatus.SC_INTERNAL_SERVER_ERROR); - } - } - else { - System.out.println("The rest response is:"); - String response = resp.getResponse(); - System.out.println(response); - System.out.println(String.format("Get \"%s\" operational environment failed with statusCode: %s, response: %s, description: %s", id, resp.getStatusCode(), resp.getResponse(), resp.getDescription())); - System.out.println(resp.getStatusCode()); - } - - assertTrue(true); - } -} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/AaiRequestHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/AaiRequestHandlerTest.java new file mode 100644 index 0000000000..3a29821504 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/AaiRequestHandlerTest.java @@ -0,0 +1,68 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.util.Properties; + +import org.junit.Test; +import org.openecomp.sdc.be.components.BeConfDependentTest; + +import mockit.Deencapsulation; + +public class AaiRequestHandlerTest extends BeConfDependentTest { + + private AaiRequestHandler createTestSubject() { + AaiRequestHandler testSubject = new AaiRequestHandler(); + testSubject.init(); + return testSubject; + } + + @Test + public void testInit() throws Exception { + AaiRequestHandler testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.init(); + } + + @Test + public void testGetOperationalEnvById() throws Exception { + AaiRequestHandler testSubject; + String id = ""; + + // default test + testSubject = createTestSubject(); + testSubject.getOperationalEnvById(id); + } + + @Test + public void testRetryOnException() throws Exception { + AaiRequestHandler testSubject; + Exception e = null; + boolean result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "retryOnException", new Object[] { Exception.class }); + } + + @Test + public void testGetCause() throws Exception { + AaiRequestHandler testSubject; + Exception e = null; + Throwable result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "getCause", new Object[] { Exception.class }); + } + + @Test + public void testCreateHeaders() throws Exception { + AaiRequestHandler testSubject; + Properties result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "createHeaders"); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ArtifactInfoImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ArtifactInfoImplTest.java new file mode 100644 index 0000000000..bbed75dc60 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ArtifactInfoImplTest.java @@ -0,0 +1,311 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.components.BeConfDependentTest; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; + +import mockit.Deencapsulation; + +public class ArtifactInfoImplTest extends BeConfDependentTest { + + private ArtifactInfoImpl createTestSubject() { + return new ArtifactInfoImpl(); + } + + @Test + public void testConvertToArtifactInfoImpl() throws Exception { + Service service = new Service(); + ComponentInstance resourceInstance = new ComponentInstance(); + Collection<ArtifactDefinition> list = new LinkedList<>(); + ArtifactDefinition artifactDefinition = new ArtifactDefinition(); + List<ArtifactInfoImpl> result; + + // test 1 + result = ArtifactInfoImpl.convertToArtifactInfoImpl(service, resourceInstance, list); + Assert.assertEquals(new LinkedList<>(), result); + + // test 2 + artifactDefinition.setUniqueId("mock"); + list.add(artifactDefinition); + result = ArtifactInfoImpl.convertToArtifactInfoImpl(service, resourceInstance, list); + Assert.assertFalse(result.isEmpty()); + + // test 3 + artifactDefinition.setGeneratedFromId("mock"); + result = ArtifactInfoImpl.convertToArtifactInfoImpl(service, resourceInstance, list); + Assert.assertFalse(result.isEmpty()); + } + + @Test + public void testConvertServiceArtifactToArtifactInfoImpl() throws Exception { + Service service = new Service(); + Collection<ArtifactDefinition> list = new LinkedList<>(); + ArtifactDefinition artifactDefinition = new ArtifactDefinition(); + List<ArtifactInfoImpl> result = new LinkedList<>(); + + // test 1 + result = ArtifactInfoImpl.convertServiceArtifactToArtifactInfoImpl(service, list); + Assert.assertEquals(new LinkedList<>(), result); + + // test 2 + artifactDefinition.setUniqueId("mock"); + list.add(artifactDefinition); + + result = ArtifactInfoImpl.convertServiceArtifactToArtifactInfoImpl(service, list); + Assert.assertFalse(result.isEmpty()); + + // test 3 + artifactDefinition.setGeneratedFromId("mock"); + + result = ArtifactInfoImpl.convertServiceArtifactToArtifactInfoImpl(service, list); + Assert.assertFalse(result.isEmpty()); + } + + @Test + public void testGetUpdatedRequiredArtifactsFromNamesToUuids() throws Exception { + ArtifactDefinition artifactDefinition = null; + Map<String, ArtifactDefinition> artifacts = new HashMap<String, ArtifactDefinition>(); + List<String> result; + + // test 1 + artifactDefinition = null; + result = Deencapsulation.invoke(ArtifactInfoImpl.class, "getUpdatedRequiredArtifactsFromNamesToUuids", + new Object[] { ArtifactDefinition.class, artifacts.getClass() }); + Assert.assertEquals(null, result); + + // test 2 + artifactDefinition = new ArtifactDefinition(); + result = Deencapsulation.invoke(ArtifactInfoImpl.class, "getUpdatedRequiredArtifactsFromNamesToUuids", + new Object[] { ArtifactDefinition.class, artifacts.getClass() }); + Assert.assertEquals(null, result); + } + + @Test + public void testGetArtifactName() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactName(); + } + + @Test + public void testSetArtifactName() throws Exception { + ArtifactInfoImpl testSubject; + String artifactName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactName(artifactName); + } + + @Test + public void testGetArtifactType() throws Exception { + ArtifactInfoImpl testSubject; + ArtifactTypeEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactType(); + } + + @Test + public void testSetArtifactType() throws Exception { + ArtifactInfoImpl testSubject; + ArtifactTypeEnum artifactType = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactType(ArtifactTypeEnum.AAI_SERVICE_MODEL); + } + + @Test + public void testGetArtifactURL() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactURL(); + } + + @Test + public void testSetArtifactURL() throws Exception { + ArtifactInfoImpl testSubject; + String artifactURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactURL(artifactURL); + } + + @Test + public void testGetArtifactChecksum() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactChecksum(); + } + + @Test + public void testSetArtifactChecksum() throws Exception { + ArtifactInfoImpl testSubject; + String artifactChecksum = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactChecksum(artifactChecksum); + } + + @Test + public void testGetArtifactDescription() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactDescription(); + } + + @Test + public void testSetArtifactDescription() throws Exception { + ArtifactInfoImpl testSubject; + String artifactDescription = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactDescription(artifactDescription); + } + + @Test + public void testGetArtifactTimeout() throws Exception { + ArtifactInfoImpl testSubject; + Integer result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactTimeout(); + } + + @Test + public void testSetArtifactTimeout() throws Exception { + ArtifactInfoImpl testSubject; + Integer artifactTimeout = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactTimeout(artifactTimeout); + } + + @Test + public void testGetRelatedArtifacts() throws Exception { + ArtifactInfoImpl testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelatedArtifacts(); + } + + @Test + public void testSetRelatedArtifacts() throws Exception { + ArtifactInfoImpl testSubject; + List<String> relatedArtifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelatedArtifacts(relatedArtifacts); + } + + @Test + public void testToString() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } + + @Test + public void testGetArtifactUUID() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactUUID(); + } + + @Test + public void testSetArtifactUUID() throws Exception { + ArtifactInfoImpl testSubject; + String artifactUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactUUID(artifactUUID); + } + + @Test + public void testGetArtifactVersion() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactVersion(); + } + + @Test + public void testSetArtifactVersion() throws Exception { + ArtifactInfoImpl testSubject; + String artifactVersion = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactVersion(artifactVersion); + } + + @Test + public void testGetGeneratedFromUUID() throws Exception { + ArtifactInfoImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGeneratedFromUUID(); + } + + @Test + public void testSetGeneratedFromUUID() throws Exception { + ArtifactInfoImpl testSubject; + String generatedFromUUID = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setGeneratedFromUUID(generatedFromUUID); + } + + @Test + public void testUpdateArtifactTimeout() throws Exception { + ArtifactInfoImpl testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.updateArtifactTimeout(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponseTest.java new file mode 100644 index 0000000000..e3bdecc440 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/CambriaErrorResponseTest.java @@ -0,0 +1,103 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.util.List; + +import org.junit.Test; +import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; + +public class CambriaErrorResponseTest { + + private CambriaErrorResponse createTestSubject() { + return new CambriaErrorResponse(); + } + + @Test + public void testConstructors() throws Exception { + CambriaErrorResponse testSubject; + CambriaOperationStatus result; + + // default test + new CambriaErrorResponse(CambriaOperationStatus.AUTHENTICATION_ERROR); + new CambriaErrorResponse(CambriaOperationStatus.CONNNECTION_ERROR, 500); + } + + @Test + public void testGetOperationStatus() throws Exception { + CambriaErrorResponse testSubject; + CambriaOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOperationStatus(); + } + + @Test + public void testSetOperationStatus() throws Exception { + CambriaErrorResponse testSubject; + CambriaOperationStatus operationStatus = null; + + // default test + testSubject = createTestSubject(); + testSubject.setOperationStatus(operationStatus); + } + + @Test + public void testGetHttpCode() throws Exception { + CambriaErrorResponse testSubject; + Integer result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getHttpCode(); + } + + @Test + public void testSetHttpCode() throws Exception { + CambriaErrorResponse testSubject; + Integer httpCode = 0; + + // default test + testSubject = createTestSubject(); + testSubject.setHttpCode(httpCode); + } + + @Test + public void testAddVariable() throws Exception { + CambriaErrorResponse testSubject; + String variable = ""; + + // default test + testSubject = createTestSubject(); + testSubject.addVariable(variable); + } + + @Test + public void testGetVariables() throws Exception { + CambriaErrorResponse testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getVariables(); + } + + @Test + public void testSetVariables() throws Exception { + CambriaErrorResponse testSubject; + List<String> variables = null; + + // default test + testSubject = createTestSubject(); + testSubject.setVariables(variables); + } + + @Test + public void testToString() throws Exception { + CambriaErrorResponse testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandlerTest.java index d425e6d0f5..ae5dec4194 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/CambriaHandlerTest.java @@ -1,10 +1,19 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.att.nsa.apiClient.credentials.ApiCredential; -import com.att.nsa.apiClient.http.HttpException; -import com.att.nsa.cambria.client.CambriaClient.CambriaApiException; -import com.att.nsa.cambria.client.CambriaIdentityManager; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.security.GeneralSecurityException; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -13,65 +22,315 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.components.BeConfDependentTest; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import java.io.IOException; -import java.net.MalformedURLException; -import java.security.GeneralSecurityException; -import java.util.Arrays; +import com.att.nsa.apiClient.credentials.ApiCredential; +import com.att.nsa.apiClient.http.HttpException; +import com.att.nsa.cambria.client.CambriaClient; +import com.att.nsa.cambria.client.CambriaClient.CambriaApiException; +import com.att.nsa.cambria.client.CambriaClientBuilders.AbstractAuthenticatedManagerBuilder; +import com.att.nsa.cambria.client.CambriaClientBuilders.TopicManagerBuilder; +import com.att.nsa.cambria.client.CambriaConsumer; +import com.att.nsa.cambria.client.CambriaIdentityManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; +import fj.data.Either; +import mockit.Deencapsulation; @RunWith(MockitoJUnitRunner.class) -public class CambriaHandlerTest { - @Spy - private CambriaHandler handler = new CambriaHandler(); +public class CambriaHandlerTest extends BeConfDependentTest { + + private CambriaHandler createTestSubject() { + return new CambriaHandler(); + } + + @Spy + private CambriaHandler handler = new CambriaHandler(); + + @Mock + private CambriaIdentityManager createIdentityManager; + + private ApiCredential apiCredential = new ApiCredential("apiKey", "apiSecret"); + + @BeforeClass + public static void beforeClass() { + String appConfigDir = "src/test/resources/config/catalog-be"; + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), + appConfigDir); + new ConfigurationManager(configurationSource); + } + + @Before + public void startUp() throws MalformedURLException, GeneralSecurityException { + doReturn(createIdentityManager).when(handler).buildCambriaClient(any()); + } + + @Test + public void testMockCreateUebKeys() throws HttpException, CambriaApiException, IOException { + Mockito.when(createIdentityManager.createApiKey(Mockito.anyString(), Mockito.anyString())) + .thenReturn(apiCredential); + Either<ApiCredential, CambriaErrorResponse> eitherCreateUebKeys = handler + .createUebKeys(Arrays.asList("Myhost:1234")); + + Mockito.verify(createIdentityManager).setApiCredentials(Mockito.anyString(), Mockito.anyString()); + + assertTrue("Unexpected Operational Status", eitherCreateUebKeys.isLeft()); + + } + + @Test + public void testMockCreateUebKeys_FAIL() throws HttpException, CambriaApiException, IOException { + Mockito.when(createIdentityManager.createApiKey(Mockito.anyString(), Mockito.anyString())) + .thenThrow(new CambriaApiException("Error Message")); + Either<ApiCredential, CambriaErrorResponse> eitherCreateUebKeys = handler + .createUebKeys(Arrays.asList("Myhost:1234")); + Mockito.verify(createIdentityManager, Mockito.never()).setApiCredentials(Mockito.anyString(), + Mockito.anyString()); + assertTrue("Unexpected Operational Status", eitherCreateUebKeys.isRight()); + CambriaErrorResponse response = eitherCreateUebKeys.right().value(); + assertEquals("Unexpected Operational Status", CambriaOperationStatus.CONNNECTION_ERROR, + response.getOperationStatus()); + assertEquals("Unexpected HTTP Code", 500, response.getHttpCode().intValue()); + } + + @Test + public void testProcessMessageException() throws Exception { + CambriaHandler testSubject; + String message = ""; + Integer result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "processMessageException", new Object[] { message }); + } + + @Test + public void testCheckPattern() throws Exception { + CambriaHandler testSubject; + String patternStr = ""; + String message = ""; + int groupIndex = 0; + Integer result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "checkPattern", new Object[] { patternStr, message, groupIndex }); + } + + @Test + public void testGetTopics() throws Exception { + CambriaHandler testSubject; + List<String> hostSet = new LinkedList<>(); + hostSet.add("mock"); + Either<Set<String>, CambriaErrorResponse> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTopics(hostSet); + } + + @Test + public void testProcessError() throws Exception { + CambriaHandler testSubject; + Exception e = null; + CambriaErrorResponse result; + + // default test + testSubject = createTestSubject(); + + e = new Exception("HTTP Status 999"); + result = Deencapsulation.invoke(testSubject, "processError", e); + + e = new Exception("HTTP Status 401"); + result = Deencapsulation.invoke(testSubject, "processError", e); + + e = new Exception("HTTP Status 409"); + result = Deencapsulation.invoke(testSubject, "processError", e); + + e = new Exception("HTTP Status 500"); + result = Deencapsulation.invoke(testSubject, "processError", e); + + e = new Exception("mock", new Throwable(new Throwable("mock"))); + result = Deencapsulation.invoke(testSubject, "processError", e); + } + + @Test + public void testWriteErrorToLog() throws Exception { + CambriaHandler testSubject; + CambriaErrorResponse cambriaErrorResponse = new CambriaErrorResponse(); + cambriaErrorResponse.setOperationStatus(CambriaOperationStatus.AUTHENTICATION_ERROR); + String errorMessage = "mock"; + String methodName = "mock"; + String operationDesc = "mock"; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "writeErrorToLog", cambriaErrorResponse, "mock", "mock", "mock"); + } + + @Test + public void testCreateTopic() throws Exception { + CambriaHandler testSubject; + Collection<String> hostSet = new LinkedList<>(); + hostSet.add("mock"); + String apiKey = "mock"; + String secretKey = "mock"; + String topicName = "mock"; + int partitionCount = 0; + int replicationCount = 0; + CambriaErrorResponse result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createTopic(hostSet, apiKey, secretKey, topicName, partitionCount, replicationCount); + } + + @Test + public void testUnRegisterFromTopic() throws Exception { + CambriaHandler testSubject; + Collection<String> hostSet = new LinkedList<>(); + hostSet.add("mock"); + String managerApiKey = "mock"; + String managerSecretKey = "mock"; + String subscriberApiKey = "mock"; + String topicName = "mock"; + CambriaErrorResponse unRegisterFromTopic = null; + + // default test + testSubject = createTestSubject(); + unRegisterFromTopic = testSubject.unRegisterFromTopic(hostSet, managerApiKey, managerSecretKey, + subscriberApiKey, SubscriberTypeEnum.CONSUMER, topicName); + } + + @Test + public void testRegisterToTopic() throws Exception { + CambriaHandler testSubject; + Collection<String> hostSet = new LinkedList<String>(); + hostSet.add("mock"); + String managerApiKey = "mock"; + String managerSecretKey = "mock"; + String subscriberApiKey = "mock"; + SubscriberTypeEnum subscriberTypeEnum = null; + String topicName = "mock"; + CambriaErrorResponse result; + + // default test + testSubject = createTestSubject(); + result = testSubject.registerToTopic(hostSet, managerApiKey, managerSecretKey, subscriberApiKey, + SubscriberTypeEnum.CONSUMER, topicName); + } + + @Test + public void testCreateConsumer() throws Exception { + CambriaHandler testSubject; + Collection<String> hostSet = new LinkedList<>(); + hostSet.add("mock"); + String topicName = "mock"; + String apiKey = "mock"; + String secretKey = "mock"; + String consumerId = "mock"; + String consumerGroup = "mock"; + int timeoutMS = 0; + CambriaConsumer result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createConsumer(hostSet, topicName, apiKey, secretKey, consumerId, consumerGroup, + timeoutMS); + } + + @Test + public void testCloseConsumer() throws Exception { + CambriaHandler testSubject; + CambriaConsumer consumer = null; + + // test 1 + testSubject = createTestSubject(); + consumer = null; + testSubject.closeConsumer(consumer); + } + + @Test + public void testFetchFromTopic() throws Exception { + CambriaHandler testSubject; + CambriaConsumer topicConsumer = null; + Either<Iterable<String>, CambriaErrorResponse> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.fetchFromTopic(topicConsumer); + } - @Mock - private CambriaIdentityManager createIdentityManager; + @Test + public void testSendNotification() throws Exception { + CambriaHandler testSubject; + String topicName = "mock"; + String uebPublicKey = "mock"; + String uebSecretKey = "mock"; + List<String> uebServers = new LinkedList<>(); + uebServers.add("mock"); + INotificationData data = null; + CambriaErrorResponse result; - private ApiCredential apiCredential = new ApiCredential("apiKey", "apiSecret"); + // default test + testSubject = createTestSubject(); + result = testSubject.sendNotification(topicName, uebPublicKey, uebSecretKey, uebServers, data); + } - @BeforeClass - public static void beforeClass() { - String appConfigDir = "src/test/resources/config/catalog-be"; - ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); - new ConfigurationManager(configurationSource); - } + @Test + public void testSendNotificationAndClose() throws Exception { + CambriaHandler testSubject; + String topicName = "mock"; + String uebPublicKey = "mock"; + String uebSecretKey = "mock"; + List<String> uebServers = new LinkedList<>(); + uebServers.add("mock"); + INotificationData data = null; + long waitBeforeCloseTimeout = 1; + CambriaErrorResponse result; + // default test + testSubject = createTestSubject(); + result = testSubject.sendNotificationAndClose(topicName, uebPublicKey, uebSecretKey, uebServers, data, + waitBeforeCloseTimeout); + } - @Before - public void startUp() throws MalformedURLException, GeneralSecurityException { - doReturn(createIdentityManager).when(handler).buildCambriaClient(any()); - } + @Test + public void testGetApiKey() throws Exception { + CambriaHandler testSubject; + String server = ""; + String apiKey = ""; + CambriaErrorResponse result; - @Test - public void testCreateUebKeys() throws HttpException, CambriaApiException, IOException { - Mockito.when(createIdentityManager.createApiKey(Mockito.anyString(), Mockito.anyString())).thenReturn(apiCredential); - Either<ApiCredential, CambriaErrorResponse> eitherCreateUebKeys = handler.createUebKeys(Arrays.asList("Myhost:1234") ); + // default test + testSubject = createTestSubject(); + result = testSubject.getApiKey(server, apiKey); + } - Mockito.verify(createIdentityManager).setApiCredentials(Mockito.anyString(), Mockito.anyString()); + @Test + public void testCreateUebKeys() throws Exception { + CambriaHandler testSubject; + List<String> hostSet = null; + Either<ApiCredential, CambriaErrorResponse> result; - assertTrue("Unexpected Operational Status", eitherCreateUebKeys.isLeft()); + // default test + testSubject = createTestSubject(); + result = testSubject.createUebKeys(hostSet); + } - } + @Test + public void testBuildCambriaClient() throws Exception { + CambriaHandler testSubject; + AbstractAuthenticatedManagerBuilder<? extends CambriaClient> client = new TopicManagerBuilder() + .usingHosts("mock").authenticatedBy("mock", "mock"); - @Test - public void testCreateUebKeys_FAIL() throws HttpException, CambriaApiException, IOException { - Mockito.when(createIdentityManager.createApiKey(Mockito.anyString(), Mockito.anyString())).thenThrow(new CambriaApiException("Error Message")); - Either<ApiCredential, CambriaErrorResponse> eitherCreateUebKeys = handler.createUebKeys(Arrays.asList("Myhost:1234") ); - Mockito.verify(createIdentityManager, Mockito.never()).setApiCredentials(Mockito.anyString(), Mockito.anyString()); - assertTrue("Unexpected Operational Status", eitherCreateUebKeys.isRight()); - CambriaErrorResponse response = eitherCreateUebKeys.right().value(); - assertEquals("Unexpected Operational Status", CambriaOperationStatus.CONNNECTION_ERROR, response.getOperationStatus()); - assertEquals("Unexpected HTTP Code", 500, response.getHttpCode().intValue()); - } + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "buildCambriaClient", client); + } -} +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/Dev2DevDmaapConsumerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/Dev2DevDmaapConsumerTest.java index 45906c6f30..9903f4c56a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/Dev2DevDmaapConsumerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/Dev2DevDmaapConsumerTest.java @@ -1,7 +1,8 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.att.nsa.mr.client.MRConsumer; -import com.google.gson.GsonBuilder; +import java.util.concurrent.ExecutorService; +import java.util.stream.IntStream; + import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; @@ -14,8 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.concurrent.ExecutorService; -import java.util.stream.IntStream; +import com.att.nsa.mr.client.MRConsumer; +import com.google.gson.GsonBuilder; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealthTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealthTest.java new file mode 100644 index 0000000000..be25e4af73 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealthTest.java @@ -0,0 +1,157 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.junit.Test; +import org.openecomp.sdc.be.components.BeConfDependentTest; +import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineClusterHealth.HealthCheckScheduledTask; +import org.openecomp.sdc.common.api.HealthCheckInfo; + +import mockit.Deencapsulation; + +public class DistributionEngineClusterHealthTest extends BeConfDependentTest{ + + private DistributionEngineClusterHealth createTestSubject() { + return new DistributionEngineClusterHealth(); + } + + @Test + public void testInit() throws Exception { + DistributionEngineClusterHealth testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "init"); + } + + @Test + public void testDestroy() throws Exception { + DistributionEngineClusterHealth testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "destroy"); + } + + @Test + public void testStartHealthCheckTask() throws Exception { + DistributionEngineClusterHealth testSubject; + Map<String, AtomicBoolean> envNamePerStatus = null; + boolean startTask = false; + + // default test + testSubject = createTestSubject(); + testSubject.startHealthCheckTask(envNamePerStatus, startTask); + } + + @Test + public void testStartHealthCheckTask_1() throws Exception { + DistributionEngineClusterHealth testSubject; + Map<String, AtomicBoolean> envNamePerStatus = new HashMap<>(); + + // default test + testSubject = createTestSubject(); + testSubject.init(); + testSubject.startHealthCheckTask(envNamePerStatus); + } + + @Test + public void testHealthCheckScheduledTask() throws Exception { + DistributionEngineClusterHealth testSubject; + Map<String, AtomicBoolean> envNamePerStatus = new HashMap<>(); + + // default test + testSubject = createTestSubject(); + HealthCheckScheduledTask healthCheckScheduledTask = testSubject. new HealthCheckScheduledTask(new LinkedList<>()); + LinkedList<UebHealthCheckCall> healthCheckCalls = new LinkedList<>(); + UebHealthCheckCall hcc = new UebHealthCheckCall("mock", "mock"); + healthCheckCalls.add(hcc); + healthCheckScheduledTask.healthCheckCalls = healthCheckCalls; + + Deencapsulation.invoke(healthCheckScheduledTask, "queryUeb"); + } + + @Test + public void testHealthCheckScheduledTaskRun() throws Exception { + DistributionEngineClusterHealth testSubject; + Map<String, AtomicBoolean> envNamePerStatus = new HashMap<>(); + envNamePerStatus.put("mock", new AtomicBoolean(true)); + // default test + testSubject = createTestSubject(); + testSubject.startHealthCheckTask(envNamePerStatus, false); + HealthCheckScheduledTask healthCheckScheduledTask = testSubject. new HealthCheckScheduledTask(new LinkedList<>()); + LinkedList<UebHealthCheckCall> healthCheckCalls = new LinkedList<>(); + UebHealthCheckCall hcc = new UebHealthCheckCall("mock", "mock"); + healthCheckCalls.add(hcc); + healthCheckScheduledTask.healthCheckCalls = healthCheckCalls; + + Deencapsulation.invoke(healthCheckScheduledTask, "run"); + } + + @Test + public void testHealthCheckScheduledTaskRun_2() throws Exception { + DistributionEngineClusterHealth testSubject; + Map<String, AtomicBoolean> envNamePerStatus = new HashMap<>(); + envNamePerStatus.put("mock", new AtomicBoolean(false)); + // default test + testSubject = createTestSubject(); + testSubject.startHealthCheckTask(envNamePerStatus, false); + HealthCheckScheduledTask healthCheckScheduledTask = testSubject. new HealthCheckScheduledTask(new LinkedList<>()); + LinkedList<UebHealthCheckCall> healthCheckCalls = new LinkedList<>(); + UebHealthCheckCall hcc = new UebHealthCheckCall("mock", "mock"); + healthCheckCalls.add(hcc); + healthCheckScheduledTask.healthCheckCalls = healthCheckCalls; + + Deencapsulation.invoke(healthCheckScheduledTask, "run"); + } + + @Test + public void testLogAlarm() throws Exception { + DistributionEngineClusterHealth testSubject; + boolean lastHealthState = false; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "logAlarm", new Object[] { lastHealthState }); + } + + @Test + public void testGetHealthCheckInfo() throws Exception { + DistributionEngineClusterHealth testSubject; + HealthCheckInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getHealthCheckInfo(); + } + + @Test + public void testSetHealthCheckUebIsDisabled() throws Exception { + DistributionEngineClusterHealth testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.setHealthCheckUebIsDisabled(); + } + + @Test + public void testSetHealthCheckUebConfigurationError() throws Exception { + DistributionEngineClusterHealth testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.setHealthCheckUebConfigurationError(); + } + + @Test + public void testSetHealthCheckOkAndReportInCaseLastStateIsDown() throws Exception { + DistributionEngineClusterHealth testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.setHealthCheckOkAndReportInCaseLastStateIsDown(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineConfigTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineConfigTest.java index 04aa242b03..6f167a57b7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineConfigTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineConfigTest.java @@ -20,6 +20,13 @@ package org.openecomp.sdc.be.components.distribution.engine; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -31,13 +38,6 @@ import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class DistributionEngineConfigTest { @Before diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineHealthCheckTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineHealthCheckTest.java index 1fa0fc60b7..3d4462e1a3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineHealthCheckTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineHealthCheckTest.java @@ -20,8 +20,12 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.List; + import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; @@ -29,11 +33,8 @@ import org.openecomp.sdc.be.components.BeConfDependentTest; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; public class DistributionEngineHealthCheckTest extends BeConfDependentTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTaskTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTaskTest.java index 03a6625cae..c77b86a949 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTaskTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineInitTaskTest.java @@ -20,7 +20,18 @@ package org.openecomp.sdc.be.components.distribution.engine; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; + import org.apache.commons.collections.CollectionUtils; import org.junit.Before; import org.junit.Test; @@ -36,17 +47,7 @@ import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class DistributionEngineInitTaskTest { @@ -90,7 +91,115 @@ public class DistributionEngineInitTaskTest { assertEquals("check next retry interval reach max retry interval", initTask.getCurrentRetryInterval(), maxRetry); } + + @Test + public void checkStartTask() { + + String envName = "PrOD"; + DistributionEngineConfiguration deConfiguration = new DistributionEngineConfiguration(); + int retry = 2; + int maxRetry = 40; + deConfiguration.setInitRetryIntervalSec(retry); + deConfiguration.setInitMaxIntervalSec(maxRetry); + DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null, readEnvFromConfig(deConfiguration)); + + initTask.startTask(); + } + + @Test + public void checkRestartTask() { + + String envName = "PrOD"; + + DistributionEngineConfiguration deConfiguration = new DistributionEngineConfiguration(); + int retry = 2; + int maxRetry = 40; + deConfiguration.setInitRetryIntervalSec(retry); + deConfiguration.setInitMaxIntervalSec(maxRetry); + DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null, readEnvFromConfig(deConfiguration)); + + initTask.restartTask(); + } + + @Test + public void checkStopTask() { + + String envName = "PrOD"; + + DistributionEngineConfiguration deConfiguration = new DistributionEngineConfiguration(); + int retry = 2; + int maxRetry = 40; + deConfiguration.setInitRetryIntervalSec(retry); + deConfiguration.setInitMaxIntervalSec(maxRetry); + DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null, readEnvFromConfig(deConfiguration)); + + initTask.stopTask(); + initTask.startTask(); + initTask.stopTask(); + } + + @Test + public void checkDestroy() { + + String envName = "PrOD"; + + DistributionEngineConfiguration deConfiguration = new DistributionEngineConfiguration(); + int retry = 2; + int maxRetry = 40; + deConfiguration.setInitRetryIntervalSec(retry); + deConfiguration.setInitMaxIntervalSec(maxRetry); + DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null, readEnvFromConfig(deConfiguration)); + + initTask.destroy(); + } + + @Test + public void checkRun() { + + String notifTopic = "notif"; + String statusTopic = "status"; + + List<String> uebServers = new ArrayList<>(); + uebServers.add("server1"); + CambriaErrorResponse cambriaErrorResponse = new CambriaErrorResponse(CambriaOperationStatus.NOT_FOUND); + Either<Set<String>, CambriaErrorResponse> right = Either.right(cambriaErrorResponse); + when(cambriaHandler.getTopics(Mockito.any(List.class))).thenReturn(right); + + String envName = "PrOD"; + + DistributionEngineConfiguration deConfiguration = new DistributionEngineConfiguration(); + deConfiguration.setUebServers(uebServers); + int retry = 2; + int maxRetry = 40; + deConfiguration.setInitRetryIntervalSec(retry); + deConfiguration.setInitMaxIntervalSec(maxRetry); + deConfiguration.setDistributionNotifTopicName(notifTopic); + deConfiguration.setDistributionStatusTopicName(statusTopic); + CreateTopicConfig createTopic = new CreateTopicConfig(); + createTopic.setPartitionCount(1); + createTopic.setReplicationCount(1); + deConfiguration.setCreateTopic(createTopic); + + cambriaErrorResponse = new CambriaErrorResponse(CambriaOperationStatus.OK); + + String realNotifTopic = notifTopic + "-" + envName.toUpperCase(); + String realStatusTopic = statusTopic + "-" + envName.toUpperCase(); + when(cambriaHandler.createTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.eq(realNotifTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); + when(cambriaHandler.createTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.eq(realStatusTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); + + cambriaErrorResponse = new CambriaErrorResponse(CambriaOperationStatus.OK); + when(cambriaHandler.registerToTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())) + .thenReturn(cambriaErrorResponse); + + DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null, readEnvFromConfig(deConfiguration)); + initTask.setCambriaHandler(cambriaHandler); + + boolean initFlow = initTask.initFlow(); + + initTask.run(); + } + @SuppressWarnings("unchecked") @Test public void testInitFlowScenarioSuccess() { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTaskTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTaskTest.java new file mode 100644 index 0000000000..ecbc1f90f6 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTaskTest.java @@ -0,0 +1,107 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.openecomp.sdc.be.components.BeConfDependentTest; +import org.openecomp.sdc.be.components.distribution.engine.report.DistributionCompleteReporter; +import org.openecomp.sdc.be.config.DistributionEngineConfiguration; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; + +import mockit.Deencapsulation; + +public class DistributionEnginePollingTaskTest extends BeConfDependentTest { + + @Mock + private ComponentsUtils componentsUtils; + + private DistributionEnginePollingTask createTestSubject() { + componentsUtils = Mockito.mock(ComponentsUtils.class); + DistributionEngineConfiguration distributionEngineConfiguration = configurationManager + .getDistributionEngineConfiguration(); + + return new DistributionEnginePollingTask(distributionEngineConfiguration, + new DistributionCompleteReporterMock(), componentsUtils, new DistributionEngineClusterHealth(), + new OperationalEnvironmentEntry()); + } + + @Test + public void testStartTask() throws Exception { + DistributionEnginePollingTask testSubject; + String topicName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.startTask(topicName); + } + + @Test + public void testStopTask() throws Exception { + DistributionEnginePollingTask testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.stopTask(); + } + + @Test + public void testDestroy() throws Exception { + DistributionEnginePollingTask testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.destroy(); + } + + @Test + public void testRun() throws Exception { + DistributionEnginePollingTask testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.run(); + } + + @Test + public void testHandleDistributionNotificationMsg() throws Exception { + DistributionEnginePollingTask testSubject; + DistributionStatusNotification notification = new DistributionStatusNotification(); + notification.setDistributionID("mock"); + notification.setConsumerID("mock"); + notification.setArtifactURL("mock"); + notification.setTimestamp(435435); + notification.setStatus(DistributionStatusNotificationEnum.ALREADY_DEPLOYED); + notification.setErrorReason("mock"); + + + + // default test + testSubject = createTestSubject(); + Mockito.doNothing().when(componentsUtils).auditDistributionStatusNotification(Mockito.any(AuditingActionEnum.class), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), + Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + Deencapsulation.invoke(testSubject, "handleDistributionNotificationMsg", + notification); + } + + @Test + public void testShutdownExecutor() throws Exception { + DistributionEnginePollingTask testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "shutdownExecutor"); + } + + private class DistributionCompleteReporterMock implements DistributionCompleteReporter { + + @Override + public void reportDistributionComplete(DistributionStatusNotification distributionStatusNotification) { + // TODO Auto-generated method stub + + } + + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java index b1a43eaa57..c1a13f2066 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java @@ -1,95 +1,358 @@ package org.openecomp.sdc.be.components.distribution.engine; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.components.utils.OperationalEnvironmentBuilder; +import org.openecomp.sdc.be.config.DistributionEngineConfiguration; +import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionStatusTopicConfig; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; +import mockit.Deencapsulation; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +public class DistributionEngineTest{ + + public static final String DISTRIBUTION_ID = "distId"; + public static final String ENV_ID = "envId"; + public static final String USER_ID = "userId"; + public static final String MODIFIER = "modifier"; + + @InjectMocks + private DistributionEngine testInstance; + + @Mock + private EnvironmentsEngine environmentsEngine; + + @Mock + private DistributionNotificationSender distributionNotificationSender; + + @Mock + private ServiceDistributionArtifactsBuilder serviceDistributionArtifactsBuilder; + + private DummyDistributionConfigurationManager distributionEngineConfigurationMock; + + private Map<String, OperationalEnvironmentEntry> envs; + + @Before + public void setUpMock() throws Exception { + MockitoAnnotations.initMocks(this); + distributionEngineConfigurationMock = new DummyDistributionConfigurationManager(); + envs = getEnvs(ENV_ID); + } + + @Test + public void notifyService() throws Exception { + NotificationDataImpl notificationData = new NotificationDataImpl(); + Service service = new Service(); + when(environmentsEngine.getEnvironmentById(ENV_ID)).thenReturn(envs.get(ENV_ID)); + when(distributionEngineConfigurationMock.getConfigurationMock().getDistributionNotifTopicName()) + .thenReturn("topic"); + when(distributionNotificationSender.sendNotification(eq("topic-ENVID"), eq(DISTRIBUTION_ID), + any(EnvironmentMessageBusData.class), any(NotificationDataImpl.class), any(Service.class), eq(USER_ID), + eq(MODIFIER))).thenReturn(ActionStatus.OK); + ActionStatus actionStatus = testInstance.notifyService(DISTRIBUTION_ID, service, notificationData, ENV_ID, + USER_ID, MODIFIER); + assertEquals(ActionStatus.OK, actionStatus); + } + + @Test + public void notifyService_couldNotResolveEnvironment() throws Exception { + when(environmentsEngine.getEnvironments()).thenReturn(envs); + ActionStatus actionStatus = testInstance.notifyService(DISTRIBUTION_ID, new Service(), + new NotificationDataImpl(), "someNonExisitngEnv", USER_ID, MODIFIER); + assertEquals(ActionStatus.DISTRIBUTION_ENVIRONMENT_NOT_AVAILABLE, actionStatus); + verifyZeroInteractions(distributionNotificationSender); + } + + @Test + public void notifyService_failedWhileSendingNotification() throws Exception { + NotificationDataImpl notificationData = new NotificationDataImpl(); + Service service = new Service(); + when(environmentsEngine.getEnvironmentById(ENV_ID)).thenReturn(envs.get(ENV_ID)); + when(distributionEngineConfigurationMock.getConfigurationMock().getDistributionNotifTopicName()) + .thenReturn("topic"); + when(distributionNotificationSender.sendNotification(eq("topic-ENVID"), eq(DISTRIBUTION_ID), + any(EnvironmentMessageBusData.class), any(NotificationDataImpl.class), any(Service.class), eq(USER_ID), + eq(MODIFIER))).thenReturn(ActionStatus.GENERAL_ERROR); + ActionStatus actionStatus = testInstance.notifyService(DISTRIBUTION_ID, service, notificationData, ENV_ID, + USER_ID, MODIFIER); + assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); + } + + private Map<String, OperationalEnvironmentEntry> getEnvs(String... environmentIds) { + Set<String> uebAddress = new HashSet<>(); + uebAddress.add("someAddress"); + return Stream.of(environmentIds) + .map(id -> new OperationalEnvironmentBuilder().setEnvId(id).setDmaapUebAddress(uebAddress).build()) + .collect(Collectors.toMap(OperationalEnvironmentEntry::getEnvironmentId, Function.identity())); + } + + private DistributionEngine createTestSubject() { + return new DistributionEngine(); + } + + /*@Test(expected=ExceptionInInitializerError.class) + public void testMain() throws Exception { + String[] args = new String[] { "" }; + + // default test + DistributionEngine.main(args); + }*/ + + @Test + public void testIsActive() throws Exception { + DistributionEngine testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isActive(); + } + + @Test(expected=NullPointerException.class) + public void testInit() throws Exception { + DistributionEngine testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "init"); + } + + @Test + public void testShutdown() throws Exception { + DistributionEngine testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.shutdown(); + } + + @Test + public void testValidateConfiguration() throws Exception { + DistributionEngine testSubject; + DistributionEngineConfiguration deConfiguration = new DistributionEngineConfiguration(); + deConfiguration.setDistributionStatusTopic((new DistributionStatusTopicConfig())); + boolean result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "validateConfiguration", deConfiguration); + } + + @Test + public void testIsValidServers() throws Exception { + DistributionEngine testSubject; + List<String> uebServers = null; + String methodName = ""; + String paramName = ""; + boolean result; + + // test 1 + testSubject = createTestSubject(); + uebServers = null; + result = Deencapsulation.invoke(testSubject, "isValidServers", + new Object[] { List.class, methodName, paramName }); + Assert.assertEquals(false, result); + } + + @Test + public void testIsValidFqdn() throws Exception { + DistributionEngine testSubject; + String serverFqdn = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "isValidFqdn", new Object[] { serverFqdn }); + } + + @Test + public void testIsValidParam() throws Exception { + DistributionEngine testSubject; + String paramValue = ""; + String methodName = ""; + String paramName = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "isValidParam", + new Object[] { paramValue, methodName, paramName }); + } + + @Test + public void testIsValidParam_1() throws Exception { + DistributionEngine testSubject; + List<String> paramValue = null; + String methodName = ""; + String paramName = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "isValidParam", + new Object[] { List.class, methodName, paramName }); + } + + @Test + public void testIsValidObject() throws Exception { + DistributionEngine testSubject; + Object paramValue = null; + String methodName = ""; + String paramName = ""; + boolean result; + + // test 1 + testSubject = createTestSubject(); + paramValue = null; + result = Deencapsulation.invoke(testSubject, "isValidObject", + new Object[] { Object.class, methodName, paramName }); + Assert.assertEquals(false, result); + } + + @Test + public void testGetEnvironmentErrorDescription() throws Exception { + DistributionEngine testSubject; + StorageOperationStatus status = null; + String result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "getEnvironmentErrorDescription", + StorageOperationStatus.DISTR_ENVIRONMENT_NOT_AVAILABLE); + result = Deencapsulation.invoke(testSubject, "getEnvironmentErrorDescription", + StorageOperationStatus.DISTR_ENVIRONMENT_NOT_FOUND); + result = Deencapsulation.invoke(testSubject, "getEnvironmentErrorDescription", + StorageOperationStatus.DISTR_ENVIRONMENT_SENT_IS_INVALID); + result = Deencapsulation.invoke(testSubject, "getEnvironmentErrorDescription", + StorageOperationStatus.ARTIFACT_NOT_FOUND); + } + + @Test + public void testIsEnvironmentAvailable() throws Exception { + DistributionEngine testSubject; + String envName = ""; + StorageOperationStatus result; + + // test 1 + testSubject = createTestSubject(); + envName = null; + result = testSubject.isEnvironmentAvailable(envName); + Assert.assertEquals(StorageOperationStatus.DISTR_ENVIRONMENT_SENT_IS_INVALID, result); + + // test 2 + testSubject = createTestSubject(); + envName = "mock"; + result = testSubject.isEnvironmentAvailable(envName); + Assert.assertEquals(StorageOperationStatus.DISTR_ENVIRONMENT_NOT_FOUND, result); + } + + //TODO Create test coverage for this method + /*@Test + public void testIsEnvironmentAvailable_1() throws Exception { + DistributionEngine testSubject; + StorageOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testInstance.isEnvironmentAvailable(); + }*/ + + @Test(expected=NullPointerException.class) + public void testDisableEnvironment() throws Exception { + DistributionEngine testSubject; + String envName = ""; + + // default test + testSubject = createTestSubject(); + testSubject.disableEnvironment(envName); + } + + @Test + public void testBuildTopicName() throws Exception { + DistributionEngine testSubject; + String envName = ""; + String result; + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "buildTopicName", new Object[] { envName }); + } + + @Test + public void testIsReadyForDistribution() throws Exception { + DistributionEngine testSubject; + Service service = null; + String envName = ""; + StorageOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isReadyForDistribution(service, envName); + } + + @Test + public void testVerifyServiceHasDeploymentArtifactsTrue() throws Exception { + Service service = new Service(); + StorageOperationStatus result; + + // default test + when(serviceDistributionArtifactsBuilder.verifyServiceContainsDeploymentArtifacts(ArgumentMatchers.any(Service.class))).thenReturn(true); + result = testInstance.verifyServiceHasDeploymentArtifacts(service); + } + + @Test + public void testVerifyServiceHasDeploymentArtifactsFalse() throws Exception { + Service service = new Service(); + StorageOperationStatus result; + + // default test + when(serviceDistributionArtifactsBuilder.verifyServiceContainsDeploymentArtifacts(ArgumentMatchers.any(Service.class))).thenReturn(false); + result = testInstance.verifyServiceHasDeploymentArtifacts(service); + } + + @Test + public void testGetEnvironmentById() throws Exception { + DistributionEngine testSubject; + String opEnvId = ""; + OperationalEnvironmentEntry result; + + // default test + when(environmentsEngine.getEnvironmentById(ArgumentMatchers.anyString())).thenReturn(new OperationalEnvironmentEntry()); + result = testInstance.getEnvironmentById(opEnvId); + } + + @Test + public void testBuildServiceForDistribution() throws Exception { + Service service = new Service(); + String distributionId = ""; + String workloadContext = ""; + INotificationData result; -public class DistributionEngineTest { - - public static final String DISTRIBUTION_ID = "distId"; - public static final String ENV_ID = "envId"; - public static final String USER_ID = "userId"; - public static final String MODIFIER = "modifier"; - - @InjectMocks - private DistributionEngine testInstance; - - @Mock - private EnvironmentsEngine environmentsEngine; - - @Mock - private DistributionNotificationSender distributionNotificationSender; - - private DummyDistributionConfigurationManager distributionEngineConfigurationMock; - - private Map<String, OperationalEnvironmentEntry> envs; - - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - distributionEngineConfigurationMock = new DummyDistributionConfigurationManager(); - envs = getEnvs(ENV_ID); - } - - @Test - public void notifyService() throws Exception { - NotificationDataImpl notificationData = new NotificationDataImpl(); - Service service = new Service(); - when(environmentsEngine.getEnvironmentById(ENV_ID)).thenReturn(envs.get(ENV_ID)); - when(distributionEngineConfigurationMock.getConfigurationMock().getDistributionNotifTopicName()).thenReturn("topic"); - when(distributionNotificationSender.sendNotification(eq("topic-ENVID"), eq(DISTRIBUTION_ID), any(EnvironmentMessageBusData.class), - any(NotificationDataImpl.class), any(Service.class), eq(USER_ID), eq(MODIFIER))) - .thenReturn(ActionStatus.OK); - ActionStatus actionStatus = testInstance.notifyService(DISTRIBUTION_ID, service, notificationData, ENV_ID, USER_ID, MODIFIER); - assertEquals(ActionStatus.OK, actionStatus); - } - - @Test - public void notifyService_couldNotResolveEnvironment() throws Exception { - when(environmentsEngine.getEnvironments()).thenReturn(envs); - ActionStatus actionStatus = testInstance.notifyService(DISTRIBUTION_ID, new Service(), new NotificationDataImpl(), "someNonExisitngEnv", USER_ID, MODIFIER); - assertEquals(ActionStatus.DISTRIBUTION_ENVIRONMENT_NOT_AVAILABLE, actionStatus); - verifyZeroInteractions(distributionNotificationSender); - } - - @Test - public void notifyService_failedWhileSendingNotification() throws Exception { - NotificationDataImpl notificationData = new NotificationDataImpl(); - Service service = new Service(); - when(environmentsEngine.getEnvironmentById(ENV_ID)).thenReturn(envs.get(ENV_ID)); - when(distributionEngineConfigurationMock.getConfigurationMock().getDistributionNotifTopicName()).thenReturn("topic"); - when(distributionNotificationSender.sendNotification(eq("topic-ENVID"), eq(DISTRIBUTION_ID), any(EnvironmentMessageBusData.class), - any(NotificationDataImpl.class), any(Service.class), eq(USER_ID), eq(MODIFIER))) - .thenReturn(ActionStatus.GENERAL_ERROR); - ActionStatus actionStatus = testInstance.notifyService(DISTRIBUTION_ID, service, notificationData, ENV_ID, USER_ID, MODIFIER); - assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); - } - - private Map<String, OperationalEnvironmentEntry> getEnvs(String ... environmentIds) { - Set<String> uebAddress = new HashSet<>(); - uebAddress.add("someAddress"); - return Stream.of(environmentIds) - .map(id -> new OperationalEnvironmentBuilder().setEnvId(id).setDmaapUebAddress(uebAddress).build()) - .collect(Collectors.toMap(OperationalEnvironmentEntry::getEnvironmentId, Function.identity())); - } + // default test + //testSubject = createTestSubject(); + when(serviceDistributionArtifactsBuilder.buildResourceInstanceForDistribution(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(new NotificationDataImpl()); + result = testInstance.buildServiceForDistribution(service, distributionId, workloadContext); + } }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionStatusNotificationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionStatusNotificationTest.java new file mode 100644 index 0000000000..2dbec7ac03 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionStatusNotificationTest.java @@ -0,0 +1,156 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import org.junit.Test; + +public class DistributionStatusNotificationTest { + + private DistributionStatusNotification createTestSubject() { + return new DistributionStatusNotification(); + } + + @Test + public void testGetDistributionID() throws Exception { + DistributionStatusNotification testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDistributionID(); + } + + @Test + public void testSetDistributionID() throws Exception { + DistributionStatusNotification testSubject; + String distributionId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setDistributionID(distributionId); + } + + @Test + public void testGetConsumerID() throws Exception { + DistributionStatusNotification testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getConsumerID(); + } + + @Test + public void testSetConsumerID() throws Exception { + DistributionStatusNotification testSubject; + String consumerId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setConsumerID(consumerId); + } + + @Test + public void testGetTimestamp() throws Exception { + DistributionStatusNotification testSubject; + long result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTimestamp(); + } + + @Test + public void testSetTimestamp() throws Exception { + DistributionStatusNotification testSubject; + long timestamp = 4354; + + // default test + testSubject = createTestSubject(); + testSubject.setTimestamp(timestamp); + } + + @Test + public void testGetArtifactURL() throws Exception { + DistributionStatusNotification testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifactURL(); + } + + @Test + public void testSetArtifactURL() throws Exception { + DistributionStatusNotification testSubject; + String artifactURL = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifactURL(artifactURL); + } + + @Test + public void testGetStatus() throws Exception { + DistributionStatusNotification testSubject; + DistributionStatusNotificationEnum result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getStatus(); + } + + @Test + public void testSetStatus() throws Exception { + DistributionStatusNotification testSubject; + DistributionStatusNotificationEnum status = null; + + // default test + testSubject = createTestSubject(); + testSubject.setStatus(status); + } + + @Test + public void testGetErrorReason() throws Exception { + DistributionStatusNotification testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getErrorReason(); + } + + @Test + public void testSetErrorReason() throws Exception { + DistributionStatusNotification testSubject; + String errorReason = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setErrorReason(errorReason); + } + + @Test + public void testIsDistributionCompleteNotification() throws Exception { + DistributionStatusNotification testSubject; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isDistributionCompleteNotification(); + + testSubject.status = DistributionStatusNotificationEnum.DISTRIBUTION_COMPLETE_OK; + result = testSubject.isDistributionCompleteNotification(); + + testSubject.status = DistributionStatusNotificationEnum.DISTRIBUTION_COMPLETE_ERROR; + result = testSubject.isDistributionCompleteNotification(); + } + + @Test + public void testToString() throws Exception { + DistributionStatusNotification testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapClientFactoryTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapClientFactoryTest.java new file mode 100644 index 0000000000..b27c5b07a6 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapClientFactoryTest.java @@ -0,0 +1,133 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.io.File; +import java.security.GeneralSecurityException; +import java.util.Properties; + +import org.junit.Test; +import org.openecomp.sdc.be.config.DmaapConsumerConfiguration; +import org.openecomp.sdc.be.config.DmaapConsumerConfiguration.Credential; + +import com.att.nsa.mr.client.MRConsumer; + +import mockit.Deencapsulation; + +public class DmaapClientFactoryTest { + + private DmaapClientFactory createTestSubject() { + return new DmaapClientFactory(); + } + + @Test + public void testCreate() throws Exception { + DmaapClientFactory testSubject; + DmaapConsumerConfiguration parameters = new DmaapConsumerConfiguration(); + MRConsumer result; + String filePath = "src/test/resources/config/mock.txt"; + + Credential credential = new Credential(); + credential.setPassword("hmXYcznAljMSisdy8zgcag=="); + credential.setUsername("mock"); + parameters.setCredential(credential); + parameters.setLatitude(new Double(32452)); + parameters.setLongitude(new Double(543534)); + parameters.setVersion("mock"); + parameters.setServiceName("mock"); + parameters.setServiceName("mock"); + parameters.setEnvironment("mock"); + parameters.setPartner("mock"); + parameters.setRouteOffer("mock"); + parameters.setProtocol("mock"); + parameters.setContenttype("mock"); + parameters.setHosts("mock"); + parameters.setTopic("mock"); + parameters.setConsumerGroup("mock"); + parameters.setConsumerId("mock"); + parameters.setTimeoutMs(42354); + parameters.setLimit(43534); + parameters.setDme2TraceOn(true); + parameters.setAftEnvironment("mock"); + parameters.setAftDme2ConnectionTimeoutMs(234324); + parameters.setAftDme2RoundtripTimeoutMs(435345); + parameters.setAftDme2ReadTimeoutMs(5645); + parameters.setDme2preferredRouterFilePath(filePath); + + // default test + testSubject = createTestSubject(); + result = testSubject.create(parameters); + File file = new File(filePath); + file.delete(); + + } + + @Test + public void testBuildProperties() throws Exception { + DmaapClientFactory testSubject; + DmaapConsumerConfiguration parameters = new DmaapConsumerConfiguration(); + Properties result; + String filePath = "src/test/resources/config/mock.txt"; + + Credential credential = new Credential(); + credential.setPassword("hmXYcznAljMSisdy8zgcag=="); + credential.setUsername("mock"); + parameters.setCredential(credential); + parameters.setLatitude(new Double(32452)); + parameters.setLongitude(new Double(543534)); + parameters.setVersion("mock"); + parameters.setServiceName("mock"); + parameters.setServiceName("mock"); + parameters.setEnvironment("mock"); + parameters.setPartner("mock"); + parameters.setRouteOffer("mock"); + parameters.setProtocol("mock"); + parameters.setContenttype("mock"); + parameters.setHosts("mock"); + parameters.setTopic("mock"); + parameters.setConsumerGroup("mock"); + parameters.setConsumerId("mock"); + parameters.setTimeoutMs(42354); + parameters.setLimit(43534); + parameters.setDme2TraceOn(true); + parameters.setAftEnvironment("mock"); + parameters.setAftDme2ConnectionTimeoutMs(234324); + parameters.setAftDme2RoundtripTimeoutMs(435345); + parameters.setAftDme2ReadTimeoutMs(5645); + parameters.setDme2preferredRouterFilePath(filePath); + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "buildProperties", parameters); + + File file = new File(filePath); + file.delete(); + } + + @Test(expected = GeneralSecurityException.class) + public void testBuildProperties_2() throws Exception { + DmaapClientFactory testSubject; + DmaapConsumerConfiguration parameters = new DmaapConsumerConfiguration(); + Properties result; + String filePath = "src/test/resources/config/mock.txt"; + + Credential credential = new Credential(); + credential.setPassword("mock"); + parameters.setCredential(credential); + + // default test + testSubject = createTestSubject(); + result = Deencapsulation.invoke(testSubject, "buildProperties", parameters); + } + + @Test + public void testEnsureFileExists() throws Exception { + DmaapClientFactory testSubject; + String filePath = "src/test/resources/config/mock.txt"; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "ensureFileExists", new Object[] { filePath }); + Deencapsulation.invoke(testSubject, "ensureFileExists", filePath); + File file = new File(filePath); + file.delete(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumerTest.java new file mode 100644 index 0000000000..b35f337ce5 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumerTest.java @@ -0,0 +1,35 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.lang.Thread.UncaughtExceptionHandler; +import java.util.function.Consumer; + +import org.junit.Test; +import org.openecomp.sdc.be.components.BeConfDependentTest; + +public class DmaapConsumerTest extends BeConfDependentTest{ + + private DmaapConsumer createTestSubject() { + return new DmaapConsumer(new ExecutorFactory(), new DmaapClientFactory()); + } + + @Test + public void testConsumeDmaapTopic() throws Exception { + DmaapConsumer testSubject; + Consumer<String> notificationReceived = null; + UncaughtExceptionHandler exceptionHandler = new UncaughtExceptionHandlerMock(); + + // default test + testSubject = createTestSubject(); + testSubject.consumeDmaapTopic(notificationReceived, exceptionHandler); + } + + private class UncaughtExceptionHandlerMock implements UncaughtExceptionHandler{ + + @Override + public void uncaughtException(Thread t, Throwable e) { + // TODO Auto-generated method stub + + } + + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealthTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealthTest.java new file mode 100644 index 0000000000..1c5199e455 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapHealthTest.java @@ -0,0 +1,104 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.net.URISyntaxException; + +import org.junit.Test; +import org.openecomp.sdc.be.components.BeConfDependentTest; +import org.openecomp.sdc.be.config.DmaapConsumerConfiguration; +import org.openecomp.sdc.common.api.HealthCheckInfo; + +import mockit.Deencapsulation; + +public class DmaapHealthTest extends BeConfDependentTest{ + + private DmaapHealth createTestSubject() { + return new DmaapHealth(); + } + + @Test + public void testInit() throws Exception { + DmaapHealth testSubject; + DmaapHealth result; + + // default test + testSubject = createTestSubject(); + result = testSubject.init(); + } + + @Test + public void testDestroy() throws Exception { + DmaapHealth testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "destroy"); + } + + @Test + public void testStartHealthCheckTask() throws Exception { + DmaapHealth testSubject; + boolean startTask = false; + + // default test + testSubject = createTestSubject(); + testSubject.startHealthCheckTask(startTask); + } + + @Test + public void testReport() throws Exception { + DmaapHealth testSubject; + Boolean isUp = false; + + // default test + testSubject = createTestSubject(); + testSubject.report(isUp); + } + + @Test + public void testLogAlarm() throws Exception { + DmaapHealth testSubject; + boolean lastHealthState = false; + + // default test + testSubject = createTestSubject(); + testSubject.logAlarm(lastHealthState); + } + + @Test + public void testGetConfiguration() throws Exception { + DmaapHealth testSubject; + DmaapConsumerConfiguration result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getConfiguration(); + } + + @Test + public void testGetHealthCheckInfo() throws Exception { + DmaapHealth testSubject; + HealthCheckInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getHealthCheckInfo(); + } + + @Test(expected=URISyntaxException.class) + public void testGetUrlHost() throws Exception { + String qualifiedHost = ""; + String result; + + // default test + result = DmaapHealth.getUrlHost(qualifiedHost); + } + + @Test + public void testGetUrlHost_2() throws Exception { + String qualifiedHost = "www.mock.com"; + String result; + + // default test + result = DmaapHealth.getUrlHost(qualifiedHost); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapNotificationDataImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapNotificationDataImplTest.java new file mode 100644 index 0000000000..16d8298fbb --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DmaapNotificationDataImplTest.java @@ -0,0 +1,40 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import org.junit.Test; + +public class DmaapNotificationDataImplTest { + + private DmaapNotificationDataImpl createTestSubject() { + return new DmaapNotificationDataImpl(); + } + + @Test + public void testGetOperationalEnvironmentId() throws Exception { + DmaapNotificationDataImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOperationalEnvironmentId(); + } + + @Test + public void testGetOperationalEnvironmentName() throws Exception { + DmaapNotificationDataImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getOperationalEnvironmentName(); + } + + @Test + public void testGetTenantContext() throws Exception { + DmaapNotificationDataImpl testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTenantContext(); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentMessageBusDataTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentMessageBusDataTest.java new file mode 100644 index 0000000000..a0be84479f --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentMessageBusDataTest.java @@ -0,0 +1,121 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import java.util.HashSet; +import java.util.List; + +import org.junit.Test; +import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; + +public class EnvironmentMessageBusDataTest { + + private EnvironmentMessageBusData createTestSubject() { + return new EnvironmentMessageBusData(); + } + + @Test + public void testConstructor() throws Exception { + OperationalEnvironmentEntry operationalEnvironment = new OperationalEnvironmentEntry(); + operationalEnvironment.setDmaapUebAddress(new HashSet<>()); + new EnvironmentMessageBusData(operationalEnvironment); + } + + @Test + public void testGetTenant() throws Exception { + EnvironmentMessageBusData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTenant(); + } + + @Test + public void testSetTenant() throws Exception { + EnvironmentMessageBusData testSubject; + String tenant = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setTenant(tenant); + } + + @Test + public void testGetDmaaPuebEndpoints() throws Exception { + EnvironmentMessageBusData testSubject; + List<String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDmaaPuebEndpoints(); + } + + @Test + public void testSetDmaaPuebEndpoints() throws Exception { + EnvironmentMessageBusData testSubject; + List<String> dmaaPuebEndpoints = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDmaaPuebEndpoints(dmaaPuebEndpoints); + } + + @Test + public void testGetUebPublicKey() throws Exception { + EnvironmentMessageBusData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUebPublicKey(); + } + + @Test + public void testSetUebPublicKey() throws Exception { + EnvironmentMessageBusData testSubject; + String uebPublicKey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUebPublicKey(uebPublicKey); + } + + @Test + public void testGetUebPrivateKey() throws Exception { + EnvironmentMessageBusData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUebPrivateKey(); + } + + @Test + public void testSetUebPrivateKey() throws Exception { + EnvironmentMessageBusData testSubject; + String uebPrivateKey = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUebPrivateKey(uebPrivateKey); + } + + @Test + public void testGetEnvId() throws Exception { + EnvironmentMessageBusData testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getEnvId(); + } + + @Test + public void testSetEnvId() throws Exception { + EnvironmentMessageBusData testSubject; + String envId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setEnvId(envId); + } +}
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineMockTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineMockTest.java new file mode 100644 index 0000000000..d239679627 --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/EnvironmentsEngineMockTest.java @@ -0,0 +1,191 @@ +package org.openecomp.sdc.be.components.distribution.engine; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.apache.http.HttpStatus; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.config.DistributionEngineConfiguration; +import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; +import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao; +import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum; +import org.openecomp.sdc.be.info.OperationalEnvInfo; +import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; +import org.openecomp.sdc.common.http.client.api.HttpResponse; + +import fj.data.Either; + +@RunWith(value = MockitoJUnitRunner.class) +public class EnvironmentsEngineMockTest { + + @InjectMocks + private EnvironmentsEngine envEngine; + @Mock + private DmaapConsumer dmaapConsumer; + @Mock + private OperationalEnvironmentDao operationalEnvironmentDao; + @Mock + private DME2EndpointIteratorCreator epIterCreator; + @Mock + private ConfigurationManager configurationManager; + @Mock + private DistributionEngineConfiguration distributionEngineConfiguration; + @Mock + private AaiRequestHandler aaiRequestHandler; + + @Before + public void preStart() { + when(configurationManager.getDistributionEngineConfiguration()).thenReturn(distributionEngineConfiguration); + envEngine.setConfigurationManager(configurationManager); + } + + @Test + public void testInit() { + List<OperationalEnvironmentEntry> entryList = Arrays.asList(createOpEnvEntry("Env1"), createOpEnvEntry("Env2")); + Either<List<OperationalEnvironmentEntry>, CassandraOperationStatus> successEither = Either.left(entryList); + when(operationalEnvironmentDao.getByEnvironmentsStatus(EnvironmentStatusEnum.COMPLETED)).thenReturn(successEither); + + when(distributionEngineConfiguration.getEnvironments()).thenReturn(Arrays.asList("Env Loaded From Configuration")); + when(distributionEngineConfiguration.getUebPublicKey()).thenReturn("Dummy Public Key"); + when(distributionEngineConfiguration.getUebSecretKey()).thenReturn("Dummy Private Key"); + when(distributionEngineConfiguration.getUebServers()).thenReturn( + Arrays.asList("uebsb91kcdc.it.att.com:3904", "uebsb92kcdc.it.att.com:3904", "uebsb91kcdc.it.att.com:3904")); + + envEngine.init(); + + Map<String, OperationalEnvironmentEntry> mapEnvs = envEngine.getEnvironments(); + assertEquals("unexpected size of map",3, mapEnvs.size()); + } + + + @Test + public void testGetFullOperationalEnvByIdSuccess() { + String json = getFullOperationalEnvJson(); + + HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_OK, "Successfully completed"); + when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse); + + Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId"); + assertTrue("The operational environment request ran as not expected", response.isLeft()); + + OperationalEnvInfo operationalEnvInfo = response.left().value(); + + assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json); + } + + @Test + public void testGetPartialOperationalEnvByIdSuccess() { + String json = getPartialOperationalEnvJson(); + + HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_OK, "Successfully completed"); + when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse); + + Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId"); + assertTrue("The operational environment request ran as not expected", response.isLeft()); + + OperationalEnvInfo operationalEnvInfo = response.left().value(); + + assertEquals("The operational environment json is not as expected", operationalEnvInfo.toString(), json); + } + + + @Test + public void testGetOperationalEnvByIdFailedByJsonConvert() { + String jsonCorrupted = getCorruptedOperationalEnvJson(); + + HttpResponse<String> restResponse = new HttpResponse<String>(jsonCorrupted, HttpStatus.SC_OK, "Successfully Completed"); + when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse); + + Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId"); + assertTrue("The operational environment request ran as not expected", response.isRight()); + assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_INTERNAL_SERVER_ERROR, response.right().value()); + } + + @Test + public void testGetOperationalEnvByIdFailed404() { + String json = getFullOperationalEnvJson(); + HttpResponse<String> restResponse = new HttpResponse<String>(json, HttpStatus.SC_NOT_FOUND, "Not Found"); + when(aaiRequestHandler.getOperationalEnvById(Mockito.anyString())).thenReturn(restResponse); + + Either<OperationalEnvInfo, Integer> response = envEngine.getOperationalEnvById("DummyId"); + assertTrue("The operational environment request ran as not expected", response.isRight()); + assertEquals("The operational environment request status code is not as expected", (Integer)HttpStatus.SC_NOT_FOUND, response.right().value()); + } + + + @Test(expected = IOException.class) + public void testCorruptedOperationalEnvJson() throws IOException { + String jsonCorrupted = getCorruptedOperationalEnvJson(); + OperationalEnvInfo.createFromJson(jsonCorrupted); + } + + private String getCorruptedOperationalEnvJson() { + return "{\"OPERATIONAL-environment-name\":\"Op Env Name\"," + + "\"OPERATIONAL-environment-type\":\"VNF\"," + + "\"OPERATIONAL-environment-status\":\"Activate\"," + + "\"tenant-context\":\"Test\"}"; + } + + private String getPartialOperationalEnvJson() { + return "{" + + "\"operational-environment-id\":\"UUID of Operational Environment\"," + + "\"operational-environment-name\":\"Op Env Name\"," + + "\"operational-environment-type\":\"VNF\"," + + "\"operational-environment-status\":\"Activate\"," + + "\"tenant-context\":\"Test\"," + + "\"workload-context\":\"VNF_Development\"," + + "\"resource-version\":\"1505228226913\"," + + "\"relationship-list\":{" + + "\"relationship\":[]" + + "}" + + "}"; + } + + private String getFullOperationalEnvJson() { + return "{" + + "\"operational-environment-id\":\"OEid1\"," + + "\"operational-environment-name\":\"OEname1\"," + + "\"operational-environment-type\":\"OEtype1\"," + + "\"operational-environment-status\":\"OEstatus1\"," + + "\"tenant-context\":\"OEtenantcontext1\"," + + "\"workload-context\":\"OEworkloadcontext1\"," + + "\"resource-version\":\"1511363173278\"," + + "\"relationship-list\":{" + + "\"relationship\":[" + + "{" + + "\"related-to\":\"operational-environment\"," + + "\"relationship-label\":\"managedBy\"," + + "\"related-link\":\"/aai/v12/cloud-infrastructure/operational-environments/operational-environment/OEid3\"," + + "\"relationship-data\":[" + + "{" + + "\"relationship-key\":\"operational-environment.operational-environment-id\"," + + "\"relationship-value\":\"OEid3\"" + + "}" + + "]," + + "\"related-to-property\":[" + + "{" + + "\"property-key\":\"operational-environment.operational-environment-name\"," + + "\"property-value\":\"OEname3\"" + + "}]}]}}"; + } + + private OperationalEnvironmentEntry createOpEnvEntry(String name) { + OperationalEnvironmentEntry entry = new OperationalEnvironmentEntry(); + entry.setEnvironmentId(name); + return entry; + } + +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java index 9b196e55ef..0c1f3a7513 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java @@ -1,11 +1,6 @@ package org.openecomp.sdc.be.components.distribution.engine; -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/StepsTenantIsolation.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/StepsTenantIsolation.java index 1a2ca4840d..31da6e8698 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/StepsTenantIsolation.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/StepsTenantIsolation.java @@ -1,15 +1,11 @@ package org.openecomp.sdc.be.components.distribution.engine; -import com.att.aft.dme2.api.DME2Exception; -import com.att.aft.dme2.iterator.DME2EndpointIterator; -import com.att.nsa.apiClient.credentials.ApiCredential; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import fj.data.Either; +import static java.util.Objects.isNull; +import static org.apache.commons.lang3.StringUtils.isEmpty; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.math.NumberUtils; import org.apache.http.HttpStatus; @@ -28,11 +24,17 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.http.client.api.HttpResponse; -import static java.util.Objects.isNull; -import static org.apache.commons.lang3.StringUtils.isEmpty; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import com.att.aft.dme2.api.DME2Exception; +import com.att.aft.dme2.iterator.DME2EndpointIterator; +import com.att.nsa.apiClient.credentials.ApiCredential; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import cucumber.api.java.Before; +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; +import fj.data.Either; public class StepsTenantIsolation { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/MsoRestClientTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/MsoRestClientTest.java index 9d0e8cd683..fdf2ebf7ab 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/MsoRestClientTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/rest/MsoRestClientTest.java @@ -1,10 +1,16 @@ package org.openecomp.sdc.be.components.distribution.engine.rest; -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import com.github.tomakehurst.wiremock.matching.AnythingPattern; -import com.github.tomakehurst.wiremock.matching.UrlPattern; -import fj.data.Either; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.patchRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + import org.apache.http.HttpHeaders; import org.junit.Before; import org.junit.ClassRule; @@ -13,13 +19,19 @@ import org.openecomp.sdc.be.components.distribution.engine.DistributionStatusNot import org.openecomp.sdc.be.components.distribution.engine.DummyDistributionConfigurationManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.common.http.client.api.HttpResponse; -import org.openecomp.sdc.common.http.config.*; +import org.openecomp.sdc.common.http.config.BasicAuthorization; +import org.openecomp.sdc.common.http.config.ExternalServiceConfig; +import org.openecomp.sdc.common.http.config.HttpClientConfig; +import org.openecomp.sdc.common.http.config.HttpRequestConfig; +import org.openecomp.sdc.common.http.config.Timeouts; import org.openecomp.sdc.security.SecurityUtil; -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.junit.WireMockRule; +import com.github.tomakehurst.wiremock.matching.AnythingPattern; +import com.github.tomakehurst.wiremock.matching.UrlPattern; + +import fj.data.Either; public class MsoRestClientTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java index 5c8b90544e..c7b55f2eef 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java @@ -1,11 +1,10 @@ package org.openecomp.sdc.be.components.health; -import static org.junit.Assert.*; -import java.util.*; +import java.util.List; + import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.apache.commons.lang3.tuple.Pair; public class HealthCheckBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java index a7529ed614..ea4df1e4ad 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java @@ -1,19 +1,12 @@ package org.openecomp.sdc.be.components.impl; -import java.util.List; - -import javax.servlet.ServletContext; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; -import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; -import java.util.*; -import org.junit.Assert; public class AdditionalInformationBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java index 4ce0740887..a9140f5b21 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java @@ -20,14 +20,26 @@ package org.openecomp.sdc.be.components.impl; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_ENV_NAME; +import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_VF_ENV_NAME; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -72,25 +84,15 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_ENV_NAME; -import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_VF_ENV_NAME; +import fj.data.Either; public class ArtifactBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java index dc89156ee9..fa0366fbef 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactResolverTest.java @@ -20,6 +20,13 @@ package org.openecomp.sdc.be.components.impl; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -30,13 +37,6 @@ import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class ArtifactResolverTest { private ArtifactResolverImpl testInstance = new ArtifactResolverImpl(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java index 9b2fb3773b..9f5fdb8d8f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java @@ -20,7 +20,17 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -36,16 +46,7 @@ import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation; import org.openecomp.sdc.common.util.CapabilityTypeNameEnum; import org.openecomp.sdc.exception.ResponseFormat; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class CapabilityTypeImportManagerTest { @InjectMocks diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java index 8a07e26161..353a6feb86 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CategoriesImportManagerTest.java @@ -20,7 +20,16 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -37,15 +46,7 @@ import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.exception.ResponseFormat; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class CategoriesImportManagerTest { @InjectMocks diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java index d406244551..011324c6f3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java @@ -17,7 +17,6 @@ import java.util.function.BiPredicate; import org.assertj.core.util.Lists; import org.junit.Assert; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @@ -32,7 +31,6 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.ServletUtils; -import org.openecomp.sdc.be.info.CreateAndAssotiateInfo; import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentsUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentsUtilsTest.java index a9245d2897..7ecd069448 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentsUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentsUtilsTest.java @@ -1,35 +1,5 @@ package org.openecomp.sdc.be.components.impl; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.openecomp.sdc.be.auditing.api.AuditEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditBaseEventFactory; -import org.openecomp.sdc.be.auditing.impl.AuditingManager; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.DistributionDownloadEvent; -import org.openecomp.sdc.be.resources.data.auditing.EcompOperationalEnvironmentEvent; -import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent; -import org.openecomp.sdc.be.resources.data.auditing.UserAdminEvent; -import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; -import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; -import org.openecomp.sdc.common.util.ThreadLocalsHolder; -import org.openecomp.sdc.exception.ResponseFormat; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -70,6 +40,36 @@ import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_FIRST_NAME; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_ID; import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_LAST_NAME; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.be.auditing.api.AuditEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditBaseEventFactory; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; +import org.openecomp.sdc.be.resources.data.auditing.DistributionDownloadEvent; +import org.openecomp.sdc.be.resources.data.auditing.EcompOperationalEnvironmentEvent; +import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent; +import org.openecomp.sdc.be.resources.data.auditing.UserAdminEvent; +import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; +import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; +import org.openecomp.sdc.common.util.ThreadLocalsHolder; +import org.openecomp.sdc.exception.ResponseFormat; + @RunWith(MockitoJUnitRunner.class) public class ComponentsUtilsTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java index 7b37b0e96a..5797516938 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogicTest.java @@ -20,13 +20,7 @@ package org.openecomp.sdc.be.components.impl; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.junit.Test; -import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.unittests.utils.FactoryUtils; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.HashMap; @@ -35,7 +29,13 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import static org.junit.Assert.assertTrue; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.unittests.utils.FactoryUtils; public class CompositionBusinessLogicTest { CompositionBusinessLogic compBl = new CompositionBusinessLogic(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CsarValidationUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CsarValidationUtilsTest.java index d91fa7995b..3c283ac3e8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CsarValidationUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CsarValidationUtilsTest.java @@ -20,11 +20,11 @@ package org.openecomp.sdc.be.components.impl; +import java.util.Arrays; + import org.junit.Assert; import org.junit.Test; -import java.util.Arrays; - public class CsarValidationUtilsTest { private String[] invalidExtensions = { null, ".bla", ".yaml", ".yml", ".txt", ".zip" }; private String[] validExtensions = { ".csar", ".cSAr", ".Csar", ".CSAR" }; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java index 46ee852aa0..f81e1444cc 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Before; import org.junit.Test; @@ -30,13 +37,7 @@ import org.openecomp.sdc.be.resources.data.ServiceMetadataData; import org.openecomp.sdc.be.resources.data.category.CategoryData; import org.openecomp.sdc.common.util.ValidationUtils; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; /** * Created by chaya on 12/7/2017. diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java index b65e77c57f..8597136b3f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java @@ -20,17 +20,10 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; -import org.junit.Test; -import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; -import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaElementTypeEnum; -import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; -import org.openecomp.sdc.be.model.HeatParameterDefinition; -import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import org.yaml.snakeyaml.Yaml; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.nio.file.FileSystems; @@ -42,10 +35,18 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; +import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaElementTypeEnum; +import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; +import org.openecomp.sdc.be.model.HeatParameterDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; +import org.yaml.snakeyaml.Yaml; + +import fj.data.Either; public class ImportUtilsTest { @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java index 068f04aae2..f2c53f47c7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java @@ -20,7 +20,18 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -39,17 +50,7 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; public class InputsBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java index e726f608f5..97eeef99c4 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -35,14 +43,7 @@ import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class InterfaceLifecycleTypeImportManagerTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java index bde1bbb3a1..5a7d8af394 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java @@ -16,7 +16,25 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyCollection; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.servlet.ServletContext; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -67,23 +85,7 @@ import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.mockito.ArgumentMatchers.anyCollection; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyObject; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; public class InterfaceOperationBusinessLogicTest implements InterfaceOperationTestUtils{ diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java index 9aca92010e..f9c0a2fc3d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java @@ -1,7 +1,21 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -44,20 +58,7 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Java6Assertions.assertThat; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class PolicyBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java index ad3e6e8974..dd92a0c495 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java @@ -1,6 +1,15 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.List; + +import javax.ws.rs.core.Response; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -28,14 +37,7 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; -import javax.ws.rs.core.Response; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class PolicyPropertiesBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java index 7dc12d96e6..009876ec31 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java @@ -1,7 +1,18 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.collect.ImmutableMap; -import fj.data.Either; +import static com.google.common.collect.Sets.newHashSet; +import static java.util.Collections.emptyList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -21,18 +32,9 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PolicyTypeOperation; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Set; +import com.google.common.collect.ImmutableMap; -import static com.google.common.collect.Sets.newHashSet; -import static java.util.Collections.emptyList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class PolicyTypeBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java index 75aa10aa64..6d4d7a0889 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java @@ -20,7 +20,27 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.servlet.ServletContext; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Before; import org.junit.Ignore; @@ -40,8 +60,6 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -51,10 +69,8 @@ import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -90,27 +106,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyCollection; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyObject; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ResourceBusinessLogicTest implements InterfaceOperationTestUtils{ diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java index 3abf711b91..0c88a37f2b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java @@ -20,7 +20,16 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -53,15 +62,7 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class ResourceInstanceBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java index 5f4dfdc6f7..309689af45 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java @@ -1,6 +1,12 @@ package org.openecomp.sdc.be.components.impl.generic; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -14,12 +20,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class GenericTypeBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtilsTest.java index 6b1b37e5bc..8fd262d1f2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PolicyTypeImportUtilsTest.java @@ -1,6 +1,12 @@ package org.openecomp.sdc.be.components.impl.utils; -import com.google.common.collect.ImmutableMap; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import org.junit.Test; import org.openecomp.sdc.be.components.utils.PolicyTypeBuilder; import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; @@ -9,12 +15,7 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint; import org.openecomp.sdc.be.model.tosca.constraints.MinLengthConstraint; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; +import com.google.common.collect.ImmutableMap; public class PolicyTypeImportUtilsTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperationTest.java index fe6071239e..6d7ae39cc2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/GroupMembersUpdateOperationTest.java @@ -1,6 +1,14 @@ package org.openecomp.sdc.be.components.impl.version; -import fj.data.Either; +import static java.util.Collections.emptyMap; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -22,14 +30,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Stream; - -import static java.util.Collections.emptyMap; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class GroupMembersUpdateOperationTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperationTest.java index 0da59d1157..5da782e484 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PolicyTargetsUpdateOperationTest.java @@ -1,5 +1,15 @@ package org.openecomp.sdc.be.components.impl.version; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.components.impl.utils.TestGenerationUtils.getComponentsUtils; + +import java.util.List; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -18,16 +28,6 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.List; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyList; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.components.impl.utils.TestGenerationUtils.getComponentsUtils; - @RunWith(MockitoJUnitRunner.class) public class PolicyTargetsUpdateOperationTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestratorTest.java index ef239f9a2b..c6fea4af6f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/version/PostChangeVersionOperationOrchestratorTest.java @@ -1,5 +1,10 @@ package org.openecomp.sdc.be.components.impl.version; +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -9,11 +14,6 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; -import static java.util.Arrays.asList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class PostChangeVersionOperationOrchestratorTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java index cfb5bb59e0..80f63e71e9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -32,8 +34,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class CertificationChangeTransitionTest extends LifecycleTestBase { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java index f9fb9c83c1..495483a857 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java @@ -20,7 +20,13 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -48,12 +54,7 @@ import org.openecomp.sdc.be.tosca.ToscaExportHandler; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.Silent.class) public class CertificationRequestTest extends LifecycleTestBase { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java index e60998b177..457a3363a0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -32,8 +34,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class CheckinTest extends LifecycleTestBase { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java index 0826e5d40c..14cbcc80d7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -34,8 +36,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class CheckoutTest extends LifecycleTestBase { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java index 941af0d728..d2903f5f11 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java @@ -20,7 +20,13 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletContext; + import org.junit.BeforeClass; import org.mockito.InjectMocks; import org.mockito.Mockito; @@ -61,11 +67,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.Mockito.when; +import fj.data.Either; public class LifecycleTestBase { private static final Logger log = LoggerFactory.getLogger(LifecycleTestBase.class); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java index d5d665809d..6ef2e8604e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java @@ -20,7 +20,9 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -31,8 +33,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class UndoCheckoutTest extends LifecycleTestBase { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java index 89b82b91d2..ab2e865ae0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java @@ -1,7 +1,14 @@ package org.openecomp.sdc.be.components.merge; -import com.google.common.collect.Sets; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -17,14 +24,9 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; +import com.google.common.collect.Sets; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; public class GlobalInputsFilteringBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java index ec741b4953..a00b0b8e8a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalTypesMergeBusinessLogicTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.components.merge; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.components.utils.ObjectGenerator.buildResourceWithInputs; + +import java.util.Arrays; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -11,13 +18,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.components.utils.ObjectGenerator.buildResourceWithInputs; +import fj.data.Either; public class GlobalTypesMergeBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java index d50f4859db..743d394c62 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/RelationsComparatorTest.java @@ -1,5 +1,10 @@ package org.openecomp.sdc.be.components.merge; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder; @@ -9,11 +14,6 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.Resource; -import java.util.Arrays; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - public class RelationsComparatorTest { public static final String INSTANCE1 = "instance1"; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java index 298a4454b3..3b1ed52550 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.be.components.merge; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -16,10 +20,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class TopologyComparatorTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolverTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolverTest.java index be9f426c2c..8071749fdf 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolverTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/capability/SimpleCapabilityResolverTest.java @@ -1,6 +1,12 @@ package org.openecomp.sdc.be.components.merge.capability; -import com.google.common.collect.ImmutableMap; +import static java.util.Arrays.asList; +import static java.util.Collections.emptyMap; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,12 +21,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; -import java.util.Map; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyMap; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; +import com.google.common.collect.ImmutableMap; @RunWith(MockitoJUnitRunner.class) public class SimpleCapabilityResolverTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogicTest.java index c75a6ccd5d..bcdd08e95b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/heat/HeatEnvArtifactsMergeBusinessLogicTest.java @@ -1,5 +1,12 @@ package org.openecomp.sdc.be.components.merge.heat; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.components.utils.ArtifactBuilder; @@ -8,13 +15,6 @@ import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Stream; - -import static org.junit.Assert.assertEquals; - public class HeatEnvArtifactsMergeBusinessLogicTest { private HeatEnvArtifactsMergeBusinessLogic testInstance; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBLTest.java index 30801b0a4a..26b6782918 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBLTest.java @@ -1,6 +1,14 @@ package org.openecomp.sdc.be.components.merge.input; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + import org.apache.commons.collections.ListUtils; import org.junit.Before; import org.junit.Test; @@ -14,14 +22,7 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ComponentInputsMergeBLTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogicTest.java index 98fceab7a8..d593e6ffd0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/InputsValuesMergingBusinessLogicTest.java @@ -1,5 +1,13 @@ package org.openecomp.sdc.be.components.merge.input; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; @@ -11,14 +19,6 @@ import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - public class InputsValuesMergingBusinessLogicTest { public static final String INPUT_DEFUALT_TYPE = "string"; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java index df3e0ddb68..be16bc3621 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java @@ -1,5 +1,10 @@ package org.openecomp.sdc.be.components.merge.instance; +import static junit.framework.TestCase.assertEquals; + +import java.util.HashMap; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -9,11 +14,6 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; -import java.util.HashMap; -import java.util.Map; - -import static groovy.util.GroovyTestCase.assertEquals; - public class ComponentInstanceArtifactsMergeTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java index 4fbb1ab5d7..70d4b87b9f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabiliteisPropertiesMergeTest.java @@ -1,6 +1,11 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,11 +21,7 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class ComponentInstanceCapabiliteisPropertiesMergeTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java index d73459c1b1..adf19011db 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java @@ -1,7 +1,21 @@ package org.openecomp.sdc.be.components.merge.instance; -import com.google.common.collect.ImmutableMap; -import fj.data.Either; +import static java.util.Collections.emptyMap; +import static java.util.Collections.singletonList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,21 +45,9 @@ import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import com.google.common.collect.ImmutableMap; -import static java.util.Collections.emptyMap; -import static java.util.Collections.singletonList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyList; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class ComponentInstanceCapabilitiesMergeBLTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java index 115825733e..f5cd924957 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -19,13 +26,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.mockito.Mockito.when; +import fj.data.Either; public class ComponentInstanceHeatEnvMergeTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java index 630a43ef2d..79064bce50 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; + import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -22,13 +29,7 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ComponentInstanceMergeDataBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java index d946206f23..0efbf5fc5b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java @@ -1,6 +1,16 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.anyListOf; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -25,16 +35,7 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.mockito.ArgumentMatchers.anyList; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyListOf; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ComponentInstancePropsAndInputsMergeTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java index 08c8456064..b341052d9e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java @@ -1,6 +1,18 @@ package org.openecomp.sdc.be.components.merge.instance; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.IntStream; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,18 +38,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.IntStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class ComponentInstanceRelationMergeTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java index 65ab3ec121..972ea4e620 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java @@ -1,6 +1,15 @@ package org.openecomp.sdc.be.components.merge.path; -import fj.data.Either; +import static groovy.util.GroovyTestCase.assertEquals; +import static junit.framework.Assert.assertNotNull; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.when; + +import java.util.Set; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -17,14 +26,7 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.common.api.UserRoleEnum; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Set; - -import static groovy.util.GroovyTestCase.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.TestCase.assertTrue; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ComponentInstanceForwardingPathMergeTest extends BaseForwardingPathVersionChangeTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java index bbb2dd6895..bb1ea68cbd 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.components.merge.property; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -17,13 +24,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ComponentInstanceInputsMergeBLTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java index 6013009106..e5ca990b7e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.components.merge.property; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -15,13 +22,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ComponentInstancePropertiesMergeBLTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java index 3b079d30d5..e310cad300 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java @@ -1,5 +1,11 @@ package org.openecomp.sdc.be.components.merge.property; +import static org.mockito.Mockito.verify; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -11,12 +17,6 @@ import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.InputDefinition; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static org.mockito.Mockito.verify; - public class DataDefinitionsValuesMergingBusinessLogicTest { private static final String DEFAULT_PROP_TYPE = "string"; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java index 5c23ec0e8c..6faee487f4 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java @@ -1,6 +1,17 @@ package org.openecomp.sdc.be.components.merge.property; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -14,17 +25,7 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class PropertyDataValueMergeBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java index 0590c7e500..a43e1e68ca 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java @@ -1,5 +1,12 @@ package org.openecomp.sdc.be.components.merge.resource; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -11,13 +18,6 @@ import org.openecomp.sdc.be.components.utils.ObjectGenerator; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Resource; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class ResourceDataMergeBusinessLogicTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java index 3131c4987c..9d07be276b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java @@ -1,6 +1,13 @@ package org.openecomp.sdc.be.components.merge.utils; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,13 +22,7 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class MergeInstanceUtilsTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java index 44f87bb352..1182136d6c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java @@ -1,7 +1,12 @@ package org.openecomp.sdc.be.components.path; -import com.google.common.collect.Lists; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + import org.junit.Before; import org.openecomp.sdc.be.components.BeConfDependentTest; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; @@ -35,12 +40,9 @@ import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; +import com.google.common.collect.Lists; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class BaseForwardingPathTest extends BeConfDependentTest implements ForwardingPathTestUtils { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java index 0e56680728..4b1dc80369 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathVersionChangeTest.java @@ -1,6 +1,10 @@ package org.openecomp.sdc.be.components.path; -import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.openecomp.sdc.be.components.merge.instance.DataForMergeHolder; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; @@ -13,10 +17,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.google.common.collect.Lists; public abstract class BaseForwardingPathVersionChangeTest { protected Service service; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBussinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBussinessLogicTest.java index 03bbc31aef..7e797fe485 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBussinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBussinessLogicTest.java @@ -1,9 +1,14 @@ package org.openecomp.sdc.be.components.path; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; @@ -16,13 +21,10 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import fj.data.Either; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "/paths/path-context.xml") diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java index 5af94d7938..4b36a98ae7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathChangeVersionTest.java @@ -1,16 +1,16 @@ package org.openecomp.sdc.be.components.path; -import org.javatuples.Pair; -import org.junit.Test; -import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; -import org.openecomp.sdc.be.impl.ForwardingPathUtils; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.HashMap; import java.util.Map; import java.util.Set; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import org.javatuples.Pair; +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; +import org.openecomp.sdc.be.impl.ForwardingPathUtils; public class ForwardingPathChangeVersionTest extends BaseForwardingPathVersionChangeTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java index e5de493cb1..f6edc45c9d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathDeleteCITest.java @@ -1,5 +1,14 @@ package org.openecomp.sdc.be.components.path; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; @@ -8,15 +17,6 @@ import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.impl.ForwardingPathUtils; import org.openecomp.sdc.be.model.Service; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - public class ForwardingPathDeleteCITest { private Service service; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java index e7100a4a7e..e92dd8dbdb 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathToscaUtilTest.java @@ -1,5 +1,19 @@ package org.openecomp.sdc.be.components.path; +import static org.junit.Assert.assertEquals; +import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDER; +import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDS_TO_TOSCA_NAME; +import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PORTS_RANGE; +import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PROTOCOL; +import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.addForwardingPaths; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -17,20 +31,6 @@ import org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDER; -import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.FORWARDS_TO_TOSCA_NAME; -import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PORTS_RANGE; -import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.PROTOCOL; -import static org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil.addForwardingPaths; - /** * @author KATYR, ORENK * @since November 19, 2017 diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java index fd9e25f475..daa342b2ad 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java @@ -1,8 +1,13 @@ package org.openecomp.sdc.be.components.path; -import com.google.common.collect.Sets; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +import java.util.Collection; +import java.util.Set; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -18,12 +23,9 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Collection; -import java.util.Set; +import com.google.common.collect.Sets; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ForwardingPathValidatorTest implements ForwardingPathTestUtils { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ArtifactCassandraDaoMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ArtifactCassandraDaoMock.java index 290ba07883..6bbc2bcfcf 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ArtifactCassandraDaoMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ArtifactCassandraDaoMock.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.path.beans; +import javax.annotation.PostConstruct; + import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - @Component("artifact-cassandra-dao") public class ArtifactCassandraDaoMock extends ArtifactCassandraDao { @PostConstruct diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/AuditCassandraDaoMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/AuditCassandraDaoMock.java index c4885e1f07..a56346cb00 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/AuditCassandraDaoMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/AuditCassandraDaoMock.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.path.beans; +import javax.annotation.PostConstruct; + import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - @Component("audit-cassandra-dao") public class AuditCassandraDaoMock extends AuditCassandraDao{ diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/CassandraClientMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/CassandraClientMock.java index 0d4b2f1e7e..416f5d814a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/CassandraClientMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/CassandraClientMock.java @@ -1,13 +1,15 @@ package org.openecomp.sdc.be.components.path.beans; -import com.datastax.driver.core.Session; -import com.datastax.driver.mapping.MappingManager; -import fj.data.Either; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.CassandraClient; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.springframework.stereotype.Component; +import com.datastax.driver.core.Session; +import com.datastax.driver.mapping.MappingManager; + +import fj.data.Either; + @Component("cassandra-client") public class CassandraClientMock extends CassandraClient{ public CassandraClientMock() { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ComponentCassandraDaoMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ComponentCassandraDaoMock.java index 6a9731e86d..15673e28bf 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ComponentCassandraDaoMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ComponentCassandraDaoMock.java @@ -1,6 +1,11 @@ package org.openecomp.sdc.be.components.path.beans; -import fj.data.Either; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; @@ -9,10 +14,7 @@ import org.openecomp.sdc.be.dao.cassandra.ComponentCassandraDao; import org.openecomp.sdc.be.resources.data.ComponentCacheData; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import java.util.List; -import java.util.Map; -import java.util.Set; +import fj.data.Either; @Component("component-cassandra-dao") public class ComponentCassandraDaoMock extends ComponentCassandraDao { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/EnvironmentCassandraDaoMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/EnvironmentCassandraDaoMock.java index 2d7b1ad287..29b8484163 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/EnvironmentCassandraDaoMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/EnvironmentCassandraDaoMock.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.path.beans; +import javax.annotation.PostConstruct; + import org.openecomp.sdc.be.dao.cassandra.OperationalEnvironmentDao; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - @Component("operational-environment-dao") public class EnvironmentCassandraDaoMock extends OperationalEnvironmentDao { @PostConstruct diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java index 09e1a72b44..c4cf9fcdd0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java @@ -1,12 +1,13 @@ package org.openecomp.sdc.be.components.path.beans; -import fj.data.Either; import org.openecomp.sdc.be.impl.ForwardingPathUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import fj.data.Either; + @org.springframework.stereotype.Component("tosca-operation-facade") public class ForwardingPathToscaOperationFacade extends ToscaOperationFacade { protected static final String GENERIC_SERVICE_NAME = "org.openecomp.resource.abstract.nodes.service"; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathValidatorMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathValidatorMock.java index 1aa3ab8102..effc35873a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathValidatorMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathValidatorMock.java @@ -1,11 +1,12 @@ package org.openecomp.sdc.be.components.path.beans; -import fj.data.Either; +import java.util.Collection; + import org.openecomp.sdc.be.components.path.ForwardingPathValidator; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Collection; +import fj.data.Either; public class ForwardingPathValidatorMock extends ForwardingPathValidator { @Override diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java index 4e3923d2ea..cb8f3b9cf7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java @@ -1,6 +1,20 @@ package org.openecomp.sdc.be.components.path.beans; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; + +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.openecomp.sdc.be.dao.TitanClientStrategy; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + import com.thinkaurelius.titan.core.InvalidElementException; import com.thinkaurelius.titan.core.InvalidIDException; import com.thinkaurelius.titan.core.PropertyKey; @@ -16,19 +30,8 @@ import com.thinkaurelius.titan.core.util.TitanCleanup; import com.thinkaurelius.titan.diskstorage.ResourceUnavailableException; import com.thinkaurelius.titan.diskstorage.locking.PermanentLockingException; import com.thinkaurelius.titan.graphdb.database.idassigner.IDPoolExhaustedException; -import fj.data.Either; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.openecomp.sdc.be.dao.TitanClientStrategy; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import java.util.ArrayList; -import java.util.HashMap; +import fj.data.Either; @Component("titan-client") public class InMemoryTitanGraphClient extends TitanGraphClient { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/SdcSchemaFilesCassandraDaoMock.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/SdcSchemaFilesCassandraDaoMock.java index 4e0105f067..62d909c1ad 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/SdcSchemaFilesCassandraDaoMock.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/SdcSchemaFilesCassandraDaoMock.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.path.beans; +import javax.annotation.PostConstruct; + import org.openecomp.sdc.be.dao.cassandra.SdcSchemaFilesCassandraDao; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - @Component("sdc-schema-files-cassandra-dao") public class SdcSchemaFilesCassandraDaoMock extends SdcSchemaFilesCassandraDao { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java index 7a7eff879a..9c41ff9f8e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java @@ -1,11 +1,9 @@ package org.openecomp.sdc.be.components.path.beans; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanGraphQuery; -import com.thinkaurelius.titan.core.schema.ConsistencyModifier; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum; @@ -21,9 +19,12 @@ import org.openecomp.sdc.be.resources.data.UserData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; +import com.thinkaurelius.titan.core.PropertyKey; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanGraphQuery; +import com.thinkaurelius.titan.core.schema.ConsistencyModifier; +import com.thinkaurelius.titan.core.schema.TitanGraphIndex; +import com.thinkaurelius.titan.core.schema.TitanManagement; public class TitanGraphTestSetup { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java index 79a1dab517..1ae0898235 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java @@ -20,9 +20,14 @@ package org.openecomp.sdc.be.components.path.utils; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; @@ -32,13 +37,10 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; public final class GraphTestUtils { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeceleratorTest.java index 9bd04d6da3..193f5d9ae0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeceleratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeceleratorTest.java @@ -1,6 +1,17 @@ package org.openecomp.sdc.be.components.property; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,17 +37,7 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java index cd454d5a84..58029953b0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java @@ -1,6 +1,16 @@ package org.openecomp.sdc.be.components.property; -import fj.data.Either; +import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,16 +31,7 @@ import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.assertj.core.api.Java6Assertions.assertThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyDeceleratorTestBase.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyDeceleratorTestBase.java index 0c761a948d..d6018f2fc7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyDeceleratorTestBase.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PropertyDeceleratorTestBase.java @@ -1,5 +1,12 @@ package org.openecomp.sdc.be.components.property; +import static org.assertj.core.api.Assertions.assertThat; +import static org.openecomp.sdc.common.api.Constants.GET_INPUT; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import org.junit.Before; import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; import org.openecomp.sdc.be.dao.utils.MapUtil; @@ -8,13 +15,6 @@ import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.openecomp.sdc.common.api.Constants.GET_INPUT; - public class PropertyDeceleratorTestBase { static final String INNER_PROP1 = "ecomp_generated_naming"; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManagerTest.java index 56aef5d923..e22bfd9889 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/RecoveryThreadManagerTest.java @@ -1,6 +1,18 @@ package org.openecomp.sdc.be.components.scheduledtasks; -import fj.data.Either; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + import org.apache.commons.lang.math.NumberUtils; import org.junit.Before; import org.junit.Test; @@ -16,18 +28,7 @@ import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; import org.openecomp.sdc.common.datastructure.Wrapper; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import fj.data.Either; public class RecoveryThreadManagerTest extends BeConfDependentTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactBuilder.java index 32e3f9c10a..55a119e078 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ArtifactBuilder.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.utils; +import java.util.ArrayList; + import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; -import java.util.ArrayList; - public class ArtifactBuilder { private ArtifactDefinition artifactDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/CapabilityDefinitionBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/CapabilityDefinitionBuilder.java index 4c137551dc..6a545622e3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/CapabilityDefinitionBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/CapabilityDefinitionBuilder.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.utils; +import java.util.ArrayList; + import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import java.util.ArrayList; - public class CapabilityDefinitionBuilder { private CapabilityDefinition capabilityDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentBuilder.java index 490140dac0..f3cf208252 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentBuilder.java @@ -1,5 +1,9 @@ package org.openecomp.sdc.be.components.utils; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.Component; @@ -12,10 +16,6 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - public abstract class ComponentBuilder<T extends Component, B extends ComponentBuilder<T, B>> { private T component; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentInstanceBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentInstanceBuilder.java index f461806010..864fb19fa1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentInstanceBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ComponentInstanceBuilder.java @@ -1,13 +1,13 @@ package org.openecomp.sdc.be.components.utils; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.CapabilityDefinition; -import org.openecomp.sdc.be.model.ComponentInstance; - import java.util.ArrayList; import java.util.HashMap; import java.util.stream.Stream; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; + public class ComponentInstanceBuilder { private ComponentInstance componentInstance; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/GroupDefinitionBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/GroupDefinitionBuilder.java index d7deaa423a..08ed89f35c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/GroupDefinitionBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/GroupDefinitionBuilder.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.utils; -import org.openecomp.sdc.be.model.GroupDefinition; - import java.util.HashMap; import java.util.Map; +import org.openecomp.sdc.be.model.GroupDefinition; + public class GroupDefinitionBuilder { private GroupDefinition groupDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ObjectGenerator.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ObjectGenerator.java index 249cf69112..3a99d54ffa 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ObjectGenerator.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ObjectGenerator.java @@ -1,5 +1,11 @@ package org.openecomp.sdc.be.components.utils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; @@ -9,12 +15,6 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.Resource; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - public class ObjectGenerator { public static Resource buildResourceWithInputs(String ... inputNames) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/OperationalEnvironmentBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/OperationalEnvironmentBuilder.java index b6aa96e7d7..0e35964bd3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/OperationalEnvironmentBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/OperationalEnvironmentBuilder.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.utils; +import java.util.Set; + import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; -import java.util.Set; - public class OperationalEnvironmentBuilder { private OperationalEnvironmentEntry operationalEnvironmentEntry; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyDefinitionBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyDefinitionBuilder.java index f818c04ccd..2826e2044e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyDefinitionBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyDefinitionBuilder.java @@ -1,15 +1,15 @@ package org.openecomp.sdc.be.components.utils; -import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; -import org.openecomp.sdc.be.model.PolicyDefinition; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.PolicyDefinition; + public class PolicyDefinitionBuilder { private PolicyDefinition policyDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyTypeBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyTypeBuilder.java index 8c2b54f27e..d084bc2a0c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyTypeBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PolicyTypeBuilder.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.components.utils; -import org.openecomp.sdc.be.model.PolicyTypeDefinition; -import org.openecomp.sdc.be.model.PropertyDefinition; - import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.model.PolicyTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; + public class PolicyTypeBuilder { private PolicyTypeDefinition policyTypeDataDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionAbstractBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionAbstractBuilder.java index 9d5d71d67c..94ad42ce7d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionAbstractBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionAbstractBuilder.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.components.utils; +import java.util.ArrayList; + import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; -import java.util.ArrayList; - public abstract class PropertyDataDefinitionAbstractBuilder<B extends PropertyDataDefinition, T extends PropertyDataDefinitionAbstractBuilder<B, T>> { B propertyDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionBuilder.java index 85b2228933..2f4ac9a281 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/PropertyDataDefinitionBuilder.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.utils; +import java.util.List; + import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; -import java.util.List; - public class PropertyDataDefinitionBuilder extends PropertyDataDefinitionAbstractBuilder<PropertyDefinition, PropertyDataDefinitionBuilder> { protected PropertyDataDefinitionBuilder self() { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/RelationsBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/RelationsBuilder.java index e0d35c6b6a..6c968f2bdc 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/RelationsBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/RelationsBuilder.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.components.utils; +import java.util.Collections; + import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.RelationshipImpl; import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import java.util.Collections; - public class RelationsBuilder { private RequirementCapabilityRelDef relation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ResourceBuilder.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ResourceBuilder.java index 25468af3c9..e5a14852e8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ResourceBuilder.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/ResourceBuilder.java @@ -1,10 +1,10 @@ package org.openecomp.sdc.be.components.utils; +import java.util.ArrayList; + import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; -import java.util.ArrayList; - public class ResourceBuilder extends ComponentBuilder<Resource, ResourceBuilder> { private Resource resource; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/UtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/UtilsTest.java index be19e8b795..4a123727f8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/UtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/utils/UtilsTest.java @@ -1,12 +1,12 @@ package org.openecomp.sdc.be.components.utils; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; public class UtilsTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidationTest.java index 7e8d1b2081..a8686c179a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidationTest.java @@ -16,8 +16,14 @@ package org.openecomp.sdc.be.components.validation; -import com.google.common.collect.Sets; -import fj.data.Either; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -39,13 +45,9 @@ import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; +import com.google.common.collect.Sets; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; +import fj.data.Either; public class InterfaceOperationValidationTest implements InterfaceOperationTestUtils { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java index df48a538a5..8538e090fd 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java @@ -1,6 +1,11 @@ package org.openecomp.sdc.be.components.validation; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -22,11 +27,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; import org.openecomp.sdc.exception.ResponseFormat; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ServiceDistributionValidationTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java index 4f90a0a42f..48aff6627a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/UiComponentDataConverterTest.java @@ -1,5 +1,9 @@ package org.openecomp.sdc.be.datamodel; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collections; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.components.utils.PolicyDefinitionBuilder; @@ -11,10 +15,6 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; -import java.util.Collections; - -import static org.assertj.core.api.Assertions.assertThat; - public class UiComponentDataConverterTest { private PolicyDefinition policy1, policy2; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogicTest.java index a80999a25b..42b730bb92 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/DistributionBusinessLogicTest.java @@ -20,6 +20,14 @@ package org.openecomp.sdc.be.distribution; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.components.distribution.engine.DistributionEngineInitTask.buildTopicName; + +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -38,14 +46,6 @@ import org.openecomp.sdc.be.distribution.api.client.TopicRegistrationResponse; import org.openecomp.sdc.be.distribution.api.client.TopicUnregistrationResponse; import org.openecomp.sdc.common.datastructure.Wrapper; -import javax.ws.rs.core.Response; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.openecomp.sdc.be.components.distribution.engine.DistributionEngineInitTask.buildTopicName; - public class DistributionBusinessLogicTest extends BeConfDependentTest { @InjectMocks diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/ServiceDistributionArtifactsBuilderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/ServiceDistributionArtifactsBuilderTest.java index 4257a88a02..07ca01219c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/ServiceDistributionArtifactsBuilderTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/ServiceDistributionArtifactsBuilderTest.java @@ -20,6 +20,14 @@ package org.openecomp.sdc.be.distribution; +import static org.junit.Assert.assertTrue; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import org.junit.Test; import org.mockito.InjectMocks; import org.openecomp.sdc.be.components.BeConfDependentTest; @@ -30,14 +38,6 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertTrue; - public class ServiceDistributionArtifactsBuilderTest extends BeConfDependentTest { @InjectMocks diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/TestQueue.java b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/TestQueue.java index 29b43c1920..64f66ea232 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/TestQueue.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/TestQueue.java @@ -20,11 +20,6 @@ package org.openecomp.sdc.be.distribution; -import com.google.common.util.concurrent.ThreadFactoryBuilder; -import org.openecomp.sdc.be.components.distribution.engine.CambriaHandler; -import org.openecomp.sdc.be.components.distribution.engine.INotificationData; -import org.openecomp.sdc.be.components.distribution.engine.NotificationDataImpl; - import java.util.ArrayList; import java.util.List; import java.util.Timer; @@ -40,6 +35,12 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import org.openecomp.sdc.be.components.distribution.engine.CambriaHandler; +import org.openecomp.sdc.be.components.distribution.engine.INotificationData; +import org.openecomp.sdc.be.components.distribution.engine.NotificationDataImpl; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; + public class TestQueue { public static void main(String[] args) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java index 253fd31390..7a74a1f983 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java @@ -20,8 +20,17 @@ package org.openecomp.sdc.be.distribution.servlet; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; @@ -48,16 +57,8 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; public class DistributionServletTest extends JerseyTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/GenerateEcompErrorFileTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/GenerateEcompErrorFileTest.java index 8a40e83506..f0ec613a27 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/GenerateEcompErrorFileTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/GenerateEcompErrorFileTest.java @@ -20,18 +20,18 @@ package org.openecomp.sdc.be.ecomp; -import org.junit.Test; -import org.openecomp.sdc.common.config.EcompClassification; -import org.openecomp.sdc.common.config.EcompErrorCode; -import org.openecomp.sdc.common.config.EcompErrorEnum; -import org.openecomp.sdc.common.config.generation.GenerateEcompErrorsCsv; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.openecomp.sdc.common.config.EcompClassification; +import org.openecomp.sdc.common.config.EcompErrorCode; +import org.openecomp.sdc.common.config.EcompErrorEnum; +import org.openecomp.sdc.common.config.generation.GenerateEcompErrorsCsv; public class GenerateEcompErrorFileTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java index fa43523c79..04dbf0ae75 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java @@ -21,7 +21,19 @@ package org.openecomp.sdc.be.externalapi.servlet; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Arrays; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; @@ -55,17 +67,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Arrays; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class AssetsDataServletTest extends JerseyTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java index 52e9230711..7871dd9d2b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ComponentsUtilsTest.java @@ -1,15 +1,9 @@ package org.openecomp.sdc.be.impl; -import java.util.EnumMap; import java.util.List; -import javax.annotation.Generated; -import javax.servlet.http.HttpServletRequest; - import org.apache.tinkerpop.gremlin.structure.T; -import org.junit.Assert; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.auditing.impl.AuditingManager; @@ -25,7 +19,6 @@ import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ConsumerDefinition; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PolicyTypeDefinition; @@ -33,17 +26,14 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData; import org.openecomp.sdc.be.tosca.ToscaError; import org.openecomp.sdc.common.api.ConfigurationSource; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; -import mockit.Deencapsulation; public class ComponentsUtilsTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java index be43fa7d62..99053aa603 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java @@ -20,17 +20,9 @@ package org.openecomp.sdc.be.servlets; -import fj.data.Either; -import org.apache.commons.codec.binary.Base64; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.sdc.be.model.UploadResourceInfo; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.common.datastructure.Wrapper; -import org.openecomp.sdc.exception.ResponseFormat; -import org.slf4j.Logger; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; -import javax.ws.rs.core.Response; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -40,8 +32,18 @@ import java.nio.file.Paths; import java.util.Map; import java.util.stream.Stream; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; +import javax.ws.rs.core.Response; + +import org.apache.commons.codec.binary.Base64; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.model.UploadResourceInfo; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.common.datastructure.Wrapper; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; + +import fj.data.Either; public class AbstractValidationsServletTest { private static AbstractValidationsServlet servlet = new AbstractValidationsServlet() {}; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ApplicationConfig.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ApplicationConfig.java index 6fe303b495..d7d470449c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ApplicationConfig.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ApplicationConfig.java @@ -20,17 +20,18 @@ package org.openecomp.sdc.be.servlets; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Application; + import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.MultiPart; import org.glassfish.jersey.server.ResourceConfig; import org.mockito.Mockito; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.core.Application; -import java.util.HashSet; -import java.util.Set; - public class ApplicationConfig extends Application { public Set<Class<?>> getClasses() { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/BaseTestConfig.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/BaseTestConfig.java index 218505d8ef..8378a71b4c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/BaseTestConfig.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/BaseTestConfig.java @@ -1,11 +1,11 @@ package org.openecomp.sdc.be.servlets; +import static org.mockito.Mockito.mock; + import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.springframework.context.annotation.Bean; -import static org.mockito.Mockito.mock; - public class BaseTestConfig { @Bean diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java index c723e0e664..5d85f52351 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java @@ -1,6 +1,15 @@ package org.openecomp.sdc.be.servlets; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.eclipse.jetty.http.HttpStatus; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; @@ -23,15 +32,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; +import fj.data.Either; /** * The test suite designed for test functionality of ComponentInstanceServlet class diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java index 2d5494354d..39a541d568 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java @@ -1,9 +1,24 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Sets; -import fj.data.Either; +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + +import javax.ws.rs.client.Invocation; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJsonProvider; @@ -33,23 +48,11 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.HttpStatus; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Stream; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Sets; -import static java.util.Arrays.asList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import fj.data.Either; public class GroupTypesEndpointTest extends JerseySpringBaseTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/JerseySpringBaseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/JerseySpringBaseTest.java index 9a074c95c2..c7e759dfea 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/JerseySpringBaseTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/JerseySpringBaseTest.java @@ -1,5 +1,9 @@ package org.openecomp.sdc.be.servlets; +import static org.mockito.Mockito.mock; + +import javax.servlet.http.HttpServletRequest; + import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -8,10 +12,6 @@ import org.junit.BeforeClass; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import javax.servlet.http.HttpServletRequest; - -import static org.mockito.Mockito.mock; - public class JerseySpringBaseTest extends JerseyTest { protected static HttpServletRequest request; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java index bb949253b2..41e2abe29f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java @@ -1,7 +1,25 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.databind.DeserializationFeature; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.glassfish.grizzly.http.util.HttpStatus; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider; @@ -25,24 +43,9 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import com.fasterxml.jackson.databind.DeserializationFeature; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import fj.data.Either; public class PolicyServletTest extends JerseySpringBaseTest{ diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpointTest.java index 23f32d169b..b58cae56a2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyTypesEndpointTest.java @@ -1,7 +1,17 @@ package org.openecomp.sdc.be.servlets; -import com.fasterxml.jackson.databind.DeserializationFeature; -import fj.data.Either; +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.List; + +import javax.ws.rs.client.Invocation; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJsonProvider; @@ -15,16 +25,9 @@ import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; -import javax.ws.rs.client.Invocation; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.List; +import com.fasterxml.jackson.databind.DeserializationFeature; -import static java.util.Arrays.asList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import fj.data.Either; public class PolicyTypesEndpointTest extends JerseySpringBaseTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java index 63e76700df..f64dfb9fec 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RepresentationUtilsTest.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.HashMap; + import org.apache.tinkerpop.gremlin.structure.T; import org.junit.Test; import org.openecomp.sdc.be.model.ArtifactDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java index e8aeb5fc70..5a35793ab9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java @@ -20,9 +20,19 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Arrays; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.tuple.ImmutablePair; import org.glassfish.hk2.utilities.binding.AbstractBinder; @@ -55,17 +65,10 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext import org.springframework.http.HttpStatus; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.Arrays; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ResourceServletTest extends JerseyTest { public static final HttpServletRequest request = Mockito.mock(HttpServletRequest.class); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java index 23daab9bf9..8d9b95d414 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java @@ -20,7 +20,22 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.media.multipart.FormDataBodyPart; @@ -51,20 +66,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import com.google.gson.Gson; public class ResourceUploadServletTest extends JerseyTest { private static final Logger log = LoggerFactory.getLogger(ResourceUploadServletTest.class); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java index 690f7427a8..cfa65f76a5 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java @@ -20,7 +20,20 @@ package org.openecomp.sdc.be.servlets; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.eclipse.jetty.http.HttpStatus; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.client.ClientConfig; @@ -53,18 +66,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; public class TypesUploadServletTest extends JerseyTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java index 696214f49d..3e6f934bfc 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/UserAdminServletTest.java @@ -20,8 +20,17 @@ package org.openecomp.sdc.be.servlets; -import com.google.gson.Gson; -import fj.data.Either; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.core.Application; + import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -41,16 +50,9 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.http.HttpStatus; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; -import javax.ws.rs.core.Application; +import com.google.gson.Gson; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; +import fj.data.Either; public class UserAdminServletTest extends JerseyTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertorTest.java index 3c42257446..b00bd0f6b1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabiltyRequirementConvertorTest.java @@ -1,13 +1,9 @@ package org.openecomp.sdc.be.tosca; // -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.CapabilityDefinition; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.Resource; +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.doReturn; import java.util.ArrayList; import java.util.Arrays; @@ -17,9 +13,13 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static java.util.Arrays.asList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doReturn; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; public class CapabiltyRequirementConvertorTest { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java index 8883786d7e..5ac1467a5c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java @@ -20,7 +20,13 @@ package org.openecomp.sdc.be.tosca; -import fj.data.Either; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -29,12 +35,7 @@ import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class CsarUtilsTest { @Before diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java index dbdec12193..139de137d9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java @@ -1,6 +1,18 @@ package org.openecomp.sdc.be.tosca; -import fj.data.Either; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; @@ -11,18 +23,7 @@ import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.tosca.model.ToscaNodeType; import org.openecomp.sdc.be.tosca.model.ToscaProperty; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class PropertyConvertorTest { private PropertyDefinition property; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java index 839095f1ca..05f872f44c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java @@ -20,8 +20,8 @@ package org.openecomp.sdc.be.tosca; -import org.junit.Test; -import org.yaml.snakeyaml.Yaml; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.FileInputStream; import java.io.IOException; @@ -31,8 +31,8 @@ import java.nio.file.Paths; import java.util.List; import java.util.stream.Collectors; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.yaml.snakeyaml.Yaml; public class SchemaFiles { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java index efc89a9f9d..041973a0b4 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.tosca; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import org.junit.Test; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.model.operations.impl.ComponentInstanceOperation; @@ -9,6 +7,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + public class ToscaExportUtilsTest { private static final Logger log = LoggerFactory.getLogger(ToscaExportUtilsTest.class); @javax.annotation.Resource diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java index ee33d00806..cfc6fa649f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java @@ -18,6 +18,7 @@ package org.openecomp.sdc.be.tosca.utils; import java.util.HashMap; import java.util.Map; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java index dc964be430..338143ef23 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/OperationArtifactUtilTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.util.HashMap; + import org.junit.BeforeClass; import org.junit.Test; import org.openecomp.sdc.be.DummyConfigurationManager; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java index 8d45e42357..0a65a51890 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java @@ -20,7 +20,12 @@ package org.openecomp.sdc.common.transaction.mngr; -import fj.data.Either; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -46,11 +51,7 @@ import org.openecomp.sdc.common.transaction.api.TransactionUtils.TransactionCode import org.openecomp.sdc.common.transaction.api.TransactionUtils.TransactionStatusEnum; import org.slf4j.Logger; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import fj.data.Either; public class SdncTransactionTest { private static ESCatalogDAO esCatalogDao = Mockito.mock(ESCatalogDAO.class); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationTest.java index 95c2ac7bdd..0fbf2c8564 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/cucumber/runners/RunTenantIsolationTest.java @@ -1,10 +1,11 @@ package org.openecomp.sdc.cucumber.runners; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; import org.openecomp.sdc.be.components.BeConfDependentTest; +import cucumber.api.CucumberOptions; +import cucumber.api.junit.Cucumber; + @RunWith(Cucumber.class) @CucumberOptions(features = "classpath:cucumber/tenantIsolation.feature", glue = "org.openecomp.sdc.be.components.distribution.engine") diff --git a/catalog-be/src/test/resources/config/mock.txt b/catalog-be/src/test/resources/config/mock.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/catalog-be/src/test/resources/config/mock.txt |