diff options
author | Amichai Hemli <amichai.hemli@intl.att.com> | 2019-11-25 08:44:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-11-25 08:44:42 +0000 |
commit | c503cc0b974566128952084c7ea53134dc984403 (patch) | |
tree | 6be36793921a1c17d41103d6f63ed894b9d21803 /vid-app-common/src | |
parent | f670a8236f9bd398f0b1a6be30c2b08122383925 (diff) | |
parent | 74985d50a82de427c57aac05266ab28ce9bd52ab (diff) |
Merge "Migrating VfModuleOrVolumeGroupRequestDetails it to Kotlin; avoid the inner static classes"
Diffstat (limited to 'vid-app-common/src')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt | 3 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt (renamed from vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java) | 92 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java | 1 | ||||
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java | 5 |
4 files changed, 36 insertions, 65 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt index e71315d67..ecf7fc933 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt @@ -11,7 +11,6 @@ import org.onap.vid.changeManagement.RequestDetailsWrapper import org.onap.vid.model.serviceInstantiation.* import org.onap.vid.mso.model.* import org.onap.vid.mso.model.BaseResourceInstantiationRequestDetails.* -import org.onap.vid.mso.model.VfModuleOrVolumeGroupRequestDetails.* import org.onap.vid.mso.rest.SubscriberInfo import org.onap.vid.properties.Features import org.onap.vid.services.AsyncInstantiationBusinessLogic @@ -295,7 +294,7 @@ class MsoRequestBuilder }.collect(Collectors.toList<VfModuleMacro>()) } - fun aggregateAllInstanceParams(instanceParams: Map<String, String>?, supplementaryParams: Map<String, String>?): List<VfModuleOrVolumeGroupRequestDetails.UserParamMap<String, String>> { + fun aggregateAllInstanceParams(instanceParams: Map<String, String>?, supplementaryParams: Map<String, String>?): List<UserParamMap<String, String>> { var instanceParamsFinal: Map<String, String> = instanceParams ?: emptyMap() val supplementaryParamsFinal: Map<String, String> = supplementaryParams ?: emptyMap() diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt index 794714edf..f4318719d 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt @@ -17,16 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +package org.onap.vid.mso.model -package org.onap.vid.mso.model; - -import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL +import java.util.* /* Based on this model: @@ -98,55 +93,32 @@ import java.util.Map; */ -public class VfModuleOrVolumeGroupRequestDetails extends BaseResourceInstantiationRequestDetails { - - public VfModuleOrVolumeGroupRequestDetails( - @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, - @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, - @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, - @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList, - @JsonProperty(value = "requestParameters", required = true) RequestParametersVfModuleOrVolumeGroup requestParameters) - { - super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters); - } - - public static class RequestParametersVfModuleOrVolumeGroup extends BaseResourceInstantiationRequestDetails.RequestParameters { - @JsonInclude(NON_NULL) private final Boolean usePreload; - - private RequestParametersVfModuleOrVolumeGroup(List<? extends UserParamTypes> userParams, Boolean usePreload, String testApi) { - super(userParams, testApi); - this.usePreload = usePreload; - } - - public Boolean isUsePreload() { - return usePreload; - } - } - - public static class RequestParametersVfModuleOrVolumeGroupInstantiation extends RequestParametersVfModuleOrVolumeGroup { - public RequestParametersVfModuleOrVolumeGroupInstantiation( - List<? extends UserParamTypes> userParams, Boolean usePreload, String testApi) { - super(userParams, usePreload, testApi); - } - } - - public static class RequestParametersVfModuleUpgrade extends RequestParametersVfModuleOrVolumeGroup { - @JsonInclude(NON_NULL) private final Boolean rebuildVolumeGroups; - - public RequestParametersVfModuleUpgrade(List<? extends UserParamTypes> userParams, Boolean usePreload, String testApi, Boolean rebuildVolumeGroups) { - super(userParams, usePreload, testApi); - this.rebuildVolumeGroups = rebuildVolumeGroups; - } - - public Boolean getRebuildVolumeGroups() { - return rebuildVolumeGroups; - } - } - - public static class UserParamMap<K,V> extends HashMap<K,V> implements UserParamTypes, Map<K,V> { - public UserParamMap() { - super(); - } - } -} +data class VfModuleOrVolumeGroupRequestDetails( + val modelInfo: ModelInfo, + val cloudConfiguration: CloudConfiguration, + val requestInfo: RequestInfo, + val relatedInstanceList: List<RelatedInstance>?, + val requestParameters: RequestParametersVfModuleOrVolumeGroup?) + : BaseResourceInstantiationRequestDetails(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters) + +open class RequestParametersVfModuleOrVolumeGroup internal constructor( + userParams: List<UserParamTypes>, + @get:JsonInclude(NON_NULL) val isUsePreload: Boolean?, + testApi: String? +) : BaseResourceInstantiationRequestDetails.RequestParameters(userParams, testApi) + +class RequestParametersVfModuleOrVolumeGroupInstantiation( + userParams: List<UserParamTypes>, + usePreload: Boolean?, + testApi: String? +) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi) + +class RequestParametersVfModuleUpgrade( + userParams: List<UserParamTypes>, + usePreload: Boolean?, + testApi: String?, + @get:JsonInclude(NON_NULL) val rebuildVolumeGroups: Boolean? +) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi) + +class UserParamMap<K, V> : HashMap<K, V>(), UserParamTypes, MutableMap<K, V> diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java index 6b7d6b9e3..a637f85dc 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java @@ -22,7 +22,6 @@ package org.onap.vid.mso.model; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -import org.onap.vid.mso.model.VfModuleOrVolumeGroupRequestDetails.RequestParametersVfModuleOrVolumeGroup; public class VolumeGroupRequestDetails extends BaseResourceInstantiationRequestDetails { diff --git a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java index b935ead88..059e2e9db 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java @@ -75,6 +75,7 @@ import org.onap.vid.mso.model.ModelInfo; import org.onap.vid.mso.model.NetworkInstantiationRequestDetails; import org.onap.vid.mso.model.ServiceDeletionRequestDetails; import org.onap.vid.mso.model.ServiceInstantiationRequestDetails; +import org.onap.vid.mso.model.UserParamMap; import org.onap.vid.mso.model.VfModuleMacro; import org.onap.vid.mso.model.VfModuleOrVolumeGroupRequestDetails; import org.onap.vid.mso.model.VnfInstantiationRequestDetails; @@ -391,8 +392,8 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { } @Test(dataProvider = "expectedAggregatedParams") - public void testAggregateInstanceParamsAndSuppFile(Map<String, String> instanceParams, Map<String, String> suppParams, List<VfModuleOrVolumeGroupRequestDetails.UserParamMap<String, String>> expected) { - List<VfModuleOrVolumeGroupRequestDetails.UserParamMap<String, String>> aggParams = msoRequestBuilder.aggregateAllInstanceParams(instanceParams, suppParams); + public void testAggregateInstanceParamsAndSuppFile(Map<String, String> instanceParams, Map<String, String> suppParams, List<UserParamMap<String, String>> expected) { + List<UserParamMap<String, String>> aggParams = msoRequestBuilder.aggregateAllInstanceParams(instanceParams, suppParams); assertThat("Aggregated params are not as expected", aggParams, equalTo(expected)); } |