Merge "Update the clamp url"
diff --git a/INFO.yaml b/INFO.yaml
index b18c42e..e46ab84 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -51,11 +51,6 @@
company: 'ATT'
id: 'xuegao'
timezone: 'Europe/Brussels'
- - name: 'Adam Krysiak'
- email: 'adam.krysiak@nokia.com'
- company: 'Nokia'
- id: 'akrysiak'
- timezone: 'Europe/Warsaw'
tsc:
approval: 'https://lists.onap.org/pipermail/onap-tsc'
changes:
@@ -71,3 +66,6 @@
- type: 'Removal'
name: 'Wang Xinyuan1'
link: 'https://lists.onap.org/g/ONAP-TSC/message/4581'
+ - type: 'Removal'
+ name: 'Adam Krysiak'
+ link: 'https://lists.onap.org/g/ONAP-TSC/message/6306'
diff --git a/docs/images/user-guide/clamp-cds-operation.png b/docs/images/user-guide/clamp-cds-operation.png
new file mode 100755
index 0000000..edc4c63
--- /dev/null
+++ b/docs/images/user-guide/clamp-cds-operation.png
Binary files differ
diff --git a/docs/images/user-guide/create-loop.png b/docs/images/user-guide/create-loop.png
index 20b9f05..40cdb4c 100644
--- a/docs/images/user-guide/create-loop.png
+++ b/docs/images/user-guide/create-loop.png
Binary files differ
diff --git a/docs/images/user-guide/loop-menu.png b/docs/images/user-guide/loop-menu.png
index 658359e..b605634 100644
--- a/docs/images/user-guide/loop-menu.png
+++ b/docs/images/user-guide/loop-menu.png
Binary files differ
diff --git a/docs/images/user-guide/open-menu-prop.png b/docs/images/user-guide/open-menu-prop.png
index c07b225..046e2a3 100755
--- a/docs/images/user-guide/open-menu-prop.png
+++ b/docs/images/user-guide/open-menu-prop.png
Binary files differ
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index 4f9d4af..b426966 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -9,7 +9,7 @@
Version: 5.0.1
--------------
-:Release Date: 2020-04-02
+:Release Date: 2020-05-12
**New Features**
@@ -54,8 +54,8 @@
New Docker Containers are available. the list of containers composing this release are below:
- clamp-backend-filebeat-onap: docker.elastic.co/beats/filebeat 5.5.0
- - clamp-backend: nexus3.onap.org:10001/onap/clamp-backend 5.0.2
- - clamp-frontend: nexus3.onap.org:10001/onap/clamp-frontend 5.0.2
+ - clamp-backend: nexus3.onap.org:10001/onap/clamp-backend 5.0.6
+ - clamp-frontend: nexus3.onap.org:10001/onap/clamp-frontend 5.0.6
- clamp-dash-es: nexus3.onap.org:10001/onap/clamp-dashboard-elasticsearch 5.0.3
- clamp-dash-kibana: nexus3.onap.org:10001/onap/clamp-dashboard-kibana 5.0.3
- clamp-dash-logstash: nexus3.onap.org:10001/onap/clamp-dashboard-logstash 5.0.3
diff --git a/docs/user-guide.rst b/docs/user-guide.rst
index bfac885..b3c1535 100644
--- a/docs/user-guide.rst
+++ b/docs/user-guide.rst
@@ -94,7 +94,10 @@
|clamp-op-policy-box-policy|
+Operations and payload for CDS actor is fetched from CDS.
+Clamp receives CDS blueprint name and version information from sdnc_model_name and sdnc_model_version properties in CSAR distributed by SDC and queries CDS to get list of operations and payload for the corresponding CDS blueprint.
+|clamp-cds-operation|
Micro-service policy properties
-------------------------------
@@ -151,3 +154,4 @@
.. |clamp-policy-submitted| image:: images/user-guide/policy-submitted.png
.. |clamp-deploy-params| image:: images/user-guide/deploy-params.png
.. |blueprint-node| image:: images/user-guide/blueprint_node_type.png
+.. |clamp-cds-operation| image:: images/user-guide/clamp-cds-operation.png
diff --git a/pom.xml b/pom.xml
index ad450b5..5a15409 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.clamp</groupId>
<artifactId>clds</artifactId>
- <version>5.0.6-SNAPSHOT</version>
+ <version>5.1.0-SNAPSHOT</version>
<name>clamp</name>
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateFieldTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateFieldTest.java
new file mode 100644
index 0000000..29f5a1d
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateFieldTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.tosca.update;
+
+import junit.framework.TestCase;
+import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField;
+
+public class JsonTemplateFieldTest extends TestCase {
+
+ JsonTemplateField field1 = new JsonTemplateField("type", "testType", true, true);
+ JsonTemplateField field2 = new JsonTemplateField("type");
+ JsonTemplateField field3 = new JsonTemplateField("type", "testType1", true, true);
+ JsonTemplateField field4 = new JsonTemplateField("type", "testType", false, true);
+ JsonTemplateField field5 = new JsonTemplateField("type", "testType", true, false);
+ JsonTemplateField field6 = new JsonTemplateField("type", "testType", true, true);
+
+ /**
+ * Test fieldsEqual method.
+ */
+ public void testFieldsEqualsMethod() {
+ assertFalse(JsonTemplateField.fieldsEquals(field1,field3));
+ assertFalse(JsonTemplateField.fieldsEquals(field1,field4));
+ assertFalse(JsonTemplateField.fieldsEquals(field1,field5));
+ assertTrue(JsonTemplateField.fieldsEquals(field1,field6));
+ }
+
+ /**
+ * Test equals method.
+ */
+ public void testEqualsMethod() {
+ assertTrue(field1.equals(field2));
+ assertTrue(field1.equals(field3));
+ assertTrue(field1.equals(field4));
+ assertTrue(field1.equals(field5));
+ assertTrue(field1.equals(field6));
+ }
+
+ /**
+ * Test compareWithField method.
+ */
+ public void testCompareWithFieldMethod() {
+ assertFalse(field1.compareWithField(field2));
+ assertFalse(field1.compareWithField(field3));
+ assertFalse(field1.compareWithField(field4));
+ assertFalse(field1.compareWithField(field5));
+ assertTrue(field1.equals(field6));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java
index fab3030..dc736a4 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateTest.java
@@ -32,20 +32,38 @@
public class JsonTemplateTest extends TestCase {
+ JsonTemplate toTest = new JsonTemplate("toTest");
+ List<JsonTemplateField>
+ jsonTemplateFields = new ArrayList<>(
+ Arrays.asList(new JsonTemplateField("type"), new JsonTemplateField("description"),
+ new JsonTemplateField(
+ "enum")));
+
/**
* Test check failed.
*/
public void testCheckFields() {
- JsonTemplate toTest = new JsonTemplate("toTest");
- List<JsonTemplateField>
- jsonTemplateFields = new ArrayList<>(
- Arrays.asList(new JsonTemplateField("type"), new JsonTemplateField("description"),
- new JsonTemplateField(
- "enum")));
toTest.setJsonTemplateFields(jsonTemplateFields);
JsonTemplate reference = new JsonTemplate("toTest");
reference.setJsonTemplateFields(jsonTemplateFields);
assertTrue(toTest.checkFields(reference));
}
+ /**
+ * Test other methods.
+ */
+ public void testOtherFields() {
+ toTest.setJsonTemplateFields(jsonTemplateFields);
+ toTest.addField(new JsonTemplateField("moreField"));
+ toTest.setVisibility("moreField", true);
+ toTest.setStatic("moreField", true);
+ toTest.updateValueField("moreField", "testValue");
+
+ assertTrue(toTest.isVisible("moreField"));
+ assertTrue(toTest.getSpecificField("moreField").getValue().equals("testValue"));
+ assertTrue(toTest.fieldStaticStatus("moreField"));
+ assertTrue(toTest.toString()
+ .equals(" templateFields : [type null null null, description null null null, "
+ + "enum null null null, moreField testValue true true]"));
+ }
}
\ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/loop/LoopTemplateLoopElementModelTest.java b/src/test/java/org/onap/clamp/loop/LoopTemplateLoopElementModelTest.java
new file mode 100644
index 0000000..e5b64c9
--- /dev/null
+++ b/src/test/java/org/onap/clamp/loop/LoopTemplateLoopElementModelTest.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.loop;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+import org.onap.clamp.loop.template.LoopElementModel;
+import org.onap.clamp.loop.template.LoopTemplate;
+import org.onap.clamp.loop.template.LoopTemplateLoopElementModel;
+import org.onap.clamp.loop.template.PolicyModel;
+
+
+public class LoopTemplateLoopElementModelTest {
+
+ private LoopElementModel loopElementModel = getLoopElementModel("yaml", "microService1",
+ getPolicyModel("org.onap.policy.drools", "yaml", "1.0.0", "Drools", "type1"));
+ private LoopTemplate loopTemplate = getLoopTemplate("templateName", "yaml", "svg", 1);
+
+ private LoopElementModel getLoopElementModel(String yaml, String name, PolicyModel policyModel) {
+ LoopElementModel model = new LoopElementModel();
+ model.setBlueprint(yaml);
+ model.setName(name);
+ model.addPolicyModel(policyModel);
+ model.setLoopElementType("OPERATIONAL_POLICY");
+ return model;
+ }
+
+ private PolicyModel getPolicyModel(String policyType, String policyModelTosca, String version, String policyAcronym,
+ String policyVariant) {
+ return new PolicyModel(policyType, policyModelTosca, version, policyAcronym);
+ }
+
+ private LoopTemplate getLoopTemplate(String name, String blueprint, String svgRepresentation,
+ Integer maxInstancesAllowed) {
+ LoopTemplate template = new LoopTemplate(name, blueprint, svgRepresentation, maxInstancesAllowed, null);
+ template.addLoopElementModel(loopElementModel);
+ return template;
+ }
+
+ /**
+ * This tests compareTo method.
+ */
+ @Test
+ public void compareToTest() {
+ LoopTemplateLoopElementModel model1 = new LoopTemplateLoopElementModel();
+ LoopTemplateLoopElementModel model2 = new LoopTemplateLoopElementModel();
+ assertThat(model1.compareTo(model2)).isEqualTo(1);
+
+ model1.setFlowOrder(2);
+ assertThat(model1.compareTo(model2)).isEqualTo(-1);
+
+ model2.setFlowOrder(3);
+ assertThat(model1.compareTo(model2)).isEqualTo(1);
+ }
+
+ /**
+ * This tests equals method.
+ */
+ @Test
+ public void equalsTest() {
+ LoopTemplateLoopElementModel model1 = new LoopTemplateLoopElementModel();
+ LoopTemplateLoopElementModel model2 = new LoopTemplateLoopElementModel();
+
+ assertThat(model1.equals(model2)).isTrue();
+
+ model1.setLoopTemplate(loopTemplate);
+ assertThat(model1.equals(model2)).isFalse();
+ model2.setLoopTemplate(loopTemplate);
+ assertThat(model1.equals(model2)).isTrue();
+
+ model1.setLoopElementModel(loopElementModel);
+ assertThat(model1.equals(model2)).isFalse();
+ model2.setLoopElementModel(loopElementModel);
+ assertThat(model1.equals(model2)).isTrue();
+
+ model1.setFlowOrder(1);
+ assertThat(model1.equals(model2)).isTrue();
+ model2.setFlowOrder(2);
+ assertThat(model1.equals(model2)).isTrue();
+ }
+
+}
diff --git a/src/test/java/org/onap/clamp/policy/pdpgroup/PolicyModelKeyTest.java b/src/test/java/org/onap/clamp/policy/pdpgroup/PolicyModelKeyTest.java
new file mode 100644
index 0000000..413ce60
--- /dev/null
+++ b/src/test/java/org/onap/clamp/policy/pdpgroup/PolicyModelKeyTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.policy.pdpgroup;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import org.junit.Test;
+
+public class PolicyModelKeyTest {
+
+ @Test
+ public void testEqualsMethod() throws IOException {
+ PolicyModelKey key1 = new PolicyModelKey("name1","1.0.0");
+ PolicyModelKey key2 = new PolicyModelKey(null,"1.0.0");
+ PolicyModelKey key3 = new PolicyModelKey("name1",null);
+
+ assertThat(key1.equals(null)).isFalse();
+ assertThat(key1.equals("key2")).isFalse();
+
+ assertThat(key2.equals(key1)).isFalse();
+ assertThat(key3.equals(key1)).isFalse();
+
+ PolicyModelKey key4 = new PolicyModelKey("name2","1.0.0");
+ PolicyModelKey key5 = new PolicyModelKey("name1","2.0.0");
+ assertThat(key1.equals(key4)).isFalse();
+ assertThat(key1.equals(key5)).isFalse();
+
+ PolicyModelKey key6 = new PolicyModelKey("name(.*)","1.0.0");
+ PolicyModelKey key7 = new PolicyModelKey("name1","1.0.0");
+ assertThat(key1.equals(key6)).isTrue();
+ assertThat(key1.equals(key7)).isTrue();
+ }
+}
diff --git a/ui-react/src/api/LoopCache.test.js b/ui-react/src/api/LoopCache.test.js
index b0eef75..3ae0817 100644
--- a/ui-react/src/api/LoopCache.test.js
+++ b/ui-react/src/api/LoopCache.test.js
@@ -39,7 +39,9 @@
"policies": []
}
},
- "jsonRepresentation": {
+ "pdpGroup": "pdpGroupTest",
+ "pdpSubgroup": "pdpSubgroupTest",
+ "jsonRepresentation": {
"schema": {}
}
}];
@@ -54,7 +56,9 @@
"controlLoop": {},
"policies": []
}
- }
+ },
+ "pdpGroup": "pdpGroupTest",
+ "pdpSubgroup": "pdpSubgroupTest",
}];
expect(loopCache.getOperationalPoliciesNoJsonSchema()).toStrictEqual(opPolicy);
});
@@ -92,6 +96,9 @@
"modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
"configurationsJson": {"domain": "measurementsForVfScaling"},
"shared": false,
+ "pdpGroup": "pdpGroupTest",
+ "pdpSubgroup": "pdpSubgroupTest",
+ "policyModel": {"policyPdpGroup": {"supportedPdpGroups": "supportedPdpGroupsTest"}},
"jsonRepresentation": {"schema": {}}
};
expect(loopCache.getMicroServiceForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJson);
@@ -180,6 +187,84 @@
expect(loopCache.getComponentStates()).toStrictEqual(component);
});
+ it('getOperationalPolicyForName', () => {
+ const opPolicy = {
+ "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
+ "configurationsJson": {
+ "operational_policy": {
+ "controlLoop": {},
+ "policies": []
+ }
+ },
+ "pdpGroup": "pdpGroupTest",
+ "pdpSubgroup": "pdpSubgroupTest",
+ "jsonRepresentation": {
+ "schema": {}
+ }
+ };
+ expect(loopCache.getOperationalPolicyForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(opPolicy);
+ expect(loopCache.getOperationalPolicyForName("Not_Exist")).toBeNull();
+ });
+
+ it('getOperationalPolicyPropertiesForName', () => {
+ const opPolicyJson = {
+ "operational_policy": {
+ "controlLoop": {},
+ "policies": []
+ }};
+ expect(loopCache.getOperationalPolicyPropertiesForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(opPolicyJson);
+ expect(loopCache.getOperationalPolicyPropertiesForName("Not_Exist")).toBeNull();
+ });
+
+ it('getOperationalPolicyJsonRepresentationForName', () => {
+ const opPolicySchema = {
+ "schema": {}
+ };
+ expect(loopCache.getOperationalPolicyJsonRepresentationForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(opPolicySchema);
+ expect(loopCache.getOperationalPolicyJsonRepresentationForName("Not_Exist")).toBeNull();
+ });
+
+ it('getOperationalPolicySupportedPdpGroup', () => {
+ expect(loopCache.getOperationalPolicySupportedPdpGroup("Not_Exist")).toStrictEqual([]);
+ });
+
+ it('getOperationalPolicyPdpGroup', () => {
+ expect(loopCache.getOperationalPolicyPdpGroup("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpGroupTest");
+ expect(loopCache.getOperationalPolicyPdpGroup("Not_Exist")).toBeNull();
+ });
+
+ it('getOperationalPolicyPdpSubgroup', () => {
+ expect(loopCache.getOperationalPolicyPdpSubgroup("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpSubgroupTest");
+ expect(loopCache.getOperationalPolicyPdpSubgroup("Not_Exist")).toBeNull();
+ });
+
+ it('getMicroServiceSupportedPdpGroup', () => {
+ expect(loopCache.getMicroServiceSupportedPdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("supportedPdpGroupsTest");
+ expect(loopCache.getMicroServiceSupportedPdpGroup("Not_Exist")).toStrictEqual([]);
+ });
+
+ it('getMicroServicePdpGroup', () => {
+ expect(loopCache.getMicroServicePdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpGroupTest");
+ expect(loopCache.getMicroServicePdpGroup("Not_Exist")).toBeNull();
+ });
+
+ it('getMicroServicePdpSubgroup', () => {
+ expect(loopCache.getMicroServicePdpSubgroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpSubgroupTest");
+ expect(loopCache.getMicroServicePdpSubgroup("Not_Exist")).toBeNull();
+ });
+
+ it('getMicroServiceJsonRepresentationForName', () => {
+ const msPolicySchema = {
+ "schema": {}
+ };
+ expect(loopCache.getMicroServiceJsonRepresentationForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msPolicySchema);
+ expect(loopCache.getMicroServiceJsonRepresentationForName("Not_Exist")).toBeNull();
+ });
+
+ it('getTemplateName', () => {
+ expect(loopCache.getTemplateName()).toStrictEqual("loopTemplateTest");
+ });
+
it('updateGlobalProperties', () => {
const newGlobalProps = {
"dcaeDeployParameters": {
@@ -208,4 +293,13 @@
loopCache.updateMicroServiceProperties("TCA_h2NMX_v1_0_ResourceInstanceName1_tca", newMsPolicyProperties);
expect(loopCache.getMicroServicePropertiesForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(newMsPolicyProperties);
});
+
+ it('updateMicroServicePdpGroup', () => {
+ const newMsPolicyProperties = {"domain": "measurementsForVfScalingNew"};
+ loopCache.updateMicroServicePdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca", "pdpGroupTest1", "pdpSubgroupTest1");
+ expect(loopCache.getMicroServicePdpGroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpGroupTest1");
+ expect(loopCache.getMicroServicePdpGroup("Not_Exist")).toBeNull();
+ expect(loopCache.getMicroServicePdpSubgroup("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual("pdpSubgroupTest1");
+ expect(loopCache.getMicroServicePdpSubgroup("Not_Exist")).toBeNull();
+ });
});
diff --git a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
index 788306b..cb9ed87 100644
--- a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
+++ b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
@@ -8,6 +8,7 @@
"policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
}
},
+ "loopTemplate": {"name": "loopTemplateTest"},
"modelService": {
"serviceDetails": {
"serviceType": "",
@@ -93,6 +94,8 @@
"policies": []
}
},
+ "pdpGroup": "pdpGroupTest",
+ "pdpSubgroup": "pdpSubgroupTest",
"jsonRepresentation": {
"schema": {}
}
@@ -104,6 +107,9 @@
"modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
"configurationsJson": {"domain": "measurementsForVfScaling"},
"shared": false,
+ "pdpGroup": "pdpGroupTest",
+ "pdpSubgroup": "pdpSubgroupTest",
+ "policyModel": {"policyPdpGroup": {"supportedPdpGroups": "supportedPdpGroupsTest"}},
"jsonRepresentation": {"schema": {}}
}
],
diff --git a/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js b/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js
new file mode 100644
index 0000000..18ec6fd
--- /dev/null
+++ b/ui-react/src/components/dialogs/Loop/CreateLoopModal.test.js
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+import React from 'react';
+import { shallow } from 'enzyme';
+import CreateLoopModal from './CreateLoopModal';
+import LoopService from '../../../api/LoopService';
+import TemplateService from '../../../api/TemplateService';
+
+describe('Verify CreateLoopModal', () => {
+
+ it('Test the render method', async () => {
+ const flushPromises = () => new Promise(setImmediate);
+ TemplateService.getTemplateNames = jest.fn().mockImplementation(() => {
+ return Promise.resolve(["template1","template2"]);
+ });
+
+ const component = shallow(<CreateLoopModal/>);
+ expect(component).toMatchSnapshot();
+ await flushPromises();
+ component.update();
+
+ expect(component.state('templateNames')).toStrictEqual([{"label": "template1", "value": "template1"}, {"label": "template2", "value": "template2"}]);
+ });
+
+ it('handleDropdownListChange event', async () => {
+ const flushPromises = () => new Promise(setImmediate);
+ const event = {value: 'template1'};
+ TemplateService.getBlueprintMicroServiceTemplateSvg = jest.fn().mockImplementation(() => {
+ return Promise.resolve("");
+ });
+
+ const component = shallow(<CreateLoopModal/>);
+ component.find('StateManager').simulate('change', event);
+ await flushPromises();
+ component.update();
+ expect(component.state('chosenTemplateName')).toEqual("template1");
+ expect(component.state('content')).toEqual("Error1");
+
+ TemplateService.getBlueprintMicroServiceTemplateSvg = jest.fn().mockImplementation(() => {
+ return Promise.resolve("svgContentTest");
+ });
+ component.find('StateManager').simulate('change', {value: 'template2'});
+ await flushPromises();
+ component.update();
+ expect(component.state('chosenTemplateName')).toEqual("template2");
+ expect(component.state('content')).toEqual("svgContentTest");
+ });
+
+
+
+ it('handleModelName event', () => {
+ const event = {target: {value : "model1"} };
+ const component = shallow(<CreateLoopModal/>);
+ component.find('input').simulate('change', event);
+ component.update();
+ expect(component.state('modelName')).toEqual("model1");
+ });
+
+
+ it('Test handleClose', () => {
+ const historyMock = { push: jest.fn() };
+ const handleClose = jest.spyOn(CreateLoopModal.prototype,'handleClose');
+ const component = shallow(<CreateLoopModal history={historyMock} />)
+
+ component.find('[variant="secondary"]').prop('onClick')();
+
+ expect(handleClose).toHaveBeenCalledTimes(1);
+ expect(component.state('show')).toEqual(false);
+ expect(historyMock.push.mock.calls[0]).toEqual([ '/']);
+
+ handleClose.mockClear();
+ });
+
+ it('Test handleCreate Fail', () => {
+ const handleCreate = jest.spyOn(CreateLoopModal.prototype,'handleCreate');
+ const component = shallow(<CreateLoopModal/>)
+
+ component.find('[variant="primary"]').prop('onClick')();
+
+ expect(handleCreate).toHaveBeenCalledTimes(1);
+ expect(component.state('show')).toEqual(true);
+
+ handleCreate.mockClear();
+ });
+
+ it('Test handleCreate Suc', async () => {
+ const flushPromises = () => new Promise(setImmediate);
+ const historyMock = { push: jest.fn() };
+ const loadLoopFunction = jest.fn();
+
+ LoopService.createLoop = jest.fn().mockImplementation(() => {
+ return Promise.resolve({
+ ok: true,
+ status: 200,
+ json: () => {}
+ });
+ });
+
+ const handleCreate = jest.spyOn(CreateLoopModal.prototype,'handleCreate');
+ const component = shallow(<CreateLoopModal history={historyMock} loadLoopFunction={loadLoopFunction}/>)
+ component.setState({
+ modelName: "modelNameTest",
+ chosenTemplateName: "template1"
+ });
+
+ component.find('[variant="primary"]').prop('onClick')();
+ await flushPromises();
+ component.update();
+
+ expect(handleCreate).toHaveBeenCalledTimes(1);
+ expect(component.state('show')).toEqual(false);
+ expect(historyMock.push.mock.calls[0]).toEqual([ '/']);
+
+ handleCreate.mockClear();
+ });
+
+});
diff --git a/ui-react/src/components/dialogs/Loop/__snapshots__/CreateLoopModal.test.js.snap b/ui-react/src/components/dialogs/Loop/__snapshots__/CreateLoopModal.test.js.snap
new file mode 100644
index 0000000..305c87b
--- /dev/null
+++ b/ui-react/src/components/dialogs/Loop/__snapshots__/CreateLoopModal.test.js.snap
@@ -0,0 +1,141 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Verify CreateLoopModal Test the render method 1`] = `
+<Styled(Bootstrap(Modal))
+ backdrop="static"
+ keyboard={false}
+ onHide={[Function]}
+ show={true}
+ size="xl"
+>
+ <ModalHeader
+ closeButton={true}
+ closeLabel="Close"
+ >
+ <ModalTitle>
+ Create Model
+ </ModalTitle>
+ </ModalHeader>
+ <ModalBody>
+ <FormGroup
+ as={
+ Object {
+ "$$typeof": Symbol(react.forward_ref),
+ "defaultProps": Object {
+ "noGutters": false,
+ },
+ "render": [Function],
+ }
+ }
+ controlId="formPlaintextEmail"
+ >
+ <FormLabel
+ column={true}
+ sm="2"
+ srOnly={false}
+ >
+ Template Name:
+ </FormLabel>
+ <Col
+ sm="10"
+ >
+ <StateManager
+ defaultInputValue=""
+ defaultMenuIsOpen={false}
+ defaultValue={null}
+ onChange={[Function]}
+ options={Array []}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup
+ as={
+ Object {
+ "$$typeof": Symbol(react.forward_ref),
+ "defaultProps": Object {
+ "noGutters": false,
+ },
+ "render": [Function],
+ }
+ }
+ controlId="formSvgPreview"
+ style={
+ Object {
+ "alignItems": "center",
+ }
+ }
+ >
+ <FormLabel
+ column={true}
+ sm="2"
+ srOnly={false}
+ >
+ Model Preview:
+ </FormLabel>
+ <Col
+ sm="10"
+ >
+ <styled.svg
+ dangerouslySetInnerHTML={
+ Object {
+ "__html": "",
+ }
+ }
+ value=""
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup
+ as={
+ Object {
+ "$$typeof": Symbol(react.forward_ref),
+ "defaultProps": Object {
+ "noGutters": false,
+ },
+ "render": [Function],
+ }
+ }
+ controlId="formPlaintextEmail"
+ >
+ <FormLabel
+ column={true}
+ sm="2"
+ srOnly={false}
+ >
+ Model Name:
+ </FormLabel>
+ <input
+ onChange={[Function]}
+ style={
+ Object {
+ "marginLeft": "1em",
+ "width": "50%",
+ }
+ }
+ type="text"
+ value=""
+ />
+ </FormGroup>
+ </ModalBody>
+ <ModalFooter>
+ <Button
+ active={false}
+ disabled={false}
+ onClick={[Function]}
+ type="null"
+ variant="secondary"
+ >
+ Cancel
+ </Button>
+ <Button
+ active={false}
+ disabled={false}
+ onClick={[Function]}
+ type="submit"
+ variant="primary"
+ >
+ Create
+ </Button>
+ </ModalFooter>
+</Styled(Bootstrap(Modal))>
+`;
diff --git a/version.properties b/version.properties
index 3b5ffc3..c7f4c98 100644
--- a/version.properties
+++ b/version.properties
@@ -26,8 +26,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major=5
-minor=0
-patch=6
+minor=1
+patch=0
base_version=${major}.${minor}.${patch}