summaryrefslogtreecommitdiffstats
path: root/models-interactions
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions')
-rw-r--r--models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java25
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java91
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java101
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java92
-rw-r--r--models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java120
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java27
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java72
-rw-r--r--models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java30
-rw-r--r--models-interactions/model-yaml/pom.xml127
-rw-r--r--models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java66
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java96
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java663
-rw-r--r--models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java50
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml32
-rw-r--r--models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml19
-rw-r--r--models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml4
16 files changed, 672 insertions, 943 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java
index eb82ae231..f26034389 100644
--- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,16 +32,16 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableMap;
import com.google.protobuf.Struct;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
@@ -68,8 +69,6 @@ public class CdsActorServiceProviderTest {
private static final String SUBREQUEST_ID = "123456";
private static final String CDS_RECIPE = "test-cds-recipe";
- @Rule
- public ExpectedException exceptionRule = ExpectedException.none();
@Mock
private CdsProcessorGrpcClient cdsClient;
private CdsActorServiceProvider cdsActor;
@@ -132,16 +131,14 @@ public class CdsActorServiceProviderTest {
@Test
public void testConstructRequestWhenMissingCdsParamsInPolicyPayload() {
policy.setPayload(new HashMap<>());
- Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor
- .constructRequest(onset, operation, policy, aaiParams);
+ Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor.constructRequest(onset, operation, policy, aaiParams);
assertFalse(cdsRequestOpt.isPresent());
}
@Test
public void testConstructRequest() {
- Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor
- .constructRequest(onset, operation, policy, aaiParams);
+ Optional<ExecutionServiceInput> cdsRequestOpt = cdsActor.constructRequest(onset, operation, policy, aaiParams);
assertTrue(cdsRequestOpt.isPresent());
final ExecutionServiceInput cdsRequest = cdsRequestOpt.get();
@@ -187,13 +184,13 @@ public class CdsActorServiceProviderTest {
public void testSendRequestToCdsLatchInterrupted() throws InterruptedException {
// Reset cdsClient
CountDownLatch countDownLatch = mock(CountDownLatch.class);
- doThrow(new InterruptedException("Test latch interrupted failure")).when(countDownLatch)
- .await(anyLong(), any(TimeUnit.class));
+ doThrow(new InterruptedException("Test latch interrupted failure")).when(countDownLatch).await(anyLong(),
+ any(TimeUnit.class));
when(cdsClient.sendRequest(any(ExecutionServiceInput.class))).thenReturn(countDownLatch);
CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager();
- CdsResponse response = cdsActorSvcMgr
- .sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());
+ CdsResponse response =
+ cdsActorSvcMgr.sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());
assertTrue(Thread.interrupted());
assertNotNull(response);
assertEquals(CdsActorConstants.INTERRUPTED, response.getStatus());
@@ -202,8 +199,8 @@ public class CdsActorServiceProviderTest {
@Test
public void testSendRequestToCdsLatchTimedOut() {
CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager();
- CdsResponse response = cdsActorSvcMgr
- .sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());
+ CdsResponse response =
+ cdsActorSvcMgr.sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build());
assertNotNull(response);
assertEquals(CdsActorConstants.TIMED_OUT, response.getStatus());
}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
index 61b6e3afd..d5e8b6c2a 100644
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
+++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java
@@ -3,7 +3,7 @@
* sdc
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,23 +23,22 @@ package org.onap.policy.sdc;
import java.io.Serializable;
import java.util.UUID;
-import lombok.Getter;
-import lombok.Setter;
-@Getter
-@Setter
+import lombok.Data;
+
+@Data
public class Resource implements Serializable {
private static final long serialVersionUID = -913729158733348027L;
- private UUID resourceUuid;
- private UUID resourceInvariantUuid;
- private String resourceName;
- private String resourceVersion;
- private String resourceType;
+ private UUID resourceUuid;
+ private UUID resourceInvariantUuid;
+ private String resourceName;
+ private String resourceVersion;
+ private String resourceType;
public Resource() {
- //Empty Constructor
+ // Empty Constructor
}
/**
@@ -80,74 +79,4 @@ public class Resource implements Serializable {
this.resourceVersion = version;
this.resourceType = type;
}
-
- @Override
- public String toString() {
- 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 + ((resourceName == null) ? 0 : resourceName.hashCode());
- result = prime * result + ((resourceType == null) ? 0 : resourceType.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) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Resource other = (Resource) obj;
- if (resourceInvariantUuid == null) {
- if (other.resourceInvariantUuid != null) {
- return false;
- }
- } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
- return false;
- }
- if (resourceName == null) {
- if (other.resourceName != null) {
- return false;
- }
- } else if (!resourceName.equals(other.resourceName)) {
- return false;
- }
- if (resourceType == null) {
- if (other.resourceType != null) {
- return false;
- }
- } else if (!resourceType.equals(other.resourceType)) {
- return false;
- }
- if (resourceUuid == null) {
- if (other.resourceUuid != null) {
- return false;
- }
- } else if (!resourceUuid.equals(other.resourceUuid)) {
- return false;
- }
- if (resourceVersion == null) {
- if (other.resourceVersion != null) {
- return false;
- }
- } else if (!resourceVersion.equals(other.resourceVersion)) {
- return false;
- }
- return true;
- }
-
}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
index 05842e24c..0b6068dce 100644
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
+++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java
@@ -21,26 +21,31 @@
package org.onap.policy.sdc;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.UUID;
-import lombok.Getter;
-import lombok.Setter;
-@Getter
-@Setter
+import lombok.Data;
+
+@Data
public class ResourceInstance implements Serializable {
private static final long serialVersionUID = -5506162340393802424L;
+ @SerializedName("ResourceUUID")
+ private UUID resourceUuid;
+
private String resourceInstanceName;
private String resourceName;
- private UUID resourceInvariantUuid;
private String resourceVersion;
private String resourceType;
- private UUID resourceUuid;
+
+ @SerializedName("ResourceInvariantUUID")
+ private UUID resourceInvariantUuid;
public ResourceInstance() {
- //Empty Constructor
+ // Empty Constructor
}
/**
@@ -59,86 +64,4 @@ public class ResourceInstance implements Serializable {
this.resourceType = instance.resourceType;
this.resourceUuid = instance.resourceUuid;
}
-
- public UUID getResourceInvariantUUID() {
- return resourceInvariantUuid;
- }
-
- public void setResourceInvariantUUID(UUID resourceInvariantUuid) {
- this.resourceInvariantUuid = resourceInvariantUuid;
- }
-
- @Override
- public String toString() {
- return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName
- + ", 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 + ((resourceName == null) ? 0 : resourceName.hashCode());
- result = prime * result + ((resourceType == null) ? 0 : resourceType.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) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ResourceInstance other = (ResourceInstance) obj;
- if (resourceInstanceName == null) {
- if (other.resourceInstanceName != null) {
- return false;
- }
- } else if (!resourceInstanceName.equals(other.resourceInstanceName)) {
- return false;
- }
- if (resourceInvariantUuid == null) {
- if (other.resourceInvariantUuid != null) {
- return false;
- }
- } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
- return false;
- }
- if (resourceName == null) {
- if (other.resourceName != null) {
- return false;
- }
- } else if (!resourceName.equals(other.resourceName)) {
- return false;
- }
- if (resourceType != other.resourceType) {
- return false;
- }
- if (resourceUuid == null) {
- if (other.resourceUuid != null) {
- return false;
- }
- } else if (!resourceUuid.equals(other.resourceUuid)) {
- return false;
- }
- if (resourceVersion == null) {
- if (other.resourceVersion != null) {
- return false;
- }
- } else if (!resourceVersion.equals(other.resourceVersion)) {
- return false;
- }
- return true;
- }
-
}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
index 7ab2f9322..765eeec54 100644
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
+++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java
@@ -3,7 +3,7 @@
* sdc
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,28 +21,33 @@
package org.onap.policy.sdc;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.UUID;
-import lombok.Getter;
-import lombok.Setter;
-@Getter
-@Setter
+import lombok.Data;
+
+@Data
public class Service implements Serializable {
private static final long serialVersionUID = -1249276698549996806L;
- private UUID serviceUUID;
- private UUID serviceInvariantUUID;
+ @SerializedName("serviceUuid")
+ private UUID serviceUuid;
+
+ @SerializedName("serviceInvariantUuid")
+ private UUID serviceInvariantUuid;
+
private String serviceName;
private String serviceVersion;
public Service() {
- //Empty Constructor
+ // Empty Constructor
}
public Service(UUID uuid) {
- this.serviceUUID = uuid;
+ this.serviceUuid = uuid;
}
public Service(String name) {
@@ -53,13 +58,13 @@ public class Service implements Serializable {
* Constructor.
*
* @param uuid service id
- * @param invariantUUID service invariant 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;
+ public Service(UUID uuid, UUID invariantUuid, String name, String version) {
+ this.serviceUuid = uuid;
+ this.serviceInvariantUuid = invariantUuid;
this.serviceName = name;
this.serviceVersion = version;
}
@@ -70,66 +75,9 @@ public class Service implements Serializable {
* @param service copy object
*/
public Service(Service service) {
- this.serviceUUID = service.serviceUUID;
- this.serviceInvariantUUID = service.serviceInvariantUUID;
+ this.serviceUuid = service.serviceUuid;
+ this.serviceInvariantUuid = service.serviceInvariantUuid;
this.serviceName = service.serviceName;
this.serviceVersion = service.serviceVersion;
}
-
- @Override
- public String toString() {
- return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID
- + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((serviceInvariantUUID == null) ? 0 : serviceInvariantUUID.hashCode());
- result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
- result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode());
- result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Service other = (Service) obj;
- if (serviceInvariantUUID == null) {
- if (other.serviceInvariantUUID != null) {
- return false;
- }
- } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID)) {
- return false;
- }
- if (serviceName == null) {
- if (other.serviceName != null) {
- return false;
- }
- } else if (!serviceName.equals(other.serviceName)) {
- return false;
- }
- if (serviceUUID == null) {
- if (other.serviceUUID != null) {
- return false;
- }
- } else if (!serviceUUID.equals(other.serviceUUID)) {
- return false;
- }
- if (serviceVersion == null) {
- return other.serviceVersion == null;
- } else {
- return serviceVersion.equals(other.serviceVersion);
- }
- }
}
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
index e02952219..45e1dc56a 100644
--- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
+++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java
@@ -3,7 +3,7 @@
* sdc
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,27 +21,36 @@
package org.onap.policy.sdc;
+import com.google.gson.annotations.SerializedName;
+
import java.io.Serializable;
import java.util.UUID;
-import lombok.Getter;
-import lombok.Setter;
-@Getter
-@Setter
+import lombok.Data;
+
+@Data
public class ServiceInstance implements Serializable {
private static final long serialVersionUID = 6285260780966679625L;
- private UUID personaModelUUID;
- private UUID serviceUUID;
- private UUID serviceInstanceUUID;
- private UUID widgetModelUUID;
+ @SerializedName("personaModelUUID")
+ private UUID personaModelUuid;
+
+ @SerializedName("serviceUUID")
+ private UUID serviceUuid;
+
+ @SerializedName("serviceInstanceUUID")
+ private UUID serviceInstanceUuid;
+
+ @SerializedName("widgetModelUUID")
+ private UUID widgetModelUuid;
+
private String widgetModelVersion;
private String serviceName;
private String serviceInstanceName;
public ServiceInstance() {
- //Empty Constructor
+ // Empty Constructor
}
/**
@@ -53,95 +62,12 @@ public class ServiceInstance implements Serializable {
if (instance == null) {
return;
}
- this.personaModelUUID = instance.personaModelUUID;
- this.serviceUUID = instance.serviceUUID;
- this.serviceInstanceUUID = instance.serviceInstanceUUID;
- this.widgetModelUUID = instance.widgetModelUUID;
+ this.personaModelUuid = instance.personaModelUuid;
+ this.serviceUuid = instance.serviceUuid;
+ this.serviceInstanceUuid = instance.serviceInstanceUuid;
+ this.widgetModelUuid = instance.widgetModelUuid;
this.widgetModelVersion = instance.widgetModelVersion;
this.serviceName = instance.serviceName;
this.serviceInstanceName = instance.serviceInstanceName;
}
-
- @Override
- public String toString() {
- return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID
- + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID
- + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName
- + ", serviceInstanceName=" + serviceInstanceName + "]";
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((personaModelUUID == null) ? 0 : personaModelUUID.hashCode());
- result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode());
- result = prime * result + ((serviceInstanceUUID == null) ? 0 : serviceInstanceUUID.hashCode());
- result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
- result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode());
- result = prime * result + ((widgetModelUUID == null) ? 0 : widgetModelUUID.hashCode());
- result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ServiceInstance other = (ServiceInstance) obj;
- if (personaModelUUID == null) {
- if (other.personaModelUUID != null) {
- return false;
- }
- } else if (!personaModelUUID.equals(other.personaModelUUID)) {
- return false;
- }
- if (serviceInstanceName == null) {
- if (other.serviceInstanceName != null) {
- return false;
- }
- } else if (!serviceInstanceName.equals(other.serviceInstanceName)) {
- return false;
- }
- if (serviceInstanceUUID == null) {
- if (other.serviceInstanceUUID != null) {
- return false;
- }
- } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) {
- return false;
- }
- if (serviceName == null) {
- if (other.serviceName != null) {
- return false;
- }
- } else if (!serviceName.equals(other.serviceName)) {
- return false;
- }
- if (serviceUUID == null) {
- if (other.serviceUUID != null) {
- return false;
- }
- } else if (!serviceUUID.equals(other.serviceUUID)) {
- return false;
- }
- if (widgetModelUUID == null) {
- if (other.widgetModelUUID != null) {
- return false;
- }
- } else if (!widgetModelUUID.equals(other.widgetModelUUID)) {
- return false;
- }
- if (widgetModelVersion == null) {
- return other.widgetModelVersion == null;
- } else {
- return widgetModelVersion.equals(other.widgetModelVersion);
- }
- }
}
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
index 8ae0084f6..e1068cb31 100644
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
+++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java
@@ -3,7 +3,7 @@
* sdc
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public class ResourceInstanceTest {
ResourceInstance ri = new ResourceInstance();
assertEquals(null, ri.getResourceInstanceName());
assertEquals(null, ri.getResourceUuid());
- assertEquals(null, ri.getResourceInvariantUUID());
+ assertEquals(null, ri.getResourceInvariantUuid());
assertEquals(null, ri.getResourceName());
assertEquals(null, ri.getResourceType());
assertEquals(null, ri.getResourceVersion());
@@ -47,7 +47,7 @@ public class ResourceInstanceTest {
ResourceInstance ri2 = new ResourceInstance((ResourceInstance) null);
assertEquals(null, ri2.getResourceInstanceName());
assertEquals(null, ri2.getResourceUuid());
- assertEquals(null, ri2.getResourceInvariantUUID());
+ assertEquals(null, ri2.getResourceInvariantUuid());
assertEquals(null, ri2.getResourceName());
assertEquals(null, ri2.getResourceType());
assertEquals(null, ri2.getResourceVersion());
@@ -55,7 +55,7 @@ public class ResourceInstanceTest {
ri2 = new ResourceInstance(ri);
assertEquals(ri2.getResourceInstanceName(), ri.getResourceInstanceName());
assertEquals(ri2.getResourceUuid(), ri.getResourceUuid());
- assertEquals(ri2.getResourceInvariantUUID(), ri.getResourceInvariantUUID());
+ assertEquals(ri2.getResourceInvariantUuid(), ri.getResourceInvariantUuid());
assertEquals(ri2.getResourceName(), ri.getResourceName());
assertEquals(ri2.getResourceType(), ri.getResourceType());
assertEquals(ri2.getResourceVersion(), ri.getResourceVersion());
@@ -65,7 +65,8 @@ public class ResourceInstanceTest {
public void testInstanceName() {
ResourceInstance ri = new ResourceInstance();
String name = "nameTestInstance";
- ri.setResourceInstanceName(name);;
+ ri.setResourceInstanceName(name);
+ ;
assertEquals(name, ri.getResourceInstanceName());
}
@@ -81,8 +82,8 @@ public class ResourceInstanceTest {
public void testInvariantUuid() {
ResourceInstance ri = new ResourceInstance();
UUID uuid = UUID.randomUUID();
- ri.setResourceInvariantUUID(uuid);
- assertEquals(uuid, ri.getResourceInvariantUUID());
+ ri.setResourceInvariantUuid(uuid);
+ assertEquals(uuid, ri.getResourceInvariantUuid());
}
@Test
@@ -117,8 +118,8 @@ public class ResourceInstanceTest {
ri1.setResourceInstanceName(INSTANCE);
ri1.setResourceName(RESOURCE);
- ri1.setResourceInvariantUUID(UUID.randomUUID());
- ri1.setResourceInvariantUUID(UUID.randomUUID());
+ ri1.setResourceInvariantUuid(UUID.randomUUID());
+ ri1.setResourceInvariantUuid(UUID.randomUUID());
ri1.setResourceVersion(VERSION_000);
ri1.setResourceType(ResourceType.VL);
ri2 = new ResourceInstance(ri1);
@@ -134,8 +135,8 @@ public class ResourceInstanceTest {
ri1.setResourceInstanceName(INSTANCE);
ri1.setResourceName(RESOURCE);
- ri1.setResourceInvariantUUID(UUID.randomUUID());
- ri1.setResourceInvariantUUID(UUID.randomUUID());
+ ri1.setResourceInvariantUuid(UUID.randomUUID());
+ ri1.setResourceInvariantUuid(UUID.randomUUID());
ri1.setResourceVersion(VERSION_000);
ri1.setResourceType(ResourceType.VL);
ri2 = new ResourceInstance(ri1);
@@ -150,8 +151,8 @@ public class ResourceInstanceTest {
ri1.setResourceInstanceName(INSTANCE);
ri1.setResourceName(RESOURCE);
- ri1.setResourceInvariantUUID(UUID.randomUUID());
- ri1.setResourceInvariantUUID(UUID.randomUUID());
+ ri1.setResourceInvariantUuid(UUID.randomUUID());
+ ri1.setResourceInvariantUuid(UUID.randomUUID());
ri1.setResourceVersion(VERSION_000);
ri1.setResourceType(ResourceType.VL);
ri2 = new ResourceInstance(ri1);
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
index c06974cd5..c81a12fc5 100644
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
+++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java
@@ -3,7 +3,7 @@
* sdc
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,29 +38,29 @@ public class ServiceInstanceTest {
public void testConstructors() {
ServiceInstance si = new ServiceInstance();
assertEquals(null, si.getServiceInstanceName());
- assertEquals(null, si.getServiceUUID());
- assertEquals(null, si.getServiceInstanceUUID());
+ assertEquals(null, si.getServiceUuid());
+ assertEquals(null, si.getServiceInstanceUuid());
assertEquals(null, si.getServiceName());
- assertEquals(null, si.getPersonaModelUUID());
- assertEquals(null, si.getWidgetModelUUID());
+ assertEquals(null, si.getPersonaModelUuid());
+ assertEquals(null, si.getWidgetModelUuid());
assertEquals(null, si.getWidgetModelVersion());
ServiceInstance si2 = new ServiceInstance((ServiceInstance) null);
assertEquals(null, si2.getServiceInstanceName());
- assertEquals(null, si2.getServiceUUID());
- assertEquals(null, si2.getServiceInstanceUUID());
+ assertEquals(null, si2.getServiceUuid());
+ assertEquals(null, si2.getServiceInstanceUuid());
assertEquals(null, si2.getServiceName());
- assertEquals(null, si2.getPersonaModelUUID());
- assertEquals(null, si2.getWidgetModelUUID());
+ assertEquals(null, si2.getPersonaModelUuid());
+ assertEquals(null, si2.getWidgetModelUuid());
assertEquals(null, si2.getWidgetModelVersion());
si2 = new ServiceInstance(si);
assertEquals(si2.getServiceInstanceName(), si.getServiceInstanceName());
- assertEquals(si2.getServiceUUID(), si.getServiceUUID());
- assertEquals(si2.getServiceInstanceUUID(), si.getServiceInstanceUUID());
+ assertEquals(si2.getServiceUuid(), si.getServiceUuid());
+ assertEquals(si2.getServiceInstanceUuid(), si.getServiceInstanceUuid());
assertEquals(si2.getServiceName(), si.getServiceName());
- assertEquals(si2.getPersonaModelUUID(), si.getPersonaModelUUID());
- assertEquals(si2.getWidgetModelUUID(), si.getWidgetModelUUID());
+ assertEquals(si2.getPersonaModelUuid(), si.getPersonaModelUuid());
+ assertEquals(si2.getWidgetModelUuid(), si.getWidgetModelUuid());
assertEquals(si2.getWidgetModelVersion(), si.getWidgetModelVersion());
}
@@ -68,7 +68,8 @@ public class ServiceInstanceTest {
public void testInstanceName() {
ServiceInstance si = new ServiceInstance();
String name = "nameTestInstance";
- si.setServiceInstanceName(name);;
+ si.setServiceInstanceName(name);
+ ;
assertEquals(name, si.getServiceInstanceName());
}
@@ -76,16 +77,16 @@ public class ServiceInstanceTest {
public void testUuid() {
ServiceInstance si = new ServiceInstance();
UUID uuid = UUID.randomUUID();
- si.setServiceUUID(uuid);
- assertEquals(uuid, si.getServiceUUID());
+ si.setServiceUuid(uuid);
+ assertEquals(uuid, si.getServiceUuid());
}
@Test
public void testInstanceUuid() {
ServiceInstance si = new ServiceInstance();
UUID uuid = UUID.randomUUID();
- si.setServiceInstanceUUID(uuid);
- assertEquals(uuid, si.getServiceInstanceUUID());
+ si.setServiceInstanceUuid(uuid);
+ assertEquals(uuid, si.getServiceInstanceUuid());
}
@Test
@@ -100,23 +101,24 @@ public class ServiceInstanceTest {
public void testPersonaModelUuid() {
ServiceInstance si = new ServiceInstance();
UUID uuid = UUID.randomUUID();
- si.setPersonaModelUUID(uuid);
- assertEquals(uuid, si.getPersonaModelUUID());
+ si.setPersonaModelUuid(uuid);
+ assertEquals(uuid, si.getPersonaModelUuid());
}
@Test
public void testWidgetModelUuid() {
ServiceInstance si = new ServiceInstance();
UUID uuid = UUID.randomUUID();
- si.setWidgetModelUUID(uuid);
- assertEquals(uuid, si.getWidgetModelUUID());
+ si.setWidgetModelUuid(uuid);
+ assertEquals(uuid, si.getWidgetModelUuid());
}
@Test
public void testWidgetModelVersion() {
ServiceInstance si = new ServiceInstance();
String version = "2.2.2";
- si.setWidgetModelVersion(version);;
+ si.setWidgetModelVersion(version);
+ ;
assertEquals(version, si.getWidgetModelVersion());
}
@@ -129,10 +131,10 @@ public class ServiceInstanceTest {
si1.setServiceInstanceName(INSTANCE);
si1.setServiceName(SERVICE);
- si1.setServiceInstanceUUID(UUID.randomUUID());
- si1.setServiceUUID(UUID.randomUUID());
- si1.setPersonaModelUUID(UUID.randomUUID());
- si1.setWidgetModelUUID(UUID.randomUUID());
+ si1.setServiceInstanceUuid(UUID.randomUUID());
+ si1.setServiceUuid(UUID.randomUUID());
+ si1.setPersonaModelUuid(UUID.randomUUID());
+ si1.setWidgetModelUuid(UUID.randomUUID());
si1.setWidgetModelVersion(VERSION_333);
si2 = new ServiceInstance(si1);
assertTrue(si1.equals(si2));
@@ -147,10 +149,10 @@ public class ServiceInstanceTest {
si1.setServiceInstanceName(INSTANCE);
si1.setServiceName(SERVICE);
- si1.setServiceInstanceUUID(UUID.randomUUID());
- si1.setServiceUUID(UUID.randomUUID());
- si1.setPersonaModelUUID(UUID.randomUUID());
- si1.setWidgetModelUUID(UUID.randomUUID());
+ si1.setServiceInstanceUuid(UUID.randomUUID());
+ si1.setServiceUuid(UUID.randomUUID());
+ si1.setPersonaModelUuid(UUID.randomUUID());
+ si1.setWidgetModelUuid(UUID.randomUUID());
si1.setWidgetModelVersion(VERSION_333);
si2 = new ServiceInstance(si1);
assertEquals(si1.toString(), si2.toString());
@@ -164,10 +166,10 @@ public class ServiceInstanceTest {
si1.setServiceInstanceName(INSTANCE);
si1.setServiceName(SERVICE);
- si1.setServiceInstanceUUID(UUID.randomUUID());
- si1.setServiceUUID(UUID.randomUUID());
- si1.setPersonaModelUUID(UUID.randomUUID());
- si1.setWidgetModelUUID(UUID.randomUUID());
+ si1.setServiceInstanceUuid(UUID.randomUUID());
+ si1.setServiceUuid(UUID.randomUUID());
+ si1.setPersonaModelUuid(UUID.randomUUID());
+ si1.setWidgetModelUuid(UUID.randomUUID());
si1.setWidgetModelVersion(VERSION_333);
si2 = new ServiceInstance(si1);
assertEquals(si1.hashCode(), si2.hashCode());
diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
index 19238622d..dc5d9d3b2 100644
--- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
+++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java
@@ -3,7 +3,7 @@
* sdc
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,23 +36,23 @@ public class ServiceTest {
@Test
public void testConstructors() {
Service svc = new Service();
- assertEquals(null, svc.getServiceUUID());
- assertEquals(null, svc.getServiceInvariantUUID());
+ assertEquals(null, svc.getServiceUuid());
+ assertEquals(null, svc.getServiceInvariantUuid());
assertEquals(null, svc.getServiceName());
assertEquals(null, svc.getServiceVersion());
UUID uuid = UUID.randomUUID();
svc = new Service(uuid);
- assertEquals(uuid, svc.getServiceUUID());
- assertEquals(null, svc.getServiceInvariantUUID());
+ assertEquals(uuid, svc.getServiceUuid());
+ assertEquals(null, svc.getServiceInvariantUuid());
assertEquals(null, svc.getServiceName());
assertEquals(null, svc.getServiceVersion());
String name = "constTest";
svc = new Service(name);
- assertEquals(null, svc.getServiceUUID());
+ assertEquals(null, svc.getServiceUuid());
assertEquals(name, svc.getServiceName());
- assertEquals(null, svc.getServiceInvariantUUID());
+ assertEquals(null, svc.getServiceInvariantUuid());
assertEquals(null, svc.getServiceVersion());
uuid = UUID.randomUUID();
@@ -60,14 +60,14 @@ public class ServiceTest {
name = "constTestUUID";
String version = "0.0.1";
svc = new Service(uuid, uuidInvariant, name, version);
- assertEquals(uuid, svc.getServiceUUID());
- assertEquals(uuidInvariant, svc.getServiceInvariantUUID());
+ assertEquals(uuid, svc.getServiceUuid());
+ assertEquals(uuidInvariant, svc.getServiceInvariantUuid());
assertEquals(name, svc.getServiceName());
assertEquals(version, svc.getServiceVersion());
Service s2 = new Service(svc);
- assertEquals(uuid, s2.getServiceUUID());
- assertEquals(uuidInvariant, s2.getServiceInvariantUUID());
+ assertEquals(uuid, s2.getServiceUuid());
+ assertEquals(uuidInvariant, s2.getServiceInvariantUuid());
assertEquals(name, s2.getServiceName());
assertEquals(version, s2.getServiceVersion());
}
@@ -76,16 +76,16 @@ public class ServiceTest {
public void testUuid() {
Service svc = new Service();
UUID uuid = UUID.randomUUID();
- svc.setServiceUUID(uuid);
- assertEquals(uuid, svc.getServiceUUID());
+ svc.setServiceUuid(uuid);
+ assertEquals(uuid, svc.getServiceUuid());
}
@Test
public void testInvariantUuid() {
Service svc = new Service();
UUID uuid = UUID.randomUUID();
- svc.setServiceInvariantUUID(uuid);
- assertEquals(uuid, svc.getServiceInvariantUUID());
+ svc.setServiceInvariantUuid(uuid);
+ assertEquals(uuid, svc.getServiceInvariantUuid());
}
@Test
diff --git a/models-interactions/model-yaml/pom.xml b/models-interactions/model-yaml/pom.xml
index 7bd1fa497..2273abfc8 100644
--- a/models-interactions/model-yaml/pom.xml
+++ b/models-interactions/model-yaml/pom.xml
@@ -3,7 +3,7 @@
ONAP
================================================================================
Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- Modifications Copyright (C) 2019 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -19,66 +19,75 @@
============LICENSE_END=========================================================
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.policy.models</groupId>
- <artifactId>policy-models-interactions</artifactId>
- <version>2.2.1-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.onap.policy.models</groupId>
+ <artifactId>policy-models-interactions</artifactId>
+ <version>2.2.1-SNAPSHOT</version>
+ </parent>
- <groupId>org.onap.policy.models.policy-models-interactions</groupId>
- <artifactId>model-yaml</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jgrapht</groupId>
- <artifactId>jgrapht-core</artifactId>
- <version>0.9.2</version>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>sdc</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.policy.common</groupId>
- <artifactId>utils-test</artifactId>
- <version>${policy.common.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <groupId>org.onap.policy.models.policy-models-interactions</groupId>
+ <artifactId>model-yaml</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jgrapht</groupId>
+ <artifactId>jgrapht-core</artifactId>
+ <version>0.9.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
+ <artifactId>sdc</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
+ <artifactId>aai</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.common</groupId>
+ <artifactId>utils-test</artifactId>
+ <version>${policy.common.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
<!--
Without this defined here, the checkstyle plugin just simply fails outright. This needs to be investigated
diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
index 779e3096f..f1a9540c0 100644
--- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
+++ b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java
@@ -3,14 +3,14 @@
* policy-yaml
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,6 +22,7 @@
package org.onap.policy.controlloop.policy.builder.impl;
import com.google.common.base.Strings;
+
import java.util.LinkedList;
import java.util.UUID;
@@ -42,20 +43,17 @@ import org.onap.policy.controlloop.policy.builder.MessageLevel;
import org.onap.policy.controlloop.policy.builder.Results;
import org.onap.policy.sdc.Resource;
import org.onap.policy.sdc.Service;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.DumperOptions.FlowStyle;
import org.yaml.snakeyaml.Yaml;
public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
private static final String UNKNOWN_POLICY = "Unknown policy ";
- private static Logger logger = LoggerFactory.getLogger(ControlLoopPolicyBuilderImpl.class.getName());
private ControlLoopPolicy controlLoopPolicy;
/**
* Constructor.
- *
+ *
* @param controlLoopName control loop id
* @param timeout timeout value
*/
@@ -69,15 +67,15 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
/**
* Constructor.
- *
+ *
* @param controlLoopName control loop id
* @param timeout timeout value
* @param resource resource
* @param services services
* @throws BuilderException builder exception
*/
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Resource resource, Service... services)
- throws BuilderException {
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Resource resource,
+ Service... services) throws BuilderException {
this(controlLoopName, timeout);
this.addResource(resource);
this.addService(services);
@@ -90,15 +88,15 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
/**
* Constructor.
- *
+ *
* @param controlLoopName control loop id
* @param timeout timeout
* @param service service
* @param resources resources
* @throws BuilderException builder exception
*/
- public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Service service, Resource[] resources)
- throws BuilderException {
+ public ControlLoopPolicyBuilderImpl(String controlLoopName, Integer timeout, Service service,
+ Resource[] resources) throws BuilderException {
this(controlLoopName, timeout);
this.addService(service);
this.addResource(resources);
@@ -116,7 +114,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
if (service == null) {
throw new BuilderException("Service must not be null");
}
- if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
+ if (service.getServiceUuid() == null && Strings.isNullOrEmpty(service.getServiceName())) {
throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
}
if (controlLoopPolicy.getControlLoop().getServices() == null) {
@@ -136,7 +134,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
if (service == null) {
throw new BuilderException("Service must not be null");
}
- if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) {
+ if (service.getServiceUuid() == null && Strings.isNullOrEmpty(service.getServiceName())) {
throw new BuilderException("Invalid service - need either a serviceUUID or serviceName");
}
boolean removed = controlLoopPolicy.getControlLoop().getServices().remove(service);
@@ -153,7 +151,6 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
return this;
}
-
@Override
public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException {
for (Resource resource : resources) {
@@ -199,8 +196,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
}
@Override
- public Policy setTriggerPolicy(PolicyParam policyParam)
- throws BuilderException {
+ public Policy setTriggerPolicy(PolicyParam policyParam) throws BuilderException {
Policy trigger = new Policy(policyParam);
@@ -228,8 +224,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
}
@Override
- public Policy setPolicyForPolicyResult(PolicyParam policyParam, PolicyResult... results)
- throws BuilderException {
+ public Policy setPolicyForPolicyResult(PolicyParam policyParam, PolicyResult... results) throws BuilderException {
//
// Find the existing policy
//
@@ -240,17 +235,19 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
//
// Create the new Policy
//
- Policy newPolicy = new Policy(
- PolicyParam.builder().id(UUID.randomUUID().toString())
- .name(policyParam.getName())
- .description(policyParam.getDescription())
- .actor(policyParam.getActor())
- .payload(policyParam.getPayload())
- .target(policyParam.getTarget())
- .recipe(policyParam.getRecipe())
- .retries(policyParam.getRetries())
- .timeout(policyParam.getTimeout())
- .build());
+ // @formatter:off
+ Policy newPolicy = new Policy(PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name(policyParam.getName())
+ .description(policyParam.getDescription())
+ .actor(policyParam.getActor())
+ .payload(policyParam.getPayload())
+ .target(policyParam.getTarget())
+ .recipe(policyParam.getRecipe())
+ .retries(policyParam.getRetries())
+ .timeout(policyParam.getTimeout())
+ .build());
+ // @formatter:on
//
// Connect the results
//
@@ -290,7 +287,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
@Override
public Policy setPolicyForPolicyResult(String policyResultId, String policyId, PolicyResult... results)
- throws BuilderException {
+ throws BuilderException {
//
// Find the existing policy
//
@@ -368,7 +365,6 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
try {
ControlLoopCompiler.compile(controlLoopPolicy, callback);
} catch (CompilerException e) {
- logger.error(e.getMessage() + e);
callback.results.addMessage(new MessageImpl(e.getMessage(), MessageLevel.EXCEPTION));
}
//
@@ -434,7 +430,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
@Override
public boolean isOpenLoop() {
return this.controlLoopPolicy.getControlLoop().getTrigger_policy()
- .equals(FinalResult.FINAL_OPENLOOP.toString());
+ .equals(FinalResult.FINAL_OPENLOOP.toString());
}
@Override
@@ -529,7 +525,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder {
@Override
public Policy addOperationsAccumulateParams(String policyId, OperationsAccumulateParams operationsAccumulateParams)
- throws BuilderException {
+ throws BuilderException {
Policy existingPolicy = this.findPolicy(policyId);
if (existingPolicy == null) {
throw new BuilderException(UNKNOWN_POLICY + policyId);
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java
index 6fc3e1acb..98c00eb2f 100644
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/compiler/ControlLoopCompilerTest.java
@@ -3,7 +3,7 @@
* policy-yaml unit test
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
package org.onap.policy.controlloop.compiler;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -30,17 +31,14 @@ import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Rule;
+
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.FinalResult;
public class ControlLoopCompilerTest {
private static final String RESTART_UNKNOWN_POLICY =
- "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy";
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
+ "Operation Policy unique-policy-id-1-restart is connected to unknown policy unknown-policy";
@Test
public void testTest() throws Exception {
@@ -62,74 +60,68 @@ public class ControlLoopCompilerTest {
expectedOnErrorMessages.add("controlLoop overall timeout is less than the sum of operational policy timeouts.");
TestControlLoopCompilerCallback testControlLoopCompilerCallback =
- new TestControlLoopCompilerCallback(expectedOnErrorMessages);
- ControlLoopPolicy controlLoopPolicy = this.test("src/test/resources/v1.0.0/test.yaml",
- testControlLoopCompilerCallback);
+ new TestControlLoopCompilerCallback(expectedOnErrorMessages);
+ ControlLoopPolicy controlLoopPolicy =
+ this.test("src/test/resources/v1.0.0/test.yaml", testControlLoopCompilerCallback);
assertEquals(22, controlLoopPolicy.getPolicies().size());
assertTrue(testControlLoopCompilerCallback.areAllExpectedOnErrorsReceived());
}
@Test
public void testSuccessConnectedToUnknownPolicy() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- RESTART_UNKNOWN_POLICY);
- this.test("src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
}
@Test
public void testFailureConnectedToUnknownPolicy() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- RESTART_UNKNOWN_POLICY);
- this.test("src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
}
@Test
public void testFailureTimeoutToUnknownPolicy() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- RESTART_UNKNOWN_POLICY);
- this.test("src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
}
@Test
public void testFailureRetriesToUnknownPolicy() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- RESTART_UNKNOWN_POLICY);
- this.test("src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
}
@Test
public void testFailureExceptionToUnknownPolicy() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- RESTART_UNKNOWN_POLICY);
- this.test("src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
}
@Test
public void testFailureGuardToUnknownPolicy() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- RESTART_UNKNOWN_POLICY);
- this.test("src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage(RESTART_UNKNOWN_POLICY);
}
@Test
public void testInvalidTriggerPolicyId() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- "Unexpected value for trigger_policy, should only be "
- + FinalResult.FINAL_OPENLOOP.toString() + " or a valid Policy ID");
- this.test("src/test/resources/v1.0.0/bad_trigger_1.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_trigger_1.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage("Unexpected value for trigger_policy, should only be "
+ + FinalResult.FINAL_OPENLOOP.toString() + " or a valid Policy ID");
}
@Test
public void testNoTriggerPolicyId() throws Exception {
- expectedException.expect(CompilerException.class);
- this.test("src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml");
+ }).isInstanceOf(CompilerException.class);
}
@Test
@@ -138,25 +130,25 @@ public class ControlLoopCompilerTest {
expectedOnErrorMessages.add("Missing controlLoopName");
expectedOnErrorMessages.add("Unsupported version for this compiler");
TestControlLoopCompilerCallback testControlLoopCompilerCallback =
- new TestControlLoopCompilerCallback(expectedOnErrorMessages);
+ new TestControlLoopCompilerCallback(expectedOnErrorMessages);
this.test("src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml",
- testControlLoopCompilerCallback);
+ testControlLoopCompilerCallback);
assertTrue(testControlLoopCompilerCallback.areAllExpectedOnErrorsReceived());
}
@Test
public void testInvalidFinalResult() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage(
- "Unexpected Final Result for trigger_policy, should only be FINAL_OPENLOOP or a valid Policy ID");
- this.test("src/test/resources/v1.0.0/bad_trigger_2.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/bad_trigger_2.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage(
+ "Unexpected Final Result for trigger_policy, should only be FINAL_OPENLOOP or a valid Policy ID");
}
@Test
public void testCompileEmptyFile() throws Exception {
- expectedException.expect(CompilerException.class);
- expectedException.expectMessage("Could not parse yaml specification.");
- this.test("src/test/resources/v1.0.0/empty.yaml");
+ assertThatThrownBy(() -> {
+ this.test("src/test/resources/v1.0.0/empty.yaml");
+ }).isInstanceOf(CompilerException.class).hasMessage("Could not parse yaml specification.");
}
public ControlLoopPolicy test(String testFile) throws Exception {
@@ -171,8 +163,8 @@ public class ControlLoopCompilerTest {
* @return the policy object
* @throws Exception exception
*/
- public ControlLoopPolicy test(String testFile,
- ControlLoopCompilerCallback controlLoopCompilerCallback) throws Exception {
+ public ControlLoopPolicy test(String testFile, ControlLoopCompilerCallback controlLoopCompilerCallback)
+ throws Exception {
try (InputStream is = new FileInputStream(new File(testFile))) {
return ControlLoopCompiler.compile(is, controlLoopCompilerCallback);
}
@@ -202,7 +194,5 @@ public class ControlLoopCompilerTest {
public boolean areAllExpectedOnErrorsReceived() {
return expectedOnErrorMessages.isEmpty();
}
-
}
-
}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
index f646712fd..81520b578 100644
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java
@@ -3,7 +3,7 @@
* policy-yaml unit test
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,10 +32,9 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.UUID;
+
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.onap.aai.domain.yang.Pnf;
import org.onap.policy.controlloop.policy.builder.BuilderException;
import org.onap.policy.controlloop.policy.builder.ControlLoopPolicyBuilder;
@@ -49,7 +48,6 @@ import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.error.YAMLException;
-
public class ControlLoopPolicyBuilderTest {
private static final String RESOURCE1 = "resource1";
@@ -60,8 +58,6 @@ public class ControlLoopPolicyBuilderTest {
private static final String REBUILD = "Rebuild";
private static final String REBUILD_VM = "Rebuild VM";
private static final String REBUILD_RESTART = "If the restart fails, rebuild it.";
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
@Test
public void testControlLoop() throws BuilderException {
@@ -69,7 +65,7 @@ public class ControlLoopPolicyBuilderTest {
// Create a builder for our policy
//
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
//
// Test add services
//
@@ -105,25 +101,28 @@ public class ControlLoopPolicyBuilderTest {
@Test
public void testAddNullService() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Service must not be null");
- builder.addService((Service) null);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+
+ assertThatThrownBy(() -> {
+ builder.addService((Service) null);
+ }).isInstanceOf(BuilderException.class).hasMessage("Service must not be null");
}
@Test
public void testAddInvalidService() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Invalid service - need either a serviceUUID or serviceName");
- builder.addService(new Service());
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+
+ assertThatThrownBy(() -> {
+ builder.addService(new Service());
+ }).isInstanceOf(BuilderException.class)
+ .hasMessage("Invalid service - need either a serviceUUID or serviceName");
}
@Test
public void testAddServiceWithUuid() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
UUID uuid = UUID.randomUUID();
Service serviceWithUuid = new Service(uuid);
builder.addService(serviceWithUuid);
@@ -133,26 +132,28 @@ public class ControlLoopPolicyBuilderTest {
@Test
public void testAddNullResource() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Resource must not be null");
- builder.addResource((Resource) null);
- }
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ assertThatThrownBy(() -> {
+ builder.addResource((Resource) null);
+ }).isInstanceOf(BuilderException.class).hasMessage("Resource must not be null");
+ }
@Test
public void testAddInvalidResource() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Invalid resource - need either resourceUUID or resourceName");
- builder.addResource(new Resource());
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+
+ assertThatThrownBy(() -> {
+ builder.addResource(new Resource());
+ }).isInstanceOf(BuilderException.class)
+ .hasMessage("Invalid resource - need either resourceUUID or resourceName");
}
@Test
public void testAddAndRemoveResourceWithUuid() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
UUID uuid = UUID.randomUUID();
Resource resourceWithUuid = new Resource(uuid);
builder.addResource(resourceWithUuid);
@@ -165,44 +166,49 @@ public class ControlLoopPolicyBuilderTest {
@Test
public void testRemoveNullResource() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
Resource resource = new Resource(RESOURCE1, ResourceType.VF);
builder.addResource(resource);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Resource must not be null");
- builder.removeResource((Resource) null);
+
+ assertThatThrownBy(() -> {
+ builder.removeResource((Resource) null);
+ }).isInstanceOf(BuilderException.class).hasMessage("Resource must not be null");
}
@Test
public void testRemoveResourceNoExistingResources() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("No existing resources to remove");
- builder.removeResource(new Resource(RESOURCE1, ResourceType.VF));
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+
+ assertThatThrownBy(() -> {
+ builder.removeResource(new Resource(RESOURCE1, ResourceType.VF));
+ }).isInstanceOf(BuilderException.class).hasMessage("No existing resources to remove");
}
@Test
public void testRemoveInvalidResource() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
Resource resource = new Resource(RESOURCE1, ResourceType.VF);
builder.addResource(resource);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Invalid resource - need either a resourceUUID or resourceName");
- builder.removeResource(new Resource());
+
+ assertThatThrownBy(() -> {
+ builder.removeResource(new Resource());
+ }).isInstanceOf(BuilderException.class)
+ .hasMessage("Invalid resource - need either a resourceUUID or resourceName");
}
@Test
public void testRemoveUnknownResource() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
Resource resource = new Resource(RESOURCE1, ResourceType.VF);
builder.addResource(resource);
final String unknownResourceName = "reource2";
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Unknown resource " + unknownResourceName);
- builder.removeResource(new Resource(unknownResourceName, ResourceType.VF));
+
+ assertThatThrownBy(() -> {
+ builder.removeResource(new Resource(unknownResourceName, ResourceType.VF));
+ }).isInstanceOf(BuilderException.class).hasMessage("Unknown resource " + unknownResourceName);
}
@Test
@@ -210,8 +216,8 @@ public class ControlLoopPolicyBuilderTest {
Resource cts = new Resource("vCTS", ResourceType.VF);
Service scp = new Service("vSCP");
Service usp = new Service("vUSP");
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory
- .buildControlLoop(UUID.randomUUID().toString(), 2400, cts, scp, usp);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, cts, scp, usp);
assertTrue(builder.getControlLoop().getResources().size() == 1);
assertTrue(builder.getControlLoop().getServices().size() == 2);
}
@@ -221,8 +227,8 @@ public class ControlLoopPolicyBuilderTest {
Resource cts = new Resource("vCTS", ResourceType.VF);
Resource com = new Resource("vCTS", ResourceType.VF);
Service scp = new Service("vSCP");
- ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory
- .buildControlLoop(UUID.randomUUID().toString(), 2400, scp, cts, com);
+ ControlLoopPolicyBuilder builder =
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, scp, cts, com);
assertTrue(builder.getControlLoop().getServices().size() == 1);
assertTrue(builder.getControlLoop().getResources().size() == 2);
}
@@ -238,9 +244,9 @@ public class ControlLoopPolicyBuilderTest {
// PLEASE ADVISE IF THE BEHAVIOUR IS INCORRECT OR THE TEST CASE IS INVALID
public void testControlLoopForPnf() throws BuilderException {
Pnf pnf = new Pnf();
- //pnf.setPnfType(PnfType.ENODEB);
+ // pnf.setPnfType(PnfType.ENODEB);
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, pnf);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400, pnf);
assertEquals(pnf, builder.getControlLoop().getPnf());
builder.removePnf();
@@ -252,11 +258,11 @@ public class ControlLoopPolicyBuilderTest {
// Fails for the same reason as the above test case
public void testSetAndRemovePnf() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
assertNull(builder.getControlLoop().getPnf());
Pnf pnf = new Pnf();
- //pnf.setPnfType(PnfType.ENODEB);
+ // pnf.setPnfType(PnfType.ENODEB);
builder.setPnf(pnf);
assertEquals(pnf, builder.getControlLoop().getPnf());
@@ -267,25 +273,27 @@ public class ControlLoopPolicyBuilderTest {
@Test
public void testSetNullPnf() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("PNF must not be null");
- builder.setPnf(null);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+
+ assertThatThrownBy(() -> {
+ builder.setPnf(null);
+ }).isInstanceOf(BuilderException.class).hasMessage("PNF must not be null");
}
@Test
public void testSetInvalidPnf() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Invalid PNF - need either pnfName or pnfType");
- builder.setPnf(new Pnf());
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+
+ assertThatThrownBy(() -> {
+ builder.setPnf(new Pnf());
+ }).isInstanceOf(BuilderException.class).hasMessage("Invalid PNF - need either pnfName or pnfType");
}
@Test
public void testSetAbatement() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
assertFalse(builder.getControlLoop().getAbatement());
builder = builder.setAbatement(true);
assertTrue(builder.getControlLoop().getAbatement());
@@ -293,11 +301,12 @@ public class ControlLoopPolicyBuilderTest {
@Test
public void testSetNullAbatement() throws BuilderException {
- ControlLoopPolicyBuilder builder =
+ assertThatThrownBy(() -> {
+ ControlLoopPolicyBuilder builder =
ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("abatement must not be null");
- builder = builder.setAbatement(null);
+
+ builder = builder.setAbatement(null);
+ }).isInstanceOf(BuilderException.class).hasMessage("abatement must not be null");
}
@Test
@@ -306,7 +315,7 @@ public class ControlLoopPolicyBuilderTest {
// Create a builder for our policy
//
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
//
// Test setTimeout
//
@@ -316,38 +325,38 @@ public class ControlLoopPolicyBuilderTest {
//
// Test calculateTimeout
//
- Policy trigger =
- builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ // @formatter:off
+ Policy trigger = builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
+ .name(RESTART_VM)
+ .description(TRIGGER_RESTART)
+ .actor("APPC").target(new Target(TargetType.VM))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
+
@SuppressWarnings("unused")
Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
- PolicyParam.builder()
- .name(REBUILD_VM)
- .description("If the restart fails, rebuild it")
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(1)
- .timeout(600)
- .id(trigger.getId()).build(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT);
+ PolicyParam.builder()
+ .name(REBUILD_VM)
+ .description("If the restart fails, rebuild it").actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(REBUILD)
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(trigger.getId())
+ .build(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
assertEquals(Integer.valueOf(300 + 600), builder.calculateTimeout());
+ // @formatter:on
}
@Test
public void testTriggerPolicyMethods() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
//
// Test isOpenLoop
//
@@ -355,35 +364,33 @@ public class ControlLoopPolicyBuilderTest {
//
// Test set initial trigger policy
//
- Policy triggerPolicy1 =
- builder.setTriggerPolicy(
- PolicyParam.builder().id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ // @formatter:off
+ Policy triggerPolicy1 = builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
+ .name(RESTART_VM)
+ .description(TRIGGER_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
assertFalse(builder.isOpenLoop());
assertEquals(builder.getControlLoop().getTrigger_policy(), triggerPolicy1.getId());
//
// Set trigger policy to a new policy
//
@SuppressWarnings("unused")
- Policy triggerPolicy2 =
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name("Rebuild the VM")
- .description("Upon getting the trigger event, rebuild the VM")
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ Policy triggerPolicy2 = builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
+ .name("Rebuild the VM")
+ .description("Upon getting the trigger event, rebuild the VM").actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(REBUILD)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
+ // @formatter:on
//
// Test set trigger policy to another existing policy
//
@@ -399,78 +406,77 @@ public class ControlLoopPolicyBuilderTest {
@Test
public void testSetTriggerPolicyNullPolicyId() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Id must not be null");
- builder.setExistingTriggerPolicy(null);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+
+ assertThatThrownBy(() -> {
+ builder.setExistingTriggerPolicy(null);
+ }).isInstanceOf(BuilderException.class).hasMessage("Id must not be null");
}
@Test
public void testSetTriggerPolicyNoPoliciesExist() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
final String unknownPolicyId = "100";
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage(UNKNOWN_POLICY + unknownPolicyId);
- builder.setExistingTriggerPolicy(unknownPolicyId);
+
+ assertThatThrownBy(() -> {
+ builder.setExistingTriggerPolicy(unknownPolicyId);
+ }).isInstanceOf(BuilderException.class).hasMessage(UNKNOWN_POLICY + unknownPolicyId);
}
@Test
public void testSetTriggerPolicyUnknownPolicy() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ // @formatter:off
+ builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
+ .name(RESTART_VM)
+ .description(TRIGGER_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
+ // @formatter:on
final String unknownPolicyId = "100";
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage(UNKNOWN_POLICY + unknownPolicyId);
- builder.setExistingTriggerPolicy(unknownPolicyId);
+
+ assertThatThrownBy(() -> {
+ builder.setExistingTriggerPolicy(unknownPolicyId);
+ }).isInstanceOf(BuilderException.class).hasMessage(UNKNOWN_POLICY + unknownPolicyId);
}
@Test
public void testAddRemovePolicies() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- Policy triggerPolicy =
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ // @formatter:off
+ Policy triggerPolicy = builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
+ .name(RESTART_VM)
+ .description(TRIGGER_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
//
// Test create a policy and chain it to the results of trigger policy
//
- Policy onRestartFailurePolicy1 = builder.setPolicyForPolicyResult(
- PolicyParam.builder()
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(1)
- .timeout(600)
- .id(triggerPolicy.getId()).build(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_EXCEPTION,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT,
- PolicyResult.FAILURE_GUARD);
+ Policy onRestartFailurePolicy1 = builder.setPolicyForPolicyResult(PolicyParam.builder()
+ .name(REBUILD_VM)
+ .description(REBUILD_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(REBUILD).payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(triggerPolicy.getId())
+ .build(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_EXCEPTION, PolicyResult.FAILURE_RETRIES,
+ PolicyResult.FAILURE_TIMEOUT, PolicyResult.FAILURE_GUARD);
//
assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy1.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_exception().equals(onRestartFailurePolicy1.getId()));
@@ -481,19 +487,20 @@ public class ControlLoopPolicyBuilderTest {
//
// Test create a policy and chain it to the results of trigger policy success
//
- Policy onSuccessPolicy1 = builder.setPolicyForPolicyResult(
- PolicyParam.builder()
- .name("Do something")
- .description("If the restart succeeds, do something else.")
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe("SomethingElse")
- .payload(null)
- .retries(1)
- .timeout(600)
- .id(triggerPolicy.getId()).build(),
- PolicyResult.SUCCESS);
- //
+ Policy onSuccessPolicy1 = builder.setPolicyForPolicyResult(PolicyParam.builder()
+ .name("Do something")
+ .description("If the restart succeeds, do something else.")
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe("SomethingElse")
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(triggerPolicy.getId())
+ .build(),
+ PolicyResult.SUCCESS);
+ //
+ // @formatter:on
assertTrue(builder.getTriggerPolicy().getSuccess().equals(onSuccessPolicy1.getId()));
//
@@ -502,55 +509,52 @@ public class ControlLoopPolicyBuilderTest {
boolean removed = builder.removePolicy(onRestartFailurePolicy1.getId());
assertTrue(removed);
assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_retries()
- .equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_timeout()
- .equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
assertTrue(
- builder.getTriggerPolicy().getFailure_guard().equals(FinalResult.FINAL_FAILURE_GUARD.toString()));
+ builder.getTriggerPolicy().getFailure_retries().equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(
+ builder.getTriggerPolicy().getFailure_timeout().equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(FinalResult.FINAL_FAILURE_GUARD.toString()));
//
// Create another policy and chain it to the results of trigger policy
//
- final Policy onRestartFailurePolicy2 =
- builder.setPolicyForPolicyResult(
- PolicyParam.builder()
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(2)
- .timeout(600)
- .id(triggerPolicy.getId()).build(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT);
+ // @formatter:off
+ final Policy onRestartFailurePolicy2 = builder.setPolicyForPolicyResult(
+ PolicyParam.builder()
+ .name(REBUILD_VM)
+ .description(REBUILD_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(REBUILD)
+ .payload(null)
+ .retries(2)
+ .timeout(600)
+ .id(triggerPolicy.getId())
+ .build(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
+ // @formatter:on
//
// Test reset policy results
//
triggerPolicy = builder.resetPolicyResults(triggerPolicy.getId());
assertTrue(builder.getTriggerPolicy().getFailure().equals(FinalResult.FINAL_FAILURE.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_retries()
- .equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
- assertTrue(builder.getTriggerPolicy().getFailure_timeout()
- .equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
+ assertTrue(
+ builder.getTriggerPolicy().getFailure_retries().equals(FinalResult.FINAL_FAILURE_RETRIES.toString()));
+ assertTrue(
+ builder.getTriggerPolicy().getFailure_timeout().equals(FinalResult.FINAL_FAILURE_TIMEOUT.toString()));
//
// Test set the policy results to an existing operational policy
//
- Policy onRestartFailurePolicy3 =
- builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(), triggerPolicy.getId(),
- PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
+ Policy onRestartFailurePolicy3 = builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(),
+ triggerPolicy.getId(), PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy3.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_retries().equals(onRestartFailurePolicy3.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_timeout().equals(onRestartFailurePolicy3.getId()));
//
// Test set the policy result for success to an existing operational policy
//
- Policy onRestartFailurePolicy4 =
- builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(), triggerPolicy.getId(),
- PolicyResult.FAILURE, PolicyResult.FAILURE_EXCEPTION, PolicyResult.FAILURE_GUARD,
- PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT, PolicyResult.SUCCESS);
+ Policy onRestartFailurePolicy4 = builder.setPolicyForPolicyResult(onRestartFailurePolicy2.getId(),
+ triggerPolicy.getId(), PolicyResult.FAILURE, PolicyResult.FAILURE_EXCEPTION, PolicyResult.FAILURE_GUARD,
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT, PolicyResult.SUCCESS);
assertTrue(builder.getTriggerPolicy().getFailure().equals(onRestartFailurePolicy4.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_exception().equals(onRestartFailurePolicy4.getId()));
assertTrue(builder.getTriggerPolicy().getFailure_guard().equals(onRestartFailurePolicy4.getId()));
@@ -568,129 +572,136 @@ public class ControlLoopPolicyBuilderTest {
@Test
public void testAddToUnknownPolicy() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
final String policyId = "100";
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage(UNKNOWN_POLICY + policyId);
- builder.setPolicyForPolicyResult(
+ assertThatThrownBy(() -> {
+ // @formatter:off
+ builder.setPolicyForPolicyResult(
PolicyParam.builder()
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(1)
- .timeout(600)
- .id(policyId).build(),
- PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES,
- PolicyResult.FAILURE_TIMEOUT,
+ .name(REBUILD_VM)
+ .description(REBUILD_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(REBUILD)
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(policyId)
+ .build(),
+ PolicyResult.FAILURE, PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT,
PolicyResult.FAILURE_GUARD);
+ // @formatter:on
+ }).isInstanceOf(BuilderException.class).hasMessage(UNKNOWN_POLICY + policyId);
+
}
@Test
public void testAddExistingPolicyToUnknownPolicy() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- Policy triggerPolicy =
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
-
-
- Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(
- PolicyParam.builder()
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(1)
- .timeout(600)
- .id(triggerPolicy.getId()).build(),
- PolicyResult.FAILURE);
-
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ // @formatter:off
+ Policy triggerPolicy = builder.setTriggerPolicy(PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name(RESTART_VM)
+ .description(TRIGGER_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
+
+ Policy onRestartFailurePolicy = builder.setPolicyForPolicyResult(PolicyParam.builder()
+ .name(REBUILD_VM)
+ .description(REBUILD_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(REBUILD)
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .id(triggerPolicy.getId())
+ .build(),
+ PolicyResult.FAILURE);
+
+ // @formatter:on
final String unknownPolicyId = "100";
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage(unknownPolicyId + " does not exist");
- builder.setPolicyForPolicyResult(onRestartFailurePolicy.getId(), unknownPolicyId, PolicyResult.FAILURE);
+ assertThatThrownBy(() -> {
+ builder.setPolicyForPolicyResult(onRestartFailurePolicy.getId(), unknownPolicyId, PolicyResult.FAILURE);
+ }).isInstanceOf(BuilderException.class).hasMessage(unknownPolicyId + " does not exist");
+
}
@Test
public void testAddUnknownExistingPolicyToPolicy() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
- Policy triggerPolicy =
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ // @formatter:off
+ Policy triggerPolicy = builder.setTriggerPolicy(PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name(RESTART_VM)
+ .description(TRIGGER_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
+ // @formatter:on
final String unknownPolicyId = "100";
- expectedException.expect(BuilderException.class);
- expectedException.expectMessage("Operational policy " + unknownPolicyId + " does not exist");
- builder.setPolicyForPolicyResult(unknownPolicyId, triggerPolicy.getId(), PolicyResult.FAILURE);
+ assertThatThrownBy(() -> {
+ builder.setPolicyForPolicyResult(unknownPolicyId, triggerPolicy.getId(), PolicyResult.FAILURE);
+ }).isInstanceOf(BuilderException.class).hasMessage("Operational policy " + unknownPolicyId + " does not exist");
+
}
@Test
public void testAddOperationsAccumulateParams() throws BuilderException {
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 2400);
+ // @formatter:off
Policy triggerPolicy =
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name("Restart the eNodeB")
- .description("Upon getting the trigger event, restart the eNodeB")
- .actor("RANController")
- .target(new Target(TargetType.PNF))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ builder.setTriggerPolicy(PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name("Restart the eNodeB")
+ .description("Upon getting the trigger event, restart the eNodeB")
+ .actor("RANController")
+ .target(new Target(TargetType.PNF))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
+ // @formatter:on
//
// Add the operationsAccumulateParams
//
- triggerPolicy = builder.addOperationsAccumulateParams(triggerPolicy.getId(),
- new OperationsAccumulateParams("15m", 5));
+ triggerPolicy =
+ builder.addOperationsAccumulateParams(triggerPolicy.getId(), new OperationsAccumulateParams("15m", 5));
assertNotNull(builder.getTriggerPolicy().getOperationsAccumulateParams());
assertEquals("15m", builder.getTriggerPolicy().getOperationsAccumulateParams().getPeriod());
assertTrue(builder.getTriggerPolicy().getOperationsAccumulateParams().getLimit() == 5);
}
-
@Test
public void testBuildSpecification() throws BuilderException {
//
// Create the builder
//
ControlLoopPolicyBuilder builder =
- ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 800);
+ ControlLoopPolicyBuilder.Factory.buildControlLoop(UUID.randomUUID().toString(), 800);
//
// Set the first invalid trigger policy
//
+ // @formatter:off
final Policy policy1 = builder.setTriggerPolicy(
- PolicyParam.builder()
+ PolicyParam.builder()
.id(UUID.randomUUID().toString())
.name(RESTART_VM)
.description(TRIGGER_RESTART)
@@ -699,8 +710,10 @@ public class ControlLoopPolicyBuilderTest {
.recipe(null)
.payload(null)
.retries(2)
- .timeout(300).build());
+ .timeout(300)
+ .build());
Results results = builder.buildSpecification();
+ // @formatter:on
//
// Check that ERRORs are in results for invalid policy arguments
//
@@ -732,32 +745,33 @@ public class ControlLoopPolicyBuilderTest {
//
// Set a valid trigger policy
//
- Policy policy1a = builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(REBUILD_VM)
- .description(REBUILD_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(REBUILD)
- .payload(null)
- .retries(1)
- .timeout(600).build());
+ // @formatter:off
+ Policy policy1a = builder.setTriggerPolicy(PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name(REBUILD_VM)
+ .description(REBUILD_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(REBUILD)
+ .payload(null)
+ .retries(1)
+ .timeout(600)
+ .build());
//
// Set a second valid trigger policy
//
- final Policy policy2 =
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
- .name(RESTART_VM)
- .description(TRIGGER_RESTART)
- .actor("APPC")
- .target(new Target(TargetType.VM))
- .recipe(RESTART)
- .payload(null)
- .retries(2)
- .timeout(300).build());
+ final Policy policy2 = builder.setTriggerPolicy(PolicyParam.builder()
+ .id(UUID.randomUUID().toString())
+ .name(RESTART_VM)
+ .description(TRIGGER_RESTART)
+ .actor("APPC")
+ .target(new Target(TargetType.VM))
+ .recipe(RESTART)
+ .payload(null)
+ .retries(2)
+ .timeout(300)
+ .build());
+ // @formatter:on
//
// Now, we have policy1 unreachable
//
@@ -765,7 +779,7 @@ public class ControlLoopPolicyBuilderTest {
boolean unreachable = false;
for (Message m : results.getMessages()) {
if (m.getMessage().equals("Policy " + policy1a.getId() + " is not reachable.")
- && m.getLevel() == MessageLevel.WARNING) {
+ && m.getLevel() == MessageLevel.WARNING) {
unreachable = true;
break;
}
@@ -775,12 +789,12 @@ public class ControlLoopPolicyBuilderTest {
// Set policy1a for the failure results of policy2
//
policy1a = builder.setPolicyForPolicyResult(policy1a.getId(), policy2.getId(), PolicyResult.FAILURE,
- PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
+ PolicyResult.FAILURE_RETRIES, PolicyResult.FAILURE_TIMEOUT);
results = builder.buildSpecification();
boolean invalidTimeout = false;
for (Message m : results.getMessages()) {
if ("controlLoop overall timeout is less than the sum of operational policy timeouts."
- .equals(m.getMessage()) && m.getLevel() == MessageLevel.ERROR) {
+ .equals(m.getMessage()) && m.getLevel() == MessageLevel.ERROR) {
invalidTimeout = true;
break;
}
@@ -797,7 +811,7 @@ public class ControlLoopPolicyBuilderTest {
unreachable = false;
for (Message m : results.getMessages()) {
if ("Open Loop policy contains policies. The policies will never be invoked.".equals(m.getMessage())
- && m.getLevel() == MessageLevel.WARNING) {
+ && m.getLevel() == MessageLevel.WARNING) {
unreachable = true;
break;
}
@@ -805,7 +819,6 @@ public class ControlLoopPolicyBuilderTest {
assertTrue(unreachable);
}
-
@Test
public void test1() throws Exception {
this.test("src/test/resources/v1.0.0/policy_Test.yaml");
@@ -842,20 +855,20 @@ public class ControlLoopPolicyBuilderTest {
// Now we're going to try to use the builder to build this.
//
ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(
- policyTobuild.getControlLoop().getControlLoopName(), policyTobuild.getControlLoop().getTimeout());
+ policyTobuild.getControlLoop().getControlLoopName(), policyTobuild.getControlLoop().getTimeout());
//
// Add services
//
if (policyTobuild.getControlLoop().getServices() != null) {
builder = builder.addService(policyTobuild.getControlLoop().getServices()
- .toArray(new Service[policyTobuild.getControlLoop().getServices().size()]));
+ .toArray(new Service[policyTobuild.getControlLoop().getServices().size()]));
}
//
// Add resources
//
if (policyTobuild.getControlLoop().getResources() != null) {
builder = builder.addResource(policyTobuild.getControlLoop().getResources()
- .toArray(new Resource[policyTobuild.getControlLoop().getResources().size()]));
+ .toArray(new Resource[policyTobuild.getControlLoop().getResources().size()]));
}
//
// Set pnf
@@ -879,12 +892,11 @@ public class ControlLoopPolicyBuilderTest {
}
private void setTriggerPolicies(ControlLoopPolicy policyTobuild, ControlLoopPolicyBuilder builder)
- throws BuilderException {
+ throws BuilderException {
for (Policy policy : policyTobuild.getPolicies()) {
if (policy.getId() == policyTobuild.getControlLoop().getTrigger_policy()) {
- builder.setTriggerPolicy(
- PolicyParam.builder()
- .id(UUID.randomUUID().toString())
+ // @formatter:off
+ builder.setTriggerPolicy(PolicyParam.builder().id(UUID.randomUUID().toString())
.name(policy.getName())
.description(policy.getDescription())
.actor(policy.getActor())
@@ -892,9 +904,10 @@ public class ControlLoopPolicyBuilderTest {
.recipe(policy.getRecipe())
.payload(null)
.retries(policy.getRetry())
- .timeout(policy.getTimeout()).build());
+ .timeout(policy.getTimeout())
+ .build());
+ // @formatter:on
}
}
}
-
}
diff --git a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java
index 0b61991f1..43428c6f9 100644
--- a/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java
+++ b/models-interactions/model-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java
@@ -3,7 +3,7 @@
* policy-yaml unit test
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,20 +23,14 @@ package org.onap.policy.controlloop.policy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import java.io.File;
import java.io.FileInputStream;
-import java.io.InputStream;
+import java.io.InputStreamReader;
+
import org.junit.Test;
-import org.onap.policy.common.utils.io.Serializer;
+import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.DumperOptions.FlowStyle;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.Constructor;
-
public class ControlLoopPolicyTest {
private static final Logger logger = LoggerFactory.getLogger(ControlLoopPolicyTest.class);
@@ -62,9 +56,8 @@ public class ControlLoopPolicyTest {
}
@Test
- public void testvFirewall() {
- // Chenfei to fix this.
- // this.test("src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml");
+ public void testvFirewall() throws Exception {
+ this.test("src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml");
}
@Test
@@ -89,37 +82,30 @@ public class ControlLoopPolicyTest {
* @throws Exception if an error occurs
*/
public void test(String testFile) throws Exception {
- try (InputStream is = new FileInputStream(new File(testFile))) {
+ try (InputStreamReader fileInputStream = new InputStreamReader(new FileInputStream(testFile))) {
//
// Read the yaml into our Java Object
//
- Yaml yaml = new Yaml(new Constructor(ControlLoopPolicy.class));
- Object obj = yaml.load(is);
- assertNotNull(obj);
- assertTrue(obj instanceof ControlLoopPolicy);
- dump(obj);
+ ControlLoopPolicy controlLoopPolicy1 =
+ new YamlJsonTranslator().fromYaml(fileInputStream, ControlLoopPolicy.class);
+ assertNotNull(controlLoopPolicy1);
+ dump(controlLoopPolicy1);
+
//
// Now dump it to a yaml string
//
- DumperOptions options = new DumperOptions();
- options.setDefaultFlowStyle(FlowStyle.BLOCK);
- options.setPrettyFlow(true);
- yaml = new Yaml(options);
- String dumpedYaml = yaml.dump(obj);
+ String dumpedYaml = new YamlJsonTranslator().toYaml(controlLoopPolicy1);
logger.debug(dumpedYaml);
//
// Read that string back into our java object
//
- Object newObject = yaml.load(dumpedYaml);
- dump(newObject);
- assertNotNull(newObject);
- assertTrue(newObject instanceof ControlLoopPolicy);
- assertEquals(obj, newObject);
+ ControlLoopPolicy controlLoopPolicy2 =
+ new YamlJsonTranslator().fromYaml(dumpedYaml, ControlLoopPolicy.class);
+ assertNotNull(controlLoopPolicy2);
+ dump(controlLoopPolicy2);
// test serialization
- ControlLoopPolicy policy = (ControlLoopPolicy) obj;
- ControlLoopPolicy policy2 = Serializer.roundTrip(policy);
- assertTrue(policy.equals(policy2));
+ assertEquals(controlLoopPolicy1, controlLoopPolicy2);
}
}
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml
index 73486b08b..de2590c15 100644
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_Test.yaml
@@ -1,5 +1,5 @@
# Copyright 2018 AT&T Intellectual Property. All rights reserved
-# Modifications Copyright (C) 2019 Nordix Foundation.
+# Modifications Copyright (C) 2019-2020 Nordix Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,9 +15,9 @@
controlLoop:
controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
version: 1.0.0
- services:
+ services:
- serviceName: Foo Service
- resources:
+ resources:
- resourceName: Bar VNF
resourceType: VF
trigger_policy: unique-policy-id-1-restart
@@ -29,7 +29,8 @@ policies:
description:
actor: APPC
recipe: Restart
- target: VM
+ target:
+ type: VM
retry: 2
timeout: 300
success: unique-policy-id-2-healthcheck-restart
@@ -37,13 +38,14 @@ policies:
failure_timeout: unique-policy-id-3-rebuild
failure_retries: unique-policy-id-3-rebuild
failure_exception: final_failure_exception
-
+
- id: unique-policy-id-2-healthcheck-restart
name: HealthCheck Policy
description:
actor: APPC
recipe: HealthCheck
- target: VM
+ target:
+ type: VM
retry: 2
timeout: 300
success: final_success
@@ -51,13 +53,14 @@ policies:
failure_timeout: unique-policy-id-3-rebuild
failure_retries: unique-policy-id-3-rebuild
failure_exception: final_failure_exception
-
+
- id: unique-policy-id-3-rebuild
name: Rebuild Policy
description:
actor: APPC
recipe: Rebuild
- target: VM
+ target:
+ type: VM
retry: 0
timeout: 600
success: unique-policy-id-4-healthcheck-rebuild
@@ -65,13 +68,14 @@ policies:
failure_timeout: unique-policy-id-5-migrate
failure_retries: unique-policy-id-5-migrate
failure_exception: final_failure_exception
-
+
- id: unique-policy-id-4-healthcheck-rebuild
name: HealthCheck the Rebuild Policy
description:
actor: APPC
recipe: HealthCheck
- target: VM
+ target:
+ type: VM
retry: 2
timeout: 300
success: final_success
@@ -79,13 +83,14 @@ policies:
failure_timeout: unique-policy-id-5-migrate
failure_retries: unique-policy-id-5-migrate
failure_exception: final_failure_exception
-
+
- id: unique-policy-id-5-migrate
name: Migrate Policy
description:
actor: APPC
recipe: Migrate
- target: VM
+ target:
+ type: VM
retry: 0
timeout: 600
success: unique-policy-id-6-healthcheck-migrate
@@ -99,7 +104,8 @@ policies:
description:
actor: APPC
recipe: HealthCheck
- target: VM
+ target:
+ type: VM
retry: 2
timeout: 300
success: final_success
diff --git a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml
index 009a49c19..44c081cb7 100644
--- a/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml
+++ b/models-interactions/model-yaml/src/test/resources/v1.0.0/policy_vService.yaml
@@ -1,5 +1,5 @@
# Copyright 2018 AT&T Intellectual Property. All rights reserved
-# Modifications Copyright (C) 2019 Nordix Foundation.
+# Modifications Copyright (C) 2019-2020 Nordix Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,9 +15,9 @@
controlLoop:
version: 1.0.0
controlLoopName: ControlLoop-vUSP-vCTS-cbed919f-2212-4ef7-8051-fe6308da1bda
- services:
+ services:
- serviceName: vUSP
- resources:
+ resources:
- resourceName: vCTS
resourceType: VF
- resourceName: vCOM
@@ -37,7 +37,8 @@ policies:
description:
actor: APPC
recipe: Restart
- target: VM
+ target:
+ type: VM
retry: 2
timeout: 300
success: final_success
@@ -45,13 +46,14 @@ policies:
failure_timeout: unique-policy-id-2-rebuild
failure_retries: unique-policy-id-2-rebuild
failure_exception: final_failure_exception
-
+
- id: unique-policy-id-2-rebuild
name: Rebuild Policy
description:
actor: APPC
recipe: Rebuild
- target: VM
+ target:
+ type: VM
retry: 0
timeout: 600
success: final_success
@@ -59,13 +61,14 @@ policies:
failure_timeout: unique-policy-id-3-migrate
failure_retries: unique-policy-id-3-migrate
failure_exception: final_failure_exception
-
+
- id: unique-policy-id-3-migrate
name: Migrate Policy
description:
actor: APPC
recipe: Migrate
- target: VM
+ target:
+ type: VM
retry: 0
timeout: 600
success: final_success
diff --git a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml
index 00b9b4cb1..feaba64cf 100644
--- a/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml
+++ b/models-interactions/model-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml
@@ -1,5 +1,5 @@
# Copyright 2018-2019 AT&T Intellectual Property. All rights reserved
-# Modifications Copyright (C) 2019 Nordix Foundation.
+# Modifications Copyright (C) 2019-2020 Nordix Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ policies:
target:
resourceID: Eace933104d443b496b8.nodes.heat.vpg
payload:
- generic-vnf.vnf-id: {generic-vnf.vnf-id}
+ generic-vnf.vnf-id: '{generic-vnf.vnf-id}'
streams: '{"active-streams":5}'
retry: 0
timeout: 300