summaryrefslogtreecommitdiffstats
path: root/controlloop/common/model-impl
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/model-impl')
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java3
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java1
-rw-r--r--controlloop/common/model-impl/appc/pom.xml40
-rw-r--r--controlloop/common/model-impl/appclcm/pom.xml40
-rw-r--r--controlloop/common/model-impl/events/pom.xml41
-rw-r--r--controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java24
-rw-r--r--controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java99
-rw-r--r--controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java85
-rw-r--r--controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java34
-rw-r--r--controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java50
-rw-r--r--controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java60
-rw-r--r--controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java28
-rw-r--r--controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java10
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java11
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java59
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java3
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java9
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java14
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java6
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java6
-rw-r--r--controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java25
-rw-r--r--controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java33
-rw-r--r--controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoManager.java (renamed from controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSOManager.java)5
-rwxr-xr-xcontrolloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java92
-rwxr-xr-xcontrolloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java46
-rw-r--r--controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java9
-rw-r--r--controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java9
-rw-r--r--controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java9
-rw-r--r--controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java4
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java45
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java45
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java61
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java16
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java43
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java43
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java74
-rw-r--r--controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java12
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java3
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealActionVmInfo.java45
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCManager.java275
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCResponseDescriptor.java64
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealActionVmInfo.java (renamed from controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCRequest.java)47
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealAdditionalParams.java (renamed from controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCResponse.java)45
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealRequest.java52
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java303
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcRequest.java (renamed from controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealAdditionalParams.java)47
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcResponse.java (renamed from controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealRequest.java)49
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcResponseDescriptor.java67
-rw-r--r--controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/TestSerialization.java11
61 files changed, 1195 insertions, 1079 deletions
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java
index 4ca91e73a..7a94dccf0 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* aai
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ package org.onap.policy.aai;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java
index b4fbd7652..b82f2b377 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.aai;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/controlloop/common/model-impl/appc/pom.xml b/controlloop/common/model-impl/appc/pom.xml
index 1c3cd1063..49a5266ea 100644
--- a/controlloop/common/model-impl/appc/pom.xml
+++ b/controlloop/common/model-impl/appc/pom.xml
@@ -42,44 +42,4 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>onap-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <!-- Use Google Java Style Guide:
- https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
- with minor changes -->
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
- <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <excludes>
- </excludes>
- <consoleOutput>true</consoleOutput>
- <failOnViolation>true</failOnViolation>
- <violationSeverity>warning</violationSeverity>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>0.1.1</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/controlloop/common/model-impl/appclcm/pom.xml b/controlloop/common/model-impl/appclcm/pom.xml
index 45885296d..e40b3daeb 100644
--- a/controlloop/common/model-impl/appclcm/pom.xml
+++ b/controlloop/common/model-impl/appclcm/pom.xml
@@ -42,44 +42,4 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>onap-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <!-- Use Google Java Style Guide:
- https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
- with minor changes -->
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
- <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <excludes>
- </excludes>
- <consoleOutput>true</consoleOutput>
- <failOnViolation>true</failOnViolation>
- <violationSeverity>warning</violationSeverity>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>0.1.1</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/controlloop/common/model-impl/events/pom.xml b/controlloop/common/model-impl/events/pom.xml
index 8fec961d8..b49aa9267 100644
--- a/controlloop/common/model-impl/events/pom.xml
+++ b/controlloop/common/model-impl/events/pom.xml
@@ -41,45 +41,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <executions>
- <execution>
- <id>onap-java-style</id>
- <goals>
- <goal>check</goal>
- </goals>
- <phase>process-sources</phase>
- <configuration>
- <!-- Use Google Java Style Guide:
- https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
- with minor changes -->
- <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
- <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
- <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
- <includeResources>true</includeResources>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- <includeTestResources>true</includeTestResources>
- <excludes>
- </excludes>
- <consoleOutput>true</consoleOutput>
- <failOnViolation>true</failOnViolation>
- <violationSeverity>warning</violationSeverity>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.oparent</groupId>
- <artifactId>checkstyle</artifactId>
- <version>0.1.1</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java
index 52ce13ef9..39e0d8a7f 100644
--- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java
+++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java
@@ -51,6 +51,17 @@ public class RESTManager {
}
}
+ /**
+ * Perform REST Post.
+ *
+ * @param url the url
+ * @param username the user name
+ * @param password the password
+ * @param headers any headers
+ * @param contentType what the content type is
+ * @param body body to send
+ * @return the response status code and the body
+ */
public Pair<Integer, String> post(String url, String username, String password,
Map<String, String> headers, String contentType, String body) {
@@ -77,7 +88,7 @@ public class RESTManager {
}
}
post.addHeader("Content-Type", contentType);
- if(authHeader != null) {
+ if (authHeader != null) {
post.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
}
@@ -107,6 +118,15 @@ public class RESTManager {
}
}
+ /**
+ * Do a REST get.
+ *
+ * @param url URL
+ * @param username user name
+ * @param password password
+ * @param headers any headers to add
+ * @return a Pair for the response status and the body
+ */
public Pair<Integer, String> get(String url, String username, String password,
Map<String, String> headers) {
@@ -124,7 +144,7 @@ public class RESTManager {
get.addHeader(entry.getKey(), headers.get(entry.getKey()));
}
}
- if(authHeader != null) {
+ if (authHeader != null) {
get.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
}
diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
index 25d0903d7..121b54e5a 100644
--- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
+++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,8 +27,8 @@ public class Resource implements Serializable {
private static final long serialVersionUID = -913729158733348027L;
- private UUID resourceUUID;
- private UUID resourceInvariantUUID;
+ private UUID resourceUuid;
+ private UUID resourceInvariantUuid;
private String resourceName;
private String resourceVersion;
private ResourceType resourceType;
@@ -37,16 +37,21 @@ public class Resource implements Serializable {
//Empty Constructor
}
+ /**
+ * Constructor.
+ *
+ * @param resource copy object
+ */
public Resource(Resource resource) {
- this.resourceUUID = resource.resourceUUID;
- this.resourceInvariantUUID = resource.resourceInvariantUUID;
+ this.resourceUuid = resource.resourceUuid;
+ this.resourceInvariantUuid = resource.resourceInvariantUuid;
this.resourceName = resource.resourceName;
this.resourceVersion = resource.resourceVersion;
this.resourceType = resource.resourceType;
}
public Resource(UUID uuid) {
- this.resourceUUID = uuid;
+ this.resourceUuid = uuid;
}
public Resource(String name, ResourceType type) {
@@ -54,28 +59,37 @@ public class Resource implements Serializable {
this.resourceType = type;
}
- public Resource(UUID uuid, UUID invariantUUID, String name, String version, ResourceType type) {
- this.resourceUUID = uuid;
- this.resourceInvariantUUID = invariantUUID;
+ /**
+ * Constructor.
+ *
+ * @param uuid uuid
+ * @param invariantUuid invariant uuid
+ * @param name name
+ * @param version version
+ * @param type type
+ */
+ public Resource(UUID uuid, UUID invariantUuid, String name, String version, ResourceType type) {
+ this.resourceUuid = uuid;
+ this.resourceInvariantUuid = invariantUuid;
this.resourceName = name;
this.resourceVersion = version;
this.resourceType = type;
}
- public UUID getResourceUUID() {
- return resourceUUID;
+ public UUID getResourceUuid() {
+ return resourceUuid;
}
- public void setResourceUUID(UUID resourceUUID) {
- this.resourceUUID = resourceUUID;
+ public void setResourceUuid(UUID resourceUuid) {
+ this.resourceUuid = resourceUuid;
}
- public UUID getResourceInvariantUUID() {
- return resourceInvariantUUID;
+ public UUID getResourceInvariantUuid() {
+ return resourceInvariantUuid;
}
- public void setResourceInvariantUUID(UUID resourceInvariantUUID) {
- this.resourceInvariantUUID = resourceInvariantUUID;
+ public void setResourceInvariantUuid(UUID resourceInvariantUuid) {
+ this.resourceInvariantUuid = resourceInvariantUuid;
}
public String getResourceName() {
@@ -104,55 +118,70 @@ public class Resource implements Serializable {
@Override
public String toString() {
- return "Resource [resourceUUID=" + resourceUUID + ", resourceInvariantUUID=" + resourceInvariantUUID
+ return "Resource [resourceUUID=" + resourceUuid + ", resourceInvariantUUID=" + resourceInvariantUuid
+ ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType="
+ resourceType + "]";
}
+
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode());
+ result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode());
result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
- result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode());
+ result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode());
result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
return result;
}
+
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
Resource other = (Resource) obj;
- if (resourceInvariantUUID == null) {
- if (other.resourceInvariantUUID != null)
+ if (resourceInvariantUuid == null) {
+ if (other.resourceInvariantUuid != null) {
return false;
- } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID))
+ }
+ } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
return false;
+ }
if (resourceName == null) {
- if (other.resourceName != null)
+ if (other.resourceName != null) {
return false;
- } else if (!resourceName.equals(other.resourceName))
+ }
+ } else if (!resourceName.equals(other.resourceName)) {
return false;
+ }
if (resourceType == null) {
- if (other.resourceType != null)
+ if (other.resourceType != null) {
return false;
- } else if (!resourceType.equals(other.resourceType))
+ }
+ } else if (!resourceType.equals(other.resourceType)) {
return false;
- if (resourceUUID == null) {
- if (other.resourceUUID != null)
+ }
+ if (resourceUuid == null) {
+ if (other.resourceUuid != null) {
return false;
- } else if (!resourceUUID.equals(other.resourceUUID))
+ }
+ } else if (!resourceUuid.equals(other.resourceUuid)) {
return false;
+ }
if (resourceVersion == null) {
- if (other.resourceVersion != null)
+ if (other.resourceVersion != null) {
return false;
- } else if (!resourceVersion.equals(other.resourceVersion))
+ }
+ } else if (!resourceVersion.equals(other.resourceVersion)) {
return false;
+ }
return true;
}
diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
index 7fca79fc3..eaee5a27b 100644
--- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
+++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,25 +28,30 @@ public class ResourceInstance implements Serializable {
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) {
return;
}
this.resourceInstanceName = instance.resourceInstanceName;
this.resourceName = instance.resourceName;
- this.resourceInvariantUUID = instance.resourceInvariantUUID;
+ this.resourceInvariantUuid = instance.resourceInvariantUuid;
this.resourceVersion = instance.resourceVersion;
this.resourceType = instance.resourceType;
- this.resourceUUID = instance.resourceUUID;
+ this.resourceUuid = instance.resourceUuid;
}
public String getResourceInstanceName() {
@@ -66,11 +71,11 @@ public class ResourceInstance implements Serializable {
}
public UUID getResourceInvariantUUID() {
- return resourceInvariantUUID;
+ return resourceInvariantUuid;
}
- public void setResourceInvariantUUID(UUID resourceInvariantUUID) {
- this.resourceInvariantUUID = resourceInvariantUUID;
+ public void setResourceInvariantUUID(UUID resourceInvariantUuid) {
+ this.resourceInvariantUuid = resourceInvariantUuid;
}
public String getResourceVersion() {
@@ -89,68 +94,84 @@ public class ResourceInstance implements Serializable {
this.resourceType = resourceType;
}
- public UUID getResourceUUID() {
- return resourceUUID;
+ public UUID getResourceUuid() {
+ return resourceUuid;
}
- public void setResourceUUID(UUID resourceUUID) {
- this.resourceUUID = resourceUUID;
+ public void setResourceUuid(UUID resourceUuid) {
+ this.resourceUuid = resourceUuid;
}
@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;
int result = 1;
result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
- result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode());
+ result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode());
result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
- result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode());
+ result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode());
result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
return result;
}
+
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
ResourceInstance other = (ResourceInstance) obj;
if (resourceInstanceName == null) {
- if (other.resourceInstanceName != null)
+ if (other.resourceInstanceName != null) {
return false;
- } else if (!resourceInstanceName.equals(other.resourceInstanceName))
+ }
+ } else if (!resourceInstanceName.equals(other.resourceInstanceName)) {
return false;
- if (resourceInvariantUUID == null) {
- if (other.resourceInvariantUUID != null)
+ }
+ if (resourceInvariantUuid == null) {
+ if (other.resourceInvariantUuid != null) {
return false;
- } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID))
+ }
+ } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
return false;
+ }
if (resourceName == null) {
- if (other.resourceName != null)
+ if (other.resourceName != null) {
return false;
- } else if (!resourceName.equals(other.resourceName))
+ }
+ } else if (!resourceName.equals(other.resourceName)) {
return false;
- if (resourceType != other.resourceType)
+ }
+ if (resourceType != other.resourceType) {
return false;
- if (resourceUUID == null) {
- if (other.resourceUUID != null)
+ }
+ if (resourceUuid == null) {
+ if (other.resourceUuid != null) {
return false;
- } else if (!resourceUUID.equals(other.resourceUUID))
+ }
+ } else if (!resourceUuid.equals(other.resourceUuid)) {
return false;
+ }
if (resourceVersion == null) {
- if (other.resourceVersion != null)
+ if (other.resourceVersion != null) {
return false;
- } else if (!resourceVersion.equals(other.resourceVersion))
+ }
+ } else if (!resourceVersion.equals(other.resourceVersion)) {
return false;
+ }
return true;
}
diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java
index c4dbfffa4..6202d64e0 100644
--- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java
+++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,21 +21,21 @@
package org.onap.policy.sdc;
public enum ResourceType {
- VF("VF"),
- VFC("VFC"),
- VL("VL"),
- CP("CP")
- ;
-
- private String type;
-
- private ResourceType(String type) {
- this.type = type;
- }
+ VF("VF"),
+ VFC("VFC"),
+ VL("VL"),
+ CP("CP")
+ ;
+
+ private String type;
+
+ private ResourceType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.type;
+ }
- @Override
- public String toString() {
- return this.type;
- }
-
}
diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
index 7bfc62e67..b3ebcc238 100644
--- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
+++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,6 +44,14 @@ public class Service implements Serializable {
this.serviceName = name;
}
+ /**
+ * Constructor.
+ *
+ * @param uuid service id
+ * @param invariantUUID service invariant id
+ * @param name name
+ * @param version version
+ */
public Service(UUID uuid, UUID invariantUUID, String name, String version) {
this.serviceUUID = uuid;
this.serviceInvariantUUID = invariantUUID;
@@ -51,6 +59,11 @@ public class Service implements Serializable {
this.serviceVersion = version;
}
+ /**
+ * Constructor.
+ *
+ * @param service copy object
+ */
public Service(Service service) {
this.serviceUUID = service.serviceUUID;
this.serviceInvariantUUID = service.serviceInvariantUUID;
@@ -95,6 +108,7 @@ public class Service implements Serializable {
return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID
+ ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]";
}
+
@Override
public int hashCode() {
final int prime = 31;
@@ -105,35 +119,47 @@ public class Service implements Serializable {
result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode());
return result;
}
+
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
Service other = (Service) obj;
if (serviceInvariantUUID == null) {
- if (other.serviceInvariantUUID != null)
+ if (other.serviceInvariantUUID != null) {
return false;
- } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID))
+ }
+ } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID)) {
return false;
+ }
if (serviceName == null) {
- if (other.serviceName != null)
+ if (other.serviceName != null) {
return false;
- } else if (!serviceName.equals(other.serviceName))
+ }
+ } else if (!serviceName.equals(other.serviceName)) {
return false;
+ }
if (serviceUUID == null) {
- if (other.serviceUUID != null)
+ if (other.serviceUUID != null) {
return false;
- } else if (!serviceUUID.equals(other.serviceUUID))
+ }
+ } else if (!serviceUUID.equals(other.serviceUUID)) {
return false;
+ }
if (serviceVersion == null) {
- if (other.serviceVersion != null)
+ if (other.serviceVersion != null) {
return false;
- } else if (!serviceVersion.equals(other.serviceVersion))
+ }
+ } else if (!serviceVersion.equals(other.serviceVersion)) {
return false;
+ }
return true;
}
diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
index c35d7dfde..a477267a3 100644
--- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
+++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* sdc
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,11 @@ public class ServiceInstance implements Serializable {
//Empty Constructor
}
+ /**
+ * Constructor.
+ *
+ * @param instance copy object
+ */
public ServiceInstance(ServiceInstance instance) {
if (instance == null) {
return;
@@ -114,6 +119,7 @@ public class ServiceInstance implements Serializable {
+ ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName
+ ", serviceInstanceName=" + serviceInstanceName + "]";
}
+
@Override
public int hashCode() {
final int prime = 31;
@@ -127,50 +133,68 @@ public class ServiceInstance implements Serializable {
result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode());
return result;
}
+
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
ServiceInstance other = (ServiceInstance) obj;
if (personaModelUUID == null) {
- if (other.personaModelUUID != null)
+ if (other.personaModelUUID != null) {
return false;
- } else if (!personaModelUUID.equals(other.personaModelUUID))
+ }
+ } else if (!personaModelUUID.equals(other.personaModelUUID)) {
return false;
+ }
if (serviceInstanceName == null) {
- if (other.serviceInstanceName != null)
+ if (other.serviceInstanceName != null) {
return false;
- } else if (!serviceInstanceName.equals(other.serviceInstanceName))
+ }
+ } else if (!serviceInstanceName.equals(other.serviceInstanceName)) {
return false;
+ }
if (serviceInstanceUUID == null) {
- if (other.serviceInstanceUUID != null)
+ if (other.serviceInstanceUUID != null) {
return false;
- } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID))
+ }
+ } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) {
return false;
+ }
if (serviceName == null) {
- if (other.serviceName != null)
+ if (other.serviceName != null) {
return false;
- } else if (!serviceName.equals(other.serviceName))
+ }
+ } else if (!serviceName.equals(other.serviceName)) {
return false;
+ }
if (serviceUUID == null) {
- if (other.serviceUUID != null)
+ if (other.serviceUUID != null) {
return false;
- } else if (!serviceUUID.equals(other.serviceUUID))
+ }
+ } else if (!serviceUUID.equals(other.serviceUUID)) {
return false;
+ }
if (widgetModelUUID == null) {
- if (other.widgetModelUUID != null)
+ if (other.widgetModelUUID != null) {
return false;
- } else if (!widgetModelUUID.equals(other.widgetModelUUID))
+ }
+ } else if (!widgetModelUUID.equals(other.widgetModelUUID)) {
return false;
+ }
if (widgetModelVersion == null) {
- if (other.widgetModelVersion != null)
+ if (other.widgetModelVersion != null) {
return false;
- } else if (!widgetModelVersion.equals(other.widgetModelVersion))
+ }
+ } else if (!widgetModelVersion.equals(other.widgetModelVersion)) {
return false;
+ }
return true;
}
diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java
index 7e64787f8..7b3a3e1f6 100644
--- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java
+++ b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResource.java
@@ -32,26 +32,26 @@ public class TestResource {
@Test
public void testConstructors() {
Resource res = new Resource();
- assertEquals(null, res.getResourceUUID());
- assertEquals(null, res.getResourceInvariantUUID());
+ assertEquals(null, res.getResourceUuid());
+ assertEquals(null, res.getResourceInvariantUuid());
assertEquals(null, res.getResourceName());
assertEquals(null, res.getResourceType());
assertEquals(null, res.getResourceVersion());
UUID uuid = UUID.randomUUID();
res = new Resource(uuid);
- assertEquals(uuid, res.getResourceUUID());
- assertEquals(null, res.getResourceInvariantUUID());
+ assertEquals(uuid, res.getResourceUuid());
+ assertEquals(null, res.getResourceInvariantUuid());
assertEquals(null, res.getResourceName());
assertEquals(null, res.getResourceType());
assertEquals(null, res.getResourceVersion());
String name = "constTest";
res = new Resource(name, ResourceType.CP);
- assertEquals(null, res.getResourceUUID());
+ assertEquals(null, res.getResourceUuid());
assertEquals(name, res.getResourceName());
assertEquals(ResourceType.CP, res.getResourceType());
- assertEquals(null, res.getResourceInvariantUUID());
+ assertEquals(null, res.getResourceInvariantUuid());
assertEquals(null, res.getResourceVersion());
uuid = UUID.randomUUID();
@@ -59,15 +59,15 @@ public class TestResource {
name = "constTestUUID";
String version = "0.0.1";
res = new Resource(uuid, uuidInvariant, name, version, ResourceType.VF);
- assertEquals(uuid, res.getResourceUUID());
- assertEquals(uuidInvariant, res.getResourceInvariantUUID());
+ assertEquals(uuid, res.getResourceUuid());
+ assertEquals(uuidInvariant, res.getResourceInvariantUuid());
assertEquals(name, res.getResourceName());
assertEquals(ResourceType.VF, res.getResourceType());
assertEquals(version, res.getResourceVersion());
Resource r2 = new Resource(res);
- assertEquals(uuid, r2.getResourceUUID());
- assertEquals(uuidInvariant, r2.getResourceInvariantUUID());
+ assertEquals(uuid, r2.getResourceUuid());
+ assertEquals(uuidInvariant, r2.getResourceInvariantUuid());
assertEquals(name, r2.getResourceName());
assertEquals(ResourceType.VF, r2.getResourceType());
assertEquals(version, r2.getResourceVersion());
@@ -77,16 +77,16 @@ public class TestResource {
public void testUuid() {
Resource res = new Resource();
UUID uuid = UUID.randomUUID();
- res.setResourceUUID(uuid);
- assertEquals(uuid, res.getResourceUUID());
+ res.setResourceUuid(uuid);
+ assertEquals(uuid, res.getResourceUuid());
}
@Test
public void testInvariantUuid() {
Resource res = new Resource();
UUID uuid = UUID.randomUUID();
- res.setResourceInvariantUUID(uuid);
- assertEquals(uuid, res.getResourceInvariantUUID());
+ res.setResourceInvariantUuid(uuid);
+ assertEquals(uuid, res.getResourceInvariantUuid());
}
@Test
diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java
index 77847f167..2a1dc42b3 100644
--- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java
+++ b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/TestResourceInstance.java
@@ -33,7 +33,7 @@ public class TestResourceInstance {
public void testConstructors() {
ResourceInstance ri = new ResourceInstance();
assertEquals(null, ri.getResourceInstanceName());
- assertEquals(null, ri.getResourceUUID());
+ assertEquals(null, ri.getResourceUuid());
assertEquals(null, ri.getResourceInvariantUUID());
assertEquals(null, ri.getResourceName());
assertEquals(null, ri.getResourceType());
@@ -41,7 +41,7 @@ public class TestResourceInstance {
ResourceInstance ri2 = new ResourceInstance((ResourceInstance) null);
assertEquals(null, ri2.getResourceInstanceName());
- assertEquals(null, ri2.getResourceUUID());
+ assertEquals(null, ri2.getResourceUuid());
assertEquals(null, ri2.getResourceInvariantUUID());
assertEquals(null, ri2.getResourceName());
assertEquals(null, ri2.getResourceType());
@@ -49,7 +49,7 @@ public class TestResourceInstance {
ri2 = new ResourceInstance(ri);
assertEquals(ri2.getResourceInstanceName(), ri.getResourceInstanceName());
- assertEquals(ri2.getResourceUUID(), ri.getResourceUUID());
+ assertEquals(ri2.getResourceUuid(), ri.getResourceUuid());
assertEquals(ri2.getResourceInvariantUUID(), ri.getResourceInvariantUUID());
assertEquals(ri2.getResourceName(), ri.getResourceName());
assertEquals(ri2.getResourceType(), ri.getResourceType());
@@ -68,8 +68,8 @@ public class TestResourceInstance {
public void testUuid() {
ResourceInstance ri = new ResourceInstance();
UUID uuid = UUID.randomUUID();
- ri.setResourceUUID(uuid);
- assertEquals(uuid, ri.getResourceUUID());
+ ri.setResourceUuid(uuid);
+ assertEquals(uuid, ri.getResourceUuid());
}
@Test
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java
index ea1257d4d..5bb03de06 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,11 @@
package org.onap.policy.so;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.time.LocalDateTime;
-import com.google.gson.annotations.SerializedName;
-
public class SOAsyncRequestStatus implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java
index 7ad497a9f..b52fe2b7c 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SOCloudConfiguration implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java
index 307e0514f..645e7f711 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SOInstanceReferences implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
index 92d52f4c2..a3f2be30b 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
@@ -63,7 +63,7 @@ public final class SOManager {
private long restGetTimeout = GET_REQUEST_WAIT_INTERVAL;
/**
- * Default constructor
+ * Default constructor.
*/
public SOManager() {
restManager = new RESTManager();
@@ -100,12 +100,11 @@ public final class SOManager {
/**
* This method makes an asynchronous Rest call to MSO and inserts the response into
* Drools working memory.
- *
+ *
+ * @param requestID request id
* @param wm the Drools working memory
- * @param url the URL to use on the POST request
- * @param urlBase the SO base URL
- * @param username user name for SO requests
- * @param password password for SO requests
+ * @param serviceInstanceId service instance id
+ * @param vnfInstanceId vnf instance id
* @param request the SO request
* @return a concurrent Future for the thread that handles the request
*/
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java
index eb257a7e9..15cbd23d0 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SOModelInfo implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java
index 975a21cbc..4c4fed1f2 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyExceptionHolder.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SOPolicyExceptionHolder implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java
index e7f3efc57..90fe339ee 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SORelatedInstance implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java
index 1148ef1e0..4d3d27346 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SORelatedInstanceListElement implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java
index 73ebba260..4a2f405e7 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,12 @@
package org.onap.policy.so;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.UUID;
-import com.google.gson.annotations.SerializedName;
-
public class SORequest implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java
index 13d25cf81..465895117 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java
@@ -20,11 +20,12 @@
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;
-import com.google.gson.annotations.SerializedName;
public class SORequestDetails implements Serializable {
@@ -55,6 +56,11 @@ public class SORequestDetails implements Serializable {
}
+ /**
+ * Constructor.
+ *
+ * @param soRequestDetails copy object
+ */
public SORequestDetails(SORequestDetails soRequestDetails) {
this.modelInfo = soRequestDetails.modelInfo;
this.cloudConfiguration = soRequestDetails.cloudConfiguration;
@@ -66,48 +72,65 @@ public class SORequestDetails implements Serializable {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
SORequestDetails other = (SORequestDetails) obj;
if (cloudConfiguration == null) {
- if (other.cloudConfiguration != null)
+ if (other.cloudConfiguration != null) {
return false;
- } else if (!cloudConfiguration.equals(other.cloudConfiguration))
+ }
+ } else if (!cloudConfiguration.equals(other.cloudConfiguration)) {
return false;
+ }
if (configurationParameters == null) {
- if (other.configurationParameters != null)
+ if (other.configurationParameters != null) {
return false;
- } else if (!configurationParameters.equals(other.configurationParameters))
+ }
+ } else if (!configurationParameters.equals(other.configurationParameters)) {
return false;
+ }
if (modelInfo == null) {
- if (other.modelInfo != null)
+ if (other.modelInfo != null) {
return false;
- } else if (!modelInfo.equals(other.modelInfo))
+ }
+ } else if (!modelInfo.equals(other.modelInfo)) {
return false;
+ }
if (relatedInstanceList == null) {
- if (other.relatedInstanceList != null)
+ if (other.relatedInstanceList != null) {
return false;
- } else if (!relatedInstanceList.equals(other.relatedInstanceList))
+ }
+ } else if (!relatedInstanceList.equals(other.relatedInstanceList)) {
return false;
+ }
if (requestInfo == null) {
- if (other.requestInfo != null)
+ if (other.requestInfo != null) {
return false;
- } else if (!requestInfo.equals(other.requestInfo))
+ }
+ } else if (!requestInfo.equals(other.requestInfo)) {
return false;
+ }
if (requestParameters == null) {
- if (other.requestParameters != null)
+ if (other.requestParameters != null) {
return false;
- } else if (!requestParameters.equals(other.requestParameters))
+ }
+ } else if (!requestParameters.equals(other.requestParameters)) {
return false;
+ }
if (subscriberInfo == null) {
- if (other.subscriberInfo != null)
+ if (other.subscriberInfo != null) {
return false;
- } else if (!subscriberInfo.equals(other.subscriberInfo))
+ }
+ } else if (!subscriberInfo.equals(other.subscriberInfo)) {
return false;
+ }
return true;
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java
index 763210831..7594ef95c 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SORequestError implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java
index fd92e3284..c30e50c17 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SORequestInfo implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java
index 7ea20defd..69faded76 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java
@@ -20,11 +20,12 @@
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;
-import com.google.gson.annotations.SerializedName;
public class SORequestParameters implements Serializable {
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java
index ed14f6b58..71b1cccfe 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SORequestReferences implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java
index 2e77c157b..79406574d 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +20,12 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SORequestStatus implements Serializable {
- /**
- *
- */
private static final long serialVersionUID = -3283942659786236032L;
@SerializedName("percentProgress")
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java
index 20e0c4155..e9350838a 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SOResponse implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java
index e18cbb62d..dcf640d83 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SOResponseWrapper implements Serializable {
private static final long serialVersionUID = 7673023687132889069L;
@@ -86,12 +86,12 @@ public class SOResponseWrapper implements Serializable {
return result;
}
- public void setRequestID(String requestID) {
- this.requestID = requestID;
+ public void setRequestID(String requestId) {
+ this.requestID = requestId;
}
- public void setSoResponse(SOResponse sOResponse) {
- soResponse = sOResponse;
+ public void setSoResponse(SOResponse response) {
+ soResponse = response;
}
@Override
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java
index 703e13be5..65ba446e3 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceExceptionHolder.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,12 @@
package org.onap.policy.so;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
-import com.google.gson.annotations.SerializedName;
-
public class SOServiceExceptionHolder implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java
index 618e9ec1e..f7a4982a1 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +20,10 @@
package org.onap.policy.so;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class SOSubscriberInfo implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
index af7ddc426..b8fd036c5 100644
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.so;
import java.util.Collection;
@@ -50,16 +51,15 @@ public class DummyWorkingMemory implements WorkingMemory {
}
@Override
- public void removeEventListener(RuleRuntimeEventListener listener) {
+ public void addEventListener(AgendaEventListener listener) {
}
@Override
- public Collection<RuleRuntimeEventListener> getRuleRuntimeEventListeners() {
- return null;
+ public void addEventListener(KieBaseEventListener listener) {
}
@Override
- public void addEventListener(AgendaEventListener listener) {
+ public void removeEventListener(RuleRuntimeEventListener listener) {
}
@Override
@@ -67,16 +67,17 @@ public class DummyWorkingMemory implements WorkingMemory {
}
@Override
- public Collection<AgendaEventListener> getAgendaEventListeners() {
- return null;
+ public void removeEventListener(KieBaseEventListener listener) {
}
@Override
- public void addEventListener(KieBaseEventListener listener) {
+ public Collection<RuleRuntimeEventListener> getRuleRuntimeEventListeners() {
+ return null;
}
@Override
- public void removeEventListener(KieBaseEventListener listener) {
+ public Collection<AgendaEventListener> getAgendaEventListeners() {
+ return null;
}
@Override
@@ -90,16 +91,16 @@ public class DummyWorkingMemory implements WorkingMemory {
}
@Override
- public void dispose() {
+ public FactHandle insert(Object object) {
+ return null;
}
@Override
- public String getEntryPointId() {
- return null;
+ public void dispose() {
}
@Override
- public FactHandle insert(Object object) {
+ public String getEntryPointId() {
return null;
}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java
index 348523140..5eb0a01ee 100644
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java
@@ -22,6 +22,7 @@
package org.onap.policy.so;
+import com.google.gson.Gson;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.ws.rs.GET;
@@ -29,7 +30,6 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
-import com.google.gson.Gson;
@Path("/SO")
public class TestSoDummyServer {
@@ -41,6 +41,11 @@ public class TestSoDummyServer {
private static Map<String, SOResponse> ongoingRequestMap = new ConcurrentHashMap<>();
+ /**
+ * Stats method.
+ *
+ * @return response
+ */
@GET
@Path("/Stats")
public Response serviceGetStats() {
@@ -49,6 +54,12 @@ public class TestSoDummyServer {
+ ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
}
+ /**
+ * Get stat type.
+ *
+ * @param statType the stat type
+ * @return http response
+ */
@GET
@Path("/OneStat/{statType}")
public Response serviceGetStat(@PathParam("statType") final String statType) {
@@ -56,6 +67,12 @@ public class TestSoDummyServer {
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) {
@@ -138,6 +155,14 @@ public class TestSoDummyServer {
return null;
}
+ /**
+ * Post.
+ *
+ * @param serviceInstanceId service instance id
+ * @param vnfInstanceId vnf instance id
+ * @param jsonString json body
+ * @return http response
+ */
@POST
@Path("/serviceInstantiation/v7/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
public Response servicePostRequestVfModules(@PathParam("serviceInstanceId") final String serviceInstanceId,
@@ -221,6 +246,12 @@ public class TestSoDummyServer {
return null;
}
+ /**
+ * Get instance ID.
+ *
+ * @param nsInstanceId node instance id
+ * @return http response
+ */
@GET
@Path("/orchestrationRequests/v5/{nsInstanceId}")
public Response soRequestStatus(@PathParam("nsInstanceId") final String nsInstanceId) {
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSOManager.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoManager.java
index 4a7fdda8d..38bfcd398 100644
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSOManager.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoManager.java
@@ -3,6 +3,7 @@
* TestSOManager
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
@@ -24,6 +26,7 @@ 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;
@@ -43,7 +46,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.drools.system.PolicyEngine;
-public class TestSOManager {
+public class TestSoManager {
private static final String BASE_URI = "http://localhost:46553/TestSOManager";
private static final String BASE_SO_URI = BASE_URI + "/SO";
private static HttpServer server;
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java
index 6e9a2bade..c4b024593 100755
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- *
+ * Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,45 +72,45 @@ public class TestSoRequestDetails {
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);
+ @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));
@@ -143,7 +143,7 @@ public class TestSoRequestDetails {
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestInfo(requestInfo);
assertTrue(details.equals(copiedDetails));
-
+
details.setRequestParameters(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestParameters(null);
@@ -152,7 +152,7 @@ public class TestSoRequestDetails {
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestParameters(requestParameters);
assertTrue(details.equals(copiedDetails));
-
+
details.setSubscriberInfo(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setSubscriberInfo(null);
@@ -161,14 +161,14 @@ public class TestSoRequestDetails {
assertFalse(details.equals(copiedDetails));
copiedDetails.setSubscriberInfo(subscriberInfo);
assertTrue(details.equals(copiedDetails));
-
+
details.setRelatedInstanceList(null);
assertFalse(details.equals(copiedDetails));
- copiedDetails.setRelatedInstanceList(null);
+ copiedDetails.setRelatedInstanceList(null);
assertTrue(details.equals(copiedDetails));
details.setRelatedInstanceList(relatedInstanceList);
assertFalse(details.equals(copiedDetails));
- copiedDetails.setRelatedInstanceList(relatedInstanceList);
+ copiedDetails.setRelatedInstanceList(relatedInstanceList);
assertTrue(details.equals(copiedDetails));
- }
+ }
}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java
index 4f21630a2..d7ef9708d 100755
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java
@@ -53,23 +53,23 @@ public class TestSoResponseWrapper {
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);
+
+ @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);
@@ -81,25 +81,25 @@ public class TestSoResponseWrapper {
assertEquals(new SOResponseWrapper(null, null), new SOResponseWrapper(null, null));
assertNotEquals(new SOResponseWrapper(null, null), identicalResponseWrapper);
- assertNotEquals(0, new SOResponseWrapper(null, null).hashCode());
+ assertNotEquals(0, new SOResponseWrapper(null, null).hashCode());
- identicalResponseWrapper.setSoResponse(new SOResponse());
+ identicalResponseWrapper.setSoResponse(new SOResponse());
assertNotEquals(responseWrapper, identicalResponseWrapper);
identicalResponseWrapper.setSoResponse(response);
assertEquals(responseWrapper, identicalResponseWrapper);
identicalResponseWrapper.setRequestID(UUID.randomUUID().toString());
assertNotEquals(responseWrapper, identicalResponseWrapper);
- identicalResponseWrapper.setRequestID(requestID);
+ identicalResponseWrapper.setRequestID(requestId);
assertEquals(responseWrapper, identicalResponseWrapper);
responseWrapper.setRequestID(null);
assertNotEquals(responseWrapper, identicalResponseWrapper);
identicalResponseWrapper.setRequestID(null);
assertEquals(responseWrapper, identicalResponseWrapper);
- responseWrapper.setRequestID(requestID);
+ responseWrapper.setRequestID(requestId);
assertNotEquals(responseWrapper, identicalResponseWrapper);
- identicalResponseWrapper.setRequestID(requestID);
+ identicalResponseWrapper.setRequestID(requestId);
assertEquals(responseWrapper, identicalResponseWrapper);
- }
+ }
}
diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java
index 7bbaf3cbf..f4571d68c 100644
--- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java
+++ b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGRequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* trafficgenerator
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +20,12 @@
package org.onap.policy.vnf.trafficgenerator;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class PGRequest implements Serializable {
- /**
- *
- */
private static final long serialVersionUID = -3283942659786236032L;
@SerializedName("pg-streams")
diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java
index a606eee4c..dad77e886 100644
--- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java
+++ b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStream.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* trafficgenerator
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +20,12 @@
package org.onap.policy.vnf.trafficgenerator;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class PGStream implements Serializable {
- /**
- *
- */
private static final long serialVersionUID = 5567635677419358210L;
@SerializedName("id")
diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java
index 2264c20a9..06117b9a3 100644
--- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java
+++ b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PGStreams.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* trafficgenerator
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,17 +20,14 @@
package org.onap.policy.vnf.trafficgenerator;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
-import com.google.gson.annotations.SerializedName;
-
public class PGStreams implements Serializable {
- /**
- *
- */
private static final long serialVersionUID = 5567635677419358210L;
@SerializedName("pg-stream")
diff --git a/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java b/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java
index 0ae5f134e..f35087794 100644
--- a/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java
+++ b/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/TestDemo.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* trafficgenerator
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@
package org.onap.policy.vnf.trafficgenerator;
-
import org.junit.Test;
+
import org.onap.policy.vnf.trafficgenerator.PGRequest;
import org.onap.policy.vnf.trafficgenerator.PGStream;
import org.onap.policy.vnf.trafficgenerator.PGStreams;
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
index a8004203e..0286a7d8b 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealActionVmInfo.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,37 +19,37 @@
package org.onap.policy.vfc;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class VFCHealActionVmInfo implements Serializable {
- private static final long serialVersionUID = 3208673205100673119L;
+ private static final long serialVersionUID = 3208673205100673119L;
- @SerializedName("vmid")
- private String vmid;
+ @SerializedName("vmid")
+ private String vmid;
- @SerializedName("vmname")
- private String vmname;
+ @SerializedName("vmname")
+ private String vmname;
- public VFCHealActionVmInfo() {
- // Default constructor for VFCHealActionVmInfo
- }
+ public VFCHealActionVmInfo() {
+ // Default constructor for VFCHealActionVmInfo
+ }
- public String getVmid() {
- return vmid;
- }
+ public String getVmid() {
+ return vmid;
+ }
- public void setVmid(String vmid) {
- this.vmid = vmid;
- }
+ public void setVmid(String vmid) {
+ this.vmid = vmid;
+ }
- public String getVmname() {
- return vmname;
- }
+ public String getVmname() {
+ return vmname;
+ }
- public void setVmname(String vmname) {
- this.vmname = vmname;
- }
+ public void setVmname(String vmname) {
+ this.vmname = vmname;
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
index 5c7555383..393e3761f 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealAdditionalParams.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,37 +19,37 @@
package org.onap.policy.vfc;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class VFCHealAdditionalParams implements Serializable {
- private static final long serialVersionUID = 2656694137285096191L;
+ private static final long serialVersionUID = 2656694137285096191L;
- @SerializedName("action")
- private String action;
+ @SerializedName("action")
+ private String action;
- @SerializedName("actionvminfo")
- private VFCHealActionVmInfo actionInfo;
+ @SerializedName("actionvminfo")
+ private VFCHealActionVmInfo actionInfo;
- public VFCHealAdditionalParams() {
- // Default constructor for VFCHealAdditionalParams
- }
+ public VFCHealAdditionalParams() {
+ // Default constructor for VFCHealAdditionalParams
+ }
- public String getAction() {
- return action;
- }
+ public String getAction() {
+ return action;
+ }
- public void setAction(String action) {
- this.action = action;
- }
+ public void setAction(String action) {
+ this.action = action;
+ }
- public VFCHealActionVmInfo getActionInfo() {
- return actionInfo;
- }
+ public VFCHealActionVmInfo getActionInfo() {
+ return actionInfo;
+ }
- public void setActionInfo(VFCHealActionVmInfo actionInfo) {
- this.actionInfo = actionInfo;
- }
+ public void setActionInfo(VFCHealActionVmInfo actionInfo) {
+ this.actionInfo = actionInfo;
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
index 11ea495a8..75b9566b1 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCHealRequest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,48 +19,48 @@
package org.onap.policy.vfc;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class VFCHealRequest implements Serializable {
- private static final long serialVersionUID = -7341931593089709247L;
+ private static final long serialVersionUID = -7341931593089709247L;
- @SerializedName("vnfInstanceId")
- private String vnfInstanceId;
+ @SerializedName("vnfInstanceId")
+ private String vnfInstanceId;
- @SerializedName("cause")
- private String cause;
+ @SerializedName("cause")
+ private String cause;
- @SerializedName("additionalParams")
- private VFCHealAdditionalParams additionalParams;
+ @SerializedName("additionalParams")
+ private VFCHealAdditionalParams additionalParams;
- public VFCHealRequest() {
- // Default constructor for VFCHealRequest
- }
+ public VFCHealRequest() {
+ // Default constructor for VFCHealRequest
+ }
- public String getVnfInstanceId() {
- return vnfInstanceId;
- }
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
- public void setVnfInstanceId(String vnfInstanceId) {
- this.vnfInstanceId = vnfInstanceId;
- }
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
- public String getCause() {
- return cause;
- }
+ public String getCause() {
+ return cause;
+ }
- public void setCause(String cause) {
- this.cause = cause;
- }
+ public void setCause(String cause) {
+ this.cause = cause;
+ }
- public VFCHealAdditionalParams getAdditionalParams() {
- return additionalParams;
- }
+ public VFCHealAdditionalParams getAdditionalParams() {
+ return additionalParams;
+ }
- public void setAdditionalParams(VFCHealAdditionalParams additionalParams) {
- this.additionalParams = additionalParams;
- }
+ public void setAdditionalParams(VFCHealAdditionalParams additionalParams) {
+ this.additionalParams = additionalParams;
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
index e5c9f5db9..1a8d603b5 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017-2018 Intel Corp, AT&T. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,6 +47,12 @@ public final class VFCManager implements Runnable {
// The REST manager used for processing REST calls for this VFC manager
private RESTManager restManager;
+ /**
+ * Constructor.
+ *
+ * @param wm Drools working memory
+ * @param request request
+ */
public VFCManager(WorkingMemory wm, VFCRequest request) {
if (wm == null || request == null) {
throw new IllegalArgumentException(
@@ -61,6 +68,13 @@ public final class VFCManager implements Runnable {
PolicyEngine.manager.getEnvironmentProperty("vfc.password"));
}
+ /**
+ * Set the parameters.
+ *
+ * @param baseUrl base URL
+ * @param name username
+ * @param pwd password
+ */
public void setVFCParams(String baseUrl, String name, String pwd) {
vfcUrlBase = baseUrl + "/api/nslcm/v1";
username = name;
@@ -148,7 +162,7 @@ public final class VFCManager implements Runnable {
}
/**
- * Protected setter for rest manager to allow mocked rest manager to be used for testing
+ * Protected setter for rest manager to allow mocked rest manager to be used for testing.
*
* @param restManager the test REST manager
*/
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
index 78802d641..cfcaf8039 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCRequest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,11 +19,11 @@
package org.onap.policy.vfc;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.UUID;
-import com.google.gson.annotations.SerializedName;
-
public class VFCRequest implements Serializable {
private static final long serialVersionUID = 3736300970326332512L;
@@ -34,30 +35,30 @@ public class VFCRequest implements Serializable {
private VFCHealRequest healRequest;
public VFCRequest() {
- // Default constructor for VFCRequest
+ // Default constructor for VFCRequest
}
- public String getNSInstanceId() {
- return nsInstanceId;
- }
+ public String getNSInstanceId() {
+ return nsInstanceId;
+ }
- public void setNSInstanceId(String nsInstanceId) {
- this.nsInstanceId = nsInstanceId;
- }
+ public void setNSInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
- public UUID getRequestId() {
- return requestId;
- }
+ public UUID getRequestId() {
+ return requestId;
+ }
- public void setRequestId(UUID requestId) {
- this.requestId = requestId;
- }
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
- public VFCHealRequest getHealRequest() {
- return healRequest;
- }
+ public VFCHealRequest getHealRequest() {
+ return healRequest;
+ }
- public void setHealRequest(VFCHealRequest healRequest) {
- this.healRequest = healRequest;
- }
+ public void setHealRequest(VFCHealRequest healRequest) {
+ this.healRequest = healRequest;
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java
index 38b73b306..21e9472b7 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponse.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,10 +19,10 @@
package org.onap.policy.vfc;
-import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
+import java.io.Serializable;
+
public class VFCResponse implements Serializable {
private static final long serialVersionUID = 9151443891238218455L;
@@ -35,30 +36,30 @@ public class VFCResponse implements Serializable {
private transient String requestId;
public VFCResponse() {
- // Default constructor for VFCResponse
+ // Default constructor for VFCResponse
}
- public String getJobId() {
- return jobId;
- }
+ public String getJobId() {
+ return jobId;
+ }
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
- public VFCResponseDescriptor getResponseDescriptor() {
- return responseDescriptor;
- }
+ public VFCResponseDescriptor getResponseDescriptor() {
+ return responseDescriptor;
+ }
- public void setResponseDescriptor(VFCResponseDescriptor responseDescriptor) {
- this.responseDescriptor = responseDescriptor;
- }
+ public void setResponseDescriptor(VFCResponseDescriptor responseDescriptor) {
+ this.responseDescriptor = responseDescriptor;
+ }
- public String getRequestId() {
- return requestId;
- }
+ public String getRequestId() {
+ return requestId;
+ }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java
index f237554fd..cdd4a39a9 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCResponseDescriptor.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +19,10 @@
package org.onap.policy.vfc;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.List;
-import com.google.gson.annotations.SerializedName;
public class VFCResponseDescriptor implements Serializable {
@@ -45,54 +47,54 @@ public class VFCResponseDescriptor implements Serializable {
private List<VFCResponseDescriptor> responseHistoryList;
public VFCResponseDescriptor() {
- // Default constructor for VFCResponseDescriptor
+ // Default constructor for VFCResponseDescriptor
}
public String getStatus() {
- return status;
+ return status;
}
- public String getProgress() {
- return progress;
- }
+ public String getProgress() {
+ return progress;
+ }
- public void setProgress(String progress) {
- this.progress = progress;
- }
+ public void setProgress(String progress) {
+ this.progress = progress;
+ }
- public String getStatusDescription() {
- return statusDescription;
- }
+ public String getStatusDescription() {
+ return statusDescription;
+ }
- public void setStatusDescription(String statusDescription) {
- this.statusDescription = statusDescription;
- }
+ public void setStatusDescription(String statusDescription) {
+ this.statusDescription = statusDescription;
+ }
- public String getErrorCode() {
- return errorCode;
- }
+ public String getErrorCode() {
+ return errorCode;
+ }
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
- public String getResponseId() {
- return responseId;
- }
+ public String getResponseId() {
+ return responseId;
+ }
- public void setResponseId(String responseId) {
- this.responseId = responseId;
- }
+ public void setResponseId(String responseId) {
+ this.responseId = responseId;
+ }
- public List<VFCResponseDescriptor> getResponseHistoryList() {
- return responseHistoryList;
- }
+ public List<VFCResponseDescriptor> getResponseHistoryList() {
+ return responseHistoryList;
+ }
- public void setResponseHistoryList(List<VFCResponseDescriptor> responseHistoryList) {
- this.responseHistoryList = responseHistoryList;
- }
+ public void setResponseHistoryList(List<VFCResponseDescriptor> responseHistoryList) {
+ this.responseHistoryList = responseHistoryList;
+ }
- public void setStatus(String status) {
- this.status = status;
- }
+ public void setStatus(String status) {
+ this.status = status;
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java
index dc8662b84..2259296d2 100644
--- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java
+++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java
@@ -22,11 +22,11 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public final class Serialization {
- private Serialization() {
- }
-
- public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping()
- .setPrettyPrinting()
- .create();
+ private Serialization() {
+ }
+
+ public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping()
+ .setPrettyPrinting()
+ .create();
}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
index 69d3d5838..a5f40f30e 100644
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestDemo.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2017 Intel Corp. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +67,7 @@ public class TestDemo {
responseDescriptor.setErrorCode(null);
responseDescriptor.setResponseId("11");
- response.getResponseDescriptor().setResponseHistoryList(new LinkedList<>());
+ response.getResponseDescriptor().setResponseHistoryList(new LinkedList<>());
response.getResponseDescriptor().getResponseHistoryList().add(responseDescriptor);
body = Serialization.gsonPretty.toJson(response);
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealActionVmInfo.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealActionVmInfo.java
deleted file mode 100644
index ab57f6415..000000000
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealActionVmInfo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * 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.vfc;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class TestVFCHealActionVmInfo {
-
- @Test
- public void testVFCHealActionVmInfo() {
- VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo();
- assertNotNull(actionInfo);
- assertNotEquals(0, actionInfo.hashCode());
-
- String vmid = "ECity";
- actionInfo.setVmid(vmid);
- assertEquals(vmid, actionInfo.getVmid());
-
- String vmName = "Emerald City";
- actionInfo.setVmname(vmName);
- assertEquals(vmName, actionInfo.getVmname());
-
- assertNotEquals(0, actionInfo.hashCode());
- }
-}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCManager.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCManager.java
deleted file mode 100644
index fa2a1ee9f..000000000
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCManager.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson, AT&T. All rights reserved.
- * ================================================================================
- * 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.vfc;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.anyMap;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.startsWith;
-import static org.mockito.Mockito.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.drools.core.WorkingMemory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.drools.system.PolicyEngine;
-import org.onap.policy.rest.RESTManager;
-import org.onap.policy.rest.RESTManager.Pair;
-import org.onap.policy.vfc.util.Serialization;
-
-public class TestVFCManager {
- private static WorkingMemory mockedWorkingMemory;
-
- private RESTManager mockedRESTManager;
-
- private Pair<Integer, String> httpResponsePutOK;
- private Pair<Integer, String> httpResponseGetOK;
- private Pair<Integer, String> httpResponseBadResponse;
- private Pair<Integer, String> httpResponseErr;
-
- private VFCRequest request;
- private VFCResponse response;
-
- @BeforeClass
- public static void beforeTestVFCManager() {
- mockedWorkingMemory = mock(WorkingMemory.class);
- }
-
- @Before
- public void setupMockedRest() {
- mockedRESTManager = mock(RESTManager.class);
-
- httpResponsePutOK = mockedRESTManager.new Pair<>(202, Serialization.gsonPretty.toJson(response));
- httpResponseGetOK = mockedRESTManager.new Pair<>(200, Serialization.gsonPretty.toJson(response));
- httpResponseBadResponse = mockedRESTManager.new Pair<>(202, Serialization.gsonPretty.toJson(null));
- httpResponseErr = mockedRESTManager.new Pair<>(200, null);
- }
-
- @Before
- public void createRequestAndResponse() {
- VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo();
- actionInfo.setVmid("TheWizard");
- actionInfo.setVmname("The Wizard of Oz");
-
- VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams();
- additionalParams.setAction("Go Home");
- additionalParams.setActionInfo(actionInfo);
-
- VFCHealRequest healRequest = new VFCHealRequest();
- healRequest.setAdditionalParams(additionalParams);
- healRequest.setCause("WestWitch");
- healRequest.setVnfInstanceId("EmeraldCity");
-
- UUID requestId = UUID.randomUUID();
- request = new VFCRequest();
- request.setHealRequest(healRequest);
- request.setNSInstanceId("Dorothy");
- request.setRequestId(requestId);
-
- List<VFCResponseDescriptor> responseHistoryList = new ArrayList<>();;
-
- VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor();
- responseDescriptor.setErrorCode("1234");
- responseDescriptor.setProgress("Follow The Yellow Brick Road");
- responseDescriptor.setResponseHistoryList(responseHistoryList);
- responseDescriptor.setResponseId(UUID.randomUUID().toString());
- responseDescriptor.setStatus("finished");
- responseDescriptor.setStatusDescription("There's no place like home");
-
- response = new VFCResponse();
- response.setJobId("1234");
- response.setRequestId(request.getRequestId().toString());
- response.setResponseDescriptor(responseDescriptor);
- }
-
- @After
- public void tearDown() {
- PolicyEngine.manager.getEnvironment().remove("vfc.password");
- PolicyEngine.manager.getEnvironment().remove("vfc.username");
- PolicyEngine.manager.getEnvironment().remove("vfc.url");
- }
-
- @Test
- public void testVFCInitiation() {
- try {
- new VFCManager(null, null);
- fail("test should throw an exception here");
- }
- catch (IllegalArgumentException e) {
- assertEquals("the parameters \"wm\" and \"request\" on the VFCManager constructor may not be null", e.getMessage());
- }
-
- try {
- new VFCManager(mockedWorkingMemory, null);
- fail("test should throw an exception here");
- }
- catch (IllegalArgumentException e) {
- assertEquals("the parameters \"wm\" and \"request\" on the VFCManager constructor may not be null", e.getMessage());
- }
-
- try {
- new VFCManager(mockedWorkingMemory, request);
- fail("test should throw an exception here");
- }
- catch (IllegalArgumentException e) {
- assertEquals("The value of policy engine manager environment property \"vfc.url\" may not be null", e.getMessage());
- }
-
- // add url; username & password are not required
- PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
- new VFCManager(mockedWorkingMemory, request);
-
- // url & username, but no password
- PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
-
- // url, username, and password
- PolicyEngine.manager.getEnvironment().put("vfc.password", "Toto");
- new VFCManager(mockedWorkingMemory, request);
- }
-
- @Test
- public void testVFCExecutionException() throws InterruptedException {
- PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
- PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
- PolicyEngine.manager.getEnvironment().put("vfc.password", "Exception");
-
- VFCManager manager = new VFCManager(mockedWorkingMemory, request);
- manager.setRestManager(mockedRESTManager);
-
- Thread managerThread = new Thread(manager);
- managerThread.start();
-
- when(mockedRESTManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Exception"), anyMap(), anyString(), anyString()))
- .thenThrow(new RuntimeException("OzException"));
-
- while (managerThread.isAlive()) {
- Thread.sleep(100);
- }
-
- PolicyEngine.manager.getEnvironment().remove("vfc.password");
- PolicyEngine.manager.getEnvironment().remove("vfc.username");
- PolicyEngine.manager.getEnvironment().remove("vfc.url");
- }
-
- @Test
- public void testVFCExecutionNull() throws InterruptedException {
- PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
- PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
- PolicyEngine.manager.getEnvironment().put("vfc.password", "Null");
-
- VFCManager manager = new VFCManager(mockedWorkingMemory, request);
- manager.setRestManager(mockedRESTManager);
-
- Thread managerThread = new Thread(manager);
- managerThread.start();
-
- when(mockedRESTManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Null"), anyMap(), anyString(), anyString()))
- .thenReturn(null);
-
- while (managerThread.isAlive()) {
- Thread.sleep(100);
- }
-
- PolicyEngine.manager.getEnvironment().remove("vfc.password");
- PolicyEngine.manager.getEnvironment().remove("vfc.username");
- PolicyEngine.manager.getEnvironment().remove("vfc.url");
- }
-
- @Test
- public void testVFCExecutionError0() throws InterruptedException {
- PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
- PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
- PolicyEngine.manager.getEnvironment().put("vfc.password", "Error0");
-
- VFCManager manager = new VFCManager(mockedWorkingMemory, request);
- manager.setRestManager(mockedRESTManager);
-
- Thread managerThread = new Thread(manager);
- managerThread.start();
-
- when(mockedRESTManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Error0"), anyMap(), anyString(), anyString()))
- .thenReturn(httpResponseErr);
-
- while (managerThread.isAlive()) {
- Thread.sleep(100);
- }
-
- PolicyEngine.manager.getEnvironment().remove("vfc.password");
- PolicyEngine.manager.getEnvironment().remove("vfc.username");
- PolicyEngine.manager.getEnvironment().remove("vfc.url");
- }
-
- @Test
- public void testVFCExecutionBadResponse() throws InterruptedException {
- PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
- PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
- PolicyEngine.manager.getEnvironment().put("vfc.password", "BadResponse");
-
- VFCManager manager = new VFCManager(mockedWorkingMemory, request);
- manager.setRestManager(mockedRESTManager);
-
- Thread managerThread = new Thread(manager);
- managerThread.start();
-
- when(mockedRESTManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString()))
- .thenReturn(httpResponseBadResponse);
-
- while (managerThread.isAlive()) {
- Thread.sleep(100);
- }
-
- PolicyEngine.manager.getEnvironment().remove("vfc.password");
- PolicyEngine.manager.getEnvironment().remove("vfc.username");
- PolicyEngine.manager.getEnvironment().remove("vfc.url");
- }
-
- @Test
- public void testVFCExecutionOK() throws InterruptedException {
- PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
- PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
- PolicyEngine.manager.getEnvironment().put("vfc.password", "OK");
-
- VFCManager manager = new VFCManager(mockedWorkingMemory, request);
- manager.setRestManager(mockedRESTManager);
-
- Thread managerThread = new Thread(manager);
- managerThread.start();
-
- when(mockedRESTManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString()))
- .thenReturn(httpResponsePutOK);
-
- when(mockedRESTManager.get(endsWith("1234"), eq("Dorothy"), eq("OK"), anyMap()))
- .thenReturn(httpResponseGetOK);
-
- while (managerThread.isAlive()) {
- Thread.sleep(100);
- }
-
- PolicyEngine.manager.getEnvironment().remove("vfc.password");
- PolicyEngine.manager.getEnvironment().remove("vfc.username");
- PolicyEngine.manager.getEnvironment().remove("vfc.url");
- }
-}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCResponseDescriptor.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCResponseDescriptor.java
deleted file mode 100644
index a2b59dd20..000000000
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCResponseDescriptor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * vfc
- * ================================================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * 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.vfc;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-public class TestVFCResponseDescriptor {
-
- @Test
- public void testVFCResponseDescriptor() {
- VFCResponseDescriptor descriptor = new VFCResponseDescriptor();
- assertNotNull(descriptor);
- assertNotEquals(0, descriptor.hashCode());
-
- String errorCode = "WitchIsDead";
- descriptor.setErrorCode(errorCode);
- assertEquals(errorCode, descriptor.getErrorCode());
-
- String progress = "Visited Wizard";
- descriptor.setProgress(progress);
- assertEquals(progress, descriptor.getProgress());
-
- List<VFCResponseDescriptor> responseHistoryList = new ArrayList<>();
- descriptor.setResponseHistoryList(responseHistoryList);
- assertEquals(responseHistoryList, descriptor.getResponseHistoryList());
-
- String responseId = "WishHard";
- descriptor.setResponseId(responseId);
- assertEquals(responseId, descriptor.getResponseId());
-
- String status = "Back in Kansas";
- descriptor.setStatus(status);
- assertEquals(status, descriptor.getStatus());
-
- String statusDescription = "Back on the prairie";
- descriptor.setStatusDescription(statusDescription);
- assertEquals(statusDescription, descriptor.getStatusDescription());
-
- assertNotEquals(0, descriptor.hashCode());
- }
-}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCRequest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealActionVmInfo.java
index 64307fec8..55f9ab8d5 100644
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCRequest.java
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealActionVmInfo.java
@@ -3,6 +3,7 @@
* vfc
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,32 +21,28 @@
package org.onap.policy.vfc;
-import static org.junit.Assert.*;
-
-import java.util.UUID;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-public class TestVFCRequest {
-
- @Test
- public void testVFCRequest() {
- VFCRequest request = new VFCRequest();
- assertNotNull(request);
- assertNotEquals(0, request.hashCode());
-
- String nsInstanceId = "Dorothy";
- request.setNSInstanceId(nsInstanceId);
- assertEquals(nsInstanceId, request.getNSInstanceId());
-
- UUID requestId = UUID.randomUUID();
- request.setRequestId(requestId);
- assertEquals(requestId, request.getRequestId());
-
- VFCHealRequest healRequest = new VFCHealRequest();
- request.setHealRequest(healRequest);
- assertEquals(healRequest, request.getHealRequest());
-
- assertNotEquals(0, request.hashCode());
- }
+public class TestVfcHealActionVmInfo {
+
+ @Test
+ public void testVfcHealActionVmInfo() {
+ VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo();
+ assertNotNull(actionInfo);
+ assertNotEquals(0, actionInfo.hashCode());
+
+ String vmid = "ECity";
+ actionInfo.setVmid(vmid);
+ assertEquals(vmid, actionInfo.getVmid());
+
+ String vmName = "Emerald City";
+ actionInfo.setVmname(vmName);
+ assertEquals(vmName, actionInfo.getVmname());
+
+ assertNotEquals(0, actionInfo.hashCode());
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCResponse.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealAdditionalParams.java
index 36591a910..b74fe1a93 100644
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCResponse.java
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealAdditionalParams.java
@@ -3,6 +3,7 @@
* vfc
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,30 +21,28 @@
package org.onap.policy.vfc;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-public class TestVFCResponse {
-
- @Test
- public void testVFCResponse() {
- VFCResponse response = new VFCResponse();
- assertNotNull(response);
- assertNotEquals(0, response.hashCode());
-
- String jobId = "GetToOz";
- response.setJobId(jobId);
- assertEquals(jobId, response.getJobId());
-
- String requestId = "Get Home";
- response.setRequestId(requestId);
- assertEquals(requestId, response.getRequestId());
-
- VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor();
- response.setResponseDescriptor(responseDescriptor);
- assertEquals(responseDescriptor, response.getResponseDescriptor());
-
- assertNotEquals(0, response.hashCode());
- }
+public class TestVfcHealAdditionalParams {
+
+ @Test
+ public void testVfcHealAdditionalParameters() {
+ VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams();
+ assertNotNull(additionalParams);
+ assertNotEquals(0, additionalParams.hashCode());
+
+ String action = "Go Home";
+ additionalParams.setAction(action);
+ assertEquals(action, additionalParams.getAction());
+
+ VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo();
+ additionalParams.setActionInfo(actionInfo );
+ assertEquals(actionInfo, additionalParams.getActionInfo());
+
+ assertNotEquals(0, additionalParams.hashCode());
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealRequest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealRequest.java
new file mode 100644
index 000000000..4c442bc2c
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcHealRequest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * vfc
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
+ * ================================================================================
+ * 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.vfc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class TestVfcHealRequest {
+
+ @Test
+ public void testVfcHealRequest() {
+ VFCHealRequest request = new VFCHealRequest();
+ assertNotNull(request);
+ assertNotEquals(0, request.hashCode());
+
+ String vnfInstanceId = "Go To Oz";
+ request.setVnfInstanceId(vnfInstanceId);
+ assertEquals(vnfInstanceId, request.getVnfInstanceId());
+
+ String cause = "West Witch";
+ request.setCause(cause);
+ assertEquals(cause, request.getCause());
+
+ VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams();
+ request.setAdditionalParams(additionalParams);
+ assertEquals(additionalParams, request.getAdditionalParams());
+
+ assertNotEquals(0, request.hashCode());
+ }
+}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java
new file mode 100644
index 000000000..9913d39b8
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java
@@ -0,0 +1,303 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * vfc
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson, AT&T. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
+ * ================================================================================
+ * 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.vfc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.endsWith;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.startsWith;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.drools.core.WorkingMemory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.policy.drools.system.PolicyEngine;
+import org.onap.policy.rest.RESTManager;
+import org.onap.policy.rest.RESTManager.Pair;
+import org.onap.policy.vfc.util.Serialization;
+
+public class TestVfcManager {
+ private static WorkingMemory mockedWorkingMemory;
+
+ private RESTManager mockedRestManager;
+
+ private Pair<Integer, String> httpResponsePutOk;
+ private Pair<Integer, String> httpResponseGetOk;
+ private Pair<Integer, String> httpResponseBadResponse;
+ private Pair<Integer, String> httpResponseErr;
+
+ private VFCRequest request;
+ private VFCResponse response;
+
+ @BeforeClass
+ public static void beforeTestVfcManager() {
+ mockedWorkingMemory = mock(WorkingMemory.class);
+ }
+
+ /**
+ * Set up the mocked REST manager.
+ */
+ @Before
+ public void setupMockedRest() {
+ mockedRestManager = mock(RESTManager.class);
+
+ httpResponsePutOk = mockedRestManager.new Pair<>(202, Serialization.gsonPretty.toJson(response));
+ httpResponseGetOk = mockedRestManager.new Pair<>(200, Serialization.gsonPretty.toJson(response));
+ httpResponseBadResponse = mockedRestManager.new Pair<>(202, Serialization.gsonPretty.toJson(null));
+ httpResponseErr = mockedRestManager.new Pair<>(200, null);
+ }
+
+ /**
+ * Create the request and response before.
+ */
+ @Before
+ public void createRequestAndResponse() {
+ VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo();
+ actionInfo.setVmid("TheWizard");
+ actionInfo.setVmname("The Wizard of Oz");
+
+ VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams();
+ additionalParams.setAction("Go Home");
+ additionalParams.setActionInfo(actionInfo);
+
+ VFCHealRequest healRequest = new VFCHealRequest();
+ healRequest.setAdditionalParams(additionalParams);
+ healRequest.setCause("WestWitch");
+ healRequest.setVnfInstanceId("EmeraldCity");
+
+ final UUID requestId = UUID.randomUUID();
+ request = new VFCRequest();
+ request.setHealRequest(healRequest);
+ request.setNSInstanceId("Dorothy");
+ request.setRequestId(requestId);
+
+ List<VFCResponseDescriptor> responseHistoryList = new ArrayList<>();;
+
+ VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor();
+ responseDescriptor.setErrorCode("1234");
+ responseDescriptor.setProgress("Follow The Yellow Brick Road");
+ responseDescriptor.setResponseHistoryList(responseHistoryList);
+ responseDescriptor.setResponseId(UUID.randomUUID().toString());
+ responseDescriptor.setStatus("finished");
+ responseDescriptor.setStatusDescription("There's no place like home");
+
+ response = new VFCResponse();
+ response.setJobId("1234");
+ response.setRequestId(request.getRequestId().toString());
+ response.setResponseDescriptor(responseDescriptor);
+ }
+
+ /**
+ * Remove the environnment.
+ */
+ @After
+ public void tearDown() {
+ PolicyEngine.manager.getEnvironment().remove("vfc.password");
+ PolicyEngine.manager.getEnvironment().remove("vfc.username");
+ PolicyEngine.manager.getEnvironment().remove("vfc.url");
+ }
+
+ @Test
+ public void testVfcInitiation() {
+ try {
+ new VFCManager(null, null);
+ fail("test should throw an exception here");
+ }
+ catch (IllegalArgumentException e) {
+ assertEquals("the parameters \"wm\" and \"request\" on the VFCManager constructor may not be null",
+ e.getMessage());
+ }
+
+ try {
+ new VFCManager(mockedWorkingMemory, null);
+ fail("test should throw an exception here");
+ }
+ catch (IllegalArgumentException e) {
+ assertEquals("the parameters \"wm\" and \"request\" on the VFCManager constructor may not be null",
+ e.getMessage());
+ }
+
+ try {
+ new VFCManager(mockedWorkingMemory, request);
+ fail("test should throw an exception here");
+ }
+ catch (IllegalArgumentException e) {
+ assertEquals("The value of policy engine manager environment property \"vfc.url\" may not be null",
+ e.getMessage());
+ }
+
+ // add url; username & password are not required
+ PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
+ new VFCManager(mockedWorkingMemory, request);
+
+ // url & username, but no password
+ PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
+
+ // url, username, and password
+ PolicyEngine.manager.getEnvironment().put("vfc.password", "Toto");
+ new VFCManager(mockedWorkingMemory, request);
+ }
+
+ @Test
+ public void testVfcExecutionException() throws InterruptedException {
+ PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
+ PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
+ PolicyEngine.manager.getEnvironment().put("vfc.password", "Exception");
+
+ VFCManager manager = new VFCManager(mockedWorkingMemory, request);
+ manager.setRestManager(mockedRestManager);
+
+ Thread managerThread = new Thread(manager);
+ managerThread.start();
+
+ when(mockedRestManager.post(
+ startsWith("http://somewhere.over.the.rainbow"),
+ eq("Dorothy"),
+ eq("Exception"),
+ anyMap(),
+ anyString(),
+ anyString()))
+ .thenThrow(new RuntimeException("OzException"));
+
+ while (managerThread.isAlive()) {
+ Thread.sleep(100);
+ }
+
+ PolicyEngine.manager.getEnvironment().remove("vfc.password");
+ PolicyEngine.manager.getEnvironment().remove("vfc.username");
+ PolicyEngine.manager.getEnvironment().remove("vfc.url");
+ }
+
+ @Test
+ public void testVfcExecutionNull() throws InterruptedException {
+ PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
+ PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
+ PolicyEngine.manager.getEnvironment().put("vfc.password", "Null");
+
+ VFCManager manager = new VFCManager(mockedWorkingMemory, request);
+ manager.setRestManager(mockedRestManager);
+
+ Thread managerThread = new Thread(manager);
+ managerThread.start();
+
+ when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"),
+ eq("Dorothy"), eq("Null"), anyMap(), anyString(), anyString()))
+ .thenReturn(null);
+
+ while (managerThread.isAlive()) {
+ Thread.sleep(100);
+ }
+
+ PolicyEngine.manager.getEnvironment().remove("vfc.password");
+ PolicyEngine.manager.getEnvironment().remove("vfc.username");
+ PolicyEngine.manager.getEnvironment().remove("vfc.url");
+ }
+
+ @Test
+ public void testVfcExecutionError0() throws InterruptedException {
+ PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
+ PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
+ PolicyEngine.manager.getEnvironment().put("vfc.password", "Error0");
+
+ VFCManager manager = new VFCManager(mockedWorkingMemory, request);
+ manager.setRestManager(mockedRestManager);
+
+ Thread managerThread = new Thread(manager);
+ managerThread.start();
+
+ when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"),
+ eq("Dorothy"), eq("Error0"), anyMap(), anyString(), anyString()))
+ .thenReturn(httpResponseErr);
+
+ while (managerThread.isAlive()) {
+ Thread.sleep(100);
+ }
+
+ PolicyEngine.manager.getEnvironment().remove("vfc.password");
+ PolicyEngine.manager.getEnvironment().remove("vfc.username");
+ PolicyEngine.manager.getEnvironment().remove("vfc.url");
+ }
+
+ @Test
+ public void testVfcExecutionBadResponse() throws InterruptedException {
+ PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
+ PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
+ PolicyEngine.manager.getEnvironment().put("vfc.password", "BadResponse");
+
+ VFCManager manager = new VFCManager(mockedWorkingMemory, request);
+ manager.setRestManager(mockedRestManager);
+
+ Thread managerThread = new Thread(manager);
+ managerThread.start();
+
+ when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"),
+ eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString()))
+ .thenReturn(httpResponseBadResponse);
+
+ while (managerThread.isAlive()) {
+ Thread.sleep(100);
+ }
+
+ PolicyEngine.manager.getEnvironment().remove("vfc.password");
+ PolicyEngine.manager.getEnvironment().remove("vfc.username");
+ PolicyEngine.manager.getEnvironment().remove("vfc.url");
+ }
+
+ @Test
+ public void testVfcExecutionOk() throws InterruptedException {
+ PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow");
+ PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy");
+ PolicyEngine.manager.getEnvironment().put("vfc.password", "OK");
+
+ VFCManager manager = new VFCManager(mockedWorkingMemory, request);
+ manager.setRestManager(mockedRestManager);
+
+ Thread managerThread = new Thread(manager);
+ managerThread.start();
+
+ when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"),
+ eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString()))
+ .thenReturn(httpResponsePutOk);
+
+ when(mockedRestManager.get(endsWith("1234"), eq("Dorothy"), eq("OK"), anyMap()))
+ .thenReturn(httpResponseGetOk);
+
+ while (managerThread.isAlive()) {
+ Thread.sleep(100);
+ }
+
+ PolicyEngine.manager.getEnvironment().remove("vfc.password");
+ PolicyEngine.manager.getEnvironment().remove("vfc.username");
+ PolicyEngine.manager.getEnvironment().remove("vfc.url");
+ }
+}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealAdditionalParams.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcRequest.java
index 7fa8fd741..0ec5d7d82 100644
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealAdditionalParams.java
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcRequest.java
@@ -3,6 +3,7 @@
* vfc
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,26 +21,34 @@
package org.onap.policy.vfc;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.UUID;
import org.junit.Test;
-public class TestVFCHealAdditionalParams {
-
- @Test
- public void testVFCHealAdditionalParameters() {
- VFCHealAdditionalParams additionalParams = new VFCHealAdditionalParams();
- assertNotNull(additionalParams);
- assertNotEquals(0, additionalParams.hashCode());
-
- String action = "Go Home";
- additionalParams.setAction(action);
- assertEquals(action, additionalParams.getAction());
-
- VFCHealActionVmInfo actionInfo = new VFCHealActionVmInfo();
- additionalParams.setActionInfo(actionInfo );
- assertEquals(actionInfo, additionalParams.getActionInfo());
-
- assertNotEquals(0, additionalParams.hashCode());
- }
+public class TestVfcRequest {
+
+ @Test
+ public void testVfcRequest() {
+ VFCRequest request = new VFCRequest();
+ assertNotNull(request);
+ assertNotEquals(0, request.hashCode());
+
+ String nsInstanceId = "Dorothy";
+ request.setNSInstanceId(nsInstanceId);
+ assertEquals(nsInstanceId, request.getNSInstanceId());
+
+ UUID requestId = UUID.randomUUID();
+ request.setRequestId(requestId);
+ assertEquals(requestId, request.getRequestId());
+
+ VFCHealRequest healRequest = new VFCHealRequest();
+ request.setHealRequest(healRequest);
+ assertEquals(healRequest, request.getHealRequest());
+
+ assertNotEquals(0, request.hashCode());
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealRequest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcResponse.java
index 5a78bfb0c..698459ad2 100644
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVFCHealRequest.java
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcResponse.java
@@ -3,6 +3,7 @@
* vfc
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,30 +21,32 @@
package org.onap.policy.vfc;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-public class TestVFCHealRequest {
-
- @Test
- public void testVFCHealRequest() {
- VFCHealRequest request = new VFCHealRequest();
- assertNotNull(request);
- assertNotEquals(0, request.hashCode());
-
- String vnfInstanceId = "Go To Oz";
- request.setVnfInstanceId(vnfInstanceId);
- assertEquals(vnfInstanceId, request.getVnfInstanceId());
-
- String cause = "West Witch";
- request.setCause(cause);
- assertEquals(cause, request.getCause());
-
- VFCHealAdditionalParams additionalParams= new VFCHealAdditionalParams();
- request.setAdditionalParams(additionalParams);
- assertEquals(additionalParams, request.getAdditionalParams());
-
- assertNotEquals(0, request.hashCode());
- }
+public class TestVfcResponse {
+
+ @Test
+ public void testVfcResponse() {
+ VFCResponse response = new VFCResponse();
+ assertNotNull(response);
+ assertNotEquals(0, response.hashCode());
+
+ String jobId = "GetToOz";
+ response.setJobId(jobId);
+ assertEquals(jobId, response.getJobId());
+
+ String requestId = "Get Home";
+ response.setRequestId(requestId);
+ assertEquals(requestId, response.getRequestId());
+
+ VFCResponseDescriptor responseDescriptor = new VFCResponseDescriptor();
+ response.setResponseDescriptor(responseDescriptor);
+ assertEquals(responseDescriptor, response.getResponseDescriptor());
+
+ assertNotEquals(0, response.hashCode());
+ }
}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcResponseDescriptor.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcResponseDescriptor.java
new file mode 100644
index 000000000..927306fd8
--- /dev/null
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcResponseDescriptor.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * vfc
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
+ * ================================================================================
+ * 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.vfc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+public class TestVfcResponseDescriptor {
+
+ @Test
+ public void testVfcResponseDescriptor() {
+ VFCResponseDescriptor descriptor = new VFCResponseDescriptor();
+ assertNotNull(descriptor);
+ assertNotEquals(0, descriptor.hashCode());
+
+ String errorCode = "WitchIsDead";
+ descriptor.setErrorCode(errorCode);
+ assertEquals(errorCode, descriptor.getErrorCode());
+
+ String progress = "Visited Wizard";
+ descriptor.setProgress(progress);
+ assertEquals(progress, descriptor.getProgress());
+
+ List<VFCResponseDescriptor> responseHistoryList = new ArrayList<>();
+ descriptor.setResponseHistoryList(responseHistoryList);
+ assertEquals(responseHistoryList, descriptor.getResponseHistoryList());
+
+ String responseId = "WishHard";
+ descriptor.setResponseId(responseId);
+ assertEquals(responseId, descriptor.getResponseId());
+
+ String status = "Back in Kansas";
+ descriptor.setStatus(status);
+ assertEquals(status, descriptor.getStatus());
+
+ String statusDescription = "Back on the prairie";
+ descriptor.setStatusDescription(statusDescription);
+ assertEquals(statusDescription, descriptor.getStatusDescription());
+
+ assertNotEquals(0, descriptor.hashCode());
+ }
+}
diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/TestSerialization.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/TestSerialization.java
index 3c4f6154e..b66806213 100644
--- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/TestSerialization.java
+++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/TestSerialization.java
@@ -3,6 +3,7 @@
* vfc
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 AT&T Corporation. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,14 +21,14 @@
package org.onap.policy.vfc.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
public class TestSerialization {
- @Test
- public void test() {
- assertNotNull(Serialization.gsonPretty);
- }
+ @Test
+ public void test() {
+ assertNotNull(Serialization.gsonPretty);
+ }
}