From 645f53bc65ca649d0ffbdea31d720a371f20811a Mon Sep 17 00:00:00 2001 From: Hengye Date: Fri, 29 Mar 2019 15:07:38 +0000 Subject: fix code smell in model-impl Issue-ID: POLICY-1264 Change-Id: Idacb7151978373e48098790d9d86825410b65aa6 Signed-off-by: Hengye --- .../java/org/onap/policy/appc/CommonHeader.java | 6 +- .../main/java/org/onap/policy/appc/Request.java | 4 +- .../main/java/org/onap/policy/appc/Response.java | 8 +- .../org/onap/policy/appclcm/LcmCommonHeader.java | 30 +-- .../java/org/onap/policy/appclcm/LcmRequest.java | 18 +- .../java/org/onap/policy/appclcm/LcmWrapper.java | 24 +-- .../policy/controlloop/ControlLoopOperation.java | 6 +- .../main/java/org/onap/policy/sdc/Resource.java | 28 +-- .../java/org/onap/policy/sdc/ResourceInstance.java | 29 +-- .../src/main/java/org/onap/policy/sdc/Service.java | 34 +-- .../java/org/onap/policy/sdc/ServiceInstance.java | 39 ++-- .../org/onap/policy/sdnc/SdncResponseOutput.java | 1 - .../java/org/onap/policy/sdnr/PciCommonHeader.java | 32 +-- .../main/java/org/onap/policy/sdnr/PciWrapper.java | 41 ++-- .../java/org/onap/policy/so/SoRequestDetails.java | 8 +- .../java/org/onap/policy/so/SoDummyServer.java | 240 +++++++++++++++++++++ .../java/org/onap/policy/so/SoDummyServerTest.java | 240 --------------------- .../java/org/onap/policy/so/SoManagerTest.java | 2 +- .../policy/vnf/trafficgenerator/PgStreams.java | 4 +- 19 files changed, 395 insertions(+), 399 deletions(-) create mode 100644 models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServer.java delete mode 100644 models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java (limited to 'models-interactions/model-impl') diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java index 964af37d2..a3859b4ae 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java @@ -8,9 +8,9 @@ * 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. @@ -58,7 +58,7 @@ public class CommonHeader implements Serializable { /** * Construct an instance from an existing instance. - * + * * @param commonHeader the existing instance */ public CommonHeader(CommonHeader commonHeader) { diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java index 7f1574624..a9ad6d8da 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java index f24c84045..d5fc66e5d 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java @@ -8,9 +8,9 @@ * 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. @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.Map; public class Response implements Serializable { + private static final long serialVersionUID = 434953706339865151L; @SerializedName("CommonHeader") @@ -45,7 +46,7 @@ public class Response implements Serializable { /** * Construct an instance from an existing instance. - * + * * @param request the existing instance */ public Response(Request request) { @@ -133,5 +134,4 @@ public class Response implements Serializable { } - } diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java index c8126275a..a2717f49c 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java @@ -8,9 +8,9 @@ * 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. @@ -57,7 +57,7 @@ public class LcmCommonHeader implements Serializable { /** * Used to copy a common header. - * + * * @param commonHeader a header that is defined by the lcm api guide that contains information * about the request (requestId, flags, etc.) */ @@ -72,7 +72,7 @@ public class LcmCommonHeader implements Serializable { /** * Get the timestamp. - * + * * @return the timeStamp */ public Instant getTimeStamp() { @@ -81,7 +81,7 @@ public class LcmCommonHeader implements Serializable { /** * Set the timestamp. - * + * * @param timeStamp the timeStamp to set */ public void setTimeStamp(Instant timeStamp) { @@ -90,7 +90,7 @@ public class LcmCommonHeader implements Serializable { /** * Get the API version. - * + * * @return the apiVer */ public String getApiVer() { @@ -99,7 +99,7 @@ public class LcmCommonHeader implements Serializable { /** * Set the API version. - * + * * @param apiVer the apiVer to set */ public void setApiVer(String apiVer) { @@ -108,7 +108,7 @@ public class LcmCommonHeader implements Serializable { /** * Get the originator Id. - * + * * @return the originatorId */ public String getOriginatorId() { @@ -117,7 +117,7 @@ public class LcmCommonHeader implements Serializable { /** * Set the originator Id. - * + * * @param originatorId the originatorId to set */ public void setOriginatorId(String originatorId) { @@ -126,7 +126,7 @@ public class LcmCommonHeader implements Serializable { /** * Get the request Id. - * + * * @return the requestId */ public UUID getRequestId() { @@ -135,7 +135,7 @@ public class LcmCommonHeader implements Serializable { /** * Set the request Id. - * + * * @param requestId the requestId to set */ public void setRequestId(UUID requestId) { @@ -144,7 +144,7 @@ public class LcmCommonHeader implements Serializable { /** * Get the sub request Id. - * + * * @return the subRequestId */ public String getSubRequestId() { @@ -153,7 +153,7 @@ public class LcmCommonHeader implements Serializable { /** * Set the sub request Id. - * + * * @param subRequestId the subRequestId to set */ public void setSubRequestId(String subRequestId) { @@ -162,7 +162,7 @@ public class LcmCommonHeader implements Serializable { /** * Get the flags. - * + * * @return the flags */ public Map getFlags() { @@ -171,7 +171,7 @@ public class LcmCommonHeader implements Serializable { /** * Set the flags. - * + * * @param flags the flags to set */ public void setFlags(Map flags) { diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java index 3e8f71743..0ea6e9c7f 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java @@ -8,9 +8,9 @@ * 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. @@ -52,7 +52,7 @@ public class LcmRequest implements Serializable { /** * Get the action. - * + * * @return the action */ public String getAction() { @@ -61,7 +61,7 @@ public class LcmRequest implements Serializable { /** * Set the action. - * + * * @param action the action to set */ public void setAction(String action) { @@ -70,7 +70,7 @@ public class LcmRequest implements Serializable { /** * Get the action identifiers. - * + * * @return the actionIdentifiers */ public Map getActionIdentifiers() { @@ -79,7 +79,7 @@ public class LcmRequest implements Serializable { /** * Set the action identifiers. - * + * * @param actionIdentifiers the actionIdentifiers to set */ public void setActionIdentifiers(Map actionIdentifiers) { @@ -88,7 +88,7 @@ public class LcmRequest implements Serializable { /** * Get the payload. - * + * * @return the payload */ public String getPayload() { @@ -97,7 +97,7 @@ public class LcmRequest implements Serializable { /** * Set the payload. - * + * * @param payload the payload to set */ public void setPayload(String payload) { @@ -106,7 +106,7 @@ public class LcmRequest implements Serializable { /** * Get the common header. - * + * * @param commonHeader the commonHeader to set */ public void setCommonHeader(LcmCommonHeader commonHeader) { diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java index 244c6abb4..f9a8d5589 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java @@ -8,9 +8,9 @@ * 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. @@ -50,7 +50,7 @@ public class LcmWrapper implements Serializable { /** * Get the version. - * + * * @return the version */ public String getVersion() { @@ -59,7 +59,7 @@ public class LcmWrapper implements Serializable { /** * Set the version. - * + * * @param version the version to set */ public void setVersion(String version) { @@ -68,7 +68,7 @@ public class LcmWrapper implements Serializable { /** * Get the cambria partition. - * + * * @return the cambriaPartition */ public String getCambriaPartition() { @@ -77,7 +77,7 @@ public class LcmWrapper implements Serializable { /** * Set the cambria partition. - * + * * @param cambriaPartition the cambriaPartition to set */ public void setCambriaPartition(String cambriaPartition) { @@ -86,7 +86,7 @@ public class LcmWrapper implements Serializable { /** * Get the RPN name. - * + * * @return the rpcName */ public String getRpcName() { @@ -95,7 +95,7 @@ public class LcmWrapper implements Serializable { /** * Set the RPC name. - * + * * @param rpcName the rpcName to set */ public void setRpcName(String rpcName) { @@ -104,7 +104,7 @@ public class LcmWrapper implements Serializable { /** * Get the correlation Id. - * + * * @return the correlationId */ public String getCorrelationId() { @@ -113,7 +113,7 @@ public class LcmWrapper implements Serializable { /** * Set the correclation Id. - * + * * @param correlationId the correlationId to set */ public void setCorrelationId(String correlationId) { @@ -122,7 +122,7 @@ public class LcmWrapper implements Serializable { /** * Get the type. - * + * * @return the type */ public String getType() { @@ -131,7 +131,7 @@ public class LcmWrapper implements Serializable { /** * Set the type. - * + * * @param type the type to set */ public void setType(String type) { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java index 8fd4148ef..85bf95a9f 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java @@ -8,9 +8,9 @@ * 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. @@ -43,7 +43,7 @@ public class ControlLoopOperation implements Serializable { /** * Construct an instance from an existing instance. - * + * * @param op the existing instance */ public ControlLoopOperation(ControlLoopOperation op) { diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java index 9b73446b6..8bdf9d3d4 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java @@ -8,9 +8,9 @@ * 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. @@ -27,20 +27,20 @@ import java.util.UUID; public class Resource implements Serializable { private static final long serialVersionUID = -913729158733348027L; - + private UUID resourceUuid; private UUID resourceInvariantUuid; private String resourceName; private String resourceVersion; private ResourceType resourceType; - + public Resource() { //Empty Constructor } - + /** * Constructor. - * + * * @param resource copy object */ public Resource(Resource resource) { @@ -50,19 +50,19 @@ public class Resource implements Serializable { this.resourceVersion = resource.resourceVersion; this.resourceType = resource.resourceType; } - + public Resource(UUID uuid) { this.resourceUuid = uuid; } - + public Resource(String name, ResourceType type) { this.resourceName = name; this.resourceType = type; } - + /** * Constructor. - * + * * @param uuid uuid * @param invariantUuid invariant uuid * @param name name @@ -76,7 +76,7 @@ public class Resource implements Serializable { this.resourceVersion = version; this.resourceType = type; } - + public UUID getResourceUuid() { return resourceUuid; } @@ -123,7 +123,7 @@ public class Resource implements Serializable { + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType=" + resourceType + "]"; } - + @Override public int hashCode() { final int prime = 31; @@ -135,7 +135,7 @@ public class Resource implements Serializable { result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) { @@ -185,5 +185,5 @@ public class Resource implements Serializable { } return true; } - + } diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java index dce6ec0fa..9c1db8a55 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java @@ -8,9 +8,9 @@ * 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. @@ -25,26 +25,27 @@ import java.io.Serializable; import java.util.UUID; public class ResourceInstance implements Serializable { + private static final long serialVersionUID = -5506162340393802424L; private String resourceInstanceName; private String resourceName; - private UUID resourceInvariantUuid; + private UUID resourceInvariantUuid; private String resourceVersion; private ResourceType resourceType; - private UUID resourceUuid; - + private UUID resourceUuid; + public ResourceInstance() { //Empty Constructor } - + /** * Constructor. - * + * * @param instance copy object */ public ResourceInstance(ResourceInstance instance) { - if (instance == null) { + if (instance == null) { return; } this.resourceInstanceName = instance.resourceInstanceName; @@ -54,7 +55,7 @@ public class ResourceInstance implements Serializable { this.resourceType = instance.resourceType; this.resourceUuid = instance.resourceUuid; } - + public String getResourceInstanceName() { return resourceInstanceName; } @@ -106,10 +107,10 @@ public class ResourceInstance implements Serializable { @Override public String toString() { return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName - + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion - + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]"; + + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion + + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]"; } - + @Override public int hashCode() { final int prime = 31; @@ -122,7 +123,7 @@ public class ResourceInstance implements Serializable { result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) { @@ -175,5 +176,5 @@ public class ResourceInstance implements Serializable { } return true; } - + } diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java index f4f97c42e..709abf9e8 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java @@ -8,9 +8,9 @@ * 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. @@ -27,27 +27,27 @@ import java.util.UUID; public class Service implements Serializable { private static final long serialVersionUID = -1249276698549996806L; - - private UUID serviceUUID; - private UUID serviceInvariantUUID; - private String serviceName; - private String serviceVersion; - + + private UUID serviceUUID; + private UUID serviceInvariantUUID; + private String serviceName; + private String serviceVersion; + public Service() { //Empty Constructor } - + public Service(UUID uuid) { this.serviceUUID = uuid; } - + public Service(String name) { this.serviceName = name; } - + /** * Constructor. - * + * * @param uuid service id * @param invariantUUID service invariant id * @param name name @@ -59,10 +59,10 @@ public class Service implements Serializable { this.serviceName = name; this.serviceVersion = version; } - + /** * Constructor. - * + * * @param service copy object */ public Service(Service service) { @@ -71,7 +71,7 @@ public class Service implements Serializable { this.serviceName = service.serviceName; this.serviceVersion = service.serviceVersion; } - + public UUID getServiceUUID() { return serviceUUID; } @@ -107,9 +107,9 @@ public class Service implements Serializable { @Override public String toString() { return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID - + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; + + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; } - + @Override public int hashCode() { final int prime = 31; diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java index 49f1b8572..d5f74d4d0 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java @@ -8,9 +8,9 @@ * 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. @@ -25,23 +25,24 @@ import java.io.Serializable; import java.util.UUID; public class ServiceInstance implements Serializable { + private static final long serialVersionUID = 6285260780966679625L; - private UUID personaModelUUID; - private UUID serviceUUID; - private UUID serviceInstanceUUID; - private UUID widgetModelUUID; - private String widgetModelVersion; - private String serviceName; - private String serviceInstanceName; - + private UUID personaModelUUID; + private UUID serviceUUID; + private UUID serviceInstanceUUID; + private UUID widgetModelUUID; + private String widgetModelVersion; + private String serviceName; + private String serviceInstanceName; + public ServiceInstance() { //Empty Constructor } - + /** * Constructor. - * + * * @param instance copy object */ public ServiceInstance(ServiceInstance instance) { @@ -56,7 +57,7 @@ public class ServiceInstance implements Serializable { this.serviceName = instance.serviceName; this.serviceInstanceName = instance.serviceInstanceName; } - + public UUID getPersonaModelUUID() { return personaModelUUID; } @@ -116,11 +117,11 @@ public class ServiceInstance implements Serializable { @Override public String toString() { return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID - + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID - + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName - + ", serviceInstanceName=" + serviceInstanceName + "]"; + + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID + + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName + + ", serviceInstanceName=" + serviceInstanceName + "]"; } - + @Override public int hashCode() { final int prime = 31; @@ -134,7 +135,7 @@ public class ServiceInstance implements Serializable { result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) { @@ -198,5 +199,5 @@ public class ServiceInstance implements Serializable { } return true; } - + } diff --git a/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java index fc3335a61..144e36322 100644 --- a/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java @@ -22,7 +22,6 @@ package org.onap.policy.sdnc; import com.google.gson.annotations.SerializedName; import java.io.Serializable; -import java.util.List; public class SdncResponseOutput implements Serializable { diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java index 5c1ed4839..f575a73c3 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java @@ -8,9 +8,9 @@ * 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. @@ -57,7 +57,7 @@ public class PciCommonHeader implements Serializable { /** * Used to copy a pci common header. - * + * * @param commonHeader a header that is defined by the Pci api guide that contains information * about the request (requestId, flags, etc.) */ @@ -75,7 +75,7 @@ public class PciCommonHeader implements Serializable { /** * Get the timestamp. - * + * * @return the timeStamp */ public Instant getTimeStamp() { @@ -84,7 +84,7 @@ public class PciCommonHeader implements Serializable { /** * Set the timestamp. - * + * * @param timeStamp * the timeStamp to set */ @@ -94,7 +94,7 @@ public class PciCommonHeader implements Serializable { /** * Get the API version. - * + * * @return the apiVer */ public String getApiVer() { @@ -103,7 +103,7 @@ public class PciCommonHeader implements Serializable { /** * Set the API version. - * + * * @param apiVer * the apiVer to set */ @@ -113,7 +113,7 @@ public class PciCommonHeader implements Serializable { /** * Get the request Id. - * + * * @return the requestId */ public UUID getRequestId() { @@ -122,7 +122,7 @@ public class PciCommonHeader implements Serializable { /** * Set the request Id. - * + * * @param requestId * the requestId to set */ @@ -132,7 +132,7 @@ public class PciCommonHeader implements Serializable { /** * Get the sub request Id. - * + * * @return the subRequestId */ public String getSubRequestId() { @@ -141,7 +141,7 @@ public class PciCommonHeader implements Serializable { /** * Set the sub request Id. - * + * * @param subRequestId * the subRequestId to set */ @@ -150,7 +150,7 @@ public class PciCommonHeader implements Serializable { } /** * Set the request track. - * + * * @param requestTrack * the requestTrack to set */ @@ -159,7 +159,7 @@ public class PciCommonHeader implements Serializable { } /** * Get the request track. - * + * * @return the requestTrack */ public Map getRequestTrack() { @@ -168,7 +168,7 @@ public class PciCommonHeader implements Serializable { /** * Get the flags. - * + * * @return the flags */ public Map getFlags() { @@ -177,7 +177,7 @@ public class PciCommonHeader implements Serializable { /** * Set the flags. - * + * * @param flags * the flags to set */ @@ -187,7 +187,7 @@ public class PciCommonHeader implements Serializable { @Override public String toString() { - return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer + return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer + ", requestId=" + requestId + ", subRequestId=" + subRequestId + ", requestTrack=" + requestTrack + ", flags=" + flags + "]"; } diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java index 7b8b5b1c1..fd9bb937f 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java @@ -8,9 +8,9 @@ * 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. @@ -50,7 +50,7 @@ public class PciWrapper implements Serializable { /** * Get the version. - * + * * @return the version */ public String getVersion() { @@ -59,9 +59,8 @@ public class PciWrapper implements Serializable { /** * Set the version. - * - * @param version - * the version to set + * + * @param version the version to set */ public void setVersion(String version) { this.version = version; @@ -69,7 +68,7 @@ public class PciWrapper implements Serializable { /** * Get the cambria partition. - * + * * @return the cambriaPartition */ public String getCambriaPartition() { @@ -78,9 +77,8 @@ public class PciWrapper implements Serializable { /** * Set the cambria partition. - * - * @param cambriaPartition - * the cambriaPartition to set + * + * @param cambriaPartition the cambriaPartition to set */ public void setCambriaPartition(String cambriaPartition) { this.cambriaPartition = cambriaPartition; @@ -88,7 +86,7 @@ public class PciWrapper implements Serializable { /** * Get the RPN name. - * + * * @return the rpcName */ public String getRpcName() { @@ -97,9 +95,8 @@ public class PciWrapper implements Serializable { /** * Set the RPC name. - * - * @param rpcName - * the rpcName to set + * + * @param rpcName the rpcName to set */ public void setRpcName(String rpcName) { this.rpcName = rpcName; @@ -107,7 +104,7 @@ public class PciWrapper implements Serializable { /** * Get the correlation Id. - * + * * @return the correlationId */ public String getCorrelationId() { @@ -116,9 +113,8 @@ public class PciWrapper implements Serializable { /** * Set the correclation Id. - * - * @param correlationId - * the correlationId to set + * + * @param correlationId the correlationId to set */ public void setCorrelationId(String correlationId) { this.correlationId = correlationId; @@ -126,7 +122,7 @@ public class PciWrapper implements Serializable { /** * Get the type. - * + * * @return the type */ public String getType() { @@ -135,9 +131,8 @@ public class PciWrapper implements Serializable { /** * Set the type. - * - * @param type - * the type to set + * + * @param type the type to set */ public void setType(String type) { this.type = type; @@ -146,7 +141,7 @@ public class PciWrapper implements Serializable { @Override public String toString() { return "Wrapper [version=" + version + ", cambriaPartition=" + cambriaPartition + ", rpcName=" + rpcName - + ", correlationId=" + correlationId + ", type=" + type + "]"; + + ", correlationId=" + correlationId + ", type=" + type + "]"; } @Override 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 index b0f4ca7c3..2e94a66c4 100644 --- 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 @@ -59,7 +59,7 @@ public class SoRequestDetails implements Serializable { /** * Constructor. - * + * * @param soRequestDetails copy object */ public SoRequestDetails(SoRequestDetails soRequestDetails) { @@ -208,9 +208,9 @@ public class SoRequestDetails implements Serializable { @Override public String toString() { return "SORequestDetails [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration - + ", requestInfo=" + requestInfo + ", subscriberInfo=" + subscriberInfo - + ", relatedInstanceList=" + relatedInstanceList + ", requestParameters=" + requestParameters - + ", configurationParameters=" + configurationParameters + "]"; + + ", requestInfo=" + requestInfo + ", subscriberInfo=" + subscriberInfo + + ", relatedInstanceList=" + relatedInstanceList + ", requestParameters=" + requestParameters + + ", configurationParameters=" + configurationParameters + "]"; } } diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServer.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServer.java new file mode 100644 index 000000000..e9c338356 --- /dev/null +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServer.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 SoDummyServer { + + 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 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/SoDummyServerTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java deleted file mode 100644 index 910c0ac13..000000000 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java +++ /dev/null @@ -1,240 +0,0 @@ -/*- - * ============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 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/SoManagerTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java index 85f5ac7f9..4d7228ff7 100644 --- 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 @@ -59,7 +59,7 @@ public class SoManagerTest { */ @BeforeClass public static void setUp() throws IOException { - final ResourceConfig rc = new ResourceConfig(SoDummyServerTest.class); + final ResourceConfig rc = new ResourceConfig(SoDummyServer.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 diff --git a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java index 886b87197..e912722cb 100644 --- a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java +++ b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java @@ -8,9 +8,9 @@ * 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. -- cgit 1.2.3-korg