aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/src/test/resources/demo/config/DEMO.postman_collection.json12
-rw-r--r--common/src/test/resources/demo/config/PolicyAPIConfig.json2
-rw-r--r--common/src/test/resources/demo/config/RuntimeConfig.json2
-rw-r--r--common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json2
-rw-r--r--common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json2
-rw-r--r--common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json2
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties4
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java44
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java8
-rw-r--r--runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java52
-rw-r--r--runtime/src/main/resources/application-noaaf.properties6
-rw-r--r--runtime/src/main/resources/application.properties6
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java2
-rw-r--r--runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java22
-rw-r--r--runtime/src/test/resources/application.properties6
-rw-r--r--runtime/src/test/resources/http-cache/third_party_proxy.py9
-rw-r--r--runtime/src/test/resources/robotframework/robotframework-test.properties4
-rw-r--r--runtime/ui-react/src/components/dialogs/Policy/PolicyEditor.js290
-rw-r--r--runtime/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap4
-rw-r--r--testsuites/performance/src/main/resources/testplans/performance.jmx2
-rw-r--r--testsuites/stability/src/main/resources/testplans/stability.jmx2
26 files changed, 299 insertions, 200 deletions
diff --git a/common/src/test/resources/demo/config/DEMO.postman_collection.json b/common/src/test/resources/demo/config/DEMO.postman_collection.json
index 72a8535d9..31c12bfc6 100644
--- a/common/src/test/resources/demo/config/DEMO.postman_collection.json
+++ b/common/src/test/resources/demo/config/DEMO.postman_collection.json
@@ -23,7 +23,7 @@
},
{
"key": "username",
- "value": "healthcheck",
+ "value": "runtimeUser",
"type": "string"
}
]
@@ -84,7 +84,7 @@
},
{
"key": "username",
- "value": "healthcheck",
+ "value": "runtimeUser",
"type": "string"
}
]
@@ -145,7 +145,7 @@
},
{
"key": "username",
- "value": "healthcheck",
+ "value": "runtimeUser",
"type": "string"
}
]
@@ -202,7 +202,7 @@
},
{
"key": "username",
- "value": "healthcheck",
+ "value": "runtimeUser",
"type": "string"
}
]
@@ -239,7 +239,7 @@
},
{
"key": "username",
- "value": "healthcheck",
+ "value": "runtimeUser",
"type": "string"
}
]
@@ -275,7 +275,7 @@
},
{
"key": "username",
- "value": "healthcheck",
+ "value": "runtimeUser",
"type": "string"
}
]
diff --git a/common/src/test/resources/demo/config/PolicyAPIConfig.json b/common/src/test/resources/demo/config/PolicyAPIConfig.json
index 48e89c5dc..dbe00a135 100644
--- a/common/src/test/resources/demo/config/PolicyAPIConfig.json
+++ b/common/src/test/resources/demo/config/PolicyAPIConfig.json
@@ -3,7 +3,7 @@
"restServerParameters": {
"host": "0.0.0.0",
"port": 6968,
- "userName": "healthcheck",
+ "userName": "policyadmin",
"password": "zb!XztG34",
"https": false,
"aaf": false
diff --git a/common/src/test/resources/demo/config/RuntimeConfig.json b/common/src/test/resources/demo/config/RuntimeConfig.json
index 529557eab..fd8948ab7 100644
--- a/common/src/test/resources/demo/config/RuntimeConfig.json
+++ b/common/src/test/resources/demo/config/RuntimeConfig.json
@@ -3,7 +3,7 @@
"restServerParameters": {
"host": "0.0.0.0",
"port": 6969,
- "userName": "healthcheck",
+ "userName": "runtimeUser",
"password": "zb!XztG34",
"https": false,
"aaf": false
diff --git a/common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json b/common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json
index b31c8ca01..6efddc256 100644
--- a/common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json
+++ b/common/src/test/resources/examples/controlloop/PMSH/pmsh.postman2.0_collection.json
@@ -247,7 +247,7 @@
"auth": {
"type": "basic",
"basic": {
- "username": "healthcheck",
+ "username": "runtimeUser",
"password": "zb!XztG34"
}
}
diff --git a/common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json b/common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json
index 38deb43ae..798b0edd6 100644
--- a/common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json
+++ b/common/src/test/resources/examples/controlloop/http-participant/http.postman2.0_collection.json
@@ -247,7 +247,7 @@
"auth": {
"type": "basic",
"basic": {
- "username": "healthcheck",
+ "username": "runtimeUser",
"password": "zb!XztG34"
}
}
diff --git a/common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json b/common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json
index 923782128..e83bc2594 100644
--- a/common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json
+++ b/common/src/test/resources/examples/controlloop/k8s-participant/k8s.postman2.0_collection.json
@@ -247,7 +247,7 @@
"auth": {
"type": "basic",
"basic": {
- "username": "healthcheck",
+ "username": "runtimeUser",
"password": "zb!XztG34"
}
}
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
index b357ae424..14660a9ff 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
@@ -11,7 +11,7 @@ participant:
clientName: api
hostname: policy-api
port: 6969
- userName: healthcheck
+ userName: policyadmin
password: zb!XztG34
useHttps: true
allowSelfSignedCerts: true
@@ -19,7 +19,7 @@ participant:
clientName: pap
hostname: policy-pap
port: 6969
- userName: healthcheck
+ userName: policyadmin
password: zb!XztG34
useHttps: true
allowSelfSignedCerts: true
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
index 5839aae66..2aa33c1c4 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
@@ -11,7 +11,7 @@ participant:
clientName: api
hostname: policy-api
port: 6969
- userName: healthcheck
+ userName: policyadmin
password: zb!XztG34
useHttps: true
allowSelfSignedCerts: true
@@ -19,7 +19,7 @@ participant:
clientName: pap
hostname: policy-pap
port: 6969
- userName: healthcheck
+ userName: policyadmin
password: zb!XztG34
useHttps: true
allowSelfSignedCerts: true
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
index 41af8a6ec..e965370cc 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java
@@ -84,7 +84,7 @@ public class CommonTestData {
map.put("clientName", "pap");
map.put("hostname", "localhost");
map.put("port", 6968);
- map.put("userName", "healthcheck");
+ map.put("userName", "policyadmin");
map.put("password", "zb!XztG34");
map.put("https", false);
map.put("allowSelfSignedCerts", true);
@@ -101,7 +101,7 @@ public class CommonTestData {
map.put("clientName", "api");
map.put("hostname", "localhost");
map.put("port", 6969);
- map.put("userName", "healthcheck");
+ map.put("userName", "policyadmin");
map.put("password", "zb!XztG34");
map.put("https", false);
map.put("allowSelfSignedCerts", true);
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties
index f857704d3..49781407d 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties
@@ -7,7 +7,7 @@ server.http-port=8085
participant.policyApiParameters.clientName=api
participant.policyApiParameters.hostname=localhost
participant.policyApiParameters.port=6969
-participant.policyApiParameters.userName=healthcheck
+participant.policyApiParameters.userName=policyadmin
participant.policyApiParameters.password=zb!XztG34
participant.policyApiParameters.https=false
participant.policyApiParameters.allowSelfSignedCerts=true
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
index 320b53805..d750d46d2 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
@@ -1,7 +1,7 @@
spring:
security:
user:
- name: healthcheck
+ name: runtimeUser
password: zb!XztG34
server:
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties
index f162367f8..a4a1f99e5 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties
+++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/application_test.properties
@@ -1,4 +1,4 @@
-spring.security.user.name=healthcheck
+spring.security.user.name=runtimeUser
spring.security.user.password=zb!XztG34
server.servlet.context-path=/onap/participantsim
@@ -6,7 +6,7 @@ server.error.path=/error
participant.restServerParameters.host=0.0.0.0
participant.restServerParameters.port=6969
-participant.restServerParameters.userName=healthcheck
+participant.restServerParameters.userName=runtimeUser
participant.restServerParameters.password=zb!XztG34
participant.restServerParameters.https=false
participant.restServerParameters.aaf=false
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java
index 5f24db7b2..43b43e3bf 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandlerTest.java
@@ -29,7 +29,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.mockito.Mockito.mock;
import java.time.Instant;
-import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Test;
@@ -39,12 +38,14 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.main.parameters.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@@ -108,6 +109,11 @@ class ControlLoopHandlerTest {
ControlLoopState.PASSIVE);
assertEquals(ControlLoopState.PASSIVE, value.getState());
+ clh.getControlLoopMap().values().iterator().next().getElements().putIfAbsent(key, value);
+ clh.updateControlLoopElementState(id, key, ControlLoopOrderedState.PASSIVE,
+ ControlLoopState.RUNNING);
+ assertEquals(ControlLoopState.RUNNING, value.getState());
+
var clElementStatistics = new ClElementStatistics();
clElementStatistics.setParticipantId(id);
clElementStatistics.setControlLoopState(ControlLoopState.RUNNING);
@@ -116,35 +122,63 @@ class ControlLoopHandlerTest {
assertNotEquals(uuid, value.getClElementStatistics().getId());
clh.updateControlLoopElementStatistics(uuid, clElementStatistics);
assertEquals(uuid, value.getClElementStatistics().getId());
+
+ clh.getElementsOnThisParticipant().remove(key, value);
+ clh.getControlLoopMap().values().iterator().next().getElements().clear();
+ assertNull(clh.updateControlLoopElementState(id, key, ControlLoopOrderedState.PASSIVE,
+ ControlLoopState.RUNNING));
+
}
@Test
void handleControlLoopUpdateExceptionTest() throws CoderException {
var uuid = UUID.randomUUID();
var id = CommonTestData.getParticipantId();
-
var stateChange = getStateChange(id, uuid, ControlLoopOrderedState.RUNNING);
-
var clh = commonTestData.setTestControlLoopHandler(id, uuid);
+ assertDoesNotThrow(() -> clh.handleControlLoopStateChange(mock(ControlLoopStateChange.class), List.of()));
+
clh.handleControlLoopStateChange(stateChange, List.of());
var newid = new ToscaConceptIdentifier("id", "1.2.3");
stateChange.setControlLoopId(newid);
stateChange.setParticipantId(newid);
assertDoesNotThrow(() -> clh.handleControlLoopStateChange(stateChange, List.of()));
- List<ControlLoopElementDefinition> clElementDefinitions = new ArrayList<>();
var cld = new ControlLoopElementDefinition();
cld.setClElementDefinitionId(id);
- clElementDefinitions.add(cld);
var updateMsg = new ControlLoopUpdate();
updateMsg.setControlLoopId(id);
updateMsg.setMessageId(uuid);
updateMsg.setParticipantId(id);
updateMsg.setStartPhase(0);
+ var clElementDefinitions = List.of(cld);
assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
updateMsg.setStartPhase(1);
assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
assertThat(clh.getClElementInstanceProperties(uuid)).isEmpty();
+
+ clh.getControlLoopMap().clear();
+ updateMsg.setStartPhase(0);
+ assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
+
+ updateMsg.setControlLoopId(new ToscaConceptIdentifier("new", "0.0.1"));
+ updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantUpdates.class)));
+ assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, clElementDefinitions));
+
+ updateMsg.setStartPhase(1);
+ var participantUpdate = new ParticipantUpdates();
+ participantUpdate.setParticipantId(id);
+ var element = new ControlLoopElement();
+ element.setParticipantType(id);
+ element.setDefinition(id);
+ participantUpdate.setControlLoopElementList(List.of(element));
+ updateMsg.setParticipantUpdatesList(List.of(participantUpdate));
+
+ var cld2 = new ControlLoopElementDefinition();
+ cld2.setClElementDefinitionId(id);
+ cld2.setControlLoopElementToscaNodeTemplate(mock(ToscaNodeTemplate.class));
+ assertDoesNotThrow(() -> clh.handleControlLoopUpdate(updateMsg, List.of(cld2)));
+
}
@Test
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java
index bbe0412ed..8c400c12f 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivatorTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.controlloop.participant.intermediary.handler;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -40,6 +41,8 @@ import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.Par
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardCoderObject;
+import org.springframework.context.event.ContextClosedEvent;
+import org.springframework.context.event.ContextRefreshedEvent;
class IntermediaryActivatorTest {
private static final Coder CODER = new StandardCoder();
@@ -86,12 +89,15 @@ class IntermediaryActivatorTest {
activator.getMsgDispatcher().onTopicEvent(null, "msg", sco);
verify(listenerSecond, times(1)).onTopicEvent(any(), any(), any());
- activator.stop();
+ activator.close();
assertFalse(activator.isAlive());
// repeat stop - should throw an exception
assertThatIllegalStateException().isThrownBy(() -> activator.stop());
assertFalse(activator.isAlive());
+
+ assertDoesNotThrow(() -> activator.handleContextRefreshEvent(mock(ContextRefreshedEvent.class)));
+ assertDoesNotThrow(() -> activator.handleContextClosedEvent(mock(ContextClosedEvent.class)));
}
}
}
diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java
index abaa52c12..5ed4a4fc0 100644
--- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java
+++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandlerTest.java
@@ -74,7 +74,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(mock(ControlLoopProvider.class), mock(ParticipantProvider.class),
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class));
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
assertThatThrownBy(() -> handler.triggerControlLoopSupervision(List.of()))
.hasMessageMatching("The list of control loops for supervision is empty");
@@ -87,7 +87,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
mock(ParticipantDeregisterAckPublisher.class), controlLoopUpdatePublisher,
- mock(ParticipantUpdatePublisher.class));
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
handler.triggerControlLoopSupervision(List.of(identifier));
@@ -96,12 +96,38 @@ class SupervisionHandlerTest {
}
@Test
+ void testTriggerControlLoopUninitialised() throws ControlLoopException, PfModelException, CoderException {
+ var controlLoopProvider = mock(ControlLoopProvider.class);
+ var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
+ var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), controlLoopUpdatePublisher,
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.UNINITIALISED);
+
+ assertThatThrownBy(() -> handler.triggerControlLoopSupervision(List.of(identifier)))
+ .hasMessageMatching("Control loop is already in state UNINITIALISED");
+ }
+
+ @Test
+ void testTriggerControlLoopRunning() throws ControlLoopException, PfModelException, CoderException {
+ var controlLoopProvider = mock(ControlLoopProvider.class);
+ var controlLoopUpdatePublisher = mock(ControlLoopUpdatePublisher.class);
+ var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
+ mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
+ mock(ParticipantDeregisterAckPublisher.class), controlLoopUpdatePublisher,
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.RUNNING);
+
+ assertThatThrownBy(() -> handler.triggerControlLoopSupervision(List.of(identifier)))
+ .hasMessageMatching("Control loop can't transition from state UNINITIALISED to state RUNNING");
+ }
+
+ @Test
void testHandleControlLoopStateChangeAckMessage() throws PfModelException, CoderException {
var controlLoopProvider = mock(ControlLoopProvider.class);
var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class));
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
var controlLoopAckMessage = new ControlLoopAck(ParticipantMessageType.CONTROLLOOP_STATECHANGE_ACK);
controlLoopAckMessage.setControlLoopResultMap(Map.of());
controlLoopAckMessage.setControlLoopId(identifier);
@@ -122,7 +148,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(controlLoopProvider, mock(ParticipantProvider.class),
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class));
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
handler.handleControlLoopUpdateAckMessage(controlLoopAckMessage);
@@ -148,7 +174,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider,
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
participantDeregisterAckPublisher, mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class));
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
handler.handleParticipantMessage(participantDeregisterMessage);
@@ -172,7 +198,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider,
mock(MonitoringProvider.class), participantRegisterAckPublisher,
mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class));
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
handler.handleParticipantMessage(participantRegisterMessage);
@@ -199,7 +225,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider,
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- mock(ParticipantUpdatePublisher.class));
+ mock(ParticipantUpdatePublisher.class), ControlLoopOrderedState.PASSIVE);
handler.handleParticipantMessage(participantUpdateAckMessage);
@@ -219,7 +245,8 @@ class SupervisionHandlerTest {
var monitoringProvider = mock(MonitoringProvider.class);
var handler = createSupervisionHandler(mock(ControlLoopProvider.class), participantProvider, monitoringProvider,
mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class),
- mock(ControlLoopUpdatePublisher.class), mock(ParticipantUpdatePublisher.class));
+ mock(ControlLoopUpdatePublisher.class), mock(ParticipantUpdatePublisher.class),
+ ControlLoopOrderedState.PASSIVE);
handler.handleParticipantMessage(participantStatusMessage);
verify(participantProvider).saveParticipant(any());
@@ -232,7 +259,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(mock(ControlLoopProvider.class), mock(ParticipantProvider.class),
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- participantUpdatePublisher);
+ participantUpdatePublisher, ControlLoopOrderedState.PASSIVE);
handler.handleSendCommissionMessage(participantId.getName(), participantId.getVersion());
verify(participantUpdatePublisher).sendComissioningBroadcast(participantId.getName(),
@@ -245,7 +272,7 @@ class SupervisionHandlerTest {
var handler = createSupervisionHandler(mock(ControlLoopProvider.class), mock(ParticipantProvider.class),
mock(MonitoringProvider.class), mock(ParticipantRegisterAckPublisher.class),
mock(ParticipantDeregisterAckPublisher.class), mock(ControlLoopUpdatePublisher.class),
- participantUpdatePublisher);
+ participantUpdatePublisher, ControlLoopOrderedState.PASSIVE);
handler.handleSendDeCommissionMessage();
verify(participantUpdatePublisher).sendDecomisioning();
@@ -256,11 +283,12 @@ class SupervisionHandlerTest {
ParticipantRegisterAckPublisher participantRegisterAckPublisher,
ParticipantDeregisterAckPublisher participantDeregisterAckPublisher,
ControlLoopUpdatePublisher controlLoopUpdatePublisher,
- ParticipantUpdatePublisher participantUpdatePublisher) throws PfModelException, CoderException {
+ ParticipantUpdatePublisher participantUpdatePublisher,
+ ControlLoopOrderedState orderedState) throws PfModelException, CoderException {
var controlLoopsCreate = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Crud");
var controlLoop = controlLoopsCreate.getControlLoopList().get(0);
- controlLoop.setOrderedState(ControlLoopOrderedState.PASSIVE);
+ controlLoop.setOrderedState(orderedState);
var controlLoopStateChangePublisher = mock(ControlLoopStateChangePublisher.class);
diff --git a/runtime/src/main/resources/application-noaaf.properties b/runtime/src/main/resources/application-noaaf.properties
index 12a08704f..9f13a314c 100644
--- a/runtime/src/main/resources/application-noaaf.properties
+++ b/runtime/src/main/resources/application-noaaf.properties
@@ -150,10 +150,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://localhost:8085
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://localhost:8085
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
#
@@ -194,5 +194,5 @@ clamp.config.cds.password=ccsdkapps
# Configuration settings for ControlLoop Runtime Rest API
clamp.config.controlloop.runtime.url=http://localhost:6969
-clamp.config.controlloop.runtime.userName=healthcheck
+clamp.config.controlloop.runtime.userName=runtimeUser
clamp.config.controlloop.runtime.password=zb!XztG34
diff --git a/runtime/src/main/resources/application.properties b/runtime/src/main/resources/application.properties
index 08260047e..21b37c69f 100644
--- a/runtime/src/main/resources/application.properties
+++ b/runtime/src/main/resources/application.properties
@@ -149,10 +149,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://policy.api.simpledemo.onap.org:6969
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://policy.api.simpledemo.onap.org:6969
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
#
@@ -204,5 +204,5 @@ clamp.config.cds.password=ccsdkapps
# Configuration settings for ControlLoop Runtime Rest API
clamp.config.controlloop.runtime.url=http://localhost:6969
-clamp.config.controlloop.runtime.userName=healthcheck
+clamp.config.controlloop.runtime.userName=runtimeUser
clamp.config.controlloop.runtime.password=zb!XztG34
diff --git a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
index eeed51c12..79f3b12d7 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/clds/it/config/CldsReferencePropertiesItTestCase.java
@@ -46,7 +46,7 @@ public class CldsReferencePropertiesItTestCase {
*/
@Test
public void testGetStringValue() {
- assertEquals("healthcheck", refProp.getStringValue("policy.api.userName"));
+ assertEquals("policyadmin", refProp.getStringValue("policy.api.userName"));
}
/**
diff --git a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
index ae80d0498..fdb815d75 100644
--- a/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
+++ b/runtime/src/test/java/org/onap/policy/clamp/runtime/RuntimeInstantiationResponseItTestCase.java
@@ -41,6 +41,8 @@ public class RuntimeInstantiationResponseItTestCase {
private static final String DIRECT_GET_TOSCA_INSTANTIATION = "direct:get-tosca-instantiation";
+ private static final String DIRECT_POST_TOSCA_INSTANTANCE_PROPERTIES = "direct:post-tosca-instance-properties";
+
private static final String SERVICE_TEMPLATE_NAME = "name";
private static final String SERVICE_TEMPLATE_VERSION = "version";
@@ -51,6 +53,12 @@ public class RuntimeInstantiationResponseItTestCase {
+ "\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\","
+ "\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}";
+ private static final String SAMPLE_TOSCA_TEMPLATE =
+ "{\"tosca_definitions_version\": \"tosca_simple_yaml_1_1_0\","
+ + "\"data_types\": {},\"node_types\": {}, \"policy_types\": {},"
+ + " \"topology_template\": {},"
+ + " \"name\": \"ToscaServiceTemplateSimple\", \"version\": \"1.0.0\", \"metadata\": {}}";
+
@Test
public void testToscaServiceTemplateStatus() {
ProducerTemplate prodTemplate = camelContext.createProducerTemplate();
@@ -93,4 +101,18 @@ public class RuntimeInstantiationResponseItTestCase {
assertThat(HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE))
.is2xxSuccessful()).isTrue();
}
+
+ @Test
+ public void testCommissioningOfToscaServiceTemplateStatus() {
+ ProducerTemplate prodTemplate = camelContext.createProducerTemplate();
+
+ Exchange exchangeResponse =
+ prodTemplate.send(DIRECT_POST_TOSCA_INSTANTANCE_PROPERTIES, ExchangeBuilder.anExchange(camelContext)
+ .withBody(SAMPLE_TOSCA_TEMPLATE)
+ .withProperty("raiseHttpExceptionFlag", "true")
+ .build());
+
+ assertThat(HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE))
+ .is2xxSuccessful()).isTrue();
+ }
}
diff --git a/runtime/src/test/resources/application.properties b/runtime/src/test/resources/application.properties
index bc0c290db..f2cf0dd33 100644
--- a/runtime/src/test/resources/application.properties
+++ b/runtime/src/test/resources/application.properties
@@ -139,10 +139,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
# Sdc service properties
@@ -183,5 +183,5 @@ clamp.config.tosca.converter.dictionary.support.enabled=true
# Configuration settings for ControlLoop Runtime Rest API
clamp.config.controlloop.runtime.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.controlloop.runtime.userName=healthcheck
+clamp.config.controlloop.runtime.userName=runtimeUser
clamp.config.controlloop.runtime.password=zb!XztG34
diff --git a/runtime/src/test/resources/http-cache/third_party_proxy.py b/runtime/src/test/resources/http-cache/third_party_proxy.py
index 5c80cdda4..67af21470 100644
--- a/runtime/src/test/resources/http-cache/third_party_proxy.py
+++ b/runtime/src/test/resources/http-cache/third_party_proxy.py
@@ -331,6 +331,15 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
jsonGenerated = "{\"controlLoopList\": [{\"name\": \"PMSHInstance0\",\"version\": \"1.0.1\",\"definition\": {},\"state\": \"UNINITIALISED\",\"orderedState\": \"UNINITIALISED\",\"description\": \"PMSH control loop instance 0\",\"elements\": {}}]}";
self._create_cache(jsonGenerated, cached_file_folder, cached_file_header, cached_file_content)
return True
+ elif (self.path.startswith("/onap/controlloop/v2/instanceProperties")) and http_type == "POST":
+ print("self.path start with POST /onap/controlloop/v2/instanceProperties, copying body to response ...")
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0o777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(self.data_string)) + "\", \"Content-Type\": \""+str(self.headers['Content-Type'])+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
else:
return False
diff --git a/runtime/src/test/resources/robotframework/robotframework-test.properties b/runtime/src/test/resources/robotframework/robotframework-test.properties
index 499719aa6..493c83c3d 100644
--- a/runtime/src/test/resources/robotframework/robotframework-test.properties
+++ b/runtime/src/test/resources/robotframework/robotframework-test.properties
@@ -136,10 +136,10 @@ clamp.config.httpclient.connectTimeout=10000
#
# Configuration Settings for Policy Engine Components
clamp.config.policy.api.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.userName=policyadmin
clamp.config.policy.api.password=zb!XztG34
clamp.config.policy.pap.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.userName=policyadmin
clamp.config.policy.pap.password=zb!XztG34
# Sdc service properties
diff --git a/runtime/ui-react/src/components/dialogs/Policy/PolicyEditor.js b/runtime/ui-react/src/components/dialogs/Policy/PolicyEditor.js
index be77f14e9..1e2754151 100644
--- a/runtime/ui-react/src/components/dialogs/Policy/PolicyEditor.js
+++ b/runtime/ui-react/src/components/dialogs/Policy/PolicyEditor.js
@@ -23,7 +23,7 @@
import React from 'react'
import PolicyToscaService from '../../../api/PolicyToscaService';
-import { JSONEditor } from '@json-editor/json-editor/dist/nonmin/jsoneditor.js';
+import { JSONEditor } from '@json-editor/json-editor/dist/nonmin/jsoneditor.js';
import "@fortawesome/fontawesome-free/css/all.css"
import styled from 'styled-components';
import Button from 'react-bootstrap/Button';
@@ -33,160 +33,160 @@ import PolicyService from '../../../api/PolicyService';
import OnapUtils from '../../../utils/OnapUtils';
const DivWhiteSpaceStyled = styled.div`
- white-space: pre;
+ white-space: pre;
`
const JsonEditorDiv = styled.div`
- margin-top: 20px;
- background-color: ${props => props.theme.loopViewerBackgroundColor};
- text-align: justify;
- font-size: ${props => props.theme.policyEditorFontSize};
- border: 1px solid #C0C0C0;
+ margin-top: 20px;
+ background-color: ${ props => props.theme.loopViewerBackgroundColor };
+ text-align: justify;
+ font-size: ${ props => props.theme.policyEditorFontSize };
+ border: 1px solid #C0C0C0;
`
const PanelDiv = styled.div`
- text-align: justify;
- font-size: ${props => props.theme.policyEditorFontSize};
- background-color: ${props => props.theme.loopViewerBackgroundColor};
+ text-align: justify;
+ font-size: ${ props => props.theme.policyEditorFontSize };
+ background-color: ${ props => props.theme.loopViewerBackgroundColor };
`
export default class PolicyEditor extends React.Component {
- state = {
- policyModelType: this.props.policyModelType,
- policyModelTypeVersion: this.props.policyModelTypeVersion,
- policyName: (typeof this.props.policyName !== "undefined") ? this.props.policyName : "org.onap.policy.new",
- policyVersion: (typeof this.props.policyVersion !== "undefined") ? this.props.policyVersion : "0.0.1",
- policyProperties: this.props.policyProperties,
- showSuccessAlert: false,
- showFailAlert: false,
- jsonEditor: null,
- jsonEditorDivId: this.props.policyModelType + "_" + this.props.policyModelTypeVersion + "_" + this.props.policyName + "_" + this.props.policyVersion,
- }
-
- constructor(props, context) {
- super(props, context);
- this.createJsonEditor = this.createJsonEditor.bind(this);
- this.getToscaModelForPolicy = this.getToscaModelForPolicy.bind(this);
- this.disableAlert = this.disableAlert.bind(this);
- this.handleCreateNewVersion = this.handleCreateNewVersion.bind(this);
- this.handleChangePolicyName = this.handleChangePolicyName.bind(this);
- this.handleChangePolicyVersion = this.handleChangePolicyVersion.bind(this);
- }
-
- disableAlert() {
- this.setState ({ showSuccessAlert: false, showFailAlert: false });
- }
-
- customValidation(editorData) {
- // method for sub-classes to override with customized validation
- return [];
- }
-
- handleCreateNewVersion() {
- var editorData = this.state.jsonEditor.getValue();
- var errors = this.state.jsonEditor.validate();
- errors = errors.concat(this.customValidation(editorData));
-
- if (errors.length !== 0) {
- console.error("Errors detected during policy data validation ", errors);
- this.setState({
- showFailAlert: true,
- showMessage: 'Errors detected during policy data validation:\n' + OnapUtils.jsonEditorErrorFormatter(errors)
- });
- return;
+ state = {
+ policyModelType: this.props.policyModelType,
+ policyModelTypeVersion: this.props.policyModelTypeVersion,
+ policyName: (typeof this.props.policyName !== "undefined") ? this.props.policyName : "org.onap.policy.new",
+ policyVersion: (typeof this.props.policyVersion !== "undefined") ? this.props.policyVersion : "0.0.1",
+ policyProperties: this.props.policyProperties,
+ showSuccessAlert: false,
+ showFailAlert: false,
+ jsonEditor: null,
+ jsonEditorDivId: this.props.policyModelType + "_" + this.props.policyModelTypeVersion + "_" + this.props.policyName + "_" + this.props.policyVersion,
+ }
+
+ constructor(props, context) {
+ super(props, context);
+ this.createJsonEditor = this.createJsonEditor.bind(this);
+ this.getToscaModelForPolicy = this.getToscaModelForPolicy.bind(this);
+ this.disableAlert = this.disableAlert.bind(this);
+ this.handleCreateNewVersion = this.handleCreateNewVersion.bind(this);
+ this.handleChangePolicyName = this.handleChangePolicyName.bind(this);
+ this.handleChangePolicyVersion = this.handleChangePolicyVersion.bind(this);
+ }
+
+ disableAlert() {
+ this.setState({ showSuccessAlert: false, showFailAlert: false });
+ }
+
+ customValidation(editorData) {
+ // method for sub-classes to override with customized validation
+ return [];
+ }
+
+ handleCreateNewVersion() {
+ var editorData = this.state.jsonEditor.getValue();
+ var errors = this.state.jsonEditor.validate();
+ errors = errors.concat(this.customValidation(editorData));
+
+ if (errors.length !== 0) {
+ console.error("Errors detected during policy data validation ", errors);
+ this.setState({
+ showFailAlert: true,
+ showMessage: 'Errors detected during policy data validation:\n' + OnapUtils.jsonEditorErrorFormatter(errors)
+ });
+ return;
+ } else {
+ console.info("NO validation errors found in policy data");
+ PolicyService.createNewPolicy(this.state.policyModelType, this.state.policyModelTypeVersion,
+ this.state.policyName, this.state.policyVersion, editorData).then(respPolicyCreation => {
+ if (typeof (respPolicyCreation) === "undefined") {
+ //it indicates a failure
+ this.setState({
+ showFailAlert: true,
+ showMessage: 'Policy Creation Failure'
+ });
} else {
- console.info("NO validation errors found in policy data");
- PolicyService.createNewPolicy(this.state.policyModelType, this.state.policyModelTypeVersion,
- this.state.policyName, this.state.policyVersion, editorData).then(respPolicyCreation => {
- if (typeof(respPolicyCreation) === "undefined") {
- //it indicates a failure
- this.setState({
- showFailAlert: true,
- showMessage: 'Policy Creation Failure'
- });
- } else {
- this.setState({
- showSuccessAlert: true,
- showMessage: 'Policy '+ this.state.policyName + '/' + this.state.policyVersion + ' created successfully'
- });
- this.props.policiesTableUpdateFunction();
- }
- })
+ this.setState({
+ showSuccessAlert: true,
+ showMessage: 'Policy ' + this.state.policyName + '/' + this.state.policyVersion + ' created successfully'
+ });
+ this.props.policiesTableUpdateFunction();
}
+ })
}
-
- getToscaModelForPolicy() {
- PolicyToscaService.getToscaPolicyModel(this.state.policyModelType, this.state.policyModelTypeVersion).then(respJsonPolicyTosca => {
- if (respJsonPolicyTosca !== {}) {
- this.setState({
- jsonSchemaPolicyTosca: respJsonPolicyTosca,
- jsonEditor: this.createJsonEditor(respJsonPolicyTosca, this.state.policyProperties),
- })
- }
- });
- }
-
- componentDidMount() {
- this.getToscaModelForPolicy();
- }
-
- createJsonEditor(toscaModel, editorData) {
- return new JSONEditor(document.getElementById(this.state.jsonEditorDivId),
- {
- schema: toscaModel,
- startval: editorData,
- theme: 'bootstrap4',
- iconlib: 'fontawesome5',
- object_layout: 'grid',
- disable_properties: false,
- disable_edit_json: false,
- disable_array_reorder: true,
- disable_array_delete_last_row: true,
- disable_array_delete_all_rows: false,
- array_controls_top: true,
- keep_oneof_values: false,
- collapsed: true,
- show_errors: 'always',
- display_required_only: false,
- show_opt_in: false,
- prompt_before_delete: true,
- required_by_default: false
+ }
+
+ getToscaModelForPolicy() {
+ PolicyToscaService.getToscaPolicyModel(this.state.policyModelType, this.state.policyModelTypeVersion).then(respJsonPolicyTosca => {
+ if (respJsonPolicyTosca !== {}) {
+ this.setState({
+ jsonSchemaPolicyTosca: respJsonPolicyTosca,
+ jsonEditor: this.createJsonEditor(respJsonPolicyTosca, this.state.policyProperties),
})
- }
-
- handleChangePolicyName(event) {
- this.setState({
- policyName: event.target.value,
- });
- }
-
- handleChangePolicyVersion(event) {
- this.setState({
- policyVersion: event.target.value,
- });
- }
-
- render() {
- return (
- <PanelDiv>
- <Alert variant="success" show={this.state.showSuccessAlert} onClose={this.disableAlert} dismissible>
- <DivWhiteSpaceStyled>
- {this.state.showMessage}
- </DivWhiteSpaceStyled>
- </Alert>
- <Alert variant="danger" show={this.state.showFailAlert} onClose={this.disableAlert} dismissible>
- <DivWhiteSpaceStyled>
- {this.state.showMessage}
- </DivWhiteSpaceStyled>
- </Alert>
- <TextField required id="policyName" label="Required" defaultValue={this.state.policyName}
- onChange={this.handleChangePolicyName} variant="outlined" size="small"/>
- <TextField required id="policyVersion" label="Required" defaultValue={this.state.policyVersion}
- onChange={this.handleChangePolicyVersion} size="small" variant="outlined"/>
- <Button variant="secondary" title="Create a new policy version from the defined parameters"
- onClick={this.handleCreateNewVersion}>Create New Version</Button>
- <JsonEditorDiv id={this.state.jsonEditorDivId} title="Policy Properties"/>
- </PanelDiv>
- );
- }
-} \ No newline at end of file
+ }
+ });
+ }
+
+ componentDidMount() {
+ this.getToscaModelForPolicy();
+ }
+
+ createJsonEditor(toscaModel, editorData) {
+ return new JSONEditor(document.getElementById(this.state.jsonEditorDivId),
+ {
+ schema: toscaModel,
+ startval: editorData,
+ theme: 'bootstrap4',
+ iconlib: 'fontawesome5',
+ object_layout: 'grid',
+ disable_properties: false,
+ disable_edit_json: false,
+ disable_array_reorder: true,
+ disable_array_delete_last_row: true,
+ disable_array_delete_all_rows: false,
+ array_controls_top: true,
+ keep_oneof_values: false,
+ collapsed: true,
+ show_errors: 'always',
+ display_required_only: false,
+ show_opt_in: false,
+ prompt_before_delete: true,
+ required_by_default: false
+ })
+ }
+
+ handleChangePolicyName(event) {
+ this.setState({
+ policyName: event.target.value,
+ });
+ }
+
+ handleChangePolicyVersion(event) {
+ this.setState({
+ policyVersion: event.target.value,
+ });
+ }
+
+ render() {
+ return (
+ <PanelDiv>
+ <Alert variant="success" show={ this.state.showSuccessAlert } onClose={ this.disableAlert } dismissible>
+ <DivWhiteSpaceStyled>
+ { this.state.showMessage }
+ </DivWhiteSpaceStyled>
+ </Alert>
+ <Alert variant="danger" show={ this.state.showFailAlert } onClose={ this.disableAlert } dismissible>
+ <DivWhiteSpaceStyled>
+ { this.state.showMessage }
+ </DivWhiteSpaceStyled>
+ </Alert>
+ <TextField required id="policyName" label="Required" defaultValue={ this.state.policyName }
+ onChange={ this.handleChangePolicyName } variant="outlined" size="small"/>
+ <TextField required id="policyVersion" label="Required" defaultValue={ this.state.policyVersion }
+ onChange={ this.handleChangePolicyVersion } size="small" variant="outlined"/>
+ <Button variant="secondary" title="Create a new policy version from the defined parameters"
+ onClick={ this.handleCreateNewVersion }>Create New Version</Button>
+ <JsonEditorDiv id={ this.state.jsonEditorDivId } title="Policy Properties"/>
+ </PanelDiv>
+ );
+ }
+}
diff --git a/runtime/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap b/runtime/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap
index 959b52a36..bf84e91d1 100644
--- a/runtime/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap
+++ b/runtime/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyEditor.test.js.snap
@@ -37,7 +37,7 @@ exports[`Verify PolicyEditor Test the render method 1`] = `
>
<styled.div>
<div
- className="sc-dlfnbm iSTbVM"
+ className="sc-dlfnbm eVKaeY"
>
<Alert
closeLabel="Close alert"
@@ -777,7 +777,7 @@ exports[`Verify PolicyEditor Test the render method 1`] = `
title="Policy Properties"
>
<div
- className="sc-gsTCUz dAYWPx"
+ className="sc-gsTCUz hXXDCR"
id="onap.policies.monitoring.tcagen2_1.0.0_org.onap.new_1.0.0"
title="Policy Properties"
/>
diff --git a/testsuites/performance/src/main/resources/testplans/performance.jmx b/testsuites/performance/src/main/resources/testplans/performance.jmx
index bb0cfc98d..6b651a9f3 100644
--- a/testsuites/performance/src/main/resources/testplans/performance.jmx
+++ b/testsuites/performance/src/main/resources/testplans/performance.jmx
@@ -57,7 +57,7 @@
<collectionProp name="AuthManager.auth_list">
<elementProp name="" elementType="Authorization">
<stringProp name="Authorization.url">https://${RUNTIME_HOST}:${RUNTIME_PORT}/onap/controlloop/v2</stringProp>
- <stringProp name="Authorization.username">healthcheck</stringProp>
+ <stringProp name="Authorization.username">runtimeUser</stringProp>
<stringProp name="Authorization.password">zb!XztG34</stringProp>
<stringProp name="Authorization.domain"></stringProp>
<stringProp name="Authorization.realm"></stringProp>
diff --git a/testsuites/stability/src/main/resources/testplans/stability.jmx b/testsuites/stability/src/main/resources/testplans/stability.jmx
index 32bb36012..b5929c1e6 100644
--- a/testsuites/stability/src/main/resources/testplans/stability.jmx
+++ b/testsuites/stability/src/main/resources/testplans/stability.jmx
@@ -37,7 +37,7 @@
<collectionProp name="AuthManager.auth_list">
<elementProp name="" elementType="Authorization">
<stringProp name="Authorization.url">https://${RUNTIME_HOST}:${RUNTIME_PORT}/onap/controlloop/v2</stringProp>
- <stringProp name="Authorization.username">healthcheck</stringProp>
+ <stringProp name="Authorization.username">runtimeUser</stringProp>
<stringProp name="Authorization.password">zb!XztG34</stringProp>
<stringProp name="Authorization.domain"></stringProp>
<stringProp name="Authorization.realm"></stringProp>