aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src
diff options
context:
space:
mode:
Diffstat (limited to 'ui-react/src')
-rw-r--r--ui-react/src/__test__/LoopCache.test.js27
-rw-r--r--ui-react/src/__test__/__snapshots__/OpenLoopModal.test.js.snap3
-rw-r--r--ui-react/src/api/LoopCache.js4
3 files changed, 13 insertions, 21 deletions
diff --git a/ui-react/src/__test__/LoopCache.test.js b/ui-react/src/__test__/LoopCache.test.js
index 101f864aa..1efea6495 100644
--- a/ui-react/src/__test__/LoopCache.test.js
+++ b/ui-react/src/__test__/LoopCache.test.js
@@ -85,24 +85,19 @@ describe('Verify LoopCache functions', () => {
"shared": false,
"jsonRepresentation": {"schema": {}}
};
- expect(loopCache.getMicroServicesJsonForType("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJson);
- expect(loopCache.getMicroServicesJsonForType("TCA_h2NMX_v1_0_ResourceInstanceName1_tca_2")).toBeNull();
+ expect(loopCache.getMicroServiceForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJson);
+ expect(loopCache.getMicroServiceForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca_2")).toBeNull();
});
it('getMicroServicePropertiesForName', () => {
const msProp = {"domain": "measurementsForVfScaling"};
- expect(loopCache.getMicroServiceProperties("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msProp);
- expect(loopCache.getMicroServiceProperties("TCA_h2NMX_v1_0_ResourceInstanceName1_tca_2")).toBeNull();
- });
-
- it('getMicroServiceJsonRepresentationForType', () => {
- const msJsonRepresentation = {"schema": {}};
- expect(loopCache.getMicroServiceJsonRepresentationForType("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJsonRepresentation);
+ expect(loopCache.getMicroServicePropertiesForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msProp);
+ expect(loopCache.getMicroServicePropertiesForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca_2")).toBeNull();
});
it('getMicroServiceJsonRepresentationForName', () => {
const msJsonRepresentation = {"schema": {}};
- expect(loopCache.getMicroServiceJsonRepresentationForType("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJsonRepresentation);
+ expect(loopCache.getMicroServiceJsonRepresentationForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(msJsonRepresentation);
});
it('getResourceDetailsVfProperty', () => {
@@ -204,14 +199,8 @@ describe('Verify LoopCache functions', () => {
});
it('updateMicroServiceProperties', () => {
- const newMsPolicy = {
- "name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca",
- "modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "properties": {"domain": "measurementsForVfScalingNew"},
- "shared": true,
- "jsonRepresentation": {"schema": {}}
- };;
- loopCache.updateMicroServiceProperties("TCA_h2NMX_v1_0_ResourceInstanceName1_tca", newMsPolicy);
- expect(loopCache.getMicroServicesJsonForType("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(newMsPolicy);
+ const newMsPolicyProperties = {"domain": "measurementsForVfScalingNew"};
+ loopCache.updateMicroServiceProperties("TCA_h2NMX_v1_0_ResourceInstanceName1_tca", newMsPolicyProperties);
+ expect(loopCache.getMicroServicePropertiesForName("TCA_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(newMsPolicyProperties);
});
});
diff --git a/ui-react/src/__test__/__snapshots__/OpenLoopModal.test.js.snap b/ui-react/src/__test__/__snapshots__/OpenLoopModal.test.js.snap
new file mode 100644
index 000000000..cb8b8fd30
--- /dev/null
+++ b/ui-react/src/__test__/__snapshots__/OpenLoopModal.test.js.snap
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Verify OpenLoopModal Test the render method 1`] = `ShallowWrapper {}`;
diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js
index d83e3ce9d..dd8c5b520 100644
--- a/ui-react/src/api/LoopCache.js
+++ b/ui-react/src/api/LoopCache.js
@@ -28,9 +28,9 @@ export default class LoopCache {
this.loopJsonCache=loopJson;
}
- updateMicroServiceProperties(type, newMsProperties) {
+ updateMicroServiceProperties(name, newMsProperties) {
for (var policy in this.loopJsonCache["microServicePolicies"]) {
- if (this.loopJsonCache["microServicePolicies"][policy]["name"] === type) {
+ if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
this.loopJsonCache["microServicePolicies"][policy]["properties"] = newMsProperties;
}
}