summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java6
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java56
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java23
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/artifact/ArtifactOperationInfo.java79
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java3
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMerge.java3
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java15
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ArtifactServlet.java7
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java10
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java38
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceHeatEnvMergeTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java2
13 files changed, 150 insertions, 99 deletions
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 dadd12f673..b0344007f0 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
@@ -31,7 +31,7 @@ import org.apache.commons.lang3.StringUtils;
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.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.components.impl.BaseBusinessLogic;
import org.openecomp.sdc.be.components.impl.CsarValidationUtils;
import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
@@ -820,7 +820,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = createOrUpdateCsarArtifactFromJson(
resource, csarInfo.getModifier(), json,
- artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE));
+ new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE));
if (uploadArtifactToService.isRight()) {
return Either.right(uploadArtifactToService.right().value());
@@ -1705,7 +1705,7 @@ public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic {
Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = createOrUpdateCsarArtifactFromJson(
resource, csarInfo.getModifier(), json,
- artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE));
+ new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE));
if (uploadArtifactToService.isRight()) {
resStatus = Either.right(uploadArtifactToService.right().value());
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 f48b3ebbbe..8a188792d8 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
@@ -59,6 +59,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.components.ArtifactsResolver;
import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.components.impl.artifact.ArtifactTypeToPayloadTypeSelector;
import org.openecomp.sdc.be.components.impl.artifact.PayloadTypeEnum;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
@@ -223,32 +224,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
}
- public class ArtifactOperationInfo {
-
- private ArtifactOperationEnum artifactOperationEnum;
- private boolean isExternalApi;
- private boolean ignoreLifecycleState;
-
- public ArtifactOperationInfo(boolean isExternalApi, boolean ignoreLifecycleState, ArtifactOperationEnum artifactOperationEnum) {
- this.artifactOperationEnum = artifactOperationEnum;
- this.isExternalApi = isExternalApi;
- this.ignoreLifecycleState = ignoreLifecycleState;
- }
-
- public boolean isExternalApi() {
- return isExternalApi;
- }
-
- public boolean ignoreLifecycleState() {
- return ignoreLifecycleState;
- }
-
- public ArtifactOperationEnum getArtifactOperationEnum() {
- return artifactOperationEnum;
- }
-
- }
-
// new flow US556184
public Either<ArtifactDefinition, Operation> handleArtifactRequest(String componentId, String userId, ComponentTypeEnum componentType,
ArtifactOperationInfo operation, String artifactId, ArtifactDefinition artifactInfo,
@@ -321,7 +296,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
ArtifactOperationEnum operationEnum = operation.getArtifactOperationEnum();
if (operationEnum == ArtifactOperationEnum.UPDATE || operationEnum == ArtifactOperationEnum.DELETE || operationEnum == ArtifactOperationEnum.DOWNLOAD) {
ArtifactDefinition dbArtifact = getArtifactIfBelongsToComponent(componentId, componentType, artifactId, component);
- if (operationEnum == ArtifactOperationEnum.DOWNLOAD) {
+ if (operation.isDownload()) {
artifactInfoToReturn = dbArtifact;
handleHeatEnvDownload(componentId, componentType, user, component, dbArtifact, shouldLock, inTransaction);
}
@@ -1046,7 +1021,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
private void validateMd5(String origMd5, String originData, byte[] payload, ArtifactOperationInfo operation) {
if (origMd5 == null) {
- if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()) && ArrayUtils.isNotEmpty(payload)) {
+ if (operation.isCreateOrLink() && ArrayUtils.isNotEmpty(payload)) {
log.debug("Missing md5 header during artifact create");
throw new ByActionStatusComponentException(ActionStatus.ARTIFACT_INVALID_MD5);
}
@@ -1114,7 +1089,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
final ArtifactGroupTypeEnum artifactGroupType =
operationName != null ? ArtifactGroupTypeEnum.LIFE_CYCLE : ArtifactGroupTypeEnum.INFORMATIONAL;
- if (!isCreateOrLinkOperation) {
+ if (operation.isNotCreateOrLink()) {
checkAndSetUnUpdatableFields(user, artifactInfo, existingArtifactInfo, artifactGroupType);
} else {
checkCreateFields(user, artifactInfo, artifactGroupType);
@@ -1123,13 +1098,13 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
composeArtifactId(componentId, artifactId, artifactInfo, interfaceName, operationName);
if (existingArtifactInfo != null) {
artifactInfo.setMandatory(existingArtifactInfo.getMandatory());
- if (!isCreateOrLinkOperation) {
+ if (operation.isNotCreateOrLink()) {
validateArtifactTypeNotChanged(artifactInfo, existingArtifactInfo);
}
}
// artifactGroupType is not allowed to be updated
- if (!isCreateOrLinkOperation) {
+ if (operation.isNotCreateOrLink()) {
Either<ArtifactDefinition, ResponseFormat> validateGroupType = validateOrSetArtifactGroupType(artifactInfo, existingArtifactInfo);
if (validateGroupType.isRight()) {
return Either.right(validateGroupType.right().value());
@@ -1143,7 +1118,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
if (isDeploymentArtifact(artifactInfo)) {
if (componentType != ComponentTypeEnum.RESOURCE_INSTANCE) {
final String artifactName = artifactInfo.getArtifactName();
- if (isCreateOrLinkOperation || !artifactName.equalsIgnoreCase(existingArtifactInfo.getArtifactName())) {
+ if (operation.isCreateOrLink() || !artifactName.equalsIgnoreCase(existingArtifactInfo.getArtifactName())) {
validateSingleDeploymentArtifactName(artifactName, parentComponent);
}
}
@@ -1200,7 +1175,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
private void ignoreUnupdateableFieldsInUpdate(final ArtifactOperationInfo operation,
final ArtifactDefinition artifactInfo,
final ArtifactDefinition currentArtifactInfo) {
- if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.UPDATE) {
+ if (operation.isUpdate()) {
artifactInfo.setArtifactType(currentArtifactInfo.getArtifactType());
artifactInfo.setArtifactGroupType(currentArtifactInfo.getArtifactGroupType());
artifactInfo.setArtifactLabel(currentArtifactInfo.getArtifactLabel());
@@ -1214,11 +1189,11 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
if (StringUtils.isNotEmpty(artifactId)) {
foundArtifact = findArtifact(parentComponent, componentType, parentId, artifactId);
}
- if (foundArtifact != null && ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) {
+ if (foundArtifact != null && operation.isCreateOrLink()) {
log.debug("Artifact {} already exist", artifactId);
throw new ByActionStatusComponentException(ActionStatus.ARTIFACT_EXIST, foundArtifact.getArtifactLabel());
}
- if (foundArtifact == null && !ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) {
+ if (foundArtifact == null && operation.isNotCreateOrLink()) {
log.debug("The artifact {} was not found on parent component or instance {}. ", artifactId, parentId);
throw new ByActionStatusComponentException(ActionStatus.ARTIFACT_NOT_FOUND, "");
}
@@ -1628,7 +1603,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
log.debug("missing artifact logical name for component {}", componentId);
return Either.right(componentsUtils.getResponseFormat(ActionStatus.MISSING_DATA, ARTIFACT_LABEL));
}
- if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()) && !artifactInfo.getMandatory()) {
+ if (operation.isCreateOrLink() && !artifactInfo.getMandatory()) {
if (operationName != null) {
if (artifactInfo.getArtifactLabel() != null && !operationName.equals(artifactInfo.getArtifactLabel())) {
@@ -3079,7 +3054,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
return componentResult.left().value();
}
- private Boolean validateWorkOnComponent(Component component, String userId, AuditingActionEnum auditingAction, User user, String artifactId, ArtifactOperationInfo operation) {
+ private void validateWorkOnComponent(Component component, String userId, AuditingActionEnum auditingAction, User user, String artifactId, ArtifactOperationInfo operation) {
if (operation.getArtifactOperationEnum() != ArtifactOperationEnum.DOWNLOAD && !operation.ignoreLifecycleState()) {
try {
validateCanWorkOnComponent(component, userId);
@@ -3091,12 +3066,11 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
throw e;
}
}
- return true;
}
private void validateUserRole(User user, AuditingActionEnum auditingAction, String componentId, String artifactId, ComponentTypeEnum componentType, ArtifactOperationInfo operation) {
- if (operation.getArtifactOperationEnum() != ArtifactOperationEnum.DOWNLOAD) {
+ if (operation.isNotDownload()) {
String role = user.getRole();
if (!role.equals(Role.ADMIN.name()) && !role.equals(Role.DESIGNER.name())) {
ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.RESTRICTED_OPERATION);
@@ -4628,7 +4602,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
} catch (ComponentException e) {
log.debug(FAILED_UPLOAD_ARTIFACT_TO_COMPONENT, componentType, component
.getName(), e.getResponseFormat());
- if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) {
+ if (operation.isCreateOrLink()) {
vfcsNewCreatedArtifacts.addAll(uploadedArtifacts);
}
throw e;
@@ -4696,7 +4670,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
}
handleArtifactsResult = uploadedArtifacts;
}catch (ComponentException e){
- if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) {
+ if (operation.isCreateOrLink()) {
vfcsNewCreatedArtifacts.addAll(uploadedArtifacts);
}
throw e;
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 50f9bc989c..71707e61f9 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
@@ -61,7 +61,7 @@ import org.openecomp.sdc.be.components.csar.CsarArtifactsAndGroupsBusinessLogic;
import org.openecomp.sdc.be.components.csar.CsarBusinessLogic;
import org.openecomp.sdc.be.components.csar.CsarInfo;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
-import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum;
import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
@@ -792,7 +792,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
} else {
Either<Resource, ResponseFormat> createdCsarArtifactsEither = handleVfCsarArtifacts(preparedResource,
csarInfo, createdArtifacts,
- artifactsBusinessLogic.new ArtifactOperationInfo(false, false, operation), shouldLock,
+ new ArtifactOperationInfo(false, false, operation), shouldLock,
inTransaction);
log.trace("************* Finished to add artifacts from yaml {}", yamlFileName);
if (createdCsarArtifactsEither.isRight()) {
@@ -1079,7 +1079,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
nodeTypeResource.getName());
handleNodeTypeArtifactsRequestRes = artifactsBusinessLogic
.handleArtifactsRequestForInnerVfcComponent(curArtifactsToHandle, nodeTypeResource, user,
- createdArtifacts, artifactsBusinessLogic.new ArtifactOperationInfo(false,
+ createdArtifacts, new ArtifactOperationInfo(false,
ignoreLifecycleState, curOperation),
false, inTransaction);
if (ArtifactOperationEnum.isCreateOrLink(curOperation)) {
@@ -2226,7 +2226,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
String vendorLicenseModelId = null;
String vfLicenseModelId = null;
- if (artifactOperation.getArtifactOperationEnum() == ArtifactOperationEnum.UPDATE) {
+ if (artifactOperation.isUpdate()) {
Map<String, ArtifactDefinition> deploymentArtifactsMap = resource.getDeploymentArtifacts();
if (deploymentArtifactsMap != null && !deploymentArtifactsMap.isEmpty()) {
for (Entry<String, ArtifactDefinition> artifactEntry : deploymentArtifactsMap.entrySet()) {
@@ -2277,7 +2277,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
.value()
.getValue();
Either<Resource, ResponseFormat> createArtifactsFromCsar;
- if (ArtifactOperationEnum.isCreateOrLink(artifactOperation.getArtifactOperationEnum())) {
+ if (artifactOperation.isCreateOrLink()) {
createArtifactsFromCsar = csarArtifactsAndGroupsBusinessLogic.createResourceArtifactsFromCsar(
csarInfo, resource, artifactsContents, artifactsFileName, createdArtifacts);
} else {
@@ -2317,8 +2317,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
.get(artifactPath);
}
Either<Boolean, ResponseFormat> result = Either.left(true);
- if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.UPDATE
- || operation.getArtifactOperationEnum() == ArtifactOperationEnum.DELETE) {
+ if (operation.isUpdate() || operation.isDelete()) {
if (isArtifactDeletionRequired(artifactId, artifactFileBytes, isFromCsar)) {
Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic
.handleDelete(resource.getUniqueId(), artifactId, csarInfo.getModifier(),
@@ -2342,7 +2341,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
if (StringUtils.isEmpty(artifactId) && artifactFileBytes != null) {
- operation = artifactsBusinessLogic.new ArtifactOperationInfo(false, false,
+ operation = new ArtifactOperationInfo(false, false,
ArtifactOperationEnum.CREATE);
}
@@ -2385,7 +2384,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
private void addNonMetaCreatedArtifactsToSupportRollback(ArtifactOperationInfo operation,
List<ArtifactDefinition> createdArtifacts,
Either<Either<ArtifactDefinition, Operation>, ResponseFormat> eitherNonMetaArtifacts) {
- if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()) && createdArtifacts != null
+ if (operation.isCreateOrLink() && createdArtifacts != null
&& eitherNonMetaArtifacts.isLeft()) {
Either<ArtifactDefinition, Operation> eitherResult = eitherNonMetaArtifacts.left()
.value();
@@ -2413,7 +2412,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
}
EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> vfCsarArtifactsToHandle = null;
- if (ArtifactOperationEnum.isCreateOrLink(artifactOperation.getArtifactOperationEnum())) {
+ if (artifactOperation.isCreateOrLink()) {
vfCsarArtifactsToHandle = new EnumMap<>(ArtifactOperationEnum.class);
vfCsarArtifactsToHandle.put(artifactOperation.getArtifactOperationEnum(), artifactPathAndNameList.left()
.value());
@@ -2464,7 +2463,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
e.getArtifactName(), e.getArtifactType(),
e.getArtifactGroupType(), e.getArtifactLabel(), e.getDisplayName(),
CsarUtils.ARTIFACT_CREATED_FROM_CSAR, e.getArtifactUniqueId(),
- artifactsBusinessLogic.new ArtifactOperationInfo(false, false,
+ new ArtifactOperationInfo(false, false,
currArtifactOperationPair.getKey()),
createdArtifacts, e.isFromCsar(), shouldLock, inTransaction))
// filter in only error
@@ -5851,7 +5850,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
currNewArtifact.getArtifactName(), currNewArtifact.getArtifactType(),
foundArtifact.getArtifactType());
AuditingActionEnum auditingAction = artifactsBusinessLogic
- .detectAuditingType(artifactsBusinessLogic.new ArtifactOperationInfo(false, false,
+ .detectAuditingType(new ArtifactOperationInfo(false, false,
ArtifactOperationEnum.CREATE), foundArtifact.getArtifactChecksum());
artifactsBusinessLogic.handleAuditing(auditingAction, resource, resource.getUniqueId(),
user, null, null, foundArtifact.getUniqueId(), responseFormat,
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/artifact/ArtifactOperationInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/artifact/ArtifactOperationInfo.java
new file mode 100644
index 0000000000..84316dbdff
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/artifact/ArtifactOperationInfo.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.components.impl.artifact;
+
+import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum.CREATE;
+import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum.DELETE;
+import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum.DOWNLOAD;
+import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum.LINK;
+import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum.UPDATE;
+
+import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
+
+public final class ArtifactOperationInfo {
+
+ private final ArtifactOperationEnum artifactOperationEnum;
+ private final boolean isExternalApi;
+ private final boolean ignoreLifecycleState;
+
+ public ArtifactOperationInfo(boolean isExternalApi, boolean ignoreLifecycleState,
+ ArtifactOperationEnum artifactOperationEnum) {
+ this.artifactOperationEnum = artifactOperationEnum;
+ this.isExternalApi = isExternalApi;
+ this.ignoreLifecycleState = ignoreLifecycleState;
+ }
+
+ public boolean isExternalApi() {
+ return isExternalApi;
+ }
+
+ public boolean ignoreLifecycleState() {
+ return ignoreLifecycleState;
+ }
+
+ public ArtifactOperationEnum getArtifactOperationEnum() {
+ return artifactOperationEnum;
+ }
+
+ public boolean isCreateOrLink() {
+ return artifactOperationEnum == CREATE || artifactOperationEnum == LINK;
+ }
+
+ public boolean isNotCreateOrLink() {
+ return !isCreateOrLink();
+ }
+
+ public boolean isDownload() {
+ return artifactOperationEnum == DOWNLOAD;
+ }
+
+ public boolean isNotDownload() {
+ return !isDownload();
+ }
+
+ public boolean isUpdate() {
+ return artifactOperationEnum == UPDATE;
+ }
+
+ public boolean isDelete() {
+ return artifactOperationEnum == DELETE;
+ }
+}
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 6a74428a90..f68019c75d 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
@@ -21,6 +21,7 @@
package org.openecomp.sdc.be.components.merge.instance;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
@@ -107,7 +108,7 @@ public class ComponentInstanceArtifactsMerge implements ComponentInstanceMergeIn
null, currentArtifactDefinition.getValue().getListHeatParameters());
addEsIdToArtifactJson(jsonForUpdateArtifact, currentArtifactDefinition.getValue().getEsId());
artifactsBusinessLogic.updateResourceInstanceArtifactNoContent(newInstanceId, updatedContainerComponent,
- user, jsonForUpdateArtifact, artifactsBusinessLogic.new ArtifactOperationInfo(
+ user, jsonForUpdateArtifact, new ArtifactOperationInfo(
false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.LINK), currentArtifactDefinition.getValue());
}
return updatedContainerComponent;
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 aa0dc22486..2f9943909c 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
@@ -22,6 +22,7 @@ package org.openecomp.sdc.be.components.merge.instance;
import fj.data.Either;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.components.merge.heat.HeatEnvArtifactsMergeBusinessLogic;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ArtifactDefinition;
@@ -69,7 +70,7 @@ public class ComponentInstanceHeatEnvMerge implements ComponentInstanceMergeInte
Map<String, Object> json = artifactsBusinessLogic.buildJsonForUpdateArtifact(artifactInfo, ArtifactGroupTypeEnum.DEPLOYMENT, null);
Either<ArtifactDefinition, Operation> uploadArtifactToService = artifactsBusinessLogic.updateResourceInstanceArtifactNoContent(newInstanceId, updatedContainerComponent, user, json,
- artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.UPDATE), null);
+ new ArtifactOperationInfo(false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.UPDATE), null);
}
return updatedContainerComponent;
}
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 a2395c8541..1eb4bf651c 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
@@ -38,6 +38,7 @@ import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResourceImportManager;
import org.openecomp.sdc.be.components.impl.aaf.AafPermission;
import org.openecomp.sdc.be.components.impl.aaf.PermissionAllowed;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -188,7 +189,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
Either<ArtifactDefinition, ResponseFormat> uploadArtifactEither = artifactsBusinessLogic
.updateArtifactOnInterfaceOperationByResourceUUID(data, request, ComponentTypeEnum
.findByParamName(assetType), uuid, interfaceUUID, operationUUID, artifactUUID,
- resourceCommonInfo, artifactsBusinessLogic.new ArtifactOperationInfo(true, false, ArtifactOperationEnum.UPDATE));
+ resourceCommonInfo, new ArtifactOperationInfo(true, false, ArtifactOperationEnum.UPDATE));
if (uploadArtifactEither.isRight()) {
log.debug(FAILED_TO_UPDATE_ARTIFACT);
responseFormat = uploadArtifactEither.right().value();
@@ -293,7 +294,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
try {
if (responseWrapper.isEmpty()) {
artifactDefinition = artifactsBusinessLogic.uploadArtifactToComponentByUUID(data, request, componentType, uuid,
- resourceCommonInfo, artifactsBusinessLogic.new ArtifactOperationInfo(true, false, ArtifactOperationEnum.CREATE));
+ resourceCommonInfo, new ArtifactOperationInfo(true, false, ArtifactOperationEnum.CREATE));
Object representation = RepresentationUtils.toRepresentation(artifactDefinition);
Map<String, String> headers = new HashMap<>();
headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
@@ -402,7 +403,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
try {
if (responseWrapper.isEmpty()) {
artifactDefinition = artifactsBusinessLogic.uploadArtifactToRiByUUID(data, request, componentType, uuid, resourceInstanceName,
- artifactsBusinessLogic.new ArtifactOperationInfo(true, false, ArtifactOperationEnum.CREATE));
+ new ArtifactOperationInfo(true, false, ArtifactOperationEnum.CREATE));
Object representation = RepresentationUtils.toRepresentation(artifactDefinition);
Map<String, String> headers = new HashMap<>();
headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
@@ -506,7 +507,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
try {
if (responseWrapper.isEmpty()) {
artifactDefinition = artifactsBusinessLogic.updateArtifactOnComponentByUUID(data, request, componentType, uuid, artifactUUID,
- resourceCommonInfo, artifactsBusinessLogic.new ArtifactOperationInfo(true, false, ArtifactOperationEnum.UPDATE));
+ resourceCommonInfo, new ArtifactOperationInfo(true, false, ArtifactOperationEnum.UPDATE));
Object representation = RepresentationUtils.toRepresentation(artifactDefinition);
Map<String, String> headers = new HashMap<>();
headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
@@ -616,7 +617,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
try {
if (responseWrapper.isEmpty()) {
artifactDefinition = artifactsBusinessLogic.updateArtifactOnRiByUUID(data, request, componentType, uuid, resourceInstanceName, artifactUUID,
- artifactsBusinessLogic.new ArtifactOperationInfo(true, false, ArtifactOperationEnum.UPDATE));
+ new ArtifactOperationInfo(true, false, ArtifactOperationEnum.UPDATE));
Object representation = RepresentationUtils.toRepresentation(artifactDefinition);
Map<String, String> headers = new HashMap<>();
headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
@@ -719,7 +720,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
try {
if (responseWrapper.isEmpty()) {
artifactDefinition = artifactsBusinessLogic.deleteArtifactOnComponentByUUID(request, componentType, uuid, artifactUUID,
- resourceCommonInfo, artifactsBusinessLogic.new ArtifactOperationInfo(true, false, ArtifactOperationEnum.DELETE));
+ resourceCommonInfo, new ArtifactOperationInfo(true, false, ArtifactOperationEnum.DELETE));
Object representation = RepresentationUtils.toRepresentation(artifactDefinition);
Map<String, String> headers = new HashMap<>();
headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
@@ -822,7 +823,7 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet {
try {
if (responseWrapper.isEmpty()) {
artifactDefinition = artifactsBusinessLogic.deleteArtifactOnRiByUUID(request, componentType, uuid, resourceInstanceName, artifactUUID,
- artifactsBusinessLogic.new ArtifactOperationInfo(true, false, ArtifactOperationEnum.DELETE));
+ new ArtifactOperationInfo(true, false, ArtifactOperationEnum.DELETE));
Object representation = RepresentationUtils.toRepresentation(artifactDefinition);
Map<String, String> headers = new HashMap<>();
headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByString((String) representation));
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 ab914dc930..037ca47b13 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
@@ -38,6 +38,7 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
import org.openecomp.sdc.be.components.impl.aaf.AafPermission;
import org.openecomp.sdc.be.components.impl.aaf.PermissionAllowed;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -716,7 +717,7 @@ public class ArtifactServlet extends BeGenericServlet {
Either<ArtifactDefinition, ResponseFormat> uploadArtifactEither =
artifactsBusinessLogic.updateArtifactOnInterfaceOperationByResourceUUID(data, request,
ComponentTypeEnum.findByParamName(assetType), uuid, interfaceUUID, operationUUID, artifactUUID,
- new ResourceCommonInfo(assetType), artifactsBusinessLogic.new ArtifactOperationInfo(true,
+ new ResourceCommonInfo(assetType), new ArtifactOperationInfo(true,
false, ArtifactOperationEnum.UPDATE));
if (uploadArtifactEither.isRight()) {
log.debug("failed to update artifact");
@@ -775,7 +776,7 @@ public class ArtifactServlet extends BeGenericServlet {
private Response handleDeleteRequest(HttpServletRequest request, String componentId, String artifactId, ComponentTypeEnum componentType, String interfaceType, String operationName, String parentId) {
String userId = request.getHeader(Constants.USER_ID_HEADER);
- Either<ArtifactDefinition, org.openecomp.sdc.be.model.Operation> actionResult = artifactsBusinessLogic.handleArtifactRequest(componentId, userId, componentType, artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.DELETE), artifactId, null, null, null, interfaceType, operationName,
+ Either<ArtifactDefinition, org.openecomp.sdc.be.model.Operation> actionResult = artifactsBusinessLogic.handleArtifactRequest(componentId, userId, componentType, new ArtifactOperationInfo(false, false, ArtifactOperationEnum.DELETE), artifactId, null, null, null, interfaceType, operationName,
parentId, null);
Response response;
@@ -798,7 +799,7 @@ public class ArtifactServlet extends BeGenericServlet {
String userId = request.getHeader(Constants.USER_ID_HEADER);
Either<ArtifactDefinition, org.openecomp.sdc.be.model.Operation> result = artifactsBusinessLogic.handleArtifactRequest(componentId, userId, componentType,
- artifactsBusinessLogic.new ArtifactOperationInfo(false, false, operationEnum), artifactId, artifactInfo, origMd5, data, interfaceName, operationName, parentId,
+ new ArtifactOperationInfo(false, false, operationEnum), artifactId, artifactInfo, origMd5, data, interfaceName, operationName, parentId,
containerComponentType);
Response response;
if (result.isLeft()) {
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 3fb25dfc77..e3e6924b7e 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
@@ -112,12 +112,8 @@ public class ArtifactBusinessLogicTest extends BaseBusinessLogicMock{
@Mock
private UserBusinessLogic userBusinessLogic;
@Mock
- private ArtifactOperation artifactOperation;
- @Mock
public ComponentsUtils componentsUtils;
@Mock
- private UserAdminOperation userOperation;
- @Mock
private ArtifactCassandraDao artifactCassandraDao;
@Mock
public ToscaOperationFacade toscaOperationFacade;
@@ -148,13 +144,7 @@ public class ArtifactBusinessLogicTest extends BaseBusinessLogicMock{
@Before
public void initMocks() {
MockitoAnnotations.initMocks(this);
- Either<ArtifactDefinition, StorageOperationStatus> NotFoundResult = Either.right(StorageOperationStatus.NOT_FOUND);
-
- Either<Map<String, ArtifactDefinition>, StorageOperationStatus> NotFoundResult2 = Either.right(StorageOperationStatus.NOT_FOUND);
-
when(userBusinessLogic.getUser(eq("jh0003"), anyBoolean())).thenReturn(USER);
-
-
when(resource.getResourceType()).thenReturn(ResourceTypeEnum.VFC);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
index cd7d9d556a..cfbc06234c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java
@@ -78,7 +78,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.MockGenerator;
import org.openecomp.sdc.be.components.ArtifactsResolver;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
-import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException;
import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
@@ -346,7 +346,8 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
.thenReturn(Either.left(new ArrayList()));
when(toscaOperationFacade.generateCustomizationUUIDOnInstanceGroup(service.getUniqueId(), ci.getUniqueId(), new ArrayList<>(Arrays.asList("guid"))))
.thenReturn(StorageOperationStatus.OK);
- artifactBL.handleUpdate(ci.getUniqueId(),ComponentTypeEnum.RESOURCE_INSTANCE,artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
+ artifactBL.handleUpdate(ci.getUniqueId(),ComponentTypeEnum.RESOURCE_INSTANCE,
+ new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
"uid2", envArtifact, null, null, null, null, null, AuditingActionEnum.ARTIFACT_METADATA_UPDATE, user, service, true);
assertThat(ci.getDeploymentArtifacts().get("HEAT").getTimeout()).isEqualTo(envArtifact.getTimeout());
assertThat(ci.getDeploymentArtifacts().get("HEAT_ENV").getTimeout()).isEqualTo(origEnvArtifact.getTimeout());
@@ -381,7 +382,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
when(toscaOperationFacade.generateCustomizationUUIDOnInstanceGroup(service.getUniqueId(), ci.getUniqueId(), new ArrayList<>(Arrays.asList("guid"))))
.thenReturn(StorageOperationStatus.OK);
try {
- artifactBL.handleUpdate(ci.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE, artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
+ artifactBL.handleUpdate(ci.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE, new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
"uid2", envArtifact, null, null, null, null, null, AuditingActionEnum.ARTIFACT_METADATA_UPDATE, user, service, true);
} catch (ComponentException exp) {
assertThat(exp.getActionStatus()).isEqualTo(ActionStatus.ARTIFACT_INVALID_TIMEOUT);
@@ -419,7 +420,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
when(toscaOperationFacade.generateCustomizationUUIDOnInstanceGroup(service.getUniqueId(), ci.getUniqueId(), new ArrayList<>(Arrays.asList("guid"))))
.thenReturn(StorageOperationStatus.OK);
try {
- artifactBL.handleUpdate(ci.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE, artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
+ artifactBL.handleUpdate(ci.getUniqueId(), ComponentTypeEnum.RESOURCE_INSTANCE, new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
"uid2", envArtifact, null, null, null, null, null, AuditingActionEnum.ARTIFACT_METADATA_UPDATE, user, service, true);
} catch (ComponentException exp) {
assertThat(exp.getActionStatus()).isEqualTo(ActionStatus.ARTIFACT_INVALID_TIMEOUT);
@@ -452,7 +453,8 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
.thenReturn(StorageOperationStatus.OK);
when(toscaOperationFacade.updateGroupInstancesOnComponent(eq(service),eq(ci.getUniqueId()), any(List.class)))
.thenReturn(Either.left(new ArrayList()));
- artifactBL.handleUpdate(ci.getUniqueId(),ComponentTypeEnum.RESOURCE_INSTANCE,artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
+ artifactBL.handleUpdate(ci.getUniqueId(),ComponentTypeEnum.RESOURCE_INSTANCE,
+ new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
"uid2", envArtifact, null, null, null, null, null, AuditingActionEnum.ARTIFACT_METADATA_UPDATE, user, service, true);
assertThat(ci.getDeploymentArtifacts().get("HEAT").getTimeout()).isEqualTo(origEnvArtifact.getTimeout());
}
@@ -477,7 +479,8 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
when(toscaOperationFacade.updateGroupInstancesOnComponent(eq(service),eq(ci.getUniqueId()), any(List.class)))
.thenReturn(Either.left(new ArrayList()));
assertThatThrownBy(() -> {
- artifactBL.handleUpdate(ci.getUniqueId(),ComponentTypeEnum.RESOURCE_INSTANCE,artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
+ artifactBL.handleUpdate(ci.getUniqueId(),ComponentTypeEnum.RESOURCE_INSTANCE,
+ new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
"uid2", envArtifact, null, null, null, null, null, AuditingActionEnum.ARTIFACT_METADATA_UPDATE, user, service, true);
}).isInstanceOf(ComponentException.class);
}
@@ -488,7 +491,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
envArtifact.setArtifactType("invalid");
try {
- artifactBL.handleUpdate("uid", ComponentTypeEnum.RESOURCE_INSTANCE, artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
+ artifactBL.handleUpdate("uid", ComponentTypeEnum.RESOURCE_INSTANCE, new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE),
"uid2", envArtifact, null, null, null, null, null, AuditingActionEnum.ARTIFACT_METADATA_UPDATE, user, null, true);
fail();
} catch(ComponentException exp) {
@@ -952,7 +955,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
String componentId = "";
ComponentTypeEnum componentType = ComponentTypeEnum.RESOURCE;
ArtifactsBusinessLogic arb = getTestSubject();
- ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ ArtifactOperationInfo operation = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
String artifactId = "";
ArtifactDefinition artifactInfo = buildArtifactPayload();
AuditingActionEnum auditingAction = AuditingActionEnum.ADD_CATEGORY;
@@ -1048,7 +1051,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
public void testIgnoreUnupdateableFieldsInUpdate() throws Exception {
ArtifactsBusinessLogic testSubject;
ArtifactsBusinessLogic arb = getTestSubject();
- ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ ArtifactOperationInfo operation = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
ArtifactDefinition artifactInfo = buildArtifactPayload();
ArtifactDefinition currentArtifactInfo = null;
@@ -1065,7 +1068,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
ComponentTypeEnum componentType = ComponentTypeEnum.RESOURCE;
String parentId = "";
ArtifactsBusinessLogic arb = getTestSubject();
- ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ ArtifactOperationInfo operation = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
String artifactId = "";
Either<ArtifactDefinition, ResponseFormat> result;
@@ -1579,7 +1582,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
String artifactId = "";
ComponentTypeEnum componentType = ComponentTypeEnum.RESOURCE;
ArtifactsBusinessLogic arb = getTestSubject();
- ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ ArtifactOperationInfo operation = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
Either<Boolean, ResponseFormat> result;
// default test
@@ -1594,7 +1597,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
public void testDetectAuditingType() throws Exception {
ArtifactsBusinessLogic testSubject;
ArtifactsBusinessLogic arb = getTestSubject();
- ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ ArtifactOperationInfo operation = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
String origMd5 = "";
AuditingActionEnum result;
@@ -1609,7 +1612,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
public void testDetectNoAuditingType() throws Exception {
ArtifactsBusinessLogic testSubject;
ArtifactsBusinessLogic arb = getTestSubject();
- ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.LINK);
+ ArtifactOperationInfo operation = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.LINK);
String origMd5 = "";
AuditingActionEnum result;
@@ -1921,7 +1924,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
List<ArtifactDefinition> vfcsNewCreatedArtifacts = new ArrayList<>();
ArtifactsBusinessLogic arb = getTestSubject();
- ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ ArtifactOperationInfo operation = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
boolean shouldLock = false;
boolean inTransaction = false;
List<ArtifactDefinition> result;
@@ -2035,7 +2038,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
service.setLastUpdaterUserId(user.getUserId());
final ArtifactOperationInfo operationInfo =
- artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
final String componentId = "componentId";
final ComponentInstance componentInstance = new ComponentInstance();
@@ -2089,7 +2092,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
service.setLastUpdaterUserId(user.getUserId());
final ArtifactOperationInfo operationInfo =
- artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
+ new ArtifactOperationInfo(false, false, ArtifactOperationEnum.CREATE);
final String componentId = "componentId";
final ComponentInstance componentInstance = new ComponentInstance();
@@ -2103,6 +2106,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
final ArtifactsBusinessLogic artifactsBusinessLogic = getTestSubject();
artifactsBusinessLogic.setToscaOperationFacade(toscaOperationFacade);
+
final Object result = Deencapsulation
.invoke(artifactsBusinessLogic, "validateInput", componentId, artifactDefinition, operationInfo, artifactId,
user, "interfaceName", ARTIFACT_LABEL, ComponentTypeEnum.RESOURCE_INSTANCE, service);
@@ -2115,7 +2119,7 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock {
public void testHandleArtifactRequest() {
String componentId = "componentId";
- ArtifactOperationInfo operationInfo = artifactBL.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE);
+ ArtifactOperationInfo operationInfo = new ArtifactOperationInfo(false, false, ArtifactOperationEnum.UPDATE);
ArtifactDefinition artifactDefinition = new ArtifactDefinition();
artifactDefinition.setArtifactName("other");
artifactDefinition.setUniqueId("artifactId");
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 160f595e95..66c535e0ce 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
@@ -28,7 +28,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
-import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
@@ -135,7 +135,7 @@ public class ComponentInstanceArtifactsMergeTest {
User user = new User();
when(artifactsBusinessLogicMock.updateResourceInstanceArtifactNoContent("mock", originComponent, user,
- new HashMap<>(), artifactsBusinessLogicMock.new ArtifactOperationInfo(false, false,
+ new HashMap<>(), new ArtifactOperationInfo(false, false,
ArtifactsBusinessLogic.ArtifactOperationEnum.LINK), currentDeploymentArtifacts.get("artifactOne"))).thenReturn(left);
when(artifactsBusinessLogicMock.updateResourceInstanceArtifactNoContent(Mockito.anyString(), Mockito.any(Component.class), Mockito.any(User.class),
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 5f70d9d01f..a23508f797 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
@@ -28,6 +28,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.components.merge.heat.HeatEnvArtifactsMergeBusinessLogic;
import org.openecomp.sdc.be.components.utils.ArtifactBuilder;
import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder;
@@ -90,7 +91,7 @@ public class ComponentInstanceHeatEnvMergeTest {
for (ArtifactDefinition mergedArtifact : mergedArtifacts) {
Map<String, Object> json = new HashMap<>();
when(artifactsBusinessLogicMock.buildJsonForUpdateArtifact(mergedArtifact, ArtifactGroupTypeEnum.DEPLOYMENT, null)).thenReturn(json);
- ArtifactsBusinessLogic.ArtifactOperationInfo artifactUpdateOperation = artifactsBusinessLogicMock.new ArtifactOperationInfo(false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.UPDATE);
+ ArtifactOperationInfo artifactUpdateOperation = new ArtifactOperationInfo(false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.UPDATE);
when(artifactsBusinessLogicMock.updateResourceInstanceArtifactNoContent(Mockito.eq(instanceId), Mockito.eq(resource),
Mockito.eq(USER), Mockito.eq(json),
Mockito.refEq(artifactUpdateOperation),
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 c7dced79c5..092dd1d2b5 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
@@ -58,7 +58,7 @@ import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.BeConfDependentTest;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
-import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo;
+import org.openecomp.sdc.be.components.impl.artifact.ArtifactOperationInfo;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus;