aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java32
-rw-r--r--src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java24
-rw-r--r--src/test/java/org/onap/clamp/clds/it/DcaeIT.java25
-rw-r--r--src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java23
-rw-r--r--src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java70
-rw-r--r--src/test/java/org/onap/clamp/clds/it/RefPropIT.java26
-rw-r--r--src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java73
-rw-r--r--src/test/java/org/onap/clamp/clds/it/SdcIT.java54
-rw-r--r--src/test/java/org/onap/clamp/clds/model/CldsModelTest.java25
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java81
11 files changed, 238 insertions, 197 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java b/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java
index e7cb5c859..20b85d6f6 100644
--- a/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/req/SdcReqTest.java
@@ -23,6 +23,12 @@
package org.onap.clamp.clds.client.req;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Assert;
import org.junit.Test;
@@ -32,12 +38,6 @@ import org.onap.clamp.clds.model.CldsSdcServiceDetail;
import org.onap.clamp.clds.model.prop.Global;
import org.onap.clamp.clds.model.prop.ModelProperties;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
public class SdcReqTest {
String baseUrl = "AYBABTU";
@@ -48,35 +48,35 @@ public class SdcReqTest {
ModelProperties prop = mock(ModelProperties.class);
SdcCatalogServices sdcCatalogServices = mock(SdcCatalogServices.class);
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- Global global = mock(Global.class);
- CldsSdcServiceDetail CldsSdcServiceDetail = mock(CldsSdcServiceDetail.class);
- CldsSdcResource CldsSdcResource = mock(CldsSdcResource.class);
- List<CldsSdcResource> CldsSdcResources = new ArrayList<>();
- CldsSdcResources.add(CldsSdcResource);
+ CldsSdcResource cldsSdcResource = mock(CldsSdcResource.class);
+ List<CldsSdcResource> cldsSdcResources = new ArrayList<>();
+ cldsSdcResources.add(cldsSdcResource);
List<String> resourceVf = new ArrayList<>();
resourceVf.add(serviceInvariantUUID);
Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty());
+ Global global = mock(Global.class);
when(prop.getGlobal()).thenReturn(global);
Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty());
when(global.getService()).thenReturn(serviceInvariantUUID);
Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty());
- when(sdcCatalogServices.getCldsSdcServiceDetailFromJson(null)).thenReturn(CldsSdcServiceDetail);
+ CldsSdcServiceDetail cldsSdcServiceDetail = mock(CldsSdcServiceDetail.class);
+ when(sdcCatalogServices.getCldsSdcServiceDetailFromJson(null)).thenReturn(cldsSdcServiceDetail);
when(global.getResourceVf()).thenReturn(new ArrayList<>());
Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty());
- when(CldsSdcServiceDetail.getResources()).thenReturn(CldsSdcResources);
+ when(cldsSdcServiceDetail.getResources()).thenReturn(cldsSdcResources);
Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty());
- when(CldsSdcResource.getResoucreType()).thenReturn("VF");
+ when(cldsSdcResource.getResoucreType()).thenReturn("VF");
Assert.assertTrue(SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution).isEmpty());
when(global.getResourceVf()).thenReturn(resourceVf);
- when(CldsSdcResource.getResourceInvariantUUID()).thenReturn(serviceInvariantUUID);
- when(CldsSdcResource.getResourceInstanceName()).thenReturn("Resource instance name");
+ when(cldsSdcResource.getResourceInvariantUUID()).thenReturn(serviceInvariantUUID);
+ when(cldsSdcResource.getResourceInstanceName()).thenReturn("Resource instance name");
List<String> expected = new ArrayList<>();
expected.add("AYBABTU/null/resourceInstances/resourceinstancename/artifacts");
Assert.assertEquals(expected, SdcReq.getSdcReqUrlsList(prop, baseUrl, sdcCatalogServices, delegateExecution));
diff --git a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java
index fa8adc761..b3d521722 100644
--- a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java
+++ b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
@@ -36,12 +36,12 @@ public class CldsUserJsonDecoderTest {
private String password = "5f4dcc3b5aa765d61d8327deb882cf99";
private String[] normalPermissionsArray = { "permission-type-cl|dev|read", "permission-type-cl|dev|update",
- "permission-type-cl-manage|dev|*", "permission-type-filter-vf|dev|*", "permission-type-template|dev|read",
- "permission-type-template|dev|update" };
+ "permission-type-cl-manage|dev|*", "permission-type-filter-vf|dev|*", "permission-type-template|dev|read",
+ "permission-type-template|dev|update" };
private String[] incompletePermissionsArray = { "permission-type-cl|dev|*", "permission-type-cl|dev|*",
- "permission-type-cl-manage|dev|*", "permission-type-filter-vf|dev|*", "permission-type-template|dev|read",
- "permission-type-template|dev|update" };
+ "permission-type-cl-manage|dev|*", "permission-type-filter-vf|dev|*", "permission-type-template|dev|read",
+ "permission-type-template|dev|update" };
@Test
public void testDecodingDoubleUsers() throws Exception {
diff --git a/src/test/java/org/onap/clamp/clds/it/DcaeIT.java b/src/test/java/org/onap/clamp/clds/it/DcaeIT.java
index 54b27974d..6cdcf98d6 100644
--- a/src/test/java/org/onap/clamp/clds/it/DcaeIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/DcaeIT.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
@@ -23,13 +23,15 @@
package org.onap.clamp.clds.it;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.onap.clamp.clds.AbstractIT;
import org.onap.clamp.clds.client.req.DcaeReq;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.prop.ModelProperties;
import org.onap.clamp.clds.transform.TransformUtil;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
@@ -48,7 +50,8 @@ public class DcaeIT extends AbstractIT {
String modelName = "example-model";
String controlName = "ClosedLoop-FRWL-SIG-1582f840-2881-11e6-b4ec-005056a9d756";
- ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, true, modelBpmnProp, modelProp);
+ ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT,
+ true, modelBpmnProp, modelProp);
String dcaeReq = DcaeReq.format(refProp, prop);
System.out.println("dcaeReq=" + dcaeReq);
diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
index 7960c6afb..543fba705 100644
--- a/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientIT.java
@@ -23,6 +23,7 @@
package org.onap.clamp.clds.it;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -33,20 +34,24 @@ import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.onap.clamp.clds.AbstractIT;
+import org.onap.clamp.clds.client.req.OperationalPolicyReq;
+import org.onap.clamp.clds.client.req.StringMatchPolicyReq;
import org.onap.clamp.clds.client.req.TcaMPolicyReq;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.prop.*;
+import org.onap.clamp.clds.transform.TransformUtil;
+
import org.onap.policy.api.AttributeType;
+
import org.skyscreamer.jsonassert.JSONAssert;
+
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
-import org.onap.clamp.clds.client.req.OperationalPolicyReq;
-import org.onap.clamp.clds.client.req.StringMatchPolicyReq;
-import org.onap.clamp.clds.transform.TransformUtil;
-import static org.junit.Assert.assertEquals;
+
/**
* Test Policy API in org.onap.clamp.ClampDesigner.client package - replicate
@@ -60,6 +65,10 @@ public class PolicyClientIT extends AbstractIT {
String modelName;
String controlName;
+
+ /**
+ * Initialize Test.
+ */
@Before
public void setUp() throws IOException {
modelProp = TransformUtil.getResourceAsString("example/modelProp.json");
@@ -168,6 +177,9 @@ public class PolicyClientIT extends AbstractIT {
}
// @Test
+ /**
+ * Temporarily disabled Test.
+ */
public void testCreateUpdateDeleteStringMatchPolicy() throws Exception {
createUpdateStringMatch(CldsEvent.ACTION_SUBMIT);
@@ -178,6 +190,9 @@ public class PolicyClientIT extends AbstractIT {
}
// @Test
+ /**
+ * Temporarily disabled Test.
+ */
public void testCreateUpdateDeleteOperationalPolicy() throws Exception {
createUpdateOperationalPolicy(CldsEvent.ACTION_SUBMIT);
diff --git a/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java b/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java
index ca849e170..c3b35eec9 100644
--- a/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/PropJsonBuilderIT.java
@@ -23,6 +23,12 @@
package org.onap.clamp.clds.it;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
import java.io.IOException;
import org.junit.Before;
@@ -35,12 +41,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
/**
* Test SDC API - stand alone (except for some config). Replicates
* getSdcServices and getSdcServicesByUUID in the CldsService Adds test of
@@ -51,9 +51,12 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class PropJsonBuilderIT extends AbstractIT {
- private String globalPropsPartial;
+ private String globalPropsPartial;
private ObjectMapper mapper;
+ /**
+ * Initial test setup.
+ */
@Before
public void setUp() throws IOException {
String url = refProp.getStringValue("sdc.serviceUrl");
@@ -81,13 +84,11 @@ public class PropJsonBuilderIT extends AbstractIT {
}
private void sampleJsonObject() throws JsonProcessingException {
- ArrayNode arrayNode = mapper.createArrayNode();
/**
- * Create three JSON Objects objectNode1, objectNode2, objectNode3 Add
- * all these three objects in the array
+ * Create three JSON Objects objectNode1, objectNode2, objectNode3.
+ * Add all these three objects in the array
*/
-
ObjectNode objectNode1 = mapper.createObjectNode();
objectNode1.put("bookName", "Java");
objectNode1.put("price", "100");
@@ -101,8 +102,9 @@ public class PropJsonBuilderIT extends AbstractIT {
objectNode3.put("price", "500");
/**
- * Array contains JSON Objects
+ * Array contains JSON Objects.
*/
+ ArrayNode arrayNode = mapper.createArrayNode();
arrayNode.add(objectNode1);
arrayNode.add(objectNode2);
arrayNode.add(objectNode3);
@@ -114,7 +116,7 @@ public class PropJsonBuilderIT extends AbstractIT {
System.out.println(arrayNode.toString());
/**
- * To make the JSON String pretty use the below code
+ * To make the JSON String pretty use the below code.
*/
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(arrayNode));
}
@@ -122,6 +124,7 @@ public class PropJsonBuilderIT extends AbstractIT {
private String createEmptySharedObject() throws JsonProcessingException {
/**
+ * Empty Object initialization.
* "": { "vf": { "": "" }, "location": { "": "" }, "alarmCondition": {
* "": "" } }
*/
@@ -133,30 +136,31 @@ public class PropJsonBuilderIT extends AbstractIT {
locationObjectNode.putPOJO("location", emptyObjectNode);
ObjectNode alarmConditionObjectNode = mapper.createObjectNode();
alarmConditionObjectNode.putPOJO("alarmCondition", emptyObjectNode);
- ObjectNode emptyServiceObjectNode = mapper.createObjectNode();
ArrayNode samArrayNode = mapper.createArrayNode();
samArrayNode.add(vfObjectNode);
samArrayNode.add(locationObjectNode);
samArrayNode.add(alarmConditionObjectNode);
+ ObjectNode emptyServiceObjectNode = mapper.createObjectNode();
emptyServiceObjectNode.putPOJO("", samArrayNode);
/**
+ * Object initialization.
* "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": "DCAE_CLAMP_DEMO3" }
*
*/
- ObjectNode vfObjectNode2 = mapper.createObjectNode();
ObjectNode dcaeClampDemo3Node = mapper.createObjectNode();
dcaeClampDemo3Node.put("DCAE_CLAMP_DEMO3", "DCAE_CLAMP_DEMO3");
ArrayNode vfArrayNode = mapper.createArrayNode();
vfArrayNode.add(emptyObjectNode);
vfArrayNode.add(dcaeClampDemo3Node);
+ ObjectNode vfObjectNode2 = mapper.createObjectNode();
vfObjectNode2.putPOJO("vf", vfArrayNode);
/**
+ * Object initialization.
* "location": { "SNDGCA64": "San Diego SAN3", "ALPRGAED":
* "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" },
*/
- ObjectNode locationObjectNode2 = mapper.createObjectNode();
ObjectNode sandiegoLocationNode = mapper.createObjectNode();
sandiegoLocationNode.put("SNDGCA64", "San Diego SAN3");
ObjectNode alpharettaNode = mapper.createObjectNode();
@@ -165,14 +169,15 @@ public class PropJsonBuilderIT extends AbstractIT {
locationArrayNode.add(emptyObjectNode);
locationArrayNode.add(sandiegoLocationNode);
locationArrayNode.add(alpharettaNode);
+ ObjectNode locationObjectNode2 = mapper.createObjectNode();
locationObjectNode2.putPOJO("location", locationArrayNode);
/**
+ * Object initialization.
* "alarmCondition": { "A+Fallback+Operation+will+soon+be+started":
* "A Fallback Operation will soon be started",
* "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto Export Backup Failed",
*/
- ObjectNode alarmConditionObjectNode2 = mapper.createObjectNode();
ObjectNode alamrCondition1 = mapper.createObjectNode();
alamrCondition1.put("A+Fallback+Operation+will+soon+be+started", "A Fallback Operation will soon be started");
ObjectNode alarmConditon2 = mapper.createObjectNode();
@@ -181,6 +186,7 @@ public class PropJsonBuilderIT extends AbstractIT {
alarmArrayNode.add(emptyObjectNode);
alarmArrayNode.add(alamrCondition1);
alarmArrayNode.add(alarmConditon2);
+ ObjectNode alarmConditionObjectNode2 = mapper.createObjectNode();
alarmConditionObjectNode2.putPOJO("alarmCondition", alarmArrayNode);
ArrayNode byServiceIdArrayNode = mapper.createArrayNode();
@@ -200,12 +206,10 @@ public class PropJsonBuilderIT extends AbstractIT {
byServiceBasicObjetNode.putPOJO("byService", byServiceBasicArrayNode);
/**
+ * Object initialization.
* "byVf": { "": { "vfc": { "": "" },
* "03596c12-c7e3-44b7-8994-5cdfeda8afdd": { "vfc": { " ": " " } } } }
*/
-
- ObjectNode byVfCBasicNode = mapper.createObjectNode();
- ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
ObjectNode vfCObjectNode = mapper.createObjectNode();
vfCObjectNode.putPOJO("vfC", emptyObjectNode);
ObjectNode vfcIdObjectNode = mapper.createObjectNode();
@@ -213,8 +217,10 @@ public class PropJsonBuilderIT extends AbstractIT {
ArrayNode emptyvfcArrayNode = mapper.createArrayNode();
emptyvfcArrayNode.add(vfCObjectNode);
emptyvfcArrayNode.add(vfcIdObjectNode);
+ ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
emptyvfcobjectNode.putPOJO("", emptyvfcArrayNode);
+ ObjectNode byVfCBasicNode = mapper.createObjectNode();
byVfCBasicNode.putPOJO("byVf", emptyvfcobjectNode);
ArrayNode finalSharedArrayObject = mapper.createArrayNode();
@@ -232,12 +238,9 @@ public class PropJsonBuilderIT extends AbstractIT {
}
private String createTestEmptySharedObject() throws IOException {
- String locationStringValue = refProp.getStringValue("ui.location.default");
- String alarmStringValue = refProp.getStringValue("ui.alarm.default");
- ObjectNode locationJsonNode = (ObjectNode) mapper.readValue(locationStringValue, JsonNode.class);
- ObjectNode alarmStringJsonNode = (ObjectNode) mapper.readValue(alarmStringValue, JsonNode.class);
/**
+ * Object initialization.
* "": { "vf": { "": "" }, "location": { "": "" }, "alarmCondition": {
* "": "" } }
*/
@@ -251,6 +254,7 @@ public class PropJsonBuilderIT extends AbstractIT {
emptyServiceObjectNode.putPOJO("", vfObjectNode);
/**
+ * Object initialization.
* "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": "DCAE_CLAMP_DEMO3" }
*
*/
@@ -261,15 +265,19 @@ public class PropJsonBuilderIT extends AbstractIT {
vfObjectNode2.putPOJO("vf", dcaeClampDemo3Node);
/**
+ * Object initialization.
* "location": { "SNDGCA64": "San Diego SAN3", "ALPRGAED":
* "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" },
*/
// ObjectNode sandiegoLocationNode = mapper.createObjectNode();
// sandiegoLocationNode.put("SNDGCA64","San Diego SAN3");
// sandiegoLocationNode.put("ALPRGAED","Alpharetta PDK1");
+ String locationStringValue = refProp.getStringValue("ui.location.default");
+ ObjectNode locationJsonNode = (ObjectNode) mapper.readValue(locationStringValue, JsonNode.class);
vfObjectNode2.putPOJO("location", locationJsonNode);
/**
+ * Object initialization.
* "alarmCondition": { "A+Fallback+Operation+will+soon+be+started":
* "A Fallback Operation will soon be started",
* "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto Export Backup Failed",
@@ -279,27 +287,28 @@ public class PropJsonBuilderIT extends AbstractIT {
// Fallback Operation will soon be started");
// alamrCondition1.put("BRM%2C+Scheduled+Backup+Failed","BRM, Scheduled
// Backup Failed");
+ String alarmStringValue = refProp.getStringValue("ui.alarm.default");
+ ObjectNode alarmStringJsonNode = (ObjectNode) mapper.readValue(alarmStringValue, JsonNode.class);
vfObjectNode2.putPOJO("alarmCondition", alarmStringJsonNode);
emptyServiceObjectNode.putPOJO("c989a551-69f7-4b30-b10a-2e85bb227c30", vfObjectNode2);
ObjectNode byServiceBasicObjetNode = mapper.createObjectNode();
byServiceBasicObjetNode.putPOJO("byService", emptyServiceObjectNode);
/**
+ * Object initialization.
* "byVf": { "": { "vfc": { "": "" },
* "03596c12-c7e3-44b7-8994-5cdfeda8afdd": { "vfc": { " ": " " } } } }
*/
-
- ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
ObjectNode vfCObjectNode = mapper.createObjectNode();
vfCObjectNode.putPOJO("vfC", emptyObjectNode);
ObjectNode subVfCObjectNode = mapper.createObjectNode();
subVfCObjectNode.putPOJO("vfc", emptyObjectNode);
vfCObjectNode.putPOJO("03596c12-c7e3-44b7-8994-5cdfeda8afdd", subVfCObjectNode);
+ ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
emptyvfcobjectNode.putPOJO("", vfCObjectNode);
byServiceBasicObjetNode.putPOJO("byVf", emptyvfcobjectNode);
ObjectNode readTree = (ObjectNode) mapper.readValue(globalPropsPartial, JsonNode.class);
-
readTree.putPOJO("shared", byServiceBasicObjetNode);
System.out.println("valuie of objNode:" + readTree);
return readTree.toString();
@@ -307,6 +316,7 @@ public class PropJsonBuilderIT extends AbstractIT {
private String createCldsSharedObject(CldsSdcServiceDetail CldsSdcServiceDetail) throws IOException {
/**
+ * Object initialization.
* "": { "vf": { "": "" }, "location": { "": "" }, "alarmCondition": {
* "": "" } }
*/
@@ -320,6 +330,7 @@ public class PropJsonBuilderIT extends AbstractIT {
emptyServiceObjectNode.putPOJO("", vfObjectNode);
/**
+ * Object initialization.
* "vf": { " ": " ", "DCAE_CLAMP_DEMO3 1": "DCAE_CLAMP_DEMO3" }
*
*/
@@ -330,6 +341,7 @@ public class PropJsonBuilderIT extends AbstractIT {
vfObjectNode2.putPOJO("vf", dcaeClampDemo3Node);
/**
+ * Object initialization.
* "location": { "SNDGCA64": "San Diego SAN3", "ALPRGAED":
* "Alpharetta PDK1", "LSLEILAA": "Lisle DPA3" },
*/
@@ -339,6 +351,7 @@ public class PropJsonBuilderIT extends AbstractIT {
vfObjectNode2.putPOJO("location", sandiegoLocationNode);
/**
+ * Object initialization.
* "alarmCondition": { "A+Fallback+Operation+will+soon+be+started":
* "A Fallback Operation will soon be started",
* "BRM%2C+Auto+Export+Backup+Failed": "BRM, Auto Export Backup Failed",
@@ -352,16 +365,17 @@ public class PropJsonBuilderIT extends AbstractIT {
byServiceBasicObjetNode.putPOJO("byService", emptyServiceObjectNode);
/**
+ * Object initialization.
* "byVf": { "": { "vfc": { "": "" },
* "03596c12-c7e3-44b7-8994-5cdfeda8afdd": { "vfc": { " ": " " } } } }
*/
- ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
ObjectNode vfCObjectNode = mapper.createObjectNode();
vfCObjectNode.putPOJO("vfC", emptyObjectNode);
ObjectNode subVfCObjectNode = mapper.createObjectNode();
subVfCObjectNode.putPOJO("vfc", emptyObjectNode);
vfCObjectNode.putPOJO("03596c12-c7e3-44b7-8994-5cdfeda8afdd", subVfCObjectNode);
+ ObjectNode emptyvfcobjectNode = mapper.createObjectNode();
emptyvfcobjectNode.putPOJO("", vfCObjectNode);
byServiceBasicObjetNode.putPOJO("byVf", emptyvfcobjectNode);
diff --git a/src/test/java/org/onap/clamp/clds/it/RefPropIT.java b/src/test/java/org/onap/clamp/clds/it/RefPropIT.java
index e3dd37232..c6a5de29d 100644
--- a/src/test/java/org/onap/clamp/clds/it/RefPropIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/RefPropIT.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
@@ -23,6 +23,9 @@
package org.onap.clamp.clds.it;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
import java.io.IOException;
import org.junit.Test;
@@ -31,9 +34,6 @@ import org.onap.clamp.clds.AbstractIT;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
/**
* Test corg.onap.clamp.ClampDesigner.model.refprop package using RefProp.
*/
@@ -43,8 +43,8 @@ public class RefPropIT extends AbstractIT {
/**
* Test getting prop value as a JSON Node / template.
- *
- * @throws IOException
+ *
+ * @throws IOException when JSON parsing fails
*/
@Test
public void testJsonTemplate() throws IOException {
diff --git a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java
index 159e66ac5..46e45f35c 100644
--- a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesIT.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
@@ -55,13 +55,13 @@ public class SdcCatalogServicesIT extends AbstractIT {
@Test
public void removeDuplicateServicesTest() throws Exception {
- SdcCatalogServices catalogServices = new SdcCatalogServices();
- List<CldsSdcServiceInfo> rawCldsSdcServiceList = new LinkedList<CldsSdcServiceInfo>();
CldsSdcServiceInfo service1a = new CldsSdcServiceInfo();
service1a.setName("service1");
service1a.setVersion("1.0");
service1a.setInvariantUUID("invariantUUID1.0");
+
+ List<CldsSdcServiceInfo> rawCldsSdcServiceList = new LinkedList<CldsSdcServiceInfo>();
rawCldsSdcServiceList.add(service1a);
rawCldsSdcServiceList.add(service1a);
@@ -83,11 +83,13 @@ public class SdcCatalogServicesIT extends AbstractIT {
service2.setInvariantUUID("invariantUUID2.0");
rawCldsSdcServiceList.add(service2);
+ SdcCatalogServices catalogServices = new SdcCatalogServices();
List<CldsSdcServiceInfo> resultList = catalogServices.removeDuplicateServices(rawCldsSdcServiceList);
assertTrue(resultList.size() == 2);
- CldsSdcServiceInfo res1, res2;
+ CldsSdcServiceInfo res1;
+ CldsSdcServiceInfo res2;
if ("service1".equals(resultList.get(0).getName())) {
res1 = resultList.get(0);
res2 = resultList.get(1);
@@ -106,7 +108,7 @@ public class SdcCatalogServicesIT extends AbstractIT {
@Test
public void removeDuplicateSdcResourceInstancesTest() {
- SdcCatalogServices catalogServices = new SdcCatalogServices();
+
List<CldsSdcResource> rawCldsSdcResourceList = new LinkedList<CldsSdcResource>();
CldsSdcResource sdcResource1a = new CldsSdcResource();
@@ -129,9 +131,11 @@ public class SdcCatalogServicesIT extends AbstractIT {
sdcResource2.setResourceVersion("1.0");
rawCldsSdcResourceList.add(sdcResource2);
+ SdcCatalogServices catalogServices = new SdcCatalogServices();
List<CldsSdcResource> resultList = catalogServices.removeDuplicateSdcResourceInstances(rawCldsSdcResourceList);
- CldsSdcResource res1, res2;
+ CldsSdcResource res1;
+ CldsSdcResource res2;
if ("resource1".equals(resultList.get(0).getResourceInstanceName())) {
res1 = resultList.get(0);
res2 = resultList.get(1);
@@ -151,7 +155,6 @@ public class SdcCatalogServicesIT extends AbstractIT {
@Test
public void removeDuplicateSdcResourceBasicInfoTest() {
- SdcCatalogServices catalogServices = new SdcCatalogServices();
List<CldsSdcResourceBasicInfo> rawCldsSdcResourceList = new LinkedList<CldsSdcResourceBasicInfo>();
CldsSdcResourceBasicInfo sdcResource1a = new CldsSdcResourceBasicInfo();
@@ -174,10 +177,12 @@ public class SdcCatalogServicesIT extends AbstractIT {
sdcResource2.setVersion("1.0");
rawCldsSdcResourceList.add(sdcResource2);
+ SdcCatalogServices catalogServices = new SdcCatalogServices();
List<CldsSdcResourceBasicInfo> resultList = catalogServices
.removeDuplicateSdcResourceBasicInfo(rawCldsSdcResourceList);
- CldsSdcResourceBasicInfo res1, res2;
+ CldsSdcResourceBasicInfo res1;
+ CldsSdcResourceBasicInfo res2;
if ("resource1".equals(resultList.get(0).getName())) {
res1 = resultList.get(0);
res2 = resultList.get(1);
@@ -196,92 +201,92 @@ public class SdcCatalogServicesIT extends AbstractIT {
@Test
public void getServiceUuidFromServiceInvariantIdTest() throws Exception {
- SdcCatalogServices aSpy = Mockito.spy(sdcCatalogWired);
- Mockito.when(aSpy.getSdcServicesInformation(null)).thenReturn(IOUtils.toString(
+ SdcCatalogServices spy = Mockito.spy(sdcCatalogWired);
+ Mockito.when(spy.getSdcServicesInformation(null)).thenReturn(IOUtils.toString(
SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8"));
// Try the vcts4 version 1.0, this one should be replaced by 1.1 so it
// should not exist, returning empty string
- String resUuidVcts4Null = aSpy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d9b");
+ String resUuidVcts4Null = spy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d9b");
assertTrue("".equals(resUuidVcts4Null));
// Try the vcts4 version 1.1, this one should be there as it replaces
// the vcts4 v1.0
- String resUuidVcts4Latest = aSpy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d9c");
+ String resUuidVcts4Latest = spy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d9c");
assertTrue("29018914-966c-442d-9d08-251b9dc45b8f".equals(resUuidVcts4Latest));
// Try the vcts5 version 1.0, this one should be there
- String resUuidVcts5 = aSpy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d8c");
+ String resUuidVcts5 = spy.getServiceUuidFromServiceInvariantId("a33ed748-3477-4434-b3f3-b5560f5e7d8c");
assertTrue("29018914-966c-442d-9d08-251b9dc45b7f".equals(resUuidVcts5));
// try one that does not exist at all
- String resUuidUnknown = aSpy.getServiceUuidFromServiceInvariantId("testuuid");
+ String resUuidUnknown = spy.getServiceUuidFromServiceInvariantId("testuuid");
assertTrue("".equals(resUuidUnknown));
}
@Test
public void getCldsServiceDataWithAlarmConditionsTest() throws Exception {
- SdcCatalogServices aSpy = Mockito.spy(sdcCatalogWired);
- Mockito.when(aSpy.getSdcServicesInformation(null)).thenReturn(IOUtils.toString(
+ SdcCatalogServices spy = Mockito.spy(sdcCatalogWired);
+ Mockito.when(spy.getSdcServicesInformation(null)).thenReturn(IOUtils.toString(
SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcServicesListExample.json"), "UTF-8"));
// This invariant uuid is the one from vcts4 v1.1
String serviceResourceDetailUrl = refProp.getStringValue("sdc.serviceUrl")
+ "/29018914-966c-442d-9d08-251b9dc45b8f/metadata";
- Mockito.when(aSpy.getCldsServicesOrResourcesBasedOnURL(serviceResourceDetailUrl, false))
+ Mockito.when(spy.getCldsServicesOrResourcesBasedOnURL(serviceResourceDetailUrl, false))
.thenReturn(IOUtils.toString(
SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcServiceDetailsExample.json"),
"UTF-8"));
String resourceDetailUrl = refProp.getStringValue("sdc.catalog.url")
+ "resources/585822c7-4027-4f84-ba50-e9248606f136/metadata";
- Mockito.when(aSpy.getCldsServicesOrResourcesBasedOnURL(resourceDetailUrl, false))
+ Mockito.when(spy.getCldsServicesOrResourcesBasedOnURL(resourceDetailUrl, false))
.thenReturn(IOUtils.toString(
SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcResourceDetailsExample.json"),
"UTF-8"));
String securityRulesDetailUrl = refProp.getStringValue("sdc.catalog.url")
+ "resources/d57e57d2-e3c6-470d-8d16-e6ea05f536c5/metadata";
- Mockito.when(aSpy.getCldsServicesOrResourcesBasedOnURL(securityRulesDetailUrl, false)).thenReturn(
+ Mockito.when(spy.getCldsServicesOrResourcesBasedOnURL(securityRulesDetailUrl, false)).thenReturn(
IOUtils.toString(SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcSecurityRules.json"),
"UTF-8"));
String cinderVolumeDetailUrl = refProp.getStringValue("sdc.catalog.url")
+ "resources/b4288e07-597a-44a2-aa98-ad36e551a39d/metadata";
- Mockito.when(aSpy.getCldsServicesOrResourcesBasedOnURL(cinderVolumeDetailUrl, false)).thenReturn(
+ Mockito.when(spy.getCldsServicesOrResourcesBasedOnURL(cinderVolumeDetailUrl, false)).thenReturn(
IOUtils.toString(SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcCinderVolume.json"),
"UTF-8"));
String vfcGenericDetailUrl = refProp.getStringValue("sdc.catalog.url")
+ "resources/2c8f1219-8000-4001-aa13-496a0396d40f/metadata";
- Mockito.when(aSpy.getCldsServicesOrResourcesBasedOnURL(vfcGenericDetailUrl, false)).thenReturn(IOUtils.toString(
+ Mockito.when(spy.getCldsServicesOrResourcesBasedOnURL(vfcGenericDetailUrl, false)).thenReturn(IOUtils.toString(
SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcVFCGenericWithAlarms.json"), "UTF-8"));
String csvDetailUrl = "/sdc/v1/catalog/resources/84855843-5247-4e97-a2bd-5395a510253b/artifacts/d57ac7ec-f3c3-4793-983a-c75ac3a43153";
- Mockito.when(aSpy.getResponsesFromArtifactUrl(csvDetailUrl)).thenReturn(IOUtils.toString(
+ Mockito.when(spy.getResponsesFromArtifactUrl(csvDetailUrl)).thenReturn(IOUtils.toString(
SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcMeasurementsList.csv"), "UTF-8"));
String csvAlarmsDetailUrl = "/sdc/v1/catalog/resources/2c8f1219-8000-4001-aa13-496a0396d40f/resourceInstances/virc_fe_be/artifacts/5138e316-0237-49aa-817a-b3d8eaf77392";
- Mockito.when(aSpy.getResponsesFromArtifactUrl(csvAlarmsDetailUrl)).thenReturn(IOUtils
+ Mockito.when(spy.getResponsesFromArtifactUrl(csvAlarmsDetailUrl)).thenReturn(IOUtils
.toString(SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcAlarmsList.csv"), "UTF-8"));
String allVfResourcesDetailUrl = refProp.getStringValue("sdc.catalog.url") + "resources?resourceType=VF";
- Mockito.when(aSpy.getCldsServicesOrResourcesBasedOnURL(allVfResourcesDetailUrl, false)).thenReturn(IOUtils
+ Mockito.when(spy.getCldsServicesOrResourcesBasedOnURL(allVfResourcesDetailUrl, false)).thenReturn(IOUtils
.toString(SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcVFResources.json"), "UTF-8"));
String allVfcResourcesDetailUrl = refProp.getStringValue("sdc.catalog.url") + "resources?resourceType=VFC";
- Mockito.when(aSpy.getCldsServicesOrResourcesBasedOnURL(allVfcResourcesDetailUrl, false)).thenReturn(
+ Mockito.when(spy.getCldsServicesOrResourcesBasedOnURL(allVfcResourcesDetailUrl, false)).thenReturn(
IOUtils.toString(SdcCatalogServicesIT.class.getResourceAsStream("/example/sdc/sdcVFCResources.json"),
"UTF-8"));
- CldsServiceData cldsServiceData = aSpy
+ CldsServiceData cldsServiceData = spy
.getCldsServiceDataWithAlarmConditions("a33ed748-3477-4434-b3f3-b5560f5e7d9c");
assertTrue("a33ed748-3477-4434-b3f3-b5560f5e7d9c".equals(cldsServiceData.getServiceInvariantUUID()));
assertTrue("29018914-966c-442d-9d08-251b9dc45b8f".equals(cldsServiceData.getServiceUUID()));
assertTrue(cldsServiceData.getCldsVfs().size() == 1);
- List<CldsAlarmCondition> alarmsList = aSpy.getAllAlarmConditionsFromCldsServiceData(cldsServiceData);
+ List<CldsAlarmCondition> alarmsList = spy.getAllAlarmConditionsFromCldsServiceData(cldsServiceData);
assertTrue(alarmsList.size() == 6);
}
diff --git a/src/test/java/org/onap/clamp/clds/it/SdcIT.java b/src/test/java/org/onap/clamp/clds/it/SdcIT.java
index 0d8acbff9..62932f82a 100644
--- a/src/test/java/org/onap/clamp/clds/it/SdcIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/SdcIT.java
@@ -23,20 +23,21 @@
package org.onap.clamp.clds.it;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.onap.clamp.clds.AbstractIT;
+import org.onap.clamp.clds.client.SdcCatalogServices;
import org.onap.clamp.clds.client.req.SdcReq;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.prop.ModelProperties;
-import org.onap.clamp.clds.transform.TransformUtil;
import org.onap.clamp.clds.model.refprop.RefProp;
-import org.onap.clamp.clds.client.SdcCatalogServices;
+import org.onap.clamp.clds.transform.TransformUtil;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-import org.junit.BeforeClass;
-import org.springframework.beans.factory.annotation.Autowired;
/**
* Test DCAE API in org.onap.clamp.ClampDesigner.client package - replicate DCAE Delegates in test.
@@ -44,15 +45,15 @@ import org.springframework.beans.factory.annotation.Autowired;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SdcIT extends AbstractIT {
- @Autowired
- private RefProp refProp;
+ @Autowired
+ private RefProp refProp;
- @Autowired
- private SdcCatalogServices sdcCatalogServices;
+ @Autowired
+ private SdcCatalogServices sdcCatalogServices;
@BeforeClass
public static void oneTimeSetUp() {
- System.setProperty("AJSC_CONF_HOME", System.getProperty("user.dir") + "/src/test/resources/");
+ System.setProperty("AJSC_CONF_HOME", System.getProperty("user.dir") + "/src/test/resources/");
}
@Test
@@ -62,26 +63,25 @@ public class SdcIT extends AbstractIT {
String modelName = "example-model06";
String controlName = "ClosedLoop-FRWL-SIG04-1582f840-test-test-1234-005056a9d756";
String docText = TransformUtil.getResourceAsString("example/templateProp.json");
- ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, true, modelBpmnProp, modelProp);
+ ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT,
+ true, modelBpmnProp, modelProp);
String blueprint = SdcReq.formatBlueprint(refProp, prop, docText);
System.out.println("blueprint=" + blueprint);
//assertEquals(blueprint, "");
}
- @Test
- public void testTcaBlueprint() throws Exception {
- String modelProp = TransformUtil.getResourceAsString("example/modelPropForPolicy.json");
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
- String modelName = "example-model06";
- String controlName = "ClosedLoop-FRWL-SIG04-1582f840-test-test-1234-005056a9d756";
-
- String docText = TransformUtil.getResourceAsString("example/templatePropForTca.json");
-
- ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT, true, modelBpmnProp, modelProp);
- String blueprint = SdcReq.formatBlueprint(refProp, prop, docText);
-
- System.out.println("blueprint=" + blueprint);
- //assertEquals(blueprint, "");
- }
+ @Test
+ public void testTcaBlueprint() throws Exception {
+ String modelProp = TransformUtil.getResourceAsString("example/modelPropForPolicy.json");
+ String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
+ String modelName = "example-model06";
+ String controlName = "ClosedLoop-FRWL-SIG04-1582f840-test-test-1234-005056a9d756";
+ String docText = TransformUtil.getResourceAsString("example/templatePropForTca.json");
+ ModelProperties prop = new ModelProperties(modelName, controlName, CldsEvent.ACTION_SUBMIT,
+ true, modelBpmnProp, modelProp);
+ String blueprint = SdcReq.formatBlueprint(refProp, prop, docText);
+ System.out.println("blueprint=" + blueprint);
+ //assertEquals(blueprint, "");
+ }
}
diff --git a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
index 414b0425c..864c9246f 100644
--- a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
@@ -23,11 +23,12 @@
package org.onap.clamp.clds.model;
-import org.onap.clamp.clds.model.CldsModel;
+import static org.junit.Assert.assertEquals;
+
import org.jboss.resteasy.spi.BadRequestException;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.onap.clamp.clds.model.CldsModel;
/**
* Test org.onap.clamp.ClampDesigner.model.Model
@@ -45,6 +46,10 @@ public class CldsModelTest {
utilCreateUsingControlName("", "c42aceb-2350-11e6-8131-fa163ea8d2da");
}
+ /**
+ * Utility Method to create model from controlname and uuid.
+ */
+
public void utilCreateUsingControlName(String controlNamePrefix, String controlNameUuid) {
CldsModel model = CldsModel.createUsingControlName(controlNamePrefix + controlNameUuid);
assertEquals(controlNamePrefix, model.getControlNamePrefix());
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
index d0ba7455e..c6b19d0f9 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java
@@ -33,7 +33,7 @@ public class CustomModelElement extends ModelElement {
private static final String CUSTOM_TYPE = "customType";
/**
- *
+ * Main Constructor.
*/
public CustomModelElement(ModelProperties modelProp, ModelBpmn modelBpmn, JsonNode modelJson) {
super(CUSTOM_TYPE, modelProp, modelBpmn, modelJson);
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
index 1038e5de0..c1c4a8c39 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
@@ -23,12 +23,16 @@
package org.onap.clamp.clds.model.prop;
-import org.onap.clamp.clds.transform.TransformUtil;
-import org.junit.Assert;
-import org.junit.Test;
import static org.junit.Assert.assertEquals;
+
import java.io.IOException;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.onap.clamp.clds.transform.TransformUtil;
+
+
/**
* Test org.onap.clamp.ClampDesigner.model.prop package using ModelProperties.
*/
@@ -45,50 +49,45 @@ public class ModelPropertiesTest {
Assert.assertEquals(modName, prop.getModelName());
Assert.assertEquals(controlName, prop.getControlName());
Assert.assertEquals(null, prop.getActionCd());
-
- Global g = prop.getGlobal();
- Assert.assertEquals("0f983e18-4603-4bb4-a98c-e29691fb16a1", g.getService());
- Assert.assertEquals("[SNDGCA64]", g.getLocation().toString());
- Assert.assertEquals("[6c7aaec2-59eb-41d9-8681-b7f976ab668d]", g.getResourceVf().toString());
-
+ Global global = prop.getGlobal();
+ Assert.assertEquals("0f983e18-4603-4bb4-a98c-e29691fb16a1", global.getService());
+ Assert.assertEquals("[SNDGCA64]", global.getLocation().toString());
+ Assert.assertEquals("[6c7aaec2-59eb-41d9-8681-b7f976ab668d]", global.getResourceVf().toString());
StringMatch sm = prop.getType(StringMatch.class);
Assert.assertEquals("StringMatch_", sm.getId());
+ Policy policy = prop.getType(Policy.class);
+ Assert.assertEquals("Policy_", policy.getId());
+ Assert.assertEquals(null, policy.getTopicPublishes());
+ Assert.assertEquals(null, policy.getTopicSubscribes());
- Policy p = prop.getType(Policy.class);
- Assert.assertEquals("Policy_", p.getId());
- Assert.assertEquals(null, p.getTopicPublishes());
- Assert.assertEquals(null, p.getTopicSubscribes());
-
- Tca t = prop.getType(Tca.class);
- Assert.assertEquals("Narra", t.getTcaItems().get(0).getTcaName());
- Assert.assertEquals(Integer.valueOf(4), t.getTcaItems().get(0).getTcaThreshholds().get(0).getThreshhold());
+ Tca tca = prop.getType(Tca.class);
+ Assert.assertEquals("Narra", tca.getTcaItems().get(0).getTcaName());
+ Assert.assertEquals(Integer.valueOf(4), tca.getTcaItems().get(0).getTcaThreshholds().get(0).getThreshhold());
}
@Test
- public void testPolicy() throws IOException {
-
- String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
- System.out.println(modelBpmnProp);
-
- String modelProp = TransformUtil.getResourceAsString("example/modelPropForPolicy.json");
- System.out.println(modelProp);
-
- ModelProperties prop = new ModelProperties("example-model-name", "example-control-name", null, true, modelBpmnProp, modelProp);
- System.out.println("attempting prop.getGlobal()...");
- Global g = prop.getGlobal();
- System.out.println("attempting prop.getStringMatch()...");
- StringMatch stringMatch = prop.getType(StringMatch.class);
- if(stringMatch.isFound()){
- System.out.println("stringMatch json object is present...");
- assertEquals("1", stringMatch.getResourceGroups().get(0).getPolicyId());
- }
- System.out.println("attempting prop.getPolicy()...");
- Policy policy = prop.getType(Policy.class);
- if(policy.isFound()){
- System.out.println("policy json object is present...");
- assertEquals("1", policy.getPolicyChains().get(0).getPolicyId());
- }
- }
+ public void testPolicy() throws IOException {
+ String modelBpmnProp = TransformUtil.getResourceAsString("example/modelBpmnPropForPolicy.json");
+ System.out.println(modelBpmnProp);
+ String modelProp = TransformUtil.getResourceAsString("example/modelPropForPolicy.json");
+ System.out.println(modelProp);
+ ModelProperties prop = new ModelProperties("example-model-name", "example-control-name",
+ null, true, modelBpmnProp, modelProp);
+ System.out.println("attempting prop.getGlobal()...");
+ Global global = prop.getGlobal();
+ System.out.println("attempting prop.getStringMatch()...");
+ StringMatch stringMatch = prop.getType(StringMatch.class);
+ if (stringMatch.isFound()) {
+ System.out.println("stringMatch json object is present...");
+ assertEquals("1", stringMatch.getResourceGroups().get(0).getPolicyId());
+ }
+ System.out.println("attempting prop.getPolicy()...");
+ Policy policy = prop.getType(Policy.class);
+ if (policy.isFound()) {
+ System.out.println("policy json object is present...");
+ assertEquals("1", policy.getPolicyChains().get(0).getPolicyId());
+ }
+ }
} \ No newline at end of file