summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
authorEinat Vinouze <einat.vinouze@intl.att.com>2020-05-13 18:19:11 +0300
committerIttay Stern <ittay.stern@att.com>2020-05-17 12:56:54 +0000
commita1891033584c124bc6e58676f9109b182707e3e8 (patch)
treea8fb2b195269e54ffe7fa1ede0c64fa7201b7fd0 /vid-app-common/src
parentc8a3cfffe97ec18a54f43e82c3d4f65a65d7eefb (diff)
Move pauseInstantiation from VfModule to BaseResource
Issue-ID: VID-821 Change-Id: Iacb80bba25596b26cb33fd91d9b2c4a4f9a6d08b Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java13
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java2
10 files changed, 23 insertions, 20 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt
index 016c66cca..1eb9799a0 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/VnfCommand.kt
@@ -7,8 +7,8 @@ import org.onap.vid.job.*
import org.onap.vid.job.impl.JobSharedData
import org.onap.vid.model.Action
import org.onap.vid.model.serviceInstantiation.BaseResource
+import org.onap.vid.model.serviceInstantiation.BaseResource.PauseInstantiation
import org.onap.vid.model.serviceInstantiation.VfModule
-import org.onap.vid.model.serviceInstantiation.VfModule.PauseInstantiation
import org.onap.vid.model.serviceInstantiation.Vnf
import org.onap.vid.mso.RestMsoImplementation
import org.onap.vid.properties.Features
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java
index 7617d7778..04dfdb21b 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java
@@ -30,6 +30,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import javax.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
import org.onap.vid.job.JobAdapter;
import org.onap.vid.job.JobType;
@@ -38,6 +39,10 @@ import org.onap.vid.mso.model.ModelInfo;
public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
+ public enum PauseInstantiation {
+ afterCompletion
+ }
+
protected String instanceId;
protected ModelInfo modelInfo;
@@ -65,6 +70,8 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
@JsonInclude(NON_NULL)
protected String originalName; //not used at backend, but stored for fronted
+ @JsonInclude(NON_NULL)
+ protected final PauseInstantiation pauseInstantiation;
private static final Map<String, Action> actionStingToEnumMap = ImmutableMap.<String, Action>builder()
.put("Delete", Action.Delete)
@@ -91,6 +98,7 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
@JsonProperty("isFailed") Boolean isFailed,
@JsonProperty("statusMessage") String statusMessage,
@JsonProperty("position") Integer position,
+ @JsonProperty("pauseInstantiation") PauseInstantiation pauseInstantiation,
@JsonProperty("originalName") String originalName) {
this.modelInfo = modelInfo;
this.modelInfo.setModelType(getModelType());
@@ -105,6 +113,7 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
this.isFailed = isFailed!= null ? isFailed: false;
this.statusMessage = statusMessage;
this.position = position;
+ this.pauseInstantiation = pauseInstantiation;
this.originalName = originalName;
}
@@ -193,4 +202,9 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest {
@JsonIgnore
public abstract JobType getJobType();
+
+ @Nullable
+ public PauseInstantiation getPauseInstantiation() {
+ return pauseInstantiation;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java
index 642e28b36..b273e1451 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java
@@ -45,7 +45,7 @@ public class InstanceGroup extends BaseResource implements JobAdapter.AsyncJobRe
@JsonProperty("originalName") String originalName) {
super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
- position, originalName);
+ position, null, originalName);
this.vnfGroupMembers = vnfGroupMembers;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java
index 758ee0694..1fa283f55 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java
@@ -37,7 +37,7 @@ public class InstanceGroupMember extends BaseResource implements JobAdapter.Asyn
@JsonProperty("position") Integer position,
@JsonProperty("originalName") String originalName) {
super(new ModelInfo(), null, action, null, null, null, null, false, instanceId, trackById, isFailed, statusMessage,
- position, originalName);
+ position, null, originalName);
}
@Override
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java
index cec61f6b7..b81e8c2d6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java
@@ -56,7 +56,7 @@ public class Network extends BaseResource implements JobAdapter.AsyncJobRequest
@JsonProperty("originalName") String originalName) {
super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
- position, originalName);
+ position, null, originalName);
this.productFamilyId = productFamilyId;
this.platformName = platformName;
this.lineOfBusiness = lineOfBusiness;
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java
index 7c04a91dc..cae28f7a3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java
@@ -107,7 +107,7 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy
@JsonProperty("vidNotions") VidNotions vidNotions,
@JsonProperty("originalName") String originalName) {
super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
- null, originalName);
+ null, null, originalName);
this.owningEntityId = owningEntityId;
this.owningEntityName = owningEntityName;
this.projectName = projectName;
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java
index 46d4de800..dc6a2c67a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java
@@ -49,9 +49,6 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
private final Boolean retainVolumeGroups;
@JsonInclude(NON_NULL)
- private final PauseInstantiation pauseInstantiation;
-
- @JsonInclude(NON_NULL)
private Boolean retainAssignments;
public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo,
@@ -75,13 +72,12 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
@JsonProperty("pauseInstantiation") PauseInstantiation pauseInstantiation,
@JsonProperty("originalName") String originalName) {
super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
- position, originalName);
+ position, pauseInstantiation, originalName);
this.volumeGroupInstanceName = volumeGroupInstanceName;
this.usePreload = usePreload;
this.supplementaryParams = supplementaryParams;
this.retainAssignments = retainAssignments;
this.retainVolumeGroups = retainVolumeGroups;
- this.pauseInstantiation = pauseInstantiation;
}
public String getVolumeGroupInstanceName() {
@@ -93,10 +89,6 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
return usePreload;
}
- public enum PauseInstantiation {
- afterCompletion
- }
-
public List<UserParamNameAndValue> getSupplementaryParams() {
return supplementaryParams;
}
@@ -126,9 +118,6 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
return retainVolumeGroups;
}
- @Nullable
- public PauseInstantiation getPauseInstantiation() {return pauseInstantiation;}
-
public VfModule cloneWith(ModelInfo modelInfo) {
return new VfModule(
modelInfo,
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java
index 2ed219637..867e75927 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java
@@ -66,7 +66,7 @@ public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest {
@JsonProperty("originalName") String originalName) {
super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
- position, originalName);
+ position, null, originalName);
this.productFamilyId = productFamilyId;
this.platformName = platformName;
this.lineOfBusiness = lineOfBusiness;
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt b/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt
index ab5440658..75640d4af 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/VnfCommandTest.kt
@@ -32,8 +32,8 @@ import org.onap.vid.job.JobsBrokerService
import org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator
import org.onap.vid.job.impl.JobSharedData
import org.onap.vid.model.Action
+import org.onap.vid.model.serviceInstantiation.BaseResource.PauseInstantiation.afterCompletion
import org.onap.vid.model.serviceInstantiation.VfModule
-import org.onap.vid.model.serviceInstantiation.VfModule.PauseInstantiation.afterCompletion
import org.onap.vid.mso.RestMsoImplementation
import org.onap.vid.properties.Features
import org.onap.vid.services.AsyncInstantiationBusinessLogic
diff --git a/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java b/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java
index 26e8f8285..81ba9578f 100644
--- a/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java
@@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.samePropertyValuesAs;
import static org.onap.vid.model.Action.Create;
-import static org.onap.vid.model.serviceInstantiation.VfModule.PauseInstantiation.afterCompletion;
+import static org.onap.vid.model.serviceInstantiation.BaseResource.PauseInstantiation.afterCompletion;
import static org.onap.vid.testUtils.TestUtils.setStringsInStringFields;
import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;