aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java2
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java4
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java32
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java4
-rw-r--r--src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java3
-rw-r--r--src/test/resources/application.properties5
8 files changed, 32 insertions, 22 deletions
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java
index c65c84a45..a99d4ab56 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java
@@ -40,7 +40,7 @@ public class ArrayFieldTest extends TestCase {
TemplateManagement templateManagement = new TemplateManagement(ResourceFileUtil.getResourceAsString(
"tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),ResourceFileUtil.getResourceAsString(
"clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor");
Property property = component.getProperties().get("actor");
ArrayField arrayParser = new ArrayField((ArrayList<Object>) property.getItems().get("default"));
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java
index f5d2fe6ee..565547e4b 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ComponentTest.java
@@ -42,7 +42,7 @@ public class ComponentTest extends TestCase {
new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor");
assertEquals(reference, component.propertiesNames());
}
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java
index 6f1046ea9..a4d329e29 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java
@@ -34,7 +34,7 @@ public class ConstraintTest extends TestCase {
TemplateManagement templateManagement = new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/constraints.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Operation");
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java
index 5a9955999..62def32b8 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/PropertyTest.java
@@ -43,7 +43,7 @@ public class PropertyTest extends TestCase {
TemplateManagement templateManagement = new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
Component component = templateManagement.getComponents().get("onap.datatype.controlloop.Actor");
Property property = component.getProperties().get("actor");
JsonArray toTest = property.parseArray((ArrayList<Object>) property.getItems().get("default"));
@@ -59,7 +59,7 @@ public class PropertyTest extends TestCase {
TemplateManagement templateManagement = new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
Component component = templateManagement.getComponents().get("onap.datatype.controlloop.operation.Failure");
Property property = component.getProperties().get("category");
Template template = templateManagement.getTemplates().get("string");
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java
index 4447a98cd..aaa549386 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateManagementTest.java
@@ -26,6 +26,7 @@ package org.onap.clamp.clds.tosca.update;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import junit.framework.TestCase;
import org.onap.clamp.clds.util.ResourceFileUtil;
@@ -44,7 +45,7 @@ public class TemplateManagementTest extends TestCase {
+ ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0&#63;"
+ "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
"clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
assertNull(templateManagement.getParseToJson());
String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app";
templateManagement.launchTranslation(componentName);
@@ -64,7 +65,7 @@ public class TemplateManagementTest extends TestCase {
+ ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0&#63;"
+ "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
"clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
assertNull(templateManagement.getParseToJson());
String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter";
templateManagement.launchTranslation(componentName);
@@ -84,7 +85,7 @@ public class TemplateManagementTest extends TestCase {
+ ".policies.controlloop.operational.common.Apex/versions/1.0.0&#63;"
+ "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
"clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
assertNull(templateManagement.getParseToJson());
String componentName = "onap.policies.controlloop.operational.common.Apex";
templateManagement.launchTranslation(componentName);
@@ -104,7 +105,7 @@ public class TemplateManagementTest extends TestCase {
+ ".policies.controlloop.operational.common.Drools/versions/1.0.0&#63;"
+ "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
"clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
assertNull(templateManagement.getParseToJson());
String componentName = "onap.policies.controlloop.operational.common.Drools";
templateManagement.launchTranslation(componentName);
@@ -122,7 +123,7 @@ public class TemplateManagementTest extends TestCase {
new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
assertNull(templateManagement.getParseToJson());
String componentName = "onap.policies.controlloop.operational.common.Drools";
templateManagement.launchTranslation(componentName);
@@ -139,10 +140,12 @@ public class TemplateManagementTest extends TestCase {
new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
int count = templateManagement.getTemplates().size();
- ArrayList<String> templateFields =
- new ArrayList<>(Arrays.asList("type", "description", "required", "metadata", "constraints"));
+ List<Field> templateFields = new ArrayList<>(Arrays.asList(new Field("type"), new Field("description"),
+ new Field(
+ "required"),
+ new Field("metadata"), new Field("constraints")));
templateManagement.addTemplate("test", templateFields);
assertNotSame(count, templateManagement.getTemplates().size());
}
@@ -157,7 +160,7 @@ public class TemplateManagementTest extends TestCase {
new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
int count = templateManagement.getTemplates().size();
templateManagement.removeTemplate("string");
assertNotSame(count, templateManagement.getTemplates().size());
@@ -173,9 +176,9 @@ public class TemplateManagementTest extends TestCase {
new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
int count = templateManagement.getTemplates().get("integer").getFields().size();
- templateManagement.updateTemplate("integer", "type", false);
+ templateManagement.updateTemplate("integer", new Field("type"), false);
assertNotSame(count, templateManagement.getTemplates().get("integer").getFields().size());
}
@@ -189,10 +192,11 @@ public class TemplateManagementTest extends TestCase {
new TemplateManagement(
ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca_update/defaultToscaTypes.yaml"),
- ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.properties"));
+ ResourceFileUtil.getResourceAsString("clds/tosca_update/templates.json"));
boolean has = true;
- ArrayList<String> templateFieldsString =
- new ArrayList<>(Arrays.asList("type", "description", "required", "metadata", "constraints"));
+ List<Field> templateFieldsString =
+ new ArrayList<>(Arrays.asList(new Field("type"), new Field("description"), new Field("required"),
+ new Field("metadata"), new Field("constraints")));
Template templateTest = new Template("String", templateFieldsString);
has = templateManagement.hasTemplate(templateTest);
assertEquals(false, has);
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java
index ebc119f0d..4ffb4e28e 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/TemplateTest.java
@@ -25,6 +25,7 @@ package org.onap.clamp.clds.tosca.update;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import junit.framework.TestCase;
public class TemplateTest extends TestCase {
@@ -34,7 +35,8 @@ public class TemplateTest extends TestCase {
*/
public void testCheckFields() {
Template toTest = new Template("toTest");
- ArrayList<String> fields = new ArrayList<>(Arrays.asList("type", "description", "enum"));
+ List<Field> fields = new ArrayList<>(Arrays.asList(new Field("type"), new Field("description"),new Field(
+ "enum")));
toTest.setFields(fields);
Template reference = new Template("toTest");
reference.setFields(fields);
diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
index f08e86e8e..03b2e506d 100644
--- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
+++ b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
@@ -77,7 +77,8 @@ public class PolicyEngineControllerTestItCase {
.contains(new PolicyModel("onap.policies.controlloop.guard.common.FrequencyLimiter", null, "1.0.0"));
assertThat(policyModelsList)
.contains(new PolicyModel("onap.policies.controlloop.guard.common.Blacklist", null, "1.0.0"));
- assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.guard.common.MinMax", null, "2.0.0"));
+ assertThat(policyModelsList)
+ .contains(new PolicyModel("onap.policies.controlloop.guard.common.MinMax", null, "2.0.0"));
// Re-do it to check that there is no issue with duplicate key
policyController.synchronizeAllPolicies();
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index 54ba0900c..0e453535c 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -165,4 +165,7 @@ clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Princ
# Configuration settings for CDS
clamp.config.cds.url=http4://localhost:${docker.http-cache.port.host}
clamp.config.cds.userName=ccsdkapps
-clamp.config.cds.password=ccsdkapps \ No newline at end of file
+clamp.config.cds.password=ccsdkapps
+
+## Tosca converter
+clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.json \ No newline at end of file