summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-dcae/src
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-dcae/src')
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java21
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java8
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java32
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java (renamed from participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParametersConfig.java)45
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java39
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java82
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java91
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json70
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml54
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json62
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java2
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java4
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClientTest.java4
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandlerTest.java144
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java116
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParametersTest.java163
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java64
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java88
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java2
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/application_test.properties41
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json3
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json61
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json2
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json70
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json71
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json61
26 files changed, 628 insertions, 772 deletions
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
index fd19d9d3a..74c1ee5c1 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.controlloop.participant.dcae.httpclient;
import org.apache.http.HttpStatus;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ClampEndPoints;
import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
import org.onap.policy.clamp.controlloop.participant.dcae.model.ExternalComponent;
import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
@@ -29,12 +30,7 @@ import org.springframework.stereotype.Component;
@Component
public class ClampHttpClient extends AbstractHttpClient {
- private static final String STATUS = "/restservices/clds/v2/loop/getstatus/";
- private static final String CREATE = "/restservices/clds/v2/loop/create/%s?templateName=%s";
- private static final String DEPLOY = "/restservices/clds/v2/loop/deploy/";
- private static final String STOP = "/restservices/clds/v2/loop/stop/";
- private static final String DELETE = "/restservices/clds/v2/loop/delete/";
- private static final String UNDEPLOY = "/restservices/clds/v2/loop/undeploy/";
+ private final ClampEndPoints endPoints;
public static final String STATUS_NOT_FOUND = "STATUS_NOT_FOUND";
public static final String POLICY_NOT_FOUND = "POLICY_NOT_FOUND";
@@ -45,6 +41,7 @@ public class ClampHttpClient extends AbstractHttpClient {
*/
public ClampHttpClient(ParticipantDcaeParameters parameters) {
super(parameters.getClampClientParameters());
+ this.endPoints = parameters.getClampClientEndPoints();
}
/**
@@ -55,7 +52,7 @@ public class ClampHttpClient extends AbstractHttpClient {
* @return the Loop object or null if error occurred
*/
public Loop create(String loopName, String templateName) {
- return executePost(String.format(CREATE, loopName, templateName), HttpStatus.SC_OK);
+ return executePost(String.format(endPoints.getCreate(), loopName, templateName), HttpStatus.SC_OK);
}
/**
@@ -65,7 +62,7 @@ public class ClampHttpClient extends AbstractHttpClient {
* @return true
*/
public boolean deploy(String loopName) {
- return executePut(DEPLOY + loopName, HttpStatus.SC_ACCEPTED);
+ return executePut(endPoints.getDeploy() + loopName, HttpStatus.SC_ACCEPTED);
}
/**
@@ -75,7 +72,7 @@ public class ClampHttpClient extends AbstractHttpClient {
* @return the Loop object or null if error occurred
*/
public Loop getstatus(String loopName) {
- return executeGet(STATUS + loopName, HttpStatus.SC_OK);
+ return executeGet(endPoints.getStatus() + loopName, HttpStatus.SC_OK);
}
/**
@@ -85,7 +82,7 @@ public class ClampHttpClient extends AbstractHttpClient {
* @return true
*/
public boolean undeploy(String loopName) {
- return executePut(UNDEPLOY + loopName, HttpStatus.SC_ACCEPTED);
+ return executePut(endPoints.getUndeploy() + loopName, HttpStatus.SC_ACCEPTED);
}
/**
@@ -95,7 +92,7 @@ public class ClampHttpClient extends AbstractHttpClient {
* @return true
*/
public boolean stop(String loopName) {
- return executePut(STOP + loopName, HttpStatus.SC_OK);
+ return executePut(endPoints.getStop() + loopName, HttpStatus.SC_OK);
}
/**
@@ -105,7 +102,7 @@ public class ClampHttpClient extends AbstractHttpClient {
* @return true
*/
public boolean delete(String loopName) {
- return executePut(DELETE + loopName, HttpStatus.SC_OK);
+ return executePut(endPoints.getDelete() + loopName, HttpStatus.SC_OK);
}
/**
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java
index 154dd09be..4cdcf7c7f 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java
@@ -21,13 +21,14 @@
package org.onap.policy.clamp.controlloop.participant.dcae.httpclient;
import org.apache.http.HttpStatus;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ConsulEndPoints;
import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
import org.springframework.stereotype.Component;
@Component
public class ConsulDcaeHttpClient extends AbstractHttpClient {
- private static final String DEPLOY = "/v1/kv/dcae-pmsh:";
+ private final ConsulEndPoints endPoints;
/**
* Constructor.
@@ -36,16 +37,17 @@ public class ConsulDcaeHttpClient extends AbstractHttpClient {
*/
public ConsulDcaeHttpClient(ParticipantDcaeParameters parameters) {
super(parameters.getConsulClientParameters());
+ this.endPoints = parameters.getConsulClientEndPoints();
}
/**
- * Call consult.
+ * Call deploy consult.
*
* @param name the name to deploy
* @param jsonEntity the Entity
* @return true
*/
public boolean deploy(String name, String jsonEntity) {
- return executePut(DEPLOY + name, jsonEntity, HttpStatus.SC_OK);
+ return executePut(endPoints.getDeploy() + name, jsonEntity, HttpStatus.SC_OK);
}
}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java
index 6c5ff1d78..5a0ddabfd 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java
@@ -30,9 +30,11 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ClampHttpClient;
import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ConsulDcaeHttpClient;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
@@ -58,19 +60,11 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
private static final String BLUEPRINT_DEPLOYED = "BLUEPRINT_DEPLOYED";
private static final String MICROSERVICE_INSTALLED_SUCCESSFULLY = "MICROSERVICE_INSTALLED_SUCCESSFULLY";
- private static final int CHECK_COUNT = 10;
-
- private static final String BODY_CONSUL =
- "{ \"subscription\": { \"subscriptionName\": \"subscriptiona\", \"administrativeState\": \"UNLOCKED\", "
- + "\"fileBasedGP\": 15, \"fileLocation\": \"/pm/pm.xml\", \"nfFilter\": "
- + "{ \"nfNames\": [ \"^pnf1.*\" ], \"modelInvariantIDs\": "
- + "[ \"5845y423-g654-6fju-po78-8n53154532k6\", \"7129e420-d396-4efb-af02-6b83499b12f8\" ], "
- + "\"modelVersionIDs\": [ \"e80a6ae3-cafd-4d24-850d-e14c084a5ca9\" ] }, \"measurementGroups\": "
- + "[ { \"measurementGroup\": { \"measurementTypes\": [ { \"measurementType\": \"countera\" }, "
- + "{ \"measurementType\": \"counterb\" } ], \"managedObjectDNsBasic\": [ { \"DN\": \"dna\" }, "
- + "{ \"DN\": \"dnb\" } ] } }, { \"measurementGroup\": { \"measurementTypes\": "
- + "[ { \"measurementType\": \"counterc\" }, { \"measurementType\": \"counterd\" } ], "
- + "\"managedObjectDNsBasic\": " + "[ { \"DN\": \"dnc\" }, { \"DN\": \"dnd\" } ] } } ] } }";
+
+ private int checkCount;
+ private int secCount;
+
+ private String bodyConsul;
/**
* Constructor.
@@ -78,9 +72,13 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
* @param clampClient the CLAMP client
* @param consulClient the Consul client
*/
- public ControlLoopElementHandler(ClampHttpClient clampClient, ConsulDcaeHttpClient consulClient) {
+ public ControlLoopElementHandler(ClampHttpClient clampClient, ConsulDcaeHttpClient consulClient,
+ ParticipantDcaeParameters parameters) {
this.clampClient = clampClient;
this.consulClient = consulClient;
+ this.checkCount = parameters.getCheckCount();
+ this.secCount = parameters.getSecCount();
+ bodyConsul = ResourceUtils.getResourceAsString(parameters.getJsonBodyConsulPath());
}
/**
@@ -126,7 +124,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
}
private void deploy() throws PfModelException {
- if (!consulClient.deploy(POLICY, BODY_CONSUL)) {
+ if (!consulClient.deploy(POLICY, bodyConsul)) {
throw new PfModelException(null, "deploy to consul failed");
}
if (!clampClient.deploy(LOOP)) {
@@ -150,9 +148,9 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
if (BLUEPRINT_DEPLOYED.equals(ClampHttpClient.getStatusCode(loop))) {
deploy();
boolean deployedFlag = false;
- for (int i = 0; i < CHECK_COUNT; i++) {
+ for (int i = 0; i < checkCount; i++) {
// sleep 10 seconds
- TimeUnit.SECONDS.sleep(CHECK_COUNT);
+ TimeUnit.SECONDS.sleep(secCount);
loop = getStatus();
String status = ClampHttpClient.getStatusCode(loop);
if (MICROSERVICE_INSTALLED_SUCCESSFULLY.equals(status)) {
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParametersConfig.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java
index ee649c993..12b67ebda 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParametersConfig.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java
@@ -18,23 +18,38 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.clamp.controlloop.participant.dcae.config;
+package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameterHandler;
-import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
+import javax.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.validation.annotation.Validated;
-@Configuration
-public class ParametersConfig {
+/**
+ * Class to hold all end points needed for clamp client.
+ *
+ */
+@Validated
+@Getter
+@Setter
+public class ClampEndPoints {
+
+ @NotBlank
+ private String status;
+
+ @NotBlank
+ private String create;
+
+ @NotBlank
+ private String deploy;
+
+ @NotBlank
+ private String stop;
+
+ @NotBlank
+ private String delete;
- @Value("${participant.file}")
- private String file;
+ @NotBlank
+ private String undeploy;
- @Bean
- public ParticipantDcaeParameters participantDcaeParameters() throws ControlLoopException {
- return new ParticipantDcaeParameterHandler().toParticipantDcaeParameters(file);
- }
}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java
new file mode 100644
index 000000000..ffbfa409c
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
+
+import javax.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.validation.annotation.Validated;
+
+/**
+ * Class to hold all end points needed for consul client.
+ *
+ */
+@Validated
+@Getter
+@Setter
+public class ConsulEndPoints {
+
+ @NotBlank
+ private String deploy;
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java
deleted file mode 100644
index 689bb40c2..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
-
-import java.io.File;
-import javax.ws.rs.core.Response;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.utils.coder.Coder;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class handles reading, parsing and validating of control loop runtime parameters from JSON files.
- */
-public class ParticipantDcaeParameterHandler {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantDcaeParameterHandler.class);
-
- private static final Coder CODER = new StandardCoder();
-
- /**
- * Read the parameters from the path of the file.
- *
- * @param path path of the config file.
- * @return the parameters read from the configuration file
- * @throws ControlLoopException on parameter exceptions
- */
- public ParticipantDcaeParameters toParticipantDcaeParameters(String path) throws ControlLoopException {
- ParticipantDcaeParameters parameters = null;
- // Read the parameters
- try {
- // Read the parameters from JSON
- File file = new File(path);
- parameters = CODER.decode(file, ParticipantDcaeParameters.class);
- } catch (final CoderException e) {
- final String errorMessage =
- "error reading parameters from \"" + path + "\"\n" + "(" + e.getClass().getSimpleName() + ")";
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage, e);
- }
-
- // The JSON processing returns null if there is an empty file
- if (parameters == null) {
- final String errorMessage = "no parameters found in \"" + path + "\"";
- LOGGER.error(errorMessage);
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage);
- }
-
- // validate the parameters
- final BeanValidationResult validationResult = parameters.validate();
- if (!validationResult.isValid()) {
- final String returnMessage =
- "validation error(s) on parameters from \"" + path + "\"\n" + validationResult.getResult();
-
- LOGGER.error(returnMessage);
- throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, returnMessage);
- }
-
- return parameters;
- }
-
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java
index 469a6fe79..798781177 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java
@@ -20,77 +20,56 @@
package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
+import javax.validation.Valid;
+import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import lombok.Getter;
-import org.apache.commons.lang3.StringUtils;
+import lombok.Setter;
import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
-import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.ParameterGroupImpl;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.common.parameters.annotations.NotNull;
-import org.onap.policy.common.parameters.annotations.Valid;
-import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.common.endpoints.parameters.RestClientParameters;
+import org.onap.policy.common.parameters.validation.ParameterGroupConstraint;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.validation.annotation.Validated;
/**
* Class to hold all parameters needed for the participant dcae.
*
*/
-@NotNull
-@NotBlank
+@Validated
@Getter
-public class ParticipantDcaeParameters extends ParameterGroupImpl {
+@Setter
+@ConfigurationProperties(prefix = "participant")
+public class ParticipantDcaeParameters {
- private static final String MSG_IS_BLANK = "is blank";
+ @NotNull
+ @Min(10)
+ private int checkCount = 10;
- @Valid
- private BusTopicParams clampClientParameters;
+ @NotNull
+ @Min(1)
+ private int secCount = 10;
+
+ @NotBlank
+ private String jsonBodyConsulPath;
+ @NotNull
@Valid
- private BusTopicParams consulClientParameters;
+ private ClampEndPoints clampClientEndPoints;
- private ParticipantIntermediaryParameters intermediaryParameters;
- private PolicyModelsProviderParameters databaseProviderParameters;
+ @NotNull
+ @Valid
+ private ConsulEndPoints consulClientEndPoints;
- /**
- * Create the participant dcae parameter group.
- *
- * @param name the parameter group name
- */
- public ParticipantDcaeParameters(final String name) {
- super(name);
- }
+ @NotNull
+ @ParameterGroupConstraint
+ private RestClientParameters clampClientParameters;
- /**
- * {@inheritDoc}.
- */
- @Override
- public BeanValidationResult validate() {
- BeanValidationResult result = super.validate();
- if (result.isValid()) {
- result.addResult(checkMissingMandatoryParams(clampClientParameters));
- result.addResult(checkMissingMandatoryParams(consulClientParameters));
- }
- return result;
- }
+ @NotNull
+ @ParameterGroupConstraint
+ private RestClientParameters consulClientParameters;
- private BeanValidationResult checkMissingMandatoryParams(BusTopicParams clientParameters) {
- BeanValidationResult result = new BeanValidationResult(clientParameters.getClientName(), clientParameters);
- if (clientParameters.isHostnameInvalid()) {
- result.addResult("Host", clientParameters.getHostname(), ValidationStatus.INVALID, MSG_IS_BLANK);
- }
- if (clientParameters.isClientNameInvalid()) {
- result.addResult("Name", clientParameters.getClientName(), ValidationStatus.INVALID, MSG_IS_BLANK);
- }
- if (StringUtils.isBlank(clientParameters.getPassword())) {
- result.addResult("Password", clientParameters.getPassword(), ValidationStatus.INVALID, MSG_IS_BLANK);
- }
- if (StringUtils.isBlank(clientParameters.getUserName())) {
- result.addResult("UserName", clientParameters.getUserName(), ValidationStatus.INVALID, MSG_IS_BLANK);
- }
- if (clientParameters.isPortInvalid()) {
- result.addResult("Port", clientParameters.getPort(), ValidationStatus.INVALID, "is not valid");
- }
- return result;
- }
+ @NotNull
+ @Valid
+ private ParticipantIntermediaryParameters intermediaryParameters;
}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json
deleted file mode 100644
index a7ea089b2..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "name": "ControlLoopParticipantDcae",
- "clampClientParameters": {
- "clientName": "Clamp",
- "hostname": "0.0.0.0",
- "port": 8443,
- "userName": "admin",
- "password": "password",
- "useHttps": true,
- "allowSelfSignedCerts": false
- },
- "consulClientParameters": {
- "clientName": "Consul",
- "hostname": "consul",
- "port": 31321,
- "userName": "admin",
- "password": "password",
- "useHttps": false
- },
- "intermediaryParameters": {
- "name": "Participant parameters",
- "reportingTimeInterval": 120000,
- "description": "Participant Description",
- "participantId": {
- "name": "DCAEParticipant0",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "version": "2.3.4"
- },
- "clampControlLoopTopics": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.h2.Driver",
- "databaseUrl": "jdbc:h2:mem:testdb",
- "databaseUser": "policy",
- "databasePassword": "P01icY",
- "persistenceUnit": "ToscaConceptTest"
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
index 58908cf8d..36b9f846a 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
@@ -1,3 +1,55 @@
participant:
- file: src/main/resources/config/DCAEParticipantConfig.json
+ name: ControlLoopParticipantDcae
+ clampClientEndPoints:
+ status: /restservices/clds/v2/loop/getstatus/
+ create: /restservices/clds/v2/loop/create/%s?templateName=%s
+ deploy: /restservices/clds/v2/loop/deploy/
+ stop: /restservices/clds/v2/loop/stop/
+ delete: /restservices/clds/v2/loop/delete/
+ undeploy: /restservices/clds/v2/loop/undeploy/
+ clampClientParameters:
+ clientName: Clamp
+ hostname: 0.0.0.0
+ port: 8443
+ userName: admin
+ password: password
+ https: true
+ aaf: false
+ consulClientEndPoints:
+ deploy: "/v1/kv/dcae-pmsh:"
+ consulClientParameters:
+ clientName: Consul
+ hostname: consul
+ port: 31321
+ userName: admin
+ password: password
+ https: false
+ aaf: false
+ intermediaryParameters:
+ name: Participant parameters
+ reportingTimeInterval: 120000
+ description: Participant Description
+ participantId:
+ name: DCAEParticipant0
+ version: 1.0.0
+ participantType:
+ name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ version: 2.3.4
+ clampControlLoopTopics:
+ topicSources[0]:
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers[0]: ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ fetchTimeout: 15000
+ topicSinks[0]:
+ topic: POLICY-CLRUNTIME-PARTICIPANT
+ servers[0]: ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ topicSinks[1]:
+ topic: POLICY-NOTIFICATION
+ servers[0]: ${topicServer:message-router}
+ topicCommInfrastructure: dmaap
+ checkCount: 10
+ secCount: 10
+ jsonBodyConsulPath: src/main/resources/parameters/consul.json
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json b/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json
new file mode 100644
index 000000000..3aad78ee8
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json
@@ -0,0 +1,62 @@
+{
+ "subscription": {
+ "subscriptionName": "subscriptiona",
+ "administrativeState": "UNLOCKED",
+ "fileBasedGP": 15,
+ "fileLocation": "/pm/pm.xml",
+ "nfFilter": {
+ "nfNames": [
+ "^pnf1.*"
+ ],
+ "modelInvariantIDs": [
+ "5845y423-g654-6fju-po78-8n53154532k6",
+ "7129e420-d396-4efb-af02-6b83499b12f8"
+ ],
+ "modelVersionIDs": [
+ "e80a6ae3-cafd-4d24-850d-e14c084a5ca9"
+ ]
+ },
+ "measurementGroups": [
+ {
+ "measurementGroup": {
+ "measurementTypes": [
+ {
+ "measurementType": "countera"
+ },
+ {
+ "measurementType": "counterb"
+ }
+ ],
+ "managedObjectDNsBasic": [
+ {
+ "DN": "dna"
+ },
+ {
+ "DN": "dnb"
+ }
+ ]
+ }
+ },
+ {
+ "measurementGroup": {
+ "measurementTypes": [
+ {
+ "measurementType": "counterc"
+ },
+ {
+ "measurementType": "counterd"
+ }
+ ],
+ "managedObjectDNsBasic": [
+ {
+ "DN": "dnc"
+ },
+ {
+ "DN": "dnd"
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java
index 6d7592db0..46317729a 100644
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java
@@ -48,7 +48,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@TestPropertySource(properties = "participant.file=src/test/resources/parameters/TestParameters.json")
+@TestPropertySource(locations = {"classpath:application_test.properties"})
class PartecipantDcaeTest {
private static final CommInfrastructure INFRA = CommInfrastructure.NOOP;
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java
index 6e375222e..f730f36f4 100644
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java
@@ -60,9 +60,7 @@ class ClampHttpClientTest {
public static void setUp() {
CommonTestData commonTestData = new CommonTestData();
- parameters = commonTestData.toObject(
- commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
- ParticipantDcaeParameters.class);
+ parameters = commonTestData.getParticipantDcaeParameters();
mockServer = ClientAndServer.startClientAndServer(parameters.getClampClientParameters().getPort());
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClientTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClientTest.java
index 734919e4c..5155fed1d 100644
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClientTest.java
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClientTest.java
@@ -48,9 +48,7 @@ class ConsulDcaeHttpClientTest {
public static void startServer() {
CommonTestData commonTestData = new CommonTestData();
- parameters = commonTestData.toObject(
- commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
- ParticipantDcaeParameters.class);
+ parameters = commonTestData.getParticipantDcaeParameters();
mockServer = ClientAndServer.startClientAndServer(parameters.getConsulClientParameters().getPort());
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandlerTest.java
new file mode 100644
index 000000000..ab181d476
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandlerTest.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.participant.dcae.main.handler;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+import org.json.JSONException;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
+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.participant.dcae.httpclient.ClampHttpClient;
+import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ConsulDcaeHttpClient;
+import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData;
+import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
+import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+/**
+ * Class to perform unit test of {@link ControlLoopElementHandler}.
+ *
+ */
+@ExtendWith(SpringExtension.class)
+class ControlLoopElementHandlerTest {
+
+ private static final String LOOP = "pmsh_loop";
+ private static final String TEMPLATE = "LOOP_TEMPLATE_k8s_pmsh";
+ private static final String BLUEPRINT_DEPLOYED = "BLUEPRINT_DEPLOYED";
+ private static final String MICROSERVICE_INSTALLED_SUCCESSFULLY = "MICROSERVICE_INSTALLED_SUCCESSFULLY";
+
+ public static final Coder CODER = new StandardCoder();
+ private CommonTestData commonTestData = new CommonTestData();
+
+ @Test
+ void test_ControlLoopElementStateChange() {
+ ClampHttpClient clampClient = spy(mock(ClampHttpClient.class));
+ ConsulDcaeHttpClient consulClient = mock(ConsulDcaeHttpClient.class);
+ ControlLoopElementHandler controlLoopElementHandler =
+ new ControlLoopElementHandler(clampClient, consulClient, commonTestData.getParticipantDcaeParameters());
+
+ when(clampClient.getstatus(eq(LOOP))).thenReturn(new Loop());
+
+ ParticipantIntermediaryApi intermediaryApi = mock(ParticipantIntermediaryApi.class);
+ controlLoopElementHandler.setIntermediaryApi(intermediaryApi);
+
+ controlLoopElementHandler.controlLoopElementStateChange(UUID.randomUUID(), ControlLoopState.PASSIVE,
+ ControlLoopOrderedState.UNINITIALISED);
+
+ verify(clampClient).undeploy(eq(LOOP));
+ }
+
+ @Test
+ void testCreate_ControlLoopElementUpdate() throws PfModelException, JSONException, CoderException {
+ ClampHttpClient clampClient = spy(mock(ClampHttpClient.class));
+ Loop loopDeployed = CODER.convert(CommonTestData.createJsonStatus(BLUEPRINT_DEPLOYED), Loop.class);
+ when(clampClient.create(eq(LOOP), eq(TEMPLATE))).thenReturn(loopDeployed);
+ when(clampClient.deploy(eq(LOOP))).thenReturn(true);
+
+ Loop loopInstalled =
+ CODER.convert(CommonTestData.createJsonStatus(MICROSERVICE_INSTALLED_SUCCESSFULLY), Loop.class);
+ when(clampClient.getstatus(eq(LOOP))).thenReturn(null, loopInstalled);
+
+ ConsulDcaeHttpClient consulClient = spy(mock(ConsulDcaeHttpClient.class));
+ when(consulClient.deploy(any(String.class), any(String.class))).thenReturn(true);
+
+ ControlLoopElementHandler controlLoopElementHandler =
+ new ControlLoopElementHandler(clampClient, consulClient, commonTestData.getParticipantDcaeParameters());
+
+ ParticipantIntermediaryApi intermediaryApi = mock(ParticipantIntermediaryApi.class);
+ controlLoopElementHandler.setIntermediaryApi(intermediaryApi);
+
+ ControlLoopElement element = new ControlLoopElement();
+ element.setId(UUID.randomUUID());
+ element.setOrderedState(ControlLoopOrderedState.PASSIVE);
+
+ final ToscaServiceTemplate controlLoopDefinition = new ToscaServiceTemplate();
+ controlLoopElementHandler.controlLoopElementUpdate(element, controlLoopDefinition);
+
+ verify(clampClient).create(eq(LOOP), eq(TEMPLATE));
+ verify(consulClient).deploy(any(String.class), any(String.class));
+ verify(clampClient).deploy(eq(LOOP));
+ }
+
+ @Test
+ void test_ControlLoopElementUpdate() throws PfModelException, JSONException, CoderException {
+ ClampHttpClient clampClient = spy(mock(ClampHttpClient.class));
+ Loop loopDeployed = CODER.convert(CommonTestData.createJsonStatus(BLUEPRINT_DEPLOYED), Loop.class);
+ Loop loopInstalled =
+ CODER.convert(CommonTestData.createJsonStatus(MICROSERVICE_INSTALLED_SUCCESSFULLY), Loop.class);
+ when(clampClient.getstatus(eq(LOOP))).thenReturn(loopDeployed, loopInstalled);
+ when(clampClient.deploy(eq(LOOP))).thenReturn(true);
+
+ ConsulDcaeHttpClient consulClient = spy(mock(ConsulDcaeHttpClient.class));
+ when(consulClient.deploy(any(String.class), any(String.class))).thenReturn(true);
+
+ ControlLoopElementHandler controlLoopElementHandler =
+ new ControlLoopElementHandler(clampClient, consulClient, commonTestData.getParticipantDcaeParameters());
+
+ ParticipantIntermediaryApi intermediaryApi = mock(ParticipantIntermediaryApi.class);
+ controlLoopElementHandler.setIntermediaryApi(intermediaryApi);
+
+ ControlLoopElement element = new ControlLoopElement();
+ element.setId(UUID.randomUUID());
+ element.setOrderedState(ControlLoopOrderedState.PASSIVE);
+
+ ToscaServiceTemplate controlLoopDefinition = new ToscaServiceTemplate();
+ controlLoopElementHandler.controlLoopElementUpdate(element, controlLoopDefinition);
+
+ verify(clampClient, times(0)).create(eq(LOOP), eq(TEMPLATE));
+ verify(consulClient).deploy(any(String.class), any(String.class));
+ verify(clampClient).deploy(eq(LOOP));
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java
index 5d8881eb3..4b6dcd619 100644
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java
@@ -31,7 +31,6 @@ import java.util.TreeMap;
import javax.ws.rs.core.Response;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -54,24 +53,19 @@ public class CommonTestData {
private static final boolean REST_CONSUL_HTTPS = false;
private static final boolean REST_CLIENT_AAF = false;
- public static final Coder coder = new StandardCoder();
+ public static final Coder CODER = new StandardCoder();
/**
- * Converts the contents of a map to a parameter class.
+ * Get ParticipantDcaeParameters.
*
- * @param <T> specific type of ParameterGroup class
- * @param source property map
- * @param clazz class of object to be created from the map
- * @return a new object represented by the map
- * @throws ControlLoopRuntimeException on errors
+ * @return ParticipantDcaeParameters
*/
- public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
+ public ParticipantDcaeParameters getParticipantDcaeParameters() {
try {
- return coder.convert(source, clazz);
-
+ return CODER.convert(getParticipantParameterGroupMap(PARTICIPANT_GROUP_NAME),
+ ParticipantDcaeParameters.class);
} catch (final CoderException e) {
- throw new ControlLoopRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
- "cannot create " + clazz.getName() + " from map", e);
+ throw new RuntimeException("cannot create ParticipantDcaeParameters from map", e);
}
}
@@ -86,10 +80,31 @@ public class CommonTestData {
final Map<String, Object> map = new TreeMap<>();
map.put("name", name);
+ map.put("checkCount", 10);
+ map.put("secCount", 10);
+ map.put("jsonBodyConsulPath", "src/main/resources/parameters/consul.json");
map.put("clampClientParameters", getClampClientParametersMap(false));
map.put("consulClientParameters", getConsulClientParametersMap(false));
map.put("intermediaryParameters", getIntermediaryParametersMap(false));
- map.put("databaseProviderParameters", getDatabaseProviderParametersMap(false));
+ map.put("clampClientEndPoints", getClampClientEndPoints());
+ map.put("consulClientEndPoints", getConsulClientEndPoints());
+ return map;
+ }
+
+ private Map<String, Object> getConsulClientEndPoints() {
+ final Map<String, Object> map = new TreeMap<>();
+ map.put("deploy", "/v1/kv/dcae-pmsh:");
+ return map;
+ }
+
+ private Map<String, Object> getClampClientEndPoints() {
+ final Map<String, Object> map = new TreeMap<>();
+ map.put("status", "/restservices/clds/v2/loop/getstatus/");
+ map.put("create", "/restservices/clds/v2/loop/create/%s?templateName=%s");
+ map.put("deploy", "/restservices/clds/v2/loop/deploy/");
+ map.put("stop", "/restservices/clds/v2/loop/stop/");
+ map.put("delete", "/restservices/clds/v2/loop/delete/");
+ map.put("undeploy", "/restservices/clds/v2/loop/undeploy/");
return map;
}
@@ -148,27 +163,6 @@ public class CommonTestData {
}
/**
- * Returns a property map for a databaseProviderParameters map for test cases.
- *
- * @param isEmpty boolean value to represent that object created should be empty or not
- * @return a property map suitable for constructing an object
- */
- public Map<String, Object> getDatabaseProviderParametersMap(final boolean isEmpty) {
- final Map<String, Object> map = new TreeMap<>();
- if (!isEmpty) {
- map.put("name", "PolicyProviderParameterGroup");
- map.put("implementation", "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl");
- map.put("databaseDriver", "org.h2.Driver");
- map.put("databaseUrl", "jdbc:h2:mem:testdb");
- map.put("databaseUser", "policy");
- map.put("databasePassword", "P01icY");
- map.put("persistenceUnit", "ToscaConceptTest");
- }
-
- return map;
- }
-
- /**
* Returns a property map for a intermediaryParameters map for test cases.
*
* @param isEmpty boolean value to represent that object created should be empty or not
@@ -229,58 +223,6 @@ public class CommonTestData {
}
/**
- * Gets the standard participant parameters.
- *
- * @param port port to be inserted into the parameters
- * @return the standard participant parameters
- * @throws ControlLoopRuntimeException on errors
- */
- public ParticipantDcaeParameters getParticipantParameterGroup(int port) {
- try {
- return coder.decode(getParticipantParameterGroupAsString(port), ParticipantDcaeParameters.class);
-
- } catch (CoderException e) {
- throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
- e);
- }
- }
-
- /**
- * Gets the standard participant parameters, as a String.
- *
- * @param port port to be inserted into the parameters
- * @return the standard participant parameters
- * @throws ControlLoopRuntimeException on errors
- */
- public static String getParticipantParameterGroupAsString(int port) {
-
- try {
- File file = new File(getParamFile());
- String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8);
-
- json = json.replace("${port}", String.valueOf(port));
- json = json.replace("${dbName}", "jdbc:h2:mem:testdb");
-
- return json;
-
- } catch (IOException e) {
- throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
- e);
-
- }
- }
-
- /**
- * Gets the full path to the parameter file, which may vary depending on whether or
- * not this is an end-to-end test.
- *
- * @return the parameter file name
- */
- private static String getParamFile() {
- return "src/test/resources/parameters/TestParametersStd.json";
- }
-
- /**
* Nulls out a field within a JSON string.
*
* @param json JSON string
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParametersTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParametersTest.java
new file mode 100644
index 000000000..b59cee756
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParametersTest.java
@@ -0,0 +1,163 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import javax.validation.Validation;
+import javax.validation.ValidatorFactory;
+import org.junit.jupiter.api.Test;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
+
+/**
+ * Class to perform unit test of {@link ParticipantDcaeParameters}.
+ * It will be tested the "javax.validation.constraints"
+ *
+ */
+class ParticipantDcaeParametersTest {
+ private CommonTestData commonTestData = new CommonTestData();
+ private ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
+
+ @Test
+ void testParticipantDcaeParameters() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isEmpty();
+ }
+
+ @Test
+ void testZeroCheckCount() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.setCheckCount(0);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientEndPoints() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.setClampClientEndPoints(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientEndPointCreate() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getClampClientEndPoints().setCreate(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientEndPointDelete() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getClampClientEndPoints().setDelete(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientEndPointDeploy() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getClampClientEndPoints().setDeploy(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientEndPointStatus() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getClampClientEndPoints().setStatus(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientEndPointStop() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getClampClientEndPoints().setStop(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientEndPointUndeploy() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getClampClientEndPoints().setUndeploy(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoClampClientParameters() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.setClampClientParameters(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoHostname() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getClampClientParameters().setHostname(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoTopicSinks() throws ControlLoopException {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+
+ ParticipantIntermediaryParameters intermediaryParameters = participantParameters.getIntermediaryParameters();
+ intermediaryParameters.getClampControlLoopTopics().setTopicSinks(null);
+
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoTopicSources() throws ControlLoopException {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+
+ ParticipantIntermediaryParameters intermediaryParameters = participantParameters.getIntermediaryParameters();
+ intermediaryParameters.getClampControlLoopTopics().setTopicSources(null);
+
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoConsulClientParameters() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.setConsulClientParameters(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoConsulHostname() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getConsulClientParameters().setHostname(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoIntermediaryParameters() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.setIntermediaryParameters(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+
+ @Test
+ void testNoParticipantId() {
+ final ParticipantDcaeParameters participantParameters = commonTestData.getParticipantDcaeParameters();
+ participantParameters.getIntermediaryParameters().setParticipantId(null);
+ assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty();
+ }
+}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java
deleted file mode 100644
index 2eb833204..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.junit.Assert.assertEquals;
-
-import java.io.FileNotFoundException;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException;
-import org.onap.policy.common.utils.coder.CoderException;
-
-
-/**
- * Class to perform unit test of {@link ParticipantParameterHandler}.
- *
- */
-class TestParticipantDcaeParameterHandler {
-
- @Test
- void testParameterHandlerNoParameterFile() throws ControlLoopException {
- final String path = "src/test/resources/parameters/NoParametersFile.json";
-
- assertThatThrownBy(() -> new ParticipantDcaeParameterHandler().toParticipantDcaeParameters(path))
- .hasCauseInstanceOf(CoderException.class)
- .hasRootCauseInstanceOf(FileNotFoundException.class);
- }
-
- @Test
- void testParameterHandlerInvalidParameters() throws ControlLoopException {
- final String path = "src/test/resources/parameters/InvalidParameters.json";
-
- assertThatThrownBy(() -> new ParticipantDcaeParameterHandler().toParticipantDcaeParameters(path))
- .hasMessageStartingWith("error reading parameters from")
- .hasCauseInstanceOf(CoderException.class);
- }
-
- @Test
- void testParticipantParameterGroup() throws ControlLoopException {
- final String path = "src/test/resources/parameters/TestParameters.json";
-
- final ParticipantDcaeParameters parGroup = new ParticipantDcaeParameterHandler()
- .toParticipantDcaeParameters(path);
- assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, parGroup.getName());
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java
deleted file mode 100644
index 2320ae07b..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map;
-import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
-import org.onap.policy.common.parameters.ValidationResult;
-
-/**
- * Class to perform unit test of {@link ParticipantParameterGroup}.
- *
- */
-class TestParticipantDcaeParameters {
- CommonTestData commonTestData = new CommonTestData();
-
- @Test
- void testParticipantParameterGroup_Named() {
- final ParticipantDcaeParameters participantParameters = new ParticipantDcaeParameters("my-name");
- assertEquals("my-name", participantParameters.getName());
- }
-
- @Test
- void testParticipantParameterGroup() {
- final ParticipantDcaeParameters participantParameters = commonTestData.toObject(
- commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME),
- ParticipantDcaeParameters.class);
- final ParticipantIntermediaryParameters participantIntermediaryParameters = participantParameters
- .getIntermediaryParameters();
- final TopicParameterGroup topicParameterGroup = participantParameters.getIntermediaryParameters()
- .getClampControlLoopTopics();
- final ValidationResult validationResult = participantParameters.validate();
- assertTrue(validationResult.isValid());
- assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, participantParameters.getName());
- assertEquals(CommonTestData.TIME_INTERVAL, participantIntermediaryParameters.getReportingTimeInterval());
- assertEquals(CommonTestData.DESCRIPTION, participantIntermediaryParameters.getDescription());
- assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSinks());
- assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSources());
- }
-
- @Test
- void testParticipantParameterGroup_EmptyParticipantIntermediaryParameters() {
- final Map<String, Object> map =
- commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME);
- map.replace("intermediaryParameters", commonTestData.getIntermediaryParametersMap(true));
- final ParticipantDcaeParameters participantParameters =
- commonTestData.toObject(map, ParticipantDcaeParameters.class);
- final ValidationResult validationResult = participantParameters.validate();
- assertNull(validationResult.getResult());
- }
-
- @Test
- void testParticipantParameterGroup_EmptyTopicParameters() {
- final Map<String, Object> map =
- commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME);
- final Map<String, Object> intermediaryParametersMap = commonTestData.getIntermediaryParametersMap(false);
- intermediaryParametersMap.put("clampControlLoopTopics", commonTestData.getTopicParametersMap(true));
- map.replace("intermediaryParameters", intermediaryParametersMap);
-
- final ParticipantDcaeParameters participantParameters =
- commonTestData.toObject(map, ParticipantDcaeParameters.class);
- final ValidationResult validationResult = participantParameters.validate();
- assertNull(validationResult.getResult());
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
index f414b7a10..0b2712b7a 100644
--- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java
@@ -34,7 +34,6 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Parti
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange;
-import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -49,7 +48,6 @@ public class TestListenerUtils {
private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
private static final Coder CODER = new StandardCoder();
private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml";
- static CommonTestData commonTestData = new CommonTestData();
/**
* Method to create a controlLoop from a yaml file.
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-dcae/src/test/resources/application_test.properties
new file mode 100644
index 000000000..d585dd3c9
--- /dev/null
+++ b/participant/participant-impl/participant-impl-dcae/src/test/resources/application_test.properties
@@ -0,0 +1,41 @@
+spring.security.user.name=healthcheck
+spring.security.user.password=zb!XztG34
+
+server.servlet.context-path=/onap/participantsim
+server.error.path=/error
+
+participant.name=ControlLoopParticipant Dcae Test
+participant.clampClientParameters.clientName=Clamp
+participant.clampClientParameters.hostname=0.0.0.0
+participant.clampClientParameters.port=8443
+participant.clampClientParameters.userName=admin
+participant.clampClientParameters.password=password
+participant.clampClientParameters.https=true
+participant.clampClientParameters.aaf=false
+participant.consulClientParameters.clientName=Consul
+participant.consulClientParameters.hostname=consul
+participant.consulClientParameters.port=31321
+participant.consulClientParameters.userName=admin
+participant.consulClientParameters.password=password
+participant.consulClientParameters.https=false
+participant.consulClientParameters.aaf=false
+participant.intermediaryParameters.name=Participant parameters
+participant.intermediaryParameters.reportingTimeInterval=120000
+participant.intermediaryParameters.description=Participant Description
+participant.intermediaryParameters.participantId.name=DCAEParticipant0
+participant.intermediaryParameters.participantId.version=1.0.0
+participant.intermediaryParameters.participantType.name=org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+participant.intermediaryParameters.participantType.version=2.3.4
+participant.intermediaryParameters.clampControlLoopTopics.name=ControlLoop Topics
+participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost
+participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000
+participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT
+participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost
+participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap
+participant.intermediaryParameters.clampControlLoopTopics.topicSinks[1].topic=POLICY-NOTIFICATION
+participant.intermediaryParameters.clampControlLoopTopics.topicSinks[1].servers[0]=localhost
+participant.intermediaryParameters.clampControlLoopTopics.topicSinks[1].topicCommInfrastructure=dmaap
+
+participant.checkCount=10
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json
deleted file mode 100644
index 1035ccb67..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "name": "
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json
deleted file mode 100644
index 1ee2955b9..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
- "name": "ControlLoopParticipantGroup",
- "restServerParameters": {
- "host": "0.0.0.0",
- "port": 6969,
- "userName": "healthcheck",
- "password": "zb!XztG34",
- "https": false,
- "aaf": false
- },
- "intermediaryParameters": {
- "name": "Participant parameters",
- "reportingTimeInterval": 120000,
- "description": "Participant Description",
- "participantId": {
- "name": "DCAEParticipant0",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "version": "2.3.4"
- },
- "clampControlLoopTopics": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.h2.Driver",
- "databaseUrl": "jdbc:h2:mem:testdb",
- "databaseUser": "policy",
- "databasePassword": "P01icY",
- "persistenceUnit": "ToscaConceptTest"
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json
deleted file mode 100644
index 7a73a41bf..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-} \ No newline at end of file
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json
deleted file mode 100644
index 580eea734..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "name": "ControlLoopParticipantGroup",
- "clampClientParameters": {
- "clientName": "Clamp",
- "hostname": "0.0.0.0",
- "port": 8443,
- "userName": "admin",
- "password": "password",
- "useHttps": true,
- "allowSelfSignedCerts": false
- },
- "consulClientParameters": {
- "clientName": "Consul",
- "hostname": "consul",
- "port": 31321,
- "userName": "admin",
- "password": "password",
- "useHttps": false
- },
- "intermediaryParameters": {
- "name": "Participant parameters",
- "reportingTimeInterval": 120000,
- "description": "Participant Description",
- "participantId": {
- "name": "DCAEParticipant0",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "version": "2.3.4"
- },
- "clampControlLoopTopics": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.h2.Driver",
- "databaseUrl": "jdbc:h2:mem:testdb",
- "databaseUser": "policy",
- "databasePassword": "P01icY",
- "persistenceUnit": "ToscaConceptTest"
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json
deleted file mode 100644
index 789fc7bbd..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json
+++ /dev/null
@@ -1,71 +0,0 @@
-{
- "name": "ControlLoopParticipantGroup",
- "clampClientParameters": {
- "name": "Clamp",
- "host": "0.0.0.0",
- "port": 8443,
- "userName": "admin",
- "password": "password",
- "https": true,
- "aaf": false
- },
- "consulClientParameters": {
- "name": "Clamp",
- "host": "consul",
- "port": 31321,
- "userName": "admin",
- "password": "password",
- "https": false,
- "aaf": false
- },
- "intermediaryParameters": {
- "name": "Participant parameters",
- "reportingTimeInterval": 120000,
- "description": "Participant Description",
- "participantId": {
- "name": "DCAEParticipant0",
- "version": "1.0.0"
- },
- "participantType": {
- "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant",
- "version": "2.3.4"
- },
- "clampControlLoopTopics": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.h2.Driver",
- "databaseUrl": "jdbc:h2:mem:testdb",
- "databaseUser": "policy",
- "databasePassword": "P01icY",
- "persistenceUnit": "ToscaConceptTest"
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json b/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json
deleted file mode 100644
index b918defe4..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
- "name": "ControlLoopRuntimeGroup",
- "restServerParameters": {
- "host": "0.0.0.0",
- "port": ${port},
- "userName": "healthcheck",
- "password": "zb!XztG34",
- "https": false,
- "aaf": false
- },
- "participantParameters": {
- "heartBeatMs": 120000,
- "updateParameters": {
- "maxRetryCount": 1,
- "maxWaitMs": 30000
- },
- "stateChangeParameters": {
- "maxRetryCount": 1,
- "maxWaitMs": 30000
- }
- },
- "databaseProviderParameters": {
- "name": "PolicyProviderParameterGroup",
- "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
- "databaseDriver": "org.h2.Driver",
- "databaseUrl": "${dbName}",
- "databaseUser": "policy",
- "databasePassword": "P01icY",
- "persistenceUnit": "ToscaConceptTest"
- },
- "topicParameterGroup": {
- "topicSources": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap",
- "fetchTimeout": 15000
- }
- ],
- "topicSinks": [
- {
- "topic": "POLICY-CLRUNTIME-PARTICIPANT",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- },
- {
- "topic": "POLICY-NOTIFICATION",
- "servers": [
- "localhost"
- ],
- "topicCommInfrastructure": "dmaap"
- }
- ]
- }
-}
-
-