summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/so/src
diff options
context:
space:
mode:
authorHengye <yehui.wang@est.tech>2019-03-25 14:32:21 +0000
committerHengye <yehui.wang@est.tech>2019-03-25 14:32:21 +0000
commitb150aa8197e8a21ab7ad4cf1d91cfa30f56fa3df (patch)
tree60c296267f496f3b40d838294e8f80b04ceb2607 /models-interactions/model-impl/so/src
parent2a245ef80e39a101015efb164de53f1753fa5d47 (diff)
migrate model-impl from drools-applications
migrate controlloop/common/model-impl from drools-applicaitons to policy/models Issue-ID: POLICY-1264 Change-Id: Ibe0bb5c49a7b1344f4104b30455f52834041e187 Signed-off-by: Hengye <yehui.wang@est.tech>
Diffstat (limited to 'models-interactions/model-impl/so/src')
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java126
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java58
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java58
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java375
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java113
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java42
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java58
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java71
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java47
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java124
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java216
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java58
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java146
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java72
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java54
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java80
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java79
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java103
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java67
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java69
-rw-r--r--models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java36
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java187
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java316
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java80
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java50
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java240
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java50
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java407
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java71
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java49
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java47
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java54
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java177
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java52
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java83
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java48
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java50
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java59
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java77
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java61
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java106
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java52
-rw-r--r--models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java54
43 files changed, 4422 insertions, 0 deletions
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java
new file mode 100644
index 000000000..cd4922dbd
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java
@@ -0,0 +1,126 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+public class SoAsyncRequestStatus implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("correlator")
+ private String correlator;
+
+ @SerializedName("requestId")
+ private String requestId;
+
+ @SerializedName("instanceReferences")
+ private SoInstanceReferences instanceReferences;
+
+ @SerializedName("startTime")
+ private LocalDateTime startTime;
+
+ @SerializedName("finishTime")
+ private LocalDateTime finishTime;
+
+ @SerializedName("requestScope")
+ private String requestScope;
+
+ @SerializedName("requestType")
+ private String requestType;
+
+ @SerializedName("requestStatus")
+ private SoRequestStatus requestStatus;
+
+ public SoAsyncRequestStatus() {
+ // required by author
+ }
+
+ public String getCorrelator() {
+ return correlator;
+ }
+
+
+ public LocalDateTime getFinishTime() {
+ return finishTime;
+ }
+
+ public SoInstanceReferences getInstanceReferences() {
+ return instanceReferences;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public String getRequestScope() {
+ return requestScope;
+ }
+
+ public SoRequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+
+ public LocalDateTime getStartTime() {
+ return startTime;
+ }
+
+ public void setCorrelator(String correlator) {
+ this.correlator = correlator;
+ }
+
+ public void setFinishTime(LocalDateTime finishTime) {
+ this.finishTime = finishTime;
+ }
+
+ public void setInstanceReferences(SoInstanceReferences instanceReferences) {
+ this.instanceReferences = instanceReferences;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+
+ public void setRequestStatus(SoRequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public void setStartTime(LocalDateTime startTime) {
+ this.startTime = startTime;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java
new file mode 100644
index 000000000..e6512685b
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoCloudConfiguration implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("lcpCloudRegionId")
+ private String lcpCloudRegionId;
+
+ @SerializedName("tenantId")
+ private String tenantId;
+
+ public SoCloudConfiguration() {
+ //required by author
+ }
+
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java
new file mode 100644
index 000000000..751f560c0
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoInstanceReferences implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("requestId")
+ private String requestId;
+
+ @SerializedName("instanceId")
+ private String instanceId;
+
+ public SoInstanceReferences() {
+ //requried by author
+ }
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java
new file mode 100644
index 000000000..4c9ba66bd
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java
@@ -0,0 +1,375 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonSyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import org.drools.core.WorkingMemory;
+import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.common.endpoints.utils.NetLoggerUtil;
+import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
+import org.onap.policy.drools.system.PolicyEngine;
+import org.onap.policy.rest.RestManager;
+import org.onap.policy.rest.RestManager.Pair;
+import org.onap.policy.so.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This class handles the interface towards SO (Service Orchestrator) for the ONAP Policy
+ * Framework. The SO API is defined at this link:
+ * http://onap.readthedocs.io/en/latest/submodules/so.git/docs/SO_R1_Interface.html#get-orchestration-request
+ *
+ */
+public final class SoManager {
+ private static final Logger logger = LoggerFactory.getLogger(SoManager.class);
+
+ private static ExecutorService executors = Executors.newCachedThreadPool();
+
+ private static final int SO_RESPONSE_ERROR = 999;
+ private static final String MEDIA_TYPE = "application/json";
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ // REST get timeout value in milliseconds
+ private static final int GET_REQUESTS_BEFORE_TIMEOUT = 20;
+ private static final long GET_REQUEST_WAIT_INTERVAL = 20000;
+
+ // The REST manager used for processing REST calls for this VFC manager
+ private RestManager restManager;
+
+ private long restGetTimeout = GET_REQUEST_WAIT_INTERVAL;
+
+ /**
+ * Default constructor.
+ */
+ public SoManager() {
+ restManager = new RestManager();
+ }
+
+ /**
+ * Create a service instance in SO.
+ *
+ * @param url the SO URL
+ * @param urlBase the base URL
+ * @param username user name on SO
+ * @param password password on SO
+ * @param request the request to issue to SO
+ * @return the SO Response object
+ */
+ public SoResponse createModuleInstance(final String url, final String urlBase, final String username,
+ final String password, final SoRequest request) {
+ // Issue the HTTP POST request to SO to create the service instance
+ String requestJson = Serialization.gsonPretty.toJson(request);
+ NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|{}|{}|{}|{}|]{}{}", "SO", url, username, password,
+ createSimpleHeaders(), MEDIA_TYPE, LINE_SEPARATOR, requestJson);
+ Pair<Integer, String> httpResponse =
+ restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, requestJson);
+
+ // Process the response from SO
+ SoResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse);
+ if (SO_RESPONSE_ERROR != response.getHttpResponseCode()) {
+ return response;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Works just like SOManager#asyncSORestCall(String, WorkingMemory, String, String, String, SORequest)
+ * except the vfModuleInstanceId is always null.
+ *
+ */
+ public Future<SoResponse> asyncSoRestCall(final String requestId, final WorkingMemory wm,
+ final String serviceInstanceId, final String vnfInstanceId,
+ final SoRequest request) {
+ return asyncSoRestCall(requestId, wm, serviceInstanceId, vnfInstanceId, null, request);
+ }
+
+ /**
+ * This method makes an asynchronous Rest call to MSO and inserts the response into
+ * Drools working memory.
+ *
+ * @param requestId the request id
+ * @param wm the Drools working memory
+ * @param serviceInstanceId service instance id to construct the request url
+ * @param vnfInstanceId vnf instance id to construct the request url
+ * @param vfModuleInstanceId vfModule instance id to construct the request url (required in case of delete vf
+ * module)
+ * @param request the SO request
+ * @return a concurrent Future for the thread that handles the request
+ */
+ public Future<SoResponse> asyncSoRestCall(final String requestId,
+ final WorkingMemory wm,
+ final String serviceInstanceId,
+ final String vnfInstanceId,
+ final String vfModuleInstanceId, final SoRequest request) {
+ return executors.submit(new AsyncSoRestCallThread(requestId, wm, serviceInstanceId, vnfInstanceId,
+ vfModuleInstanceId, request));
+ }
+
+ /**
+ * This class handles an asynchronous request to SO as a thread.
+ */
+ private class AsyncSoRestCallThread implements Callable<SoResponse> {
+ final String requestId;
+ final WorkingMemory wm;
+ final String serviceInstanceId;
+ final String vnfInstanceId;
+ final String vfModuleInstanceId;
+ final SoRequest request;
+
+ /**
+ * Constructor, sets the context of the request.
+ *
+ * @param requestID The request ID
+ * @param wm reference to the Drools working memory
+ * @param serviceInstanceId the service instance in SO to use
+ * @param vnfInstanceId the VNF instance that is the subject of the request
+ * @param vfModuleInstanceId the vf module instance id (not null in case of delete vf module request)
+ * @param request the request itself
+ */
+ private AsyncSoRestCallThread(final String requestId,
+ final WorkingMemory wm, final String serviceInstanceId,
+ final String vnfInstanceId, final String vfModuleInstanceId,
+ final SoRequest request) {
+ this.requestId = requestId;
+ this.wm = wm;
+ this.serviceInstanceId = serviceInstanceId;
+ this.vnfInstanceId = vnfInstanceId;
+ this.vfModuleInstanceId = vfModuleInstanceId;
+ this.request = request;
+ }
+
+ /**
+ * Process the asynchronous SO request.
+ */
+ @Override
+ public SoResponse call() {
+ String urlBase = PolicyEngine.manager.getEnvironmentProperty("so.url");
+ String username = PolicyEngine.manager.getEnvironmentProperty("so.username");
+ String password = PolicyEngine.manager.getEnvironmentProperty("so.password");
+
+ // Create a JSON representation of the request
+ String soJson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create().toJson(request);
+ String url = null;
+ Pair<Integer, String> httpResponse = null;
+
+ if (request.getOperationType() != null && request.getOperationType()
+ .equals(SoOperationType.SCALE_OUT)) {
+ url = urlBase + "/serviceInstantiation/v7/serviceInstances/" + serviceInstanceId + "/vnfs/"
+ + vnfInstanceId + "/vfModules/scaleOut";
+ NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, soJson);
+ httpResponse = restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson);
+ } else if (request.getOperationType() != null && request.getOperationType()
+ .equals(SoOperationType.DELETE_VF_MODULE)) {
+ url = urlBase + "/serviceInstances/v7/" + serviceInstanceId + "/vnfs/" + vnfInstanceId
+ + "/vfModules/" + vfModuleInstanceId;
+ NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, soJson);
+ httpResponse = restManager.delete(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson);
+ } else {
+ return null;
+ }
+
+ // Process the response from SO
+ SoResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse);
+
+ // Return the response to Drools in its working memory
+ SoResponseWrapper soWrapper = new SoResponseWrapper(response, requestId);
+ wm.insert(soWrapper);
+
+ return response;
+ }
+ }
+
+ /**
+ * Wait for the SO operation we have ordered to complete.
+ *
+ * @param urlBaseSo The base URL for SO
+ * @param username user name on SO
+ * @param password password on SO
+ * @param initialRequestUrl The URL of the initial HTTP request
+ * @param initialHttpResponse The initial HTTP message returned from SO
+ * @return The parsed final response of SO to the request
+ */
+ private SoResponse waitForSoOperationCompletion(final String urlBaseSo, final String username,
+ final String password, final String initialRequestUrl,
+ final Pair<Integer, String> initialHttpResponse) {
+ // Process the initial response from SO, the response to a post
+ SoResponse response = processSoResponse(initialRequestUrl, initialHttpResponse);
+ if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) {
+ return response;
+ }
+
+ // The SO URL to use to get the status of orchestration requests
+ String urlGet = urlBaseSo + "/orchestrationRequests/v5/" + response.getRequestReferences().getRequestId();
+
+ // The HTTP status code of the latest response
+ Pair<Integer, String> latestHttpResponse = initialHttpResponse;
+
+ // Wait for the response from SO
+ for (int attemptsLeft = GET_REQUESTS_BEFORE_TIMEOUT; attemptsLeft >= 0; attemptsLeft--) {
+ // The SO request may have completed even on the first request so we check the
+ // response
+ // here before
+ // issuing any other requests
+ if (isRequestStateFinished(latestHttpResponse, response)) {
+ return response;
+ }
+
+ // Wait for the defined interval before issuing a get
+ try {
+ Thread.sleep(restGetTimeout);
+ } catch (InterruptedException e) {
+ logger.error("Interrupted exception: ", e);
+ Thread.currentThread().interrupt();
+ response.setHttpResponseCode(SO_RESPONSE_ERROR);
+ return response;
+ }
+
+ // Issue a GET to find the current status of our request
+ NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|{}|{}|{}|{}|]{}", "SO", urlGet, username, password,
+ createSimpleHeaders(), MEDIA_TYPE, LINE_SEPARATOR);
+ Pair<Integer, String> httpResponse = restManager.get(urlGet, username, password, createSimpleHeaders());
+
+ // Get our response
+ response = processSoResponse(urlGet, httpResponse);
+ if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) {
+ return response;
+ }
+
+ // Our latest HTTP response code
+ latestHttpResponse = httpResponse;
+ }
+
+ // We have timed out on the SO request
+ response.setHttpResponseCode(SO_RESPONSE_ERROR);
+ return response;
+ }
+
+ /**
+ * Parse the response message from SO into a SOResponse object.
+ *
+ * @param requestURL The URL of the HTTP request
+ * @param httpResponse The HTTP message returned from SO
+ * @return The parsed response
+ */
+ private SoResponse processSoResponse(final String requestUrl, final Pair<Integer, String> httpResponse) {
+ SoResponse response = new SoResponse();
+
+ // A null httpDetails indicates a HTTP problem, a valid response from SO must be
+ // either 200
+ // or 202
+ if (!httpResultIsNullFree(httpResponse) || (httpResponse.first != 200 && httpResponse.first != 202)) {
+ logger.error("Invalid HTTP response received from SO");
+ response.setHttpResponseCode(SO_RESPONSE_ERROR);
+ return response;
+ }
+
+ // Parse the JSON of the response into our POJO
+ try {
+ response = Serialization.gsonPretty.fromJson(httpResponse.second, SoResponse.class);
+ } catch (JsonSyntaxException e) {
+ logger.error("Failed to deserialize HTTP response into SOResponse: ", e);
+ response.setHttpResponseCode(SO_RESPONSE_ERROR);
+ return response;
+ }
+
+ // Set the HTTP response code of the response if needed
+ if (response.getHttpResponseCode() == 0) {
+ response.setHttpResponseCode(httpResponse.first);
+ }
+
+ NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, requestUrl, httpResponse.second);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("***** Response to SO Request to URL {}:", requestUrl);
+ logger.debug(httpResponse.second);
+ }
+
+ return response;
+ }
+
+ /**
+ * Method to allow tuning of REST get timeout.
+ *
+ * @param restGetTimeout the timeout value
+ */
+ protected void setRestGetTimeout(final long restGetTimeout) {
+ this.restGetTimeout = restGetTimeout;
+ }
+
+ /**
+ * Check that the request state of a response is defined.
+ *
+ * @param response The response to check
+ * @return true if the request for the response is defined
+ */
+ private boolean isRequestStateDefined(final SoResponse response) {
+ return response != null && response.getRequest() != null && response.getRequest().getRequestStatus() != null
+ && response.getRequest().getRequestStatus().getRequestState() != null;
+ }
+
+ /**
+ * Check that the request state of a response is finished.
+ *
+ * @param latestHttpDetails the HTTP details of the response
+ * @param response The response to check
+ * @return true if the request for the response is finished
+ */
+ private boolean isRequestStateFinished(final Pair<Integer, String> latestHttpDetails, final SoResponse response) {
+ if (latestHttpDetails != null && 200 == latestHttpDetails.first && isRequestStateDefined(response)) {
+ String requestState = response.getRequest().getRequestStatus().getRequestState();
+ return "COMPLETE".equalsIgnoreCase(requestState) || "FAILED".equalsIgnoreCase(requestState);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Check that a HTTP operation result has no nulls.
+ *
+ * @param httpOperationResult the result to check
+ * @return true if no nulls are found
+ */
+ private boolean httpResultIsNullFree(Pair<Integer, String> httpOperationResult) {
+ return httpOperationResult != null && httpOperationResult.first != null && httpOperationResult.second != null;
+ }
+
+ /**
+ * Create simple HTTP headers for unauthenticated requests to SO.
+ *
+ * @return the HTTP headers
+ */
+ private Map<String, String> createSimpleHeaders() {
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Accept", MEDIA_TYPE);
+ return headers;
+ }
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java
new file mode 100644
index 000000000..42e477b6b
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoModelInfo implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("modelType")
+ private String modelType;
+
+ @SerializedName("modelInvariantId")
+ private String modelInvariantId;
+
+ @SerializedName("modelVersionId")
+ private String modelVersionId;
+
+ @SerializedName("modelName")
+ private String modelName;
+
+ @SerializedName("modelVersion")
+ private String modelVersion;
+
+ @SerializedName("modelCustomizationName")
+ private String modelCustomizationName;
+
+ @SerializedName("modelCustomizationId")
+ private String modelCustomizationId;
+
+ public SoModelInfo() {
+ //required by author
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public String getModelType() {
+ return modelType;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java
new file mode 100644
index 000000000..e2a7af71d
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2018 Amdocs. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+/**
+ * Enumeration of SO Operations type that can be performed by a policy.
+ */
+public enum SoOperationType {
+ SCALE_OUT("Create Vf Module"),
+ DELETE_VF_MODULE("Delete Vf Module");
+
+ private String operationType;
+
+ SoOperationType(String operationType) {
+ this.operationType = operationType;
+ }
+
+ @Override
+ public String toString() {
+ return this.operationType;
+ }
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java
new file mode 100644
index 000000000..1b80898cc
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoPolicyExceptionHolder implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("messageId")
+ private String messageId;
+
+ @SerializedName("text")
+ private String text;
+
+ public SoPolicyExceptionHolder() {
+ //required by author
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java
new file mode 100644
index 000000000..b55ce27e8
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoRelatedInstance implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceId")
+ private String instanceId;
+
+ @SerializedName("instanceName")
+ private String instanceName;
+
+ @SerializedName("modelInfo")
+ private SoModelInfo modelInfo;
+
+ public SoRelatedInstance() {
+ //required by author
+ }
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public SoModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+
+ public void setModelInfo(SoModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java
new file mode 100644
index 000000000..7fa2d638f
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoRelatedInstanceListElement implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("relatedInstance")
+ private SoRelatedInstance relatedInstance;
+
+ public SoRelatedInstanceListElement() {
+ //required by author
+ }
+
+ public SoRelatedInstance getRelatedInstance() {
+ return relatedInstance;
+ }
+
+ public void setRelatedInstance(SoRelatedInstance relatedInstance) {
+ this.relatedInstance = relatedInstance;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java
new file mode 100644
index 000000000..9c4cc0f81
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.UUID;
+
+public class SoRequest implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("requestId")
+ private UUID requestId;
+
+ @SerializedName("startTime")
+ private String startTime;
+
+ @SerializedName("finishTime")
+ private LocalDateTime finishTime;
+
+ @SerializedName("requestScope")
+ private String requestScope;
+
+ @SerializedName("requestType")
+ private String requestType;
+
+ @SerializedName("requestDetails")
+ private SoRequestDetails requestDetails;
+
+ @SerializedName("requestStatus")
+ private SoRequestStatus requestStatus;
+
+ private transient SoOperationType operationType;
+
+ public SoRequest() {
+ // required by author
+ }
+
+ public LocalDateTime getFinishTime() {
+ return finishTime;
+ }
+
+ public SoRequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public UUID getRequestId() {
+ return requestId;
+ }
+
+ public String getRequestScope() {
+ return requestScope;
+ }
+
+ public SoRequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setFinishTime(LocalDateTime finishTime) {
+ this.finishTime = finishTime;
+ }
+
+ public void setRequestDetails(SoRequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
+
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+
+ public void setRequestStatus(SoRequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public SoOperationType getOperationType() {
+ return operationType;
+ }
+
+ public void setOperationType(SoOperationType operationType) {
+ this.operationType = operationType;
+ }
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java
new file mode 100644
index 000000000..b0f4ca7c3
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java
@@ -0,0 +1,216 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+public class SoRequestDetails implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("modelInfo")
+ private SoModelInfo modelInfo;
+
+ @SerializedName("cloudConfiguration")
+ private SoCloudConfiguration cloudConfiguration;
+
+ @SerializedName("requestInfo")
+ private SoRequestInfo requestInfo;
+
+ @SerializedName("subscriberInfo")
+ private SoSubscriberInfo subscriberInfo;
+
+ @SerializedName("relatedInstanceList")
+ private List<SoRelatedInstanceListElement> relatedInstanceList = new LinkedList<>();
+
+ @SerializedName("requestParameters")
+ private SoRequestParameters requestParameters;
+
+ @SerializedName("configurationParameters")
+ private List<Map<String, String>> configurationParameters = new LinkedList<>();
+
+ public SoRequestDetails() {
+
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param soRequestDetails copy object
+ */
+ public SoRequestDetails(SoRequestDetails soRequestDetails) {
+ this.modelInfo = soRequestDetails.modelInfo;
+ this.cloudConfiguration = soRequestDetails.cloudConfiguration;
+ this.requestInfo = soRequestDetails.requestInfo;
+ this.relatedInstanceList = soRequestDetails.relatedInstanceList;
+ this.requestParameters = soRequestDetails.requestParameters;
+ this.subscriberInfo = soRequestDetails.subscriberInfo;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SoRequestDetails other = (SoRequestDetails) obj;
+ if (cloudConfiguration == null) {
+ if (other.cloudConfiguration != null) {
+ return false;
+ }
+ } else if (!cloudConfiguration.equals(other.cloudConfiguration)) {
+ return false;
+ }
+ if (configurationParameters == null) {
+ if (other.configurationParameters != null) {
+ return false;
+ }
+ } else if (!configurationParameters.equals(other.configurationParameters)) {
+ return false;
+ }
+ if (modelInfo == null) {
+ if (other.modelInfo != null) {
+ return false;
+ }
+ } else if (!modelInfo.equals(other.modelInfo)) {
+ return false;
+ }
+ if (relatedInstanceList == null) {
+ if (other.relatedInstanceList != null) {
+ return false;
+ }
+ } else if (!relatedInstanceList.equals(other.relatedInstanceList)) {
+ return false;
+ }
+ if (requestInfo == null) {
+ if (other.requestInfo != null) {
+ return false;
+ }
+ } else if (!requestInfo.equals(other.requestInfo)) {
+ return false;
+ }
+ if (requestParameters == null) {
+ if (other.requestParameters != null) {
+ return false;
+ }
+ } else if (!requestParameters.equals(other.requestParameters)) {
+ return false;
+ }
+ if (subscriberInfo == null) {
+ if (other.subscriberInfo != null) {
+ return false;
+ }
+ } else if (!subscriberInfo.equals(other.subscriberInfo)) {
+ return false;
+ }
+ return true;
+ }
+
+ public SoCloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public SoModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public List<SoRelatedInstanceListElement> getRelatedInstanceList() {
+ return relatedInstanceList;
+ }
+
+ public SoRequestInfo getRequestInfo() {
+ return requestInfo;
+ }
+
+ public SoRequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ public List<Map<String, String>> getConfigurationParameters() {
+ return configurationParameters;
+ }
+
+ public SoSubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode());
+ result = prime * result + ((configurationParameters == null) ? 0 : configurationParameters.hashCode());
+ result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode());
+ result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode());
+ result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode());
+ result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode());
+ result = prime * result + ((subscriberInfo == null) ? 0 : subscriberInfo.hashCode());
+ return result;
+ }
+
+ public void setCloudConfiguration(SoCloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public void setModelInfo(SoModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public void setRequestInfo(SoRequestInfo requestInfo) {
+ this.requestInfo = requestInfo;
+ }
+
+ public void setRequestParameters(SoRequestParameters requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+ public void setConfigurationParameters(List<Map<String, String>> configurationParameters) {
+ this.configurationParameters = configurationParameters;
+ }
+
+ public void setSubscriberInfo(SoSubscriberInfo subscriberInfo) {
+ this.subscriberInfo = subscriberInfo;
+ }
+
+ public void setRelatedInstanceList(List<SoRelatedInstanceListElement> relatedInstanceList) {
+ this.relatedInstanceList = relatedInstanceList;
+ }
+
+ @Override
+ public String toString() {
+ return "SORequestDetails [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration
+ + ", requestInfo=" + requestInfo + ", subscriberInfo=" + subscriberInfo
+ + ", relatedInstanceList=" + relatedInstanceList + ", requestParameters=" + requestParameters
+ + ", configurationParameters=" + configurationParameters + "]";
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java
new file mode 100644
index 000000000..06dea0549
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoRequestError implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("policyException")
+ private SoPolicyExceptionHolder policyException;
+
+ @SerializedName("serviceException")
+ private SoServiceExceptionHolder serviceException;
+
+ public SoRequestError() {
+ // required by author
+ }
+
+ public SoPolicyExceptionHolder getPolicyException() {
+ return policyException;
+ }
+
+ public SoServiceExceptionHolder getServiceException() {
+ return serviceException;
+ }
+
+ public void setPolicyException(SoPolicyExceptionHolder policyException) {
+ this.policyException = policyException;
+ }
+
+ public void setServiceException(SoServiceExceptionHolder serviceException) {
+ this.serviceException = serviceException;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java
new file mode 100644
index 000000000..06f456a8d
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java
@@ -0,0 +1,146 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoRequestInfo implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceName")
+ private String instanceName;
+
+ @SerializedName("source")
+ private String source;
+
+ @SerializedName("productFamilyId")
+ private String productFamilyId;
+
+ @SerializedName("suppressRollback")
+ private boolean suppressRollback;
+
+ @SerializedName("billingAccountNumber")
+ private String billingAccountNumber;
+
+ @SerializedName("callbackUrl")
+ private String callbackUrl;
+
+ @SerializedName("correlator")
+ private String correlator;
+
+ @SerializedName("orderNumber")
+ private String orderNumber;
+
+ @SerializedName("orderVersion")
+ private Integer orderVersion;
+
+ @SerializedName("requestorId")
+ private String requestorId;
+
+ public SoRequestInfo() {
+ // required by author
+ }
+
+ public String getBillingAccountNumber() {
+ return billingAccountNumber;
+ }
+
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ public String getCorrelator() {
+ return correlator;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public String getOrderNumber() {
+ return orderNumber;
+ }
+
+ public Integer getOrderVersion() {
+ return orderVersion;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public boolean isSuppressRollback() {
+ return suppressRollback;
+ }
+
+ public void setBillingAccountNumber(String billingAccountNumber) {
+ this.billingAccountNumber = billingAccountNumber;
+ }
+
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ public void setCorrelator(String correlator) {
+ this.correlator = correlator;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public void setOrderNumber(String orderNumber) {
+ this.orderNumber = orderNumber;
+ }
+
+ public void setOrderVersion(Integer orderVersion) {
+ this.orderVersion = orderVersion;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public void setSuppressRollback(boolean suppressRollback) {
+ this.suppressRollback = suppressRollback;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java
new file mode 100644
index 000000000..2db4e1a03
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+public class SoRequestParameters implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236033L;
+
+ @SerializedName("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @SerializedName("usePreload")
+ private boolean usePreload;
+
+ @SerializedName("userParams")
+ private List<Map<String, String>> userParams = new LinkedList<>();
+
+ public SoRequestParameters() {
+ // required by author
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public boolean isUsePreload() {
+ return usePreload;
+ }
+
+ public List<Map<String, String>> getUserParams() {
+ return userParams;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public void setUsePreload(boolean usePreload) {
+ this.usePreload = usePreload;
+ }
+
+ public void setUserParams(List<Map<String, String>> userParams) {
+ this.userParams = userParams;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java
new file mode 100644
index 000000000..92ec1fe2e
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoRequestReferences implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceId")
+ private String instanceId;
+
+ @SerializedName("requestId")
+ private String requestId;
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java
new file mode 100644
index 000000000..95df506f9
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoRequestStatus implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("percentProgress")
+ private int percentProgress;
+
+ @SerializedName("requestState")
+ private String requestState;
+
+ @SerializedName("timestamp")
+ private String timestamp;
+
+ @SerializedName("wasRolledBack")
+ private boolean wasRolledBack;
+
+ public SoRequestStatus() {
+ //required by author
+ }
+
+ public int getPercentProgress() {
+ return percentProgress;
+ }
+
+ public String getRequestState() {
+ return requestState;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public boolean isWasRolledBack() {
+ return wasRolledBack;
+ }
+
+ public void setPercentProgress(int percentProgress) {
+ this.percentProgress = percentProgress;
+ }
+
+ public void setRequestState(String requestState) {
+ this.requestState = requestState;
+ }
+
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public void setWasRolledBack(boolean wasRolledBack) {
+ this.wasRolledBack = wasRolledBack;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java
new file mode 100644
index 000000000..5feeb415e
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoResponse implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("requestReferences")
+ private SoRequestReferences requestReferences;
+
+ @SerializedName("requestError")
+ private SoRequestError requestError;
+
+ @SerializedName("request")
+ private SoRequest request;
+
+ private int httpResponseCode;
+
+ public SoResponse() {
+ // required by author
+ }
+
+ public int getHttpResponseCode() {
+ return httpResponseCode;
+ }
+
+ public SoRequest getRequest() {
+ return request;
+ }
+
+ public SoRequestError getRequestError() {
+ return requestError;
+ }
+
+ public SoRequestReferences getRequestReferences() {
+ return requestReferences;
+ }
+
+ public void setHttpResponseCode(int httpResponseCode) {
+ this.httpResponseCode = httpResponseCode;
+ }
+
+ public void setRequest(SoRequest request) {
+ this.request = request;
+ }
+
+ public void setRequestError(SoRequestError requestError) {
+ this.requestError = requestError;
+ }
+
+ public void setRequestReferences(SoRequestReferences requestReferences) {
+ this.requestReferences = requestReferences;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java
new file mode 100644
index 000000000..2a74f38b5
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoResponseWrapper implements Serializable {
+
+ private static final long serialVersionUID = 7673023687132889069L;
+
+ @SerializedName("SoResponse")
+ private SoResponse soResponse;
+
+ private transient String requestId;
+
+ public SoResponseWrapper(SoResponse response, String reqId) {
+ this.soResponse = response;
+ this.requestId = reqId;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SoResponseWrapper other = (SoResponseWrapper) obj;
+ if (soResponse == null) {
+ if (other.soResponse != null) {
+ return false;
+ }
+ }
+ else if (!soResponse.equals(other.soResponse)) {
+ return false;
+ }
+ if (requestId == null) {
+ if (other.requestId != null) {
+ return false;
+ }
+ }
+ else if (!requestId.equals(other.requestId)) {
+ return false;
+ }
+ return true;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public SoResponse getSoResponse() {
+ return soResponse;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((soResponse == null) ? 0 : soResponse.hashCode());
+ result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
+ return result;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public void setSoResponse(SoResponse response) {
+ soResponse = response;
+ }
+
+ @Override
+ public String toString() {
+ return "SOResponseWrapper [SOResponse=" + soResponse + ", RequestId=" + requestId + "]";
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java
new file mode 100644
index 000000000..79c162b4e
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+public class SoServiceExceptionHolder implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("messageId")
+ private String messageId;
+
+ @SerializedName("text")
+ private String text;
+
+ @SerializedName("variables")
+ private List<String> variables = new LinkedList<>();
+
+ public SoServiceExceptionHolder() {
+ // required by author
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public List<String> getVariables() {
+ return variables;
+ }
+
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java
new file mode 100644
index 000000000..19f279dbb
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+
+public class SoSubscriberInfo implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @SerializedName("subscriberCommonSiteId")
+ private String subscriberCommonSiteId;
+
+ @SerializedName("subscriberName")
+ private String subscriberName;
+
+ public SoSubscriberInfo() {
+ //required by author
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public String getSubscriberCommonSiteId() {
+ return subscriberCommonSiteId;
+ }
+
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
+ this.subscriberCommonSiteId = subscriberCommonSiteId;
+ }
+
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java
new file mode 100644
index 000000000..b23ccc993
--- /dev/null
+++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so.util;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+public final class Serialization {
+
+ public static final Gson gsonPretty =
+ new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
+
+ private Serialization() {
+ // utility class with explicit private constructor
+ // change if class is more than utility
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java
new file mode 100644
index 000000000..d64b70b51
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java
@@ -0,0 +1,187 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.policy.so.SoCloudConfiguration;
+import org.onap.policy.so.SoModelInfo;
+import org.onap.policy.so.SoRelatedInstance;
+import org.onap.policy.so.SoRelatedInstanceListElement;
+import org.onap.policy.so.SoRequest;
+import org.onap.policy.so.SoRequestDetails;
+import org.onap.policy.so.SoRequestInfo;
+import org.onap.policy.so.SoRequestParameters;
+import org.onap.policy.so.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoTest {
+ private static final Logger logger = LoggerFactory.getLogger(DemoTest.class);
+
+ @Test
+ public void test() {
+
+ SoRequest request = new SoRequest();
+ request.setRequestDetails(new SoRequestDetails());
+ request.getRequestDetails().setModelInfo(new SoModelInfo());
+ request.getRequestDetails().setCloudConfiguration(new SoCloudConfiguration());
+ request.getRequestDetails().setRequestInfo(new SoRequestInfo());
+ request.getRequestDetails().setRequestParameters(new SoRequestParameters());
+
+ request.getRequestDetails().getModelInfo().setModelType("vfModule");
+ request.getRequestDetails().getModelInfo().setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ request.getRequestDetails().getModelInfo().setModelVersionId("fe6478e5-ea33-3346-ac12-ab121484a3fe");
+ request.getRequestDetails().getModelInfo().setModelName("vSAMP12..base..module-0");
+ request.getRequestDetails().getModelInfo().setModelVersion("1");
+
+ request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("mdt1");
+ request.getRequestDetails().getCloudConfiguration().setTenantId("88a6ca3ee0394ade9403f075db23167e");
+
+ request.getRequestDetails().getRequestInfo().setInstanceName("SOTEST103a-vSAMP12_base_module-0");
+ request.getRequestDetails().getRequestInfo().setSource("VID");
+ request.getRequestDetails().getRequestInfo().setSuppressRollback(true);
+
+ SoRelatedInstanceListElement relatedInstanceListElement1 =
+ new SoRelatedInstanceListElement();
+ SoRelatedInstanceListElement relatedInstanceListElement2 =
+ new SoRelatedInstanceListElement();
+ SoRelatedInstanceListElement relatedInstanceListElement3 =
+ new SoRelatedInstanceListElement();
+ relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance());
+ relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance());
+ relatedInstanceListElement3.setRelatedInstance(new SoRelatedInstance());
+
+ relatedInstanceListElement1.getRelatedInstance().setInstanceId(
+ "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c");
+ relatedInstanceListElement1.getRelatedInstance().setInstanceName(
+ "SOTESTVOL103a-vSAMP12_base_module-0_vol");
+ relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo());
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("volumeGroup");
+
+ relatedInstanceListElement2.getRelatedInstance().setInstanceId("serviceInstanceId");
+ relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo());
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("service");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId(
+ "ff3514e3-5a33-55df-13ab-12abad84e7ff");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersionId(
+ "fe6985cd-ea33-3346-ac12-ab121484a3fe");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName(
+ "parent service model name");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("1.0");
+
+ relatedInstanceListElement3.getRelatedInstance().setInstanceId("vnfInstanceId");
+ relatedInstanceListElement3.getRelatedInstance().setModelInfo(new SoModelInfo());
+ relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelType("vnf");
+ relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelInvariantId(
+ "ff5256d1-5a33-55df-13ab-12abad84e7ff");
+ relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelVersionId(
+ "fe6478e4-ea33-3346-ac12-ab121484a3fe");
+ relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelName("vSAMP12");
+ relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelVersion("1.0");
+ relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelCustomizationName("vSAMP12 1");
+
+ request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1);
+ request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
+ request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement3);
+
+ Map<String, String> userParam1 = new HashMap<>();
+ userParam1.put("name1", "value1");
+
+ Map<String, String> userParam2 = new HashMap<>();
+ userParam2.put("name2", "value2");
+
+ request.getRequestDetails().getRequestParameters().getUserParams().add(userParam1);
+ request.getRequestDetails().getRequestParameters().getUserParams().add(userParam2);
+
+ logger.debug(Serialization.gsonPretty.toJson(request));
+
+ }
+
+ @Test
+ public void testHack() {
+
+ logger.debug("** HACK **");
+
+ SoRequest request = new SoRequest();
+
+ request.setRequestDetails(new SoRequestDetails());
+ request.getRequestDetails().setModelInfo(new SoModelInfo());
+ request.getRequestDetails().setCloudConfiguration(new SoCloudConfiguration());
+ request.getRequestDetails().setRequestInfo(new SoRequestInfo());
+ request.getRequestDetails().setRequestParameters(new SoRequestParameters());
+ request.getRequestDetails().getRequestParameters().setUserParams(null);
+
+ request.getRequestDetails().getModelInfo().setModelType("vfModule");
+ request.getRequestDetails().getModelInfo().setModelInvariantId("a9c4a35a-de48-451a-9e4e-343f2ac52928");
+ request.getRequestDetails().getModelInfo().setModelVersionId("e0d98ad1-238d-4555-b439-023d3f9079f6");
+ request.getRequestDetails().getModelInfo().setModelName("0d9e0d9d352749f4B3cb..dnsscaling..module-0");
+ request.getRequestDetails().getModelInfo().setModelVersion("2.0");
+
+ request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("DFW");
+ request.getRequestDetails().getCloudConfiguration().setTenantId("1015548");
+
+ request.getRequestDetails().getRequestInfo().setInstanceName(
+ "Vfmodule_Ete_Name1eScaling63928f-ccdc-4b34-bdef-9bf64109026e");
+ request.getRequestDetails().getRequestInfo().setSource("POLICY");
+ request.getRequestDetails().getRequestInfo().setSuppressRollback(false);
+
+ SoRelatedInstanceListElement relatedInstanceListElement1 =
+ new SoRelatedInstanceListElement();
+ SoRelatedInstanceListElement relatedInstanceListElement2 =
+ new SoRelatedInstanceListElement();
+ relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance());
+ relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance());
+
+ String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6";
+ relatedInstanceListElement1.getRelatedInstance().setInstanceId(serviceInstanceId);
+ relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo());
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelInvariantId(
+ "24329a0c-1d57-4210-b1af-a65df64e9d59");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersionId(
+ "ac642881-8e7e-4217-bd64-16ad41c42e30");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("5116d67e-0b4f-46bf-a46f");
+ relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("2.0");
+
+ String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93";
+ relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfInstanceId);
+ relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo());
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId(
+ "09fd971e-db5f-475d-997c-cf6704b6b8fe");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersionId(
+ "152ed917-6dcc-46ee-bf8a-a775c5aa5a74");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName("9e4c31d2-4b25-4d9e-9fb4");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("2.0");
+ relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelCustomizationName(
+ "0d9e0d9d-3527-49f4-b3cb 2");
+
+ request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1);
+ request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2);
+
+ logger.debug(Serialization.gsonPretty.toJson(request));
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
new file mode 100644
index 000000000..caffef43d
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
@@ -0,0 +1,316 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.drools.core.WorkingMemory;
+import org.drools.core.WorkingMemoryEntryPoint;
+import org.drools.core.common.InternalFactHandle;
+import org.drools.core.impl.InternalKnowledgeBase;
+import org.drools.core.spi.AsyncExceptionHandler;
+import org.drools.core.spi.GlobalResolver;
+import org.kie.api.event.kiebase.KieBaseEventListener;
+import org.kie.api.event.rule.AgendaEventListener;
+import org.kie.api.event.rule.RuleRuntimeEventListener;
+import org.kie.api.runtime.Environment;
+import org.kie.api.runtime.ObjectFilter;
+import org.kie.api.runtime.process.ProcessInstance;
+import org.kie.api.runtime.process.WorkItemManager;
+import org.kie.api.runtime.rule.Agenda;
+import org.kie.api.runtime.rule.AgendaFilter;
+import org.kie.api.runtime.rule.FactHandle;
+import org.kie.api.runtime.rule.FactHandle.State;
+import org.kie.api.runtime.rule.QueryResults;
+import org.kie.api.time.SessionClock;
+
+public class DummyWorkingMemory implements WorkingMemory {
+
+ @Override
+ public void addEventListener(RuleRuntimeEventListener listener) {
+ }
+
+ @Override
+ public void addEventListener(AgendaEventListener listener) {
+ }
+
+ @Override
+ public void addEventListener(KieBaseEventListener listener) {
+ }
+
+ @Override
+ public void removeEventListener(RuleRuntimeEventListener listener) {
+ }
+
+ @Override
+ public void removeEventListener(AgendaEventListener listener) {
+ }
+
+ @Override
+ public void removeEventListener(KieBaseEventListener listener) {
+ }
+
+ @Override
+ public Collection<RuleRuntimeEventListener> getRuleRuntimeEventListeners() {
+ return null;
+ }
+
+ @Override
+ public Collection<AgendaEventListener> getAgendaEventListeners() {
+ return null;
+ }
+
+ @Override
+ public Collection<KieBaseEventListener> getKieBaseEventListeners() {
+ return null;
+ }
+
+ @Override
+ public FactHandle insert(Object object, boolean dynamic) {
+ return null;
+ }
+
+ @Override
+ public FactHandle insert(Object object) {
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public String getEntryPointId() {
+ return null;
+ }
+
+ @Override
+ public void retract(FactHandle handle) {
+ }
+
+ @Override
+ public void delete(FactHandle handle) {
+ }
+
+ @Override
+ public void delete(FactHandle handle, State fhState) {
+
+
+ }
+
+ @Override
+ public void update(FactHandle handle, Object object) {
+ }
+
+ @Override
+ public void update(FactHandle handle, Object object, String... modifiedProperties) {
+ }
+
+ @Override
+ public Collection<? extends Object> getObjects() {
+ return null;
+ }
+
+ @Override
+ public Collection<? extends Object> getObjects(ObjectFilter filter) {
+ return null;
+ }
+
+ @Override
+ public <T extends FactHandle> Collection<T> getFactHandles() {
+ return null;
+ }
+
+ @Override
+ public <T extends FactHandle> Collection<T> getFactHandles(ObjectFilter filter) {
+ return null;
+ }
+
+ @Override
+ public long getFactCount() {
+ return 0;
+ }
+
+ @Override
+ public Agenda getAgenda() {
+ return null;
+ }
+
+ @Override
+ public void setGlobal(String identifier, Object value) {
+ }
+
+ @Override
+ public Object getGlobal(String identifier) {
+ return null;
+ }
+
+ @Override
+ public Environment getEnvironment() {
+ return null;
+ }
+
+ @Override
+ public void setGlobalResolver(GlobalResolver globalResolver) {
+ }
+
+ @Override
+ public GlobalResolver getGlobalResolver() {
+ return null;
+ }
+
+ @Override
+ public InternalKnowledgeBase getKnowledgeBase() {
+ return null;
+ }
+
+ @Override
+ public int fireAllRules() {
+ return 0;
+ }
+
+ @Override
+ public int fireAllRules(AgendaFilter agendaFilter) {
+ return 0;
+ }
+
+ @Override
+ public int fireAllRules(int fireLimit) {
+ return 0;
+ }
+
+ @Override
+ public int fireAllRules(AgendaFilter agendaFilter, int fireLimit) {
+ return 0;
+ }
+
+ @Override
+ public Object getObject(FactHandle handle) {
+ return null;
+ }
+
+ @Override
+ public FactHandle getFactHandle(Object object) {
+ return null;
+ }
+
+ @Override
+ public FactHandle getFactHandleByIdentity(Object object) {
+ return null;
+ }
+
+ @Override
+ public Iterator<?> iterateObjects() {
+ return null;
+ }
+
+ @Override
+ public Iterator<?> iterateObjects(ObjectFilter filter) {
+ return null;
+ }
+
+ @Override
+ public Iterator<InternalFactHandle> iterateFactHandles() {
+ return null;
+ }
+
+ @Override
+ public Iterator<InternalFactHandle> iterateFactHandles(ObjectFilter filter) {
+ return null;
+ }
+
+ @Override
+ public void setFocus(String focus) {
+ }
+
+ @Override
+ public QueryResults getQueryResults(String query, Object... arguments) {
+ return null;
+ }
+
+ @Override
+ public void setAsyncExceptionHandler(AsyncExceptionHandler handler) {
+ }
+
+ @Override
+ public void clearAgenda() {
+ }
+
+ @Override
+ public void clearAgendaGroup(String group) {
+ }
+
+ @Override
+ public void clearActivationGroup(String group) {
+ }
+
+ @Override
+ public void clearRuleFlowGroup(String group) {
+ }
+
+ @Override
+ public ProcessInstance startProcess(String processId) {
+ return null;
+ }
+
+ @Override
+ public ProcessInstance startProcess(String processId, Map<String, Object> parameters) {
+ return null;
+ }
+
+ @Override
+ public Collection<ProcessInstance> getProcessInstances() {
+ return null;
+ }
+
+ @Override
+ public ProcessInstance getProcessInstance(long id) {
+ return null;
+ }
+
+ @Override
+ public ProcessInstance getProcessInstance(long id, boolean readOnly) {
+ return null;
+ }
+
+ @Override
+ public WorkItemManager getWorkItemManager() {
+ return null;
+ }
+
+ @Override
+ public void halt() {
+ }
+
+ @Override
+ public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String id) {
+ return null;
+ }
+
+ @Override
+ public SessionClock getSessionClock() {
+ return null;
+ }
+
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java
new file mode 100644
index 000000000..39aa2da6c
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.time.LocalDateTime;
+
+import org.junit.Test;
+
+public class SoAsyncRequestStatusTest {
+
+ @Test
+ public void testConstructor() {
+ SoAsyncRequestStatus obj = new SoAsyncRequestStatus();
+
+ assertTrue(obj.getCorrelator() == null);
+ assertTrue(obj.getFinishTime() == null);
+ assertTrue(obj.getInstanceReferences() == null);
+ assertTrue(obj.getRequestId() == null);
+ assertTrue(obj.getRequestScope() == null);
+ assertTrue(obj.getRequestStatus() == null);
+ assertTrue(obj.getStartTime() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoAsyncRequestStatus obj = new SoAsyncRequestStatus();
+
+ obj.setCorrelator("correlator");
+ assertEquals("correlator", obj.getCorrelator());
+
+ LocalDateTime finishTime = LocalDateTime.now();
+ obj.setFinishTime(finishTime);
+ assertEquals(finishTime, obj.getFinishTime());
+
+ SoInstanceReferences instanceReferences = new SoInstanceReferences();
+ obj.setInstanceReferences(instanceReferences);
+ assertEquals(instanceReferences, obj.getInstanceReferences());
+
+ obj.setRequestId("requestId");
+ assertEquals("requestId", obj.getRequestId());
+
+ obj.setRequestScope("requestScope");
+ assertEquals("requestScope", obj.getRequestScope());
+
+ SoRequestStatus requestStatus = new SoRequestStatus();
+ obj.setRequestStatus(requestStatus);
+ assertEquals(requestStatus, obj.getRequestStatus());
+
+ obj.setRequestType("requestType");
+ assertEquals("requestType", obj.getRequestType());
+
+ LocalDateTime startTime = LocalDateTime.now();
+ obj.setStartTime(startTime);
+ assertEquals(startTime, obj.getStartTime());
+
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java
new file mode 100644
index 000000000..b81643886
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoCloudConfigurationTest {
+
+ @Test
+ public void testConstructor() {
+ SoCloudConfiguration obj = new SoCloudConfiguration();
+
+ assertTrue(obj.getLcpCloudRegionId() == null);
+ assertTrue(obj.getTenantId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoCloudConfiguration obj = new SoCloudConfiguration();
+
+ obj.setLcpCloudRegionId("lcpCloudRegionId");
+ assertEquals("lcpCloudRegionId", obj.getLcpCloudRegionId());
+
+ obj.setTenantId("tenantId");
+ assertEquals("tenantId", obj.getTenantId());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java
new file mode 100644
index 000000000..910c0ac13
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java
@@ -0,0 +1,240 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (C) 2018-2019 AT&T. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import com.google.gson.Gson;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+@Path("/SO")
+public class SoDummyServerTest {
+
+ private static int postMessagesReceived = 0;
+ private static int putMessagesReceived = 0;
+ private static int statMessagesReceived = 0;
+ private static int getMessagesReceived = 0;
+ private static int deleteMessagesReceived = 0;
+
+ private static Map<String, SoResponse> ongoingRequestMap = new ConcurrentHashMap<>();
+
+ /**
+ * Stats method.
+ *
+ * @return response
+ */
+ @GET
+ @Path("/Stats")
+ public Response serviceGetStats() {
+ statMessagesReceived++;
+ return Response.status(200).entity("{\"GET\": " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
+ + ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived
+ + ",\"DELETE\": " + deleteMessagesReceived + "}").build();
+
+ }
+
+ /**
+ * Get stat type.
+ *
+ * @param statType the stat type
+ * @return http response
+ */
+ @GET
+ @Path("/OneStat/{statType}")
+ public Response serviceGetStat(@PathParam("statType") final String statType) {
+ statMessagesReceived++;
+ return Response.status(200).entity("{\"TYPE\": " + statType + "}").build();
+ }
+
+ /**
+ * Post to service instantiation.
+ *
+ * @param jsonString string to send
+ * @return http response
+ */
+ @POST
+ @Path("/serviceInstantiation/v7")
+ public Response servicePostRequest(final String jsonString) {
+ postMessagesReceived++;
+ return buildResponse(jsonString);
+ }
+
+ /**
+ * Post.
+ *
+ * @param serviceInstanceId service instance id
+ * @param vnfInstanceId vnf instance id
+ * @param jsonString json body
+ * @return http response
+ */
+ @POST
+ @Path("/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
+ public Response servicePostRequestVfModules(@PathParam("serviceInstanceId") final String serviceInstanceId,
+ @PathParam("vnfInstanceId") final String vnfInstanceId, final String jsonString) {
+ postMessagesReceived++;
+ return buildResponse(jsonString);
+ }
+
+ /**
+ * Get instance ID.
+ *
+ * @param nsInstanceId node instance id
+ * @return http response
+ */
+ @GET
+ @Path("/orchestrationRequests/v5/{nsInstanceId}")
+ public Response soRequestStatus(@PathParam("nsInstanceId") final String nsInstanceId) {
+
+ SoResponse response = ongoingRequestMap.get(nsInstanceId);
+
+ int iterationsLeft = Integer.valueOf(response.getRequest().getRequestScope());
+ if (--iterationsLeft > 0) {
+ response.getRequest().setRequestScope(new Integer(iterationsLeft).toString());
+ String responseString = new Gson().toJson(response, SoResponse.class);
+ return Response.status(response.getHttpResponseCode()).entity(responseString).build();
+ }
+
+ ongoingRequestMap.remove(nsInstanceId);
+
+ if ("ReturnBadAfterWait".equals(response.getRequest().getRequestType())) {
+ return Response.status(400).build();
+ }
+
+ response.getRequest().getRequestStatus().setRequestState("COMPLETE");
+ response.getRequest().setRequestScope("0");
+ response.setHttpResponseCode(200);
+ String responseString = new Gson().toJson(response, SoResponse.class);
+ return Response.status(response.getHttpResponseCode()).entity(responseString).build();
+ }
+
+ /**
+ * Delete.
+ *
+ * @param serviceInstanceId service instance id
+ * @param vnfInstanceId vnf instance id
+ * @param vfModuleInstanceId vf module instance id
+ * @param jsonString json body
+ * @return http response
+ */
+ @DELETE
+ @Path("/serviceInstances/v7/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleInstanceId}")
+ public Response serviceDeleteRequestVfModules(
+ @PathParam("serviceInstanceId") final String serviceInstanceId,
+ @PathParam("vnfInstanceId") final String vnfInstanceId,
+ @PathParam("vfModuleInstanceId") final String vfModuleInstanceId,
+ final String jsonString) {
+ deleteMessagesReceived++;
+ return buildResponse(jsonString);
+ }
+
+ private Response buildResponse(String jsonString) {
+ if (jsonString == null) {
+ return Response.status(400).build();
+ }
+
+ SoRequest request = null;
+ try {
+ request = new Gson().fromJson(jsonString, SoRequest.class);
+ } catch (Exception e) {
+ return Response.status(400).build();
+ }
+
+ if (request == null) {
+ return Response.status(400).build();
+ }
+
+ if (request.getRequestType() == null) {
+ return Response.status(400).build();
+ }
+
+ if ("ReturnBadJson".equals(request.getRequestType())) {
+ return Response.status(200)
+ .entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived
+ + ",\"POST\":" + " , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived
+ + ",\"DELETE\": " + deleteMessagesReceived + "}").build();
+ }
+
+ SoResponse response = new SoResponse();
+ response.setRequest(request);
+ response.setRequestReferences(new SoRequestReferences());
+ response.getRequestReferences().setRequestId(request.getRequestId().toString());
+
+ if ("ReturnCompleted".equals(request.getRequestType())) {
+ response.getRequest().getRequestStatus().setRequestState("COMPLETE");
+ response.setHttpResponseCode(200);
+ String responseString = new Gson().toJson(response, SoResponse.class);
+ return Response.status(response.getHttpResponseCode())
+ .entity(responseString)
+ .build();
+ }
+
+ if ("ReturnFailed".equals(request.getRequestType())) {
+ response.getRequest().getRequestStatus().setRequestState("FAILED");
+ response.setHttpResponseCode(200);
+ String responseString = new Gson().toJson(response, SoResponse.class);
+ return Response.status(response.getHttpResponseCode())
+ .entity(responseString)
+ .build();
+ }
+
+ if ("ReturnOnging202".equals(request.getRequestType())) {
+ ongoingRequestMap.put(request.getRequestId().toString(), response);
+
+ response.getRequest().getRequestStatus().setRequestState("ONGOING");
+ response.setHttpResponseCode(202);
+ String responseString = new Gson().toJson(response, SoResponse.class);
+ return Response.status(response.getHttpResponseCode())
+ .entity(responseString)
+ .build();
+ }
+
+ if ("ReturnOnging200".equals(request.getRequestType())) {
+ ongoingRequestMap.put(request.getRequestId().toString(), response);
+
+ response.getRequest().getRequestStatus().setRequestState("ONGOING");
+ response.setHttpResponseCode(200);
+ String responseString = new Gson().toJson(response, SoResponse.class);
+ return Response.status(response.getHttpResponseCode())
+ .entity(responseString)
+ .build();
+ }
+
+ if ("ReturnBadAfterWait".equals(request.getRequestType())) {
+ ongoingRequestMap.put(request.getRequestId().toString(), response);
+
+ response.getRequest().getRequestStatus().setRequestState("ONGOING");
+ response.setHttpResponseCode(200);
+ String responseString = new Gson().toJson(response, SoResponse.class);
+ return Response.status(response.getHttpResponseCode())
+ .entity(responseString)
+ .build();
+ }
+ return null;
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java
new file mode 100644
index 000000000..0b0aa5f03
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoInstanceReferencesTest {
+
+ @Test
+ public void testConstructor() {
+ SoInstanceReferences obj = new SoInstanceReferences();
+
+ assertTrue(obj.getInstanceId() == null);
+ assertTrue(obj.getRequestId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoInstanceReferences obj = new SoInstanceReferences();
+
+ obj.setInstanceId("instanceId");
+ assertEquals("instanceId", obj.getInstanceId());
+
+ obj.setRequestId("requestId");
+ assertEquals("requestId", obj.getRequestId());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java
new file mode 100644
index 000000000..85f5ac7f9
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java
@@ -0,0 +1,407 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * TestSOManager
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ *
+ * 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.onap.policy.so;
+
+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 static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.UUID;
+import java.util.concurrent.Future;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.drools.core.WorkingMemory;
+import org.glassfish.grizzly.http.server.HttpServer;
+import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.drools.system.PolicyEngine;
+
+public class SoManagerTest {
+ private static final String BASE_URI = "http://localhost:46553/TestSOManager";
+ private static final String BASE_SO_URI = BASE_URI + "/SO";
+ private static HttpServer server;
+
+ /**
+ * Set up test class.
+ */
+ @BeforeClass
+ public static void setUp() throws IOException {
+ final ResourceConfig rc = new ResourceConfig(SoDummyServerTest.class);
+ //Grizzly by default doesn't allow payload for HTTP methods (ex: DELETE), for which HTTP spec doesn't
+ // explicitly state that.
+ //allow it before starting the server
+ server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc, false);
+ server.getServerConfiguration().setAllowPayloadForUndefinedHttpMethods(true);
+ server.start();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ server.shutdown();
+ }
+
+ @Test
+ public void testGrizzlyServer() throws ClientProtocolException, IOException {
+ CloseableHttpClient httpclient = HttpClients.createDefault();
+ HttpGet httpGet = new HttpGet("http://localhost:46553/TestSOManager/SO/Stats");
+ CloseableHttpResponse response = httpclient.execute(httpGet);
+
+ String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8");
+ assertTrue(returnBody.matches("^\\{\"GET\": [0-9]*,\"STAT\": [0-9]*,\"POST\": [0-9]*,\"PUT\": [0-9]*,"
+ + "\"DELETE\": [0-9]*\\}$"));
+ }
+
+ @Test
+ public void testServiceInstantiation() throws IOException {
+ SoManager manager = new SoManager();
+ assertNotNull(manager);
+ manager.setRestGetTimeout(100);
+
+ SoResponse response = manager.createModuleInstance("http:/localhost:99999999", BASE_SO_URI, "sean",
+ "citizen", null);
+ assertNull(response);
+
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", null);
+ assertNull(response);
+
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", new SoRequest());
+ assertNull(response);
+
+ SoRequest request = new SoRequest();
+ request.setRequestId(UUID.randomUUID());
+ request.setRequestScope("Test");
+ request.setRequestType("ReturnBadJson");
+ request.setStartTime("2018-03-23 16:31");
+ request.setRequestStatus(new SoRequestStatus());
+ request.getRequestStatus().setRequestState("ONGOING");
+
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", request);
+ assertNull(response);
+
+ request.setRequestType("ReturnCompleted");
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", request);
+ assertNotNull(response);
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+
+ request.setRequestType("ReturnFailed");
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", request);
+ assertNotNull(response);
+ assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState());
+
+ // Use scope to set the number of iterations we'll wait for
+
+ request.setRequestType("ReturnOnging200");
+ request.setRequestScope(new Integer(10).toString());
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", request);
+ assertNotNull(response);
+ assertNotNull(response.getRequest());
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+
+ request.setRequestType("ReturnOnging202");
+ request.setRequestScope(new Integer(20).toString());
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", request);
+ assertNotNull(response);
+ assertNotNull(response.getRequest());
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+
+ // Test timeout after 20 attempts for a response
+ request.setRequestType("ReturnOnging202");
+ request.setRequestScope(new Integer(21).toString());
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", request);
+ assertNull(response);
+
+ // Test bad response after 3 attempts for a response
+ request.setRequestType("ReturnBadAfterWait");
+ request.setRequestScope(new Integer(3).toString());
+ response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean",
+ "citizen", request);
+ assertNull(response);
+ }
+
+ @Test
+ public void testVfModuleCreation() throws IOException {
+ SoManager manager = new SoManager();
+ assertNotNull(manager);
+ manager.setRestGetTimeout(100);
+
+ PolicyEngine.manager.setEnvironmentProperty("so.username", "sean");
+ PolicyEngine.manager.setEnvironmentProperty("so.password", "citizen");
+
+ WorkingMemory wm = new DummyWorkingMemory();
+
+ SoRequest soRequest = new SoRequest();
+ soRequest.setOperationType(SoOperationType.SCALE_OUT);
+ PolicyEngine.manager.setEnvironmentProperty("so.url", "http:/localhost:99999999");
+ Future<SoResponse> asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm,
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ PolicyEngine.manager.setEnvironmentProperty("so.url", BASE_SO_URI);
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), soRequest);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ SoRequest request = new SoRequest();
+ request.setRequestId(UUID.randomUUID());
+ request.setRequestScope("Test");
+ request.setRequestType("ReturnBadJson");
+ request.setStartTime("2018-03-23 16:31");
+ request.setRequestStatus(new SoRequestStatus());
+ request.getRequestStatus().setRequestState("ONGOING");
+ request.setOperationType(SoOperationType.SCALE_OUT);
+
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ request.setRequestType("ReturnCompleted");
+
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ request.setRequestType("ReturnFailed");
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ // Use scope to set the number of iterations we'll wait for
+
+ request.setRequestType("ReturnOnging200");
+ request.setRequestScope(new Integer(10).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertNotNull(response.getRequest());
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ request.setRequestType("ReturnOnging202");
+ request.setRequestScope(new Integer(20).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertNotNull(response.getRequest());
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ // Test timeout after 20 attempts for a response
+ request.setRequestType("ReturnOnging202");
+ request.setRequestScope(new Integer(21).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ // Test bad response after 3 attempts for a response
+ request.setRequestType("ReturnBadAfterWait");
+ request.setRequestScope(new Integer(3).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+ }
+
+ @Test
+ public void testVfModuleDeletion() {
+ SoManager manager = new SoManager();
+ assertNotNull(manager);
+ manager.setRestGetTimeout(100);
+
+ PolicyEngine.manager.setEnvironmentProperty("so.username", "sean");
+ PolicyEngine.manager.setEnvironmentProperty("so.password", "citizen");
+
+ WorkingMemory wm = new DummyWorkingMemory();
+
+ SoRequest soRequest = new SoRequest();
+ soRequest.setOperationType(SoOperationType.DELETE_VF_MODULE);
+ PolicyEngine.manager.setEnvironmentProperty("so.url", "http:/localhost:99999999");
+ Future<SoResponse> asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm,
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ PolicyEngine.manager.setEnvironmentProperty("so.url", BASE_SO_URI);
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ SoRequest request = new SoRequest();
+ request.setRequestId(UUID.randomUUID());
+ request.setRequestScope("Test");
+ request.setRequestType("ReturnBadJson");
+ request.setStartTime("2018-03-23 16:31");
+ request.setRequestStatus(new SoRequestStatus());
+ request.getRequestStatus().setRequestState("ONGOING");
+ request.setOperationType(SoOperationType.DELETE_VF_MODULE);
+
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ request.setRequestType("ReturnCompleted");
+
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ request.setRequestType("ReturnFailed");
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ // Use scope to set the number of iterations we'll wait for
+
+ request.setRequestType("ReturnOnging200");
+ request.setRequestScope(new Integer(10).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertNotNull(response.getRequest());
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ request.setRequestType("ReturnOnging202");
+ request.setRequestScope(new Integer(20).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertNotNull(response.getRequest());
+ assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ // Test timeout after 20 attempts for a response
+ request.setRequestType("ReturnOnging202");
+ request.setRequestScope(new Integer(21).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+
+ // Test bad response after 3 attempts for a response
+ request.setRequestType("ReturnBadAfterWait");
+ request.setRequestScope(new Integer(3).toString());
+ asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(),
+ UUID.randomUUID().toString(), UUID.randomUUID().toString(), request);
+ try {
+ SoResponse response = asyncRestCallFuture.get();
+ assertEquals(999, response.getHttpResponseCode());
+ } catch (Exception e) {
+ fail("test should not throw an exception");
+ }
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java
new file mode 100644
index 000000000..51dd5cdc1
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoModelInfoTest {
+
+ @Test
+ public void testConstructor() {
+ SoModelInfo obj = new SoModelInfo();
+
+ assertTrue(obj.getModelCustomizationId() == null);
+ assertTrue(obj.getModelCustomizationName() == null);
+ assertTrue(obj.getModelInvariantId() == null);
+ assertTrue(obj.getModelName() == null);
+ assertTrue(obj.getModelType() == null);
+ assertTrue(obj.getModelVersion() == null);
+ assertTrue(obj.getModelVersionId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoModelInfo obj = new SoModelInfo();
+
+ obj.setModelCustomizationId("modelCustomizationId");
+ assertEquals("modelCustomizationId", obj.getModelCustomizationId());
+
+ obj.setModelCustomizationName("modelCustomizationName");
+ assertEquals("modelCustomizationName", obj.getModelCustomizationName());
+
+ obj.setModelInvariantId("modelInvariantId");
+ assertEquals("modelInvariantId", obj.getModelInvariantId());
+
+ obj.setModelName("modelName");
+ assertEquals("modelName", obj.getModelName());
+
+ obj.setModelType("modelType");
+ assertEquals("modelType", obj.getModelType());
+
+ obj.setModelVersion("modelVersion");
+ assertEquals("modelVersion", obj.getModelVersion());
+
+ obj.setModelVersionId("modelVersionId");
+ assertEquals("modelVersionId", obj.getModelVersionId());
+
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java
new file mode 100644
index 000000000..e8899dd9d
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoPolicyExceptionHolderTest {
+
+ @Test
+ public void testConstructor() {
+ SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder();
+
+ assertTrue(obj.getMessageId() == null);
+ assertTrue(obj.getText() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder();
+
+ obj.setMessageId("messageId");
+ assertEquals("messageId", obj.getMessageId());
+
+ obj.setText("text");
+ assertEquals("text", obj.getText());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java
new file mode 100644
index 000000000..82b11e03a
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoRelatedInstanceListElementTest {
+
+ @Test
+ public void testConstructor() {
+ SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement();
+
+ assertTrue(obj.getRelatedInstance() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement();
+
+ SoRelatedInstance relatedInstance = new SoRelatedInstance();
+ obj.setRelatedInstance(relatedInstance);
+ assertEquals(relatedInstance, obj.getRelatedInstance());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java
new file mode 100644
index 000000000..019012f2e
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoRelatedInstanceTest {
+
+ @Test
+ public void testConstructor() {
+ SoRelatedInstance obj = new SoRelatedInstance();
+
+ assertTrue(obj.getInstanceId() == null);
+ assertTrue(obj.getInstanceName() == null);
+ assertTrue(obj.getModelInfo() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRelatedInstance obj = new SoRelatedInstance();
+
+ obj.setInstanceId("instanceId");
+ assertEquals("instanceId", obj.getInstanceId());
+
+ obj.setInstanceName("instanceName");
+ assertEquals("instanceName", obj.getInstanceName());
+
+ SoModelInfo modelInfo = new SoModelInfo();
+ obj.setModelInfo(modelInfo);
+ assertEquals(modelInfo, obj.getModelInfo());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
new file mode 100644
index 000000000..64f6ee594
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+public class SoRequestDetailsTest {
+
+ @Test
+ public void testConstructor() {
+ SoRequestDetails obj = new SoRequestDetails();
+
+ assertTrue(obj.getCloudConfiguration() == null);
+ assertTrue(obj.getModelInfo() == null);
+ assertTrue(obj.getRequestInfo() == null);
+ assertTrue(obj.getRequestParameters() == null);
+ assertTrue(obj.getSubscriberInfo() == null);
+
+ assertTrue(obj.getRelatedInstanceList() != null);
+ assertEquals(0, obj.getRelatedInstanceList().size());
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRequestDetails obj = new SoRequestDetails();
+
+ SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
+ obj.setCloudConfiguration(cloudConfiguration);
+ assertEquals(cloudConfiguration, obj.getCloudConfiguration());
+
+ SoModelInfo modelInfo = new SoModelInfo();
+ obj.setModelInfo(modelInfo);
+ assertEquals(modelInfo, obj.getModelInfo());
+
+ SoRequestInfo requestInfo = new SoRequestInfo();
+ obj.setRequestInfo(requestInfo);
+ assertEquals(requestInfo, obj.getRequestInfo());
+
+ SoRequestParameters requestParameters = new SoRequestParameters();
+ obj.setRequestParameters(requestParameters);
+ assertEquals(requestParameters, obj.getRequestParameters());
+
+ SoSubscriberInfo subscriberInfo = new SoSubscriberInfo();
+ obj.setSubscriberInfo(subscriberInfo);
+ assertEquals(subscriberInfo, obj.getSubscriberInfo());
+ }
+
+ @Test
+ public void testSoMRequestDetailsMethods() {
+ SoRequestDetails details = new SoRequestDetails();
+ assertNotNull(details);
+ assertNotEquals(0, details.hashCode());
+
+ SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
+ details.setCloudConfiguration(cloudConfiguration);
+ assertEquals(cloudConfiguration, details.getCloudConfiguration());
+ assertNotEquals(0, details.hashCode());
+
+ SoModelInfo modelInfo = new SoModelInfo();
+ details.setModelInfo(modelInfo);
+ assertEquals(modelInfo, details.getModelInfo());
+ assertNotEquals(0, details.hashCode());
+
+ List<SoRelatedInstanceListElement> relatedInstanceList = new ArrayList<>();
+ details.setRelatedInstanceList(relatedInstanceList);
+ assertEquals(relatedInstanceList, details.getRelatedInstanceList());
+ assertNotEquals(0, details.hashCode());
+
+ SoRequestInfo requestInfo = new SoRequestInfo();
+ details.setRequestInfo(requestInfo);
+ assertEquals(requestInfo, details.getRequestInfo());
+ assertNotEquals(0, details.hashCode());
+
+ SoRequestParameters requestParameters = new SoRequestParameters();
+ details.setRequestParameters(requestParameters);
+ assertEquals(requestParameters, details.getRequestParameters());
+ assertNotEquals(0, details.hashCode());
+
+ SoSubscriberInfo subscriberInfo = new SoSubscriberInfo();
+ details.setSubscriberInfo(subscriberInfo);
+ assertEquals(subscriberInfo, details.getSubscriberInfo());
+ assertNotEquals(0, details.hashCode());
+
+ assertEquals("SORequestDetails [modelInfo=org.onap.policy.so", details.toString().substring(0, 46));
+
+ SoRequestDetails copiedDetails = new SoRequestDetails(details);
+
+ assertTrue(details.equals(details));
+ assertTrue(details.equals(copiedDetails));
+ assertFalse(details.equals(null));
+ assertFalse(details.equals("Hello"));
+
+ details.setCloudConfiguration(null);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setCloudConfiguration(null);
+ assertTrue(details.equals(copiedDetails));
+ details.setCloudConfiguration(cloudConfiguration);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setCloudConfiguration(cloudConfiguration);
+ assertTrue(details.equals(copiedDetails));
+
+ details.setModelInfo(null);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setModelInfo(null);
+ assertTrue(details.equals(copiedDetails));
+ details.setModelInfo(modelInfo);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setModelInfo(modelInfo);
+ assertTrue(details.equals(copiedDetails));
+
+ details.setRequestInfo(null);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setRequestInfo(null);
+ assertTrue(details.equals(copiedDetails));
+ details.setRequestInfo(requestInfo);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setRequestInfo(requestInfo);
+ assertTrue(details.equals(copiedDetails));
+
+ details.setRequestParameters(null);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setRequestParameters(null);
+ assertTrue(details.equals(copiedDetails));
+ details.setRequestParameters(requestParameters);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setRequestParameters(requestParameters);
+ assertTrue(details.equals(copiedDetails));
+
+ details.setSubscriberInfo(null);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setSubscriberInfo(null);
+ assertTrue(details.equals(copiedDetails));
+ details.setSubscriberInfo(subscriberInfo);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setSubscriberInfo(subscriberInfo);
+ assertTrue(details.equals(copiedDetails));
+
+ details.setRelatedInstanceList(null);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setRelatedInstanceList(null);
+ assertTrue(details.equals(copiedDetails));
+ details.setRelatedInstanceList(relatedInstanceList);
+ assertFalse(details.equals(copiedDetails));
+ copiedDetails.setRelatedInstanceList(relatedInstanceList);
+ assertTrue(details.equals(copiedDetails));
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java
new file mode 100644
index 000000000..e0b819343
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoRequestErrorTest {
+
+ @Test
+ public void testConstructor() {
+ SoRequestError obj = new SoRequestError();
+
+ assertTrue(obj.getPolicyException() == null);
+ assertTrue(obj.getServiceException() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRequestError obj = new SoRequestError();
+
+ SoPolicyExceptionHolder policyException = new SoPolicyExceptionHolder();
+ obj.setPolicyException(policyException);
+ assertEquals(policyException, obj.getPolicyException());
+
+ SoServiceExceptionHolder serviceException = new SoServiceExceptionHolder();
+ obj.setServiceException(serviceException);
+ assertEquals(serviceException, obj.getServiceException());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java
new file mode 100644
index 000000000..2302696ee
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoRequestInfoTest {
+
+ @Test
+ public void testConstructor() {
+ SoRequestInfo obj = new SoRequestInfo();
+
+ assertTrue(obj.getBillingAccountNumber() == null);
+ assertTrue(obj.getCallbackUrl() == null);
+ assertTrue(obj.getCorrelator() == null);
+ assertTrue(obj.getInstanceName() == null);
+ assertTrue(obj.getOrderNumber() == null);
+ assertTrue(obj.getOrderVersion() == null);
+ assertTrue(obj.getProductFamilyId() == null);
+ assertTrue(obj.getRequestorId() == null);
+ assertTrue(obj.getSource() == null);
+ assertTrue(obj.isSuppressRollback() == false);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRequestInfo obj = new SoRequestInfo();
+
+ obj.setBillingAccountNumber("billingAccountNumber");
+ assertEquals("billingAccountNumber", obj.getBillingAccountNumber());
+
+ obj.setCallbackUrl("callbackUrl");
+ assertEquals("callbackUrl", obj.getCallbackUrl());
+
+ obj.setCorrelator("correlator");
+ assertEquals("correlator", obj.getCorrelator());
+
+ obj.setInstanceName("instanceName");
+ assertEquals("instanceName", obj.getInstanceName());
+
+ obj.setOrderNumber("orderNumber");
+ assertEquals("orderNumber", obj.getOrderNumber());
+
+ int orderVersion = 2008;
+ obj.setOrderVersion(orderVersion);
+ assertEquals((Integer) orderVersion, obj.getOrderVersion());
+
+ obj.setProductFamilyId("productFamilyId");
+ assertEquals("productFamilyId", obj.getProductFamilyId());
+
+ obj.setRequestorId("requestorId");
+ assertEquals("requestorId", obj.getRequestorId());
+
+ obj.setSource("source");
+ assertEquals("source", obj.getSource());
+
+ obj.setSuppressRollback(true);
+ assertEquals(true, obj.isSuppressRollback());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java
new file mode 100644
index 000000000..92638f906
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoRequestParametersTest {
+
+ @Test
+ public void testConstructor() {
+ SoRequestParameters obj = new SoRequestParameters();
+
+ assertTrue(obj.getSubscriptionServiceType() == null);
+ assertTrue(obj.getUserParams() != null);
+ assertEquals(0, obj.getUserParams().size());
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRequestParameters obj = new SoRequestParameters();
+
+ obj.setSubscriptionServiceType("subscriptionServiceType");
+ assertEquals("subscriptionServiceType", obj.getSubscriptionServiceType());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java
new file mode 100644
index 000000000..42481996a
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoRequestReferencesTest {
+
+ @Test
+ public void testConstructor() {
+ SoRequestReferences obj = new SoRequestReferences();
+
+ assertTrue(obj.getInstanceId() == null);
+ assertTrue(obj.getRequestId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRequestReferences obj = new SoRequestReferences();
+
+ obj.setInstanceId("instanceId");
+ assertEquals("instanceId", obj.getInstanceId());
+
+ obj.setRequestId("requestId");
+ assertEquals("requestId", obj.getRequestId());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java
new file mode 100644
index 000000000..b83cb00dc
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoRequestStatusTest {
+
+ @Test
+ public void testConstructor() {
+ SoRequestStatus obj = new SoRequestStatus();
+
+ assertEquals(0, obj.getPercentProgress());
+ assertTrue(obj.getRequestState() == null);
+ assertTrue(obj.getTimestamp() == null);
+ assertFalse(obj.isWasRolledBack());
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRequestStatus obj = new SoRequestStatus();
+
+ obj.setPercentProgress(2008);
+ assertEquals(2008, obj.getPercentProgress());
+
+ obj.setRequestState("requestState");
+ assertEquals("requestState", obj.getRequestState());
+
+ obj.setTimestamp("timestamp");
+ assertEquals("timestamp", obj.getTimestamp());
+
+ obj.setWasRolledBack(true);
+ assertTrue(obj.isWasRolledBack());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java
new file mode 100644
index 000000000..93b855bd8
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.time.LocalDateTime;
+import java.util.UUID;
+
+import org.junit.Test;
+
+public class SoRequestTest {
+
+ @Test
+ public void testConstructor() {
+ SoRequest obj = new SoRequest();
+
+ assertTrue(obj.getFinishTime() == null);
+ assertTrue(obj.getRequestDetails() == null);
+ assertTrue(obj.getRequestId() == null);
+ assertTrue(obj.getRequestScope() == null);
+ assertTrue(obj.getRequestStatus() == null);
+ assertTrue(obj.getRequestType() == null);
+ assertTrue(obj.getStartTime() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoRequest obj = new SoRequest();
+
+ LocalDateTime finishTime = LocalDateTime.now();
+ obj.setFinishTime(finishTime);
+ assertEquals(finishTime, obj.getFinishTime());
+
+ UUID uuid = UUID.randomUUID();
+ obj.setRequestId(uuid);
+ assertEquals(uuid, obj.getRequestId());
+
+ obj.setRequestScope("requestScope");
+ assertEquals("requestScope", obj.getRequestScope());
+
+ SoRequestStatus requestStatus = new SoRequestStatus();
+ obj.setRequestStatus(requestStatus);
+ assertEquals(requestStatus, obj.getRequestStatus());
+
+ obj.setRequestType("requestType");
+ assertEquals("requestType", obj.getRequestType());
+
+ obj.setOperationType(SoOperationType.DELETE_VF_MODULE);
+ assertEquals(SoOperationType.DELETE_VF_MODULE, obj.getOperationType());
+
+ LocalDateTime startTime = LocalDateTime.now();
+ obj.setStartTime(startTime.toString());
+ assertEquals(startTime.toString(), obj.getStartTime());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java
new file mode 100644
index 000000000..eb1b0ef6d
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoResponseTest {
+
+ @Test
+ public void testConstructor() {
+ SoResponse obj = new SoResponse();
+
+ assertEquals(0, obj.getHttpResponseCode());
+ assertTrue(obj.getRequest() == null);
+ assertTrue(obj.getRequestError() == null);
+ assertTrue(obj.getRequestReferences() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoResponse obj = new SoResponse();
+
+ obj.setHttpResponseCode(2008);
+ assertEquals(2008, obj.getHttpResponseCode());
+
+ SoRequest request = new SoRequest();
+ obj.setRequest(request);
+ assertEquals(request, obj.getRequest());
+
+ SoRequestError requestError = new SoRequestError();
+ obj.setRequestError(requestError);
+ assertEquals(requestError, obj.getRequestError());
+
+ SoRequestReferences requestReferences = new SoRequestReferences();
+ obj.setRequestReferences(requestReferences);
+ assertEquals(requestReferences, obj.getRequestReferences());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
new file mode 100644
index 000000000..deedc79c5
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.UUID;
+
+import org.junit.Test;
+
+public class SoResponseWrapperTest {
+
+ @Test
+ public void testConstructor() {
+ SoResponse response = new SoResponse();
+ SoResponseWrapper obj = new SoResponseWrapper(response, "reqID");
+
+ assertEquals(response, obj.getSoResponse());
+ assertEquals("reqID", obj.getRequestId());
+ }
+
+ @Test
+ public void testSetGet() {
+ SoResponse response = new SoResponse();
+ SoResponseWrapper obj = new SoResponseWrapper(response, "reqID");
+
+ SoResponse response2 = new SoResponse();
+ response2.setHttpResponseCode(2008);
+ obj.setSoResponse(response2);
+ assertEquals(response2, obj.getSoResponse());
+
+ obj.setRequestId("id2");
+ assertEquals("id2", obj.getRequestId());
+ }
+
+ @Test
+ public void testSoResponseWrapperMethods() {
+ String requestId = UUID.randomUUID().toString();
+ SoResponse response = new SoResponse();
+
+ SoResponseWrapper responseWrapper = new SoResponseWrapper(response, requestId);
+ assertNotNull(responseWrapper);
+ assertNotEquals(0, responseWrapper.hashCode());
+
+ assertEquals(response, responseWrapper.getSoResponse());
+
+ assertNotEquals(0, responseWrapper.hashCode());
+
+ assertEquals("SOResponseWrapper [SOResponse=org.onap.policy.", responseWrapper.toString().substring(0, 46));
+
+ SoResponseWrapper identicalResponseWrapper = new SoResponseWrapper(response, requestId);
+
+ assertEquals(responseWrapper, responseWrapper);
+ assertEquals(responseWrapper, identicalResponseWrapper);
+ assertNotEquals(null, responseWrapper);
+ assertNotEquals("Hello", responseWrapper);
+ assertFalse(responseWrapper.equals(null));
+ assertFalse(responseWrapper.equals("AString"));
+
+ assertEquals(new SoResponseWrapper(null, null), new SoResponseWrapper(null, null));
+ assertNotEquals(new SoResponseWrapper(null, null), identicalResponseWrapper);
+
+ assertNotEquals(0, new SoResponseWrapper(null, null).hashCode());
+
+ identicalResponseWrapper.setSoResponse(new SoResponse());
+ assertNotEquals(responseWrapper, identicalResponseWrapper);
+ identicalResponseWrapper.setSoResponse(response);
+ assertEquals(responseWrapper, identicalResponseWrapper);
+
+ identicalResponseWrapper.setRequestId(UUID.randomUUID().toString());
+ assertNotEquals(responseWrapper, identicalResponseWrapper);
+ identicalResponseWrapper.setRequestId(requestId);
+ assertEquals(responseWrapper, identicalResponseWrapper);
+
+ responseWrapper.setRequestId(null);
+ assertNotEquals(responseWrapper, identicalResponseWrapper);
+ identicalResponseWrapper.setRequestId(null);
+ assertEquals(responseWrapper, identicalResponseWrapper);
+ responseWrapper.setRequestId(requestId);
+ assertNotEquals(responseWrapper, identicalResponseWrapper);
+ identicalResponseWrapper.setRequestId(requestId);
+ assertEquals(responseWrapper, identicalResponseWrapper);
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java
new file mode 100644
index 000000000..b5f31e595
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoServiceExceptionHolderTest {
+
+ @Test
+ public void testConstructor() {
+ SoServiceExceptionHolder obj = new SoServiceExceptionHolder();
+
+ assertTrue(obj.getMessageId() == null);
+ assertTrue(obj.getText() == null);
+ assertTrue(obj.getVariables() != null);
+ assertEquals(0, obj.getVariables().size());
+ }
+
+ @Test
+ public void testSetGet() {
+ SoServiceExceptionHolder obj = new SoServiceExceptionHolder();
+
+ obj.setMessageId("messageId");
+ assertEquals("messageId", obj.getMessageId());
+
+ obj.setText("text");
+ assertEquals("text", obj.getText());
+ }
+}
diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java
new file mode 100644
index 000000000..4d5bc7504
--- /dev/null
+++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class SoSubscriberInfoTest {
+
+ @Test
+ public void testConstructor() {
+ SoSubscriberInfo obj = new SoSubscriberInfo();
+
+ assertTrue(obj.getGlobalSubscriberId() == null);
+ assertTrue(obj.getSubscriberCommonSiteId() == null);
+ assertTrue(obj.getSubscriberName() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SoSubscriberInfo obj = new SoSubscriberInfo();
+
+ obj.setGlobalSubscriberId("globalSubscriberId");
+ assertEquals("globalSubscriberId", obj.getGlobalSubscriberId());
+
+ obj.setSubscriberCommonSiteId("subscriberCommonSiteId");
+ assertEquals("subscriberCommonSiteId", obj.getSubscriberCommonSiteId());
+
+ obj.setSubscriberName("subscriberName");
+ assertEquals("subscriberName", obj.getSubscriberName());
+ }
+}