aboutsummaryrefslogtreecommitdiffstats
path: root/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2019-08-08 15:57:14 +0000
committerWaqas Ikram <waqas.ikram@est.tech>2019-08-08 15:57:30 +0000
commitc44a753af3693cc67de62f8fea2c93cf17c070dc (patch)
tree355bf85f70c168633c6437c70346266208ed0b85 /plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src
parent1b878eb83fa02ce13c3391ba2ccdaba42111e667 (diff)
Adding correct user in aai simulator
Plus Fixing belows issues - NullpointerException in aai simulator - Service Type update in catalogdb - OutputRequest format in sdnc simulator Change-Id: I87c8b814e93cf9bc83b62e90b868c603a15a5560 Issue-ID: SO-1953 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src')
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java7
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java153
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java124
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java4
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java8
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java16
6 files changed, 186 insertions, 126 deletions
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java
index 03fbe7ef..00740298 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java
@@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MediaType;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.so.sdncsimulator.models.InputRequest;
+import org.onap.so.sdncsimulator.models.Output;
import org.onap.so.sdncsimulator.models.OutputRequest;
import org.onap.so.sdncsimulator.providers.ServiceOperationsCacheServiceProvider;
import org.slf4j.Logger;
@@ -66,10 +67,10 @@ public class OperationsController {
return ResponseEntity.badRequest().build();
}
- final OutputRequest outputRequest =
- cacheServiceProvider.putServiceOperationInformation(apiServiceOperationInformation);
+ final Output output = cacheServiceProvider.putServiceOperationInformation(apiServiceOperationInformation);
+ final OutputRequest outputRequest = new OutputRequest(output);
- if (outputRequest.getResponseCode().equals(HttpStatus.OK.toString())) {
+ if (output.getResponseCode().equals(HttpStatus.OK.toString())) {
return ResponseEntity.ok(outputRequest);
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java
new file mode 100644
index 00000000..554989db
--- /dev/null
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.sdncsimulator.models;
+
+import org.onap.sdnc.northbound.client.model.GenericResourceApiInstanceReference;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class Output {
+
+ @JsonProperty("response-message")
+ private String responseMessage;
+
+ @JsonProperty("ack-final-indicator")
+ private String ackFinalIndicator;
+
+ @JsonProperty("svc-request-id")
+ private String svcRequestId;
+
+ @JsonProperty("response-code")
+ private String responseCode;
+
+ @JsonProperty("service-response-information")
+ private GenericResourceApiInstanceReference serviceResponseInformation = null;
+
+ /**
+ * @return the responseMessage
+ */
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ /**
+ * @param responseMessage the responseMessage to set
+ */
+ public void setResponseMessage(final String responseMessage) {
+ this.responseMessage = responseMessage;
+ }
+
+ /**
+ * @return the ackFinalIndicator
+ */
+ public String getAckFinalIndicator() {
+ return ackFinalIndicator;
+ }
+
+ /**
+ * @param ackFinalIndicator the ackFinalIndicator to set
+ */
+ public void setAckFinalIndicator(final String ackFinalIndicator) {
+ this.ackFinalIndicator = ackFinalIndicator;
+ }
+
+ /**
+ * @return the svcRequestId
+ */
+ public String getSvcRequestId() {
+ return svcRequestId;
+ }
+
+ /**
+ * @param svcRequestId the svcRequestId to set
+ */
+ public void setSvcRequestId(final String svcRequestId) {
+ this.svcRequestId = svcRequestId;
+ }
+
+ /**
+ * @return the responseCode
+ */
+ public String getResponseCode() {
+ return responseCode;
+ }
+
+ /**
+ * @param responseCode the responseCode to set
+ */
+ public void setResponseCode(final String responseCode) {
+ this.responseCode = responseCode;
+ }
+
+ /**
+ * @return the serviceResponseInformation
+ */
+ public GenericResourceApiInstanceReference getServiceResponseInformation() {
+ return serviceResponseInformation;
+ }
+
+ /**
+ * @param serviceResponseInformation the serviceResponseInformation to set
+ */
+ public void setServiceResponseInformation(final GenericResourceApiInstanceReference serviceResponseInformation) {
+ this.serviceResponseInformation = serviceResponseInformation;
+ }
+
+ public Output responseMessage(final String responseMessage) {
+ this.responseMessage = responseMessage;
+ return this;
+ }
+
+ public Output ackFinalIndicator(final String ackFinalIndicator) {
+ this.ackFinalIndicator = ackFinalIndicator;
+ return this;
+ }
+
+ public Output svcRequestId(final String svcRequestId) {
+ this.svcRequestId = svcRequestId;
+ return this;
+ }
+
+ public Output responseCode(final String responseCode) {
+ this.responseCode = responseCode;
+ return this;
+ }
+
+ public Output serviceResponseInformation(final GenericResourceApiInstanceReference serviceResponseInformation) {
+ this.serviceResponseInformation = serviceResponseInformation;
+ return this;
+ }
+
+
+ @JsonIgnore
+ @Override
+ public String toString() {
+ return "OutputRequest [responseMessage=" + responseMessage + ", ackFinalIndicator=" + ackFinalIndicator
+ + ", svcRequestId=" + svcRequestId + ", responseCode=" + responseCode + ", serviceResponseInformation="
+ + serviceResponseInformation + "]";
+ }
+
+
+
+}
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java
index 75395235..97d20568 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/OutputRequest.java
@@ -19,137 +19,35 @@
*/
package org.onap.so.sdncsimulator.models;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiInstanceReference;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
*
*/
-@JsonRootName("output")
-public class OutputRequest {
-
- @JsonProperty("response-message")
- private String responseMessage;
-
- @JsonProperty("ack-final-indicator")
- private String ackFinalIndicator;
-
- @JsonProperty("svc-request-id")
- private String svcRequestId;
-
- @JsonProperty("response-code")
- private String responseCode;
-
- @JsonProperty("service-response-information")
- private GenericResourceApiInstanceReference serviceResponseInformation = null;
-
- /**
- * @return the responseMessage
- */
- public String getResponseMessage() {
- return responseMessage;
- }
-
- /**
- * @param responseMessage the responseMessage to set
- */
- public void setResponseMessage(final String responseMessage) {
- this.responseMessage = responseMessage;
- }
-
- /**
- * @return the ackFinalIndicator
- */
- public String getAckFinalIndicator() {
- return ackFinalIndicator;
- }
-
- /**
- * @param ackFinalIndicator the ackFinalIndicator to set
- */
- public void setAckFinalIndicator(final String ackFinalIndicator) {
- this.ackFinalIndicator = ackFinalIndicator;
- }
-
- /**
- * @return the svcRequestId
- */
- public String getSvcRequestId() {
- return svcRequestId;
- }
-
- /**
- * @param svcRequestId the svcRequestId to set
- */
- public void setSvcRequestId(final String svcRequestId) {
- this.svcRequestId = svcRequestId;
- }
-
- /**
- * @return the responseCode
- */
- public String getResponseCode() {
- return responseCode;
- }
-
- /**
- * @param responseCode the responseCode to set
- */
- public void setResponseCode(final String responseCode) {
- this.responseCode = responseCode;
- }
- /**
- * @return the serviceResponseInformation
- */
- public GenericResourceApiInstanceReference getServiceResponseInformation() {
- return serviceResponseInformation;
- }
+public class OutputRequest {
+ @JsonProperty("output")
+ private Output output;
- /**
- * @param serviceResponseInformation the serviceResponseInformation to set
- */
- public void setServiceResponseInformation(final GenericResourceApiInstanceReference serviceResponseInformation) {
- this.serviceResponseInformation = serviceResponseInformation;
- }
+ public OutputRequest() {}
- public OutputRequest responseMessage(final String responseMessage) {
- this.responseMessage = responseMessage;
- return this;
+ public OutputRequest(final Output output) {
+ this.output = output;
}
- public OutputRequest ackFinalIndicator(final String ackFinalIndicator) {
- this.ackFinalIndicator = ackFinalIndicator;
- return this;
- }
- public OutputRequest svcRequestId(final String svcRequestId) {
- this.svcRequestId = svcRequestId;
- return this;
+ public Output getOutput() {
+ return output;
}
- public OutputRequest responseCode(final String responseCode) {
- this.responseCode = responseCode;
- return this;
+ public void setOutput(final Output output) {
+ this.output = output;
}
- public OutputRequest serviceResponseInformation(
- final GenericResourceApiInstanceReference serviceResponseInformation) {
- this.serviceResponseInformation = serviceResponseInformation;
- return this;
- }
-
-
- @JsonIgnore
@Override
public String toString() {
- return "OutputRequest [responseMessage=" + responseMessage + ", ackFinalIndicator=" + ackFinalIndicator
- + ", svcRequestId=" + svcRequestId + ", responseCode=" + responseCode + ", serviceResponseInformation="
- + serviceResponseInformation + "]";
+ return "OutputRequest [output=" + output + "]";
}
-
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java
index 5194d499..a0116c48 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java
@@ -22,7 +22,7 @@ package org.onap.so.sdncsimulator.providers;
import java.util.Optional;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceModelInfrastructure;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
-import org.onap.so.sdncsimulator.models.OutputRequest;
+import org.onap.so.sdncsimulator.models.Output;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
@@ -30,7 +30,7 @@ import org.onap.so.sdncsimulator.models.OutputRequest;
*/
public interface ServiceOperationsCacheServiceProvider {
- OutputRequest putServiceOperationInformation(
+ Output putServiceOperationInformation(
final GenericResourceApiServiceOperationInformation apiServiceOperationInformation);
Optional<GenericResourceApiServiceModelInfrastructure> getGenericResourceApiServiceModelInfrastructure(
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java
index 37773e1f..620742ab 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java
@@ -46,7 +46,7 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiServicemodelinfra
import org.onap.sdnc.northbound.client.model.GenericResourceApiServicestatusServiceStatus;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServicetopologyServiceTopology;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServicetopologyidentifierServiceTopologyIdentifier;
-import org.onap.so.sdncsimulator.models.OutputRequest;
+import org.onap.so.sdncsimulator.models.Output;
import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,7 +73,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ
}
@Override
- public OutputRequest putServiceOperationInformation(final GenericResourceApiServiceOperationInformation input) {
+ public Output putServiceOperationInformation(final GenericResourceApiServiceOperationInformation input) {
final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = input.getSdncRequestHeader();
final String svcRequestId = requestHeader != null ? requestHeader.getSvcRequestId() : null;
@@ -94,13 +94,13 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ
final GenericResourceApiServicestatusServiceStatus serviceStatus = service.getServiceStatus();
- return new OutputRequest().ackFinalIndicator(serviceStatus.getFinalIndicator())
+ return new Output().ackFinalIndicator(serviceStatus.getFinalIndicator())
.responseCode(serviceStatus.getResponseCode()).responseMessage(serviceStatus.getResponseMessage())
.svcRequestId(svcRequestId).serviceResponseInformation(new GenericResourceApiInstanceReference()
.instanceId(serviceInstanceId).objectPath(RESTCONF_CONFIG_END_POINT + serviceInstanceId));
}
- return new OutputRequest().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString())
+ return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString())
.responseMessage("Service instance not found").svcRequestId(svcRequestId);
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java
index bcfff95e..af46ab40 100644
--- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java
@@ -32,6 +32,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.sdnc.northbound.client.model.GenericResourceApiInstanceReference;
import org.onap.so.sdncsimulator.models.InputRequest;
+import org.onap.so.sdncsimulator.models.Output;
import org.onap.so.sdncsimulator.models.OutputRequest;
import org.onap.so.sdncsimulator.providers.ServiceOperationsCacheServiceProvider;
import org.onap.so.sdncsimulator.utils.Constants;
@@ -92,9 +93,13 @@ public class OperationsControllerTest {
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
assertTrue(responseEntity.hasBody());
- final OutputRequest actualObject = responseEntity.getBody();
- assertNotNull(actualObject);
+ final OutputRequest actualOutputRequest = responseEntity.getBody();
+ assertNotNull(actualOutputRequest);
+
+ final Output actualObject = actualOutputRequest.getOutput();
+
+ assertNotNull(actualObject);
assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode());
assertEquals(Constants.YES, actualObject.getAckFinalIndicator());
assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId());
@@ -126,8 +131,12 @@ public class OperationsControllerTest {
assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode());
assertTrue(responseEntity.hasBody());
- final OutputRequest actualObject = responseEntity.getBody();
+ final OutputRequest actualOutputRequest = responseEntity.getBody();
+ assertNotNull(actualOutputRequest);
+
+ final Output actualObject = actualOutputRequest.getOutput();
+ assertNotNull(actualObject);
assertEquals(HttpStatus.BAD_REQUEST.toString(), actualObject.getResponseCode());
assertEquals(SVC_REQUEST_ID, actualObject.getSvcRequestId());
assertEquals(Constants.YES, actualObject.getAckFinalIndicator());
@@ -138,7 +147,6 @@ public class OperationsControllerTest {
return getHttpHeaders(userCredentials.getUsers().iterator().next().getUsername());
}
-
private String getUrl() {
return "http://localhost:" + port + Constants.OPERATIONS_URL + SERVICE_TOPOLOGY_OPERATION_URL;
}