summaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2021-06-20 19:39:39 +0000
committerGerrit Code Review <gerrit@onap.org>2021-06-20 19:39:39 +0000
commitf00ca4de37bbbf272e107dd89f4dbb901c787462 (patch)
tree419f19cfffa1a49e5a4be4b80d75cfc740c26cf0 /participant
parent18526e9a01fc0b0e085d2a6e3457957e6392ce27 (diff)
parent2d186df9e3ed47599dbc86c2f435f7884535398c (diff)
Merge "Clean up CLAMP Sonar and checkstyle issues"
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-impl/participant-impl-dcae/pom.xml19
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java6
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java12
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java2
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java3
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java3
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java10
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java12
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java19
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java18
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java1
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java5
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java19
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java3
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java17
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java1
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java111
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java94
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java2
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java13
-rw-r--r--participant/participant-intermediary/pom.xml1
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java9
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java58
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java25
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java11
27 files changed, 256 insertions, 222 deletions
diff --git a/participant/participant-impl/participant-impl-dcae/pom.xml b/participant/participant-impl/participant-impl-dcae/pom.xml
index 714f1551c..d59bca376 100644
--- a/participant/participant-impl/participant-impl-dcae/pom.xml
+++ b/participant/participant-impl/participant-impl-dcae/pom.xml
@@ -31,44 +31,32 @@
<artifactId>policy-clamp-participant-impl-dcae</artifactId>
<name>${project.artifactId}</name>
<description>DCAE participant, that allows DCAE to partake in control loops</description>
-
- <dependencyManagement>
- <dependencies>
- <!-- Spring Boot BOM -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${version.springboot}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
+ <version>${version.springboot}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
+ <version>${version.springboot}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
+ <version>${version.springboot}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
- <version>${version.mockserver}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-client-java</artifactId>
- <version>${version.mockserver}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -78,7 +66,6 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <version>${version.springboot}</version>
<executions>
<execution>
<goals>
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java
index 25edaf552..9be83bbd3 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java
@@ -30,8 +30,10 @@ import org.springframework.context.annotation.ComponentScan;
*
*/
@SpringBootApplication
-@ComponentScan({"org.onap.policy.clamp.controlloop.participant.dcae",
- "org.onap.policy.clamp.controlloop.participant.intermediary"})
+@ComponentScan({
+ "org.onap.policy.clamp.controlloop.participant.dcae",
+ "org.onap.policy.clamp.controlloop.participant.intermediary"
+})
@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.dcae.main.parameters")
public class DcaeParticipantApplication {
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java
index e23aaaf23..43326e725 100644
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java
+++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java
@@ -24,7 +24,6 @@ import java.io.Closeable;
import java.io.IOException;
import java.util.Collections;
import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
@@ -46,6 +45,9 @@ public abstract class AbstractHttpClient implements Closeable {
/**
* Constructor.
+ *
+ * @param restClientParameters the REST client parameters
+ * @throws ControlLoopRuntimeException on errors
*/
protected AbstractHttpClient(BusTopicParams restClientParameters) {
try {
@@ -58,7 +60,7 @@ public abstract class AbstractHttpClient implements Closeable {
protected boolean executePut(String path, String jsonEntity, int statusCode) {
try {
- Response response = httpclient.put(path, Entity.json(jsonEntity), Collections.emptyMap());
+ var response = httpclient.put(path, Entity.json(jsonEntity), Collections.emptyMap());
return response.getStatus() == statusCode;
} catch (Exception e) {
LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e);
@@ -68,7 +70,7 @@ public abstract class AbstractHttpClient implements Closeable {
protected boolean executePut(String path, int statusCode) {
try {
- Response response = httpclient.put(path, Entity.json(""), Collections.emptyMap());
+ var response = httpclient.put(path, Entity.json(""), Collections.emptyMap());
return response.getStatus() == statusCode;
} catch (Exception e) {
LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e);
@@ -78,7 +80,7 @@ public abstract class AbstractHttpClient implements Closeable {
protected Loop executePost(String path, int statusCode) {
try {
- Response response = httpclient.post(path, Entity.json(""), Collections.emptyMap());
+ var response = httpclient.post(path, Entity.json(""), Collections.emptyMap());
if (response.getStatus() != statusCode) {
return null;
}
@@ -91,7 +93,7 @@ public abstract class AbstractHttpClient implements Closeable {
protected Loop executeGet(String path, int statusCode) {
try {
- Response response = httpclient.get(path);
+ var response = httpclient.get(path);
if (response.getStatus() != statusCode) {
return null;
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 e928c138f..fd19d9d3a 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
@@ -40,6 +40,8 @@ public class ClampHttpClient extends AbstractHttpClient {
/**
* Constructor.
+ *
+ * @param parameters the DCAE parameters
*/
public ClampHttpClient(ParticipantDcaeParameters parameters) {
super(parameters.getClampClientParameters());
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 4f76e3025..154dd09be 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
@@ -31,6 +31,8 @@ public class ConsulDcaeHttpClient extends AbstractHttpClient {
/**
* Constructor.
+ *
+ * @param parameters the DCAE parameters
*/
public ConsulDcaeHttpClient(ParticipantDcaeParameters parameters) {
super(parameters.getConsulClientParameters());
@@ -39,6 +41,7 @@ public class ConsulDcaeHttpClient extends AbstractHttpClient {
/**
* Call consult.
*
+ * @param name the name to deploy
* @param jsonEntity the Entity
* @return true
*/
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 76ed1122c..6c5ff1d78 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
@@ -74,6 +74,9 @@ public class ControlLoopElementHandler implements ControlLoopElementListener {
/**
* Constructor.
+ *
+ * @param clampClient the CLAMP client
+ * @param consulClient the Consul client
*/
public ControlLoopElementHandler(ClampHttpClient clampClient, ConsulDcaeHttpClient consulClient) {
this.clampClient = clampClient;
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 cb06fcb15..5d8881eb3 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
@@ -59,16 +59,19 @@ public class CommonTestData {
/**
* Converts the contents of a map to a parameter class.
*
+ * @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
*/
public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
try {
return coder.convert(source, clazz);
} catch (final CoderException e) {
- throw new RuntimeException("cannot create " + clazz.getName() + " from map", e);
+ throw new ControlLoopRuntimeException(Response.Status.INTERNAL_SERVER_ERROR,
+ "cannot create " + clazz.getName() + " from map", e);
}
}
@@ -95,6 +98,7 @@ public class CommonTestData {
*
* @param isEmpty boolean value to represent that object created should be empty or not
* @return a property map suitable for constructing an object
+ * @throws ControlLoopRuntimeException on errors
*/
public Map<String, Object> getClampClientParametersMap(final boolean isEmpty) {
final Map<String, Object> map = new TreeMap<>();
@@ -121,6 +125,7 @@ public class CommonTestData {
*
* @param isEmpty boolean value to represent that object created should be empty or not
* @return a property map suitable for constructing an object
+ * @throws ControlLoopRuntimeException on errors
*/
public Map<String, Object> getConsulClientParametersMap(final boolean isEmpty) {
final Map<String, Object> map = new TreeMap<>();
@@ -228,6 +233,7 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on errors
*/
public ParticipantDcaeParameters getParticipantParameterGroup(int port) {
try {
@@ -244,6 +250,7 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on errors
*/
public static String getParticipantParameterGroupAsString(int port) {
@@ -289,6 +296,7 @@ public class CommonTestData {
*
* @param status the status of Partecipant
* @return the JSON
+ * @throws ControlLoopRuntimeException on errors
*/
public static String createJsonStatus(String status) {
try {
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java
index 427b06fc5..5560e47a8 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/controller/ChartController.java
@@ -74,7 +74,8 @@ public class ChartController {
*
* @param info Info of the chart to be installed
* @return Status of the install operation
- * @throws ServiceException incase of error
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO error
*/
@PostMapping(path = "/install", consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
@@ -97,7 +98,7 @@ public class ChartController {
* @param name name of the chart
* @param version version of the chart
* @return Status of operation
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
@DeleteMapping(path = "/uninstall/{name}/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Uninstall the Chart")
@@ -118,9 +119,10 @@ public class ChartController {
*
* @param chartFile Multipart file for the helm chart
* @param infoJson AppInfo of the chart
+ * @param overrideFile the file for overriding the chart
* @return Status of onboard operation
- * @throws ServiceException incase of error
- * @throws IOException incase of IO error
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO error
*/
@PostMapping(path = "/charts", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
@@ -147,7 +149,7 @@ public class ChartController {
* @param name name of the chart
* @param version version of the chart
* @return Status of operation
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
@DeleteMapping(path = "/charts/{name}/{version}")
@ApiOperation(value = "Delete the chart")
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
index 1b7599ce9..343a44617 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java
@@ -46,7 +46,6 @@ public class HelmClient {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
/**
* Install a chart.
*
@@ -70,7 +69,9 @@ public class HelmClient {
* Finds helm chart repository for the chart.
*
* @param chart ChartInfo.
- * @throws ServiceException incase of error
+ * @return the chart repository as a string
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO errors
*/
public String findChartRepository(ChartInfo chart) throws ServiceException, IOException {
updateHelmRepo();
@@ -127,8 +128,8 @@ public class HelmClient {
return output;
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
- throw new ServiceException(
- "Failed to execute the Command: " + commandStr + ", the command was interrupted", ie);
+ throw new ServiceException("Failed to execute the Command: " + commandStr + ", the command was interrupted",
+ ie);
} catch (Exception exc) {
throw new ServiceException("Failed to execute the Command: " + commandStr, exc);
}
@@ -139,12 +140,12 @@ public class HelmClient {
// @formatter:off
List<String> helmArguments = new ArrayList<>(
Arrays.asList(
- "helm",
- "install", chart.getReleaseName(), chart.getRepository() + "/" + chart.getChartName(),
- "--version", chart.getVersion(),
- "--namespace", chart.getNamespace()
+ "helm",
+ "install", chart.getReleaseName(), chart.getRepository() + "/" + chart.getChartName(),
+ "--version", chart.getVersion(),
+ "--namespace", chart.getNamespace()
)
- );
+ );
// @formatter:on
// Verify if values.yaml available for the chart
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
index 6accac339..29a49a9ff 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartService.java
@@ -53,7 +53,7 @@ public class ChartService {
* @param name name of the app
* @param version version of the app
* @return chart
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
public ChartInfo getChart(String name, String version) throws ServiceException {
return chartStore.getChart(name, version);
@@ -63,12 +63,13 @@ public class ChartService {
* Save a helm chart.
* @param chartInfo name and version of the app.
* @param chartFile Helm chart file
+ * @param overrideFile override file
* @return chart details of the helm chart
- * @throws IOException incase of IO error
- * @throws ServiceException incase of error
+ * @throws IOException in case of IO error
+ * @throws ServiceException in case of error
*/
public ChartInfo saveChart(ChartInfo chartInfo, MultipartFile chartFile, MultipartFile overrideFile)
- throws IOException, ServiceException {
+ throws IOException, ServiceException {
return chartStore.saveChart(chartInfo, chartFile, overrideFile);
}
@@ -83,7 +84,8 @@ public class ChartService {
/**
* Install a helm chart.
* @param chart name and version.
- * @throws ServiceException incase of error
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO errors
*/
public void installChart(ChartInfo chart) throws ServiceException, IOException {
if (chart.getRepository() == null) {
@@ -102,7 +104,9 @@ public class ChartService {
/**
* Finds helm chart repository for a given chart.
* @param chart chartInfo.
- * @throws ServiceException incase of error
+ * @return the chart repo as a string
+ * @throws ServiceException in case of error
+ * @throws IOException in case of IO errors
*/
public String findChartRepo(ChartInfo chart) throws ServiceException, IOException {
logger.info("Fetching helm chart repository for the given chart {} ", chart.getChartName());
@@ -112,7 +116,7 @@ public class ChartService {
/**
* Uninstall a helm chart.
* @param chart name and version
- * @throws ServiceException incase of error.
+ * @throws ServiceException in case of error.
*/
public void uninstallChart(ChartInfo chart) throws ServiceException {
logger.info("Uninstalling helm deployment {}", chart.getReleaseName());
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java
index 041c0c810..e7458a4cd 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java
@@ -94,6 +94,7 @@ public class ChartStore {
*
* @param chartInfo chartInfo
* @param chartFile helm chart file.
+ * @param overrideFile override file.
* @return chart
* @throws IOException incase of IO error
* @throws ServiceException incase of error.
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java
index bdc09c8b9..4869b7c2f 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java
@@ -30,8 +30,9 @@ import org.springframework.context.annotation.ComponentScan;
*
*/
@SpringBootApplication
-@ComponentScan({"org.onap.policy.clamp.controlloop.participant.policy",
- "org.onap.policy.clamp.controlloop.participant.intermediary"})
+@ComponentScan({
+ "org.onap.policy.clamp.controlloop.participant.policy",
+ "org.onap.policy.clamp.controlloop.participant.intermediary"})
@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.policy.main.parameters")
public class PolicyParticipantApplication {
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java
index 4b6686156..2579585e5 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java
@@ -41,25 +41,26 @@ public abstract class AbstractHttpClient implements Closeable {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractHttpClient.class);
private final HttpClient httpclient;
-
/**
* Constructor.
+ *
+ * @param policyParticipantParameters the parameters for the policy participant
+ * @throws ControlLoopRuntimeException on client start errors
*/
- protected AbstractHttpClient(BusTopicParams policyApiParameters) {
+ protected AbstractHttpClient(BusTopicParams policyParticipantParameters) {
try {
- httpclient = HttpClientFactoryInstance.getClientFactory().build(policyApiParameters);
+ httpclient = HttpClientFactoryInstance.getClientFactory().build(policyParticipantParameters);
} catch (final Exception e) {
throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, " Client failed to start", e);
}
}
protected Response executePost(String path, final Entity<?> entity) {
- Response response = httpclient.post(path, entity, Map.of(HttpHeaders.ACCEPT,
- MediaType.APPLICATION_JSON, HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON));
+ var response = httpclient.post(path, entity, Map.of(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON,
+ HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON));
if (response.getStatus() / 100 != 2) {
- LOGGER.error(
- "Invocation of path {} failed for entity {}. Response status: {}, Response status info: {}",
- path, entity, response.getStatus(), response.getStatusInfo());
+ LOGGER.error("Invocation of path {} failed for entity {}. Response status: {}, Response status info: {}",
+ path, entity, response.getStatus(), response.getStatusInfo());
}
return response;
}
@@ -72,4 +73,4 @@ public abstract class AbstractHttpClient implements Closeable {
public void close() throws IOException {
httpclient.shutdown();
}
-} \ No newline at end of file
+}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java
index 3d1047ce4..38a79f7f6 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java
@@ -35,6 +35,8 @@ public class PolicyApiHttpClient extends AbstractHttpClient {
/**
* Constructor.
+ *
+ * @param parameters the policy participant parameters
*/
public PolicyApiHttpClient(ParticipantPolicyParameters parameters) {
super(parameters.getPolicyApiParameters());
@@ -45,6 +47,7 @@ public class PolicyApiHttpClient extends AbstractHttpClient {
*
* @param toscaServiceTemplate the whole ToscaServiceTemplate
* @return Response
+ * @throws PfModelException on errors creating the policy type
*/
public Response createPolicyType(ToscaServiceTemplate toscaServiceTemplate) throws PfModelException {
return executePost(POLICY_URI + "policytypes", Entity.entity(toscaServiceTemplate, MediaType.APPLICATION_JSON));
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 e3d7e3aa5..1acc2c838 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
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.parameters.ParameterGroup;
@@ -51,15 +52,18 @@ public class CommonTestData {
/**
* Converts the contents of a map to a parameter class.
*
+ * @param <T> the type of ParameterGroup to process
* @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 decoding errors
*/
public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
try {
return coder.convert(source, clazz);
} catch (final CoderException e) {
- throw new RuntimeException("cannot create " + clazz.getName() + " from map", e);
+ throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE,
+ "cannot create " + clazz.getName() + " from map", e);
}
}
@@ -163,14 +167,15 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on parameter read errors
*/
public ParticipantPolicyParameters getParticipantPolicyParameters(int port) {
try {
return coder.decode(getParticipantPolicyParametersAsString(port), ParticipantPolicyParameters.class);
} catch (CoderException e) {
- throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
- "cannot read participant parameters", e);
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
+ e);
}
}
@@ -179,6 +184,7 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on parameter read errors
*/
public static String getParticipantPolicyParametersAsString(int port) {
@@ -192,8 +198,8 @@ public class CommonTestData {
return json;
} catch (IOException e) {
- throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE,
- "cannot read participant parameters", e);
+ throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
+ e);
}
}
@@ -211,6 +217,7 @@ public class CommonTestData {
/**
* Nulls out a field within a JSON string.
+ *
* @param json JSON string
* @param field field to be nulled out
* @return a new JSON string with the field nulled out
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java
index b872ec0c6..5a6dbfa81 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/AbstractRestController.java
@@ -92,6 +92,8 @@ public abstract class AbstractRestController {
/**
* create a Rest Controller.
+ *
+ * @param simulationProvider the provider for the simulation participant
*/
protected AbstractRestController(SimulationProvider simulationProvider) {
this.simulationProvider = simulationProvider;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java
index 6ee4eac3e..49338c2b0 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java
@@ -41,6 +41,7 @@ public class SimulationProvider {
/**
* Create a participant simulation provider.
+ * @param intermediaryApi the intermediary to use for talking to the CLAMP runtime
*/
public SimulationProvider(ParticipantIntermediaryApi intermediaryApi) {
this.intermediaryApi = intermediaryApi;
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java
index de2a06223..e0569cf0f 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java
@@ -68,40 +68,42 @@ public class SimulationElementController extends AbstractRestController {
*/
// @formatter:off
@GetMapping("/elements/{name}/{version}")
- @ApiOperation(value = "Query details of the requested simulated control loop elements",
- notes = "Queries details of the requested simulated control loop elements, "
- + "returning all control loop element details",
- response = ControlLoops.class,
- tags = {
- "Clamp Control Loop Participant Simulator API"
- },
- authorizations = @Authorization(value = AUTHORIZATION_TYPE),
- responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)},
- extensions = {
- @Extension(
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
- }
+ @ApiOperation(
+ value = "Query details of the requested simulated control loop elements",
+ notes = "Queries details of the requested simulated control loop elements, "
+ + "returning all control loop element details",
+ response = ControlLoops.class,
+ tags = {
+ "Clamp Control Loop Participant Simulator API"
+ },
+ authorizations = @Authorization(value = AUTHORIZATION_TYPE),
+ responseHeaders = {
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)},
+ extensions = {
+ @Extension
+ (
+ name = EXTENSION_NAME,
+ properties = {
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
+ @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
+ }
+ )
+ }
)
@ApiResponses(
- value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
- }
+ value = {
+ @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
+ @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
+ @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
+ }
)
// @formatter:on
public ResponseEntity<Map<UUID, ControlLoopElement>> elements(
@@ -134,31 +136,32 @@ public class SimulationElementController extends AbstractRestController {
},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME,
- description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_PATCH_NAME,
- description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_LATEST_NAME,
- description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = REQUEST_ID_NAME,
- description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)
- },
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME,
+ description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_PATCH_NAME,
+ description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_LATEST_NAME,
+ description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = REQUEST_ID_NAME,
+ description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)
+ },
extensions = {
- @Extension(
- name = EXTENSION_NAME,
- properties = {
+ @Extension
+ (
+ name = EXTENSION_NAME,
+ properties = {
@ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
@ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
+ }
+ )
}
)
@ApiResponses(
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java
index 715ec3410..25ae4ac22 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationParticipantController.java
@@ -76,39 +76,38 @@ public class SimulationParticipantController extends AbstractRestController {
},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME, description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_PATCH_NAME, description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = VERSION_LATEST_NAME, description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(name = REQUEST_ID_NAME, description = REQUEST_ID_HDR_DESCRIPTION,
response = UUID.class)},
extensions = {
- @Extension(
- name = EXTENSION_NAME,
- properties = {
- @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
- @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
+ @Extension
+ (
+ name = EXTENSION_NAME,
+ properties = {
+ @ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
+ @ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
+ }
)
}
)
@ApiResponses(
value = {
- @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
+ @ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
+ @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
+ @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)
}
)
// @formatter:on
public ResponseEntity<List<Participant>> participants(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Participant name", required = true) @PathVariable("name") String name,
- @ApiParam(value = "Participant version", required = true) @PathVariable("version") String version) {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Participant name", required = true) @PathVariable("name") String name,
+ @ApiParam(value = "Participant version", required = true) @PathVariable("version") String version) {
return ResponseEntity.ok().body(getSimulationProvider().getParticipants(name, version));
}
@@ -131,31 +130,32 @@ public class SimulationParticipantController extends AbstractRestController {
},
authorizations = @Authorization(value = AUTHORIZATION_TYPE),
responseHeaders = {
- @ResponseHeader(
- name = VERSION_MINOR_NAME,
- description = VERSION_MINOR_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_PATCH_NAME,
- description = VERSION_PATCH_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = VERSION_LATEST_NAME,
- description = VERSION_LATEST_DESCRIPTION,
- response = String.class),
- @ResponseHeader(
- name = REQUEST_ID_NAME,
- description = REQUEST_ID_HDR_DESCRIPTION,
- response = UUID.class)
- },
+ @ResponseHeader(
+ name = VERSION_MINOR_NAME,
+ description = VERSION_MINOR_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_PATCH_NAME,
+ description = VERSION_PATCH_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = VERSION_LATEST_NAME,
+ description = VERSION_LATEST_DESCRIPTION,
+ response = String.class),
+ @ResponseHeader(
+ name = REQUEST_ID_NAME,
+ description = REQUEST_ID_HDR_DESCRIPTION,
+ response = UUID.class)
+ },
extensions = {
- @Extension(
- name = EXTENSION_NAME,
- properties = {
+ @Extension
+ (
+ name = EXTENSION_NAME,
+ properties = {
@ExtensionProperty(name = API_VERSION_NAME, value = API_VERSION),
@ExtensionProperty(name = LAST_MOD_NAME, value = LAST_MOD_RELEASE)
- }
- )
+ }
+ )
}
)
@ApiResponses(
@@ -167,10 +167,8 @@ public class SimulationParticipantController extends AbstractRestController {
)
// @formatter:on
public ResponseEntity<TypedSimpleResponse<Participant>> update(
- @RequestHeader(
- name = REQUEST_ID_NAME,
- required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "Body of a participant", required = true) @RequestBody Participant body) {
+ @RequestHeader(name = REQUEST_ID_NAME, required = false) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "Body of a participant", required = true) @RequestBody Participant body) {
return ResponseEntity.ok().body(getSimulationProvider().updateParticipant(body));
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java
index 832399660..46495f7c3 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/endtoend/ParticipantSimulatorTest.java
@@ -234,7 +234,7 @@ class ParticipantSimulatorTest {
String.class, uuid);
checkResponseEntity(response, 200, uuid);
- Map returnValue = coder.decode(response.getBody(), Map.class);
+ Map<?, ?> returnValue = coder.decode(response.getBody(), Map.class);
// Verify the result of GET controlloop elements with what is stored
assertThat(returnValue).isEmpty();
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java
index 8ca139bcd..2c9b1ccd2 100644
--- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/CommonTestData.java
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.parameters.ParameterGroup;
@@ -57,15 +58,18 @@ public class CommonTestData {
/**
* Converts the contents of a map to a parameter class.
*
+ * @param <T> the specific parameter group type to convert
* @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 parameter parsing errors
*/
public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
try {
return coder.convert(source, clazz);
} catch (final CoderException e) {
- throw new RuntimeException("cannot create " + clazz.getName() + " from map", e);
+ throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE,
+ "cannot create " + clazz.getName() + " from map", e);
}
}
@@ -191,14 +195,14 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on parameter read errors
*/
public ParticipantSimulatorParameters getParticipantParameterGroup(int port) {
try {
return coder.decode(getParticipantParameterGroupAsString(port), ParticipantSimulatorParameters.class);
} catch (CoderException e) {
- throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
- e);
+ throw new ControlLoopRuntimeException(Status.NOT_ACCEPTABLE, "cannot read participant parameters", e);
}
}
@@ -207,6 +211,7 @@ public class CommonTestData {
*
* @param port port to be inserted into the parameters
* @return the standard participant parameters
+ * @throws ControlLoopRuntimeException on parameter read errors
*/
public static String getParticipantParameterGroupAsString(int port) {
@@ -221,7 +226,7 @@ public class CommonTestData {
} catch (IOException e) {
throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters",
- e);
+ e);
}
}
diff --git a/participant/participant-intermediary/pom.xml b/participant/participant-intermediary/pom.xml
index df354d46c..aac80a4a2 100644
--- a/participant/participant-intermediary/pom.xml
+++ b/participant/participant-intermediary/pom.xml
@@ -28,7 +28,6 @@
<version>6.1.2-SNAPSHOT</version>
</parent>
- <groupId>org.onap.policy.clamp.participant</groupId>
<artifactId>policy-clamp-participant-intermediary</artifactId>
<name>${project.artifactId}</name>
<description>Common intermediary library for managing DMaaP participant messaging and holding participant and control
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
index d31ae1082..adc9c2393 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
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;
@@ -134,6 +133,7 @@ public interface ParticipantIntermediaryApi {
* if participantHandler is not returned, there is no way to test state change messages
* without dmaap simulator.
*
+ * @return the participant handler
*/
ParticipantHandler getParticipantHandler();
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
index 3128f1eaa..6926bc30b 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.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.ParticipantResponseStatus;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusPublisher;
import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -72,7 +71,7 @@ public class MessageSender extends TimerTask implements Closeable {
public void run() {
LOGGER.debug("Sent heartbeat to CLAMP");
- ParticipantResponseDetails response = new ParticipantResponseDetails();
+ var response = new ParticipantResponseDetails();
response.setResponseTo(null);
response.setResponseStatus(ParticipantResponseStatus.PERIODIC);
@@ -100,7 +99,7 @@ public class MessageSender extends TimerTask implements Closeable {
* @param response the details to include in the response message
*/
public void sendResponse(ToscaConceptIdentifier controlLoopId, ParticipantResponseDetails response) {
- ParticipantStatus status = new ParticipantStatus();
+ var status = new ParticipantStatus();
// Participant related fields
status.setParticipantType(participantHandler.getParticipantType());
@@ -109,12 +108,12 @@ public class MessageSender extends TimerTask implements Closeable {
status.setHealthStatus(participantHandler.getHealthStatus());
// Control loop related fields
- ControlLoops controlLoops = participantHandler.getControlLoopHandler().getControlLoops();
+ var controlLoops = participantHandler.getControlLoopHandler().getControlLoops();
status.setControlLoopId(controlLoopId);
status.setControlLoops(controlLoops);
status.setResponse(response);
- ParticipantStatistics participantStatistics = new ParticipantStatistics();
+ var participantStatistics = new ParticipantStatistics();
participantStatistics.setTimeStamp(Instant.now());
participantStatistics.setParticipantId(participantHandler.getParticipantId());
participantStatistics.setHealthStatus(participantHandler.getHealthStatus());
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
index cc2a66b58..18ee29f08 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
@@ -49,6 +50,7 @@ import org.slf4j.LoggerFactory;
/*
* This class is responsible for managing the state of all control loops in the participant.
*/
+@NoArgsConstructor
public class ControlLoopHandler implements Closeable {
private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopHandler.class);
@@ -63,8 +65,6 @@ public class ControlLoopHandler implements Closeable {
@Getter
private List<ControlLoopElementListener> listeners = new ArrayList<>();
- public ControlLoopHandler() {}
-
/**
* Constructor, set the participant ID and messageSender.
*
@@ -85,7 +85,7 @@ public class ControlLoopHandler implements Closeable {
public void registerControlLoopElementListener(ControlLoopElementListener listener) {
listeners.add(listener);
}
-
+
/**
* Handle a control loop element state change message.
*
@@ -95,7 +95,7 @@ public class ControlLoopHandler implements Closeable {
* @return controlLoopElement the updated controlloop element
*/
public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState orderedState,
- ControlLoopState newState) {
+ ControlLoopState newState) {
if (id == null) {
return null;
@@ -106,7 +106,7 @@ public class ControlLoopHandler implements Closeable {
clElement.setOrderedState(orderedState);
clElement.setState(newState);
LOGGER.debug("Control loop element {} state changed to {}", id, newState);
- ParticipantResponseDetails response = new ParticipantResponseDetails();
+ var response = new ParticipantResponseDetails();
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
response.setResponseMessage("ControlLoopElement state changed to {} " + newState);
messageSender.sendResponse(response);
@@ -141,14 +141,14 @@ public class ControlLoopHandler implements Closeable {
return;
}
- ControlLoop controlLoop = controlLoopMap.get(stateChangeMsg.getControlLoopId());
+ var controlLoop = controlLoopMap.get(stateChangeMsg.getControlLoopId());
if (controlLoop == null) {
LOGGER.debug("Control loop {} does not use this participant", stateChangeMsg.getControlLoopId());
return;
}
- ParticipantResponseDetails response = new ParticipantResponseDetails(stateChangeMsg);
+ var response = new ParticipantResponseDetails(stateChangeMsg);
handleState(controlLoop, response, stateChangeMsg.getOrderedState());
messageSender.sendResponse(response);
}
@@ -161,7 +161,7 @@ public class ControlLoopHandler implements Closeable {
* @param orderedState controlloop ordered state
*/
private void handleState(final ControlLoop controlLoop, final ParticipantResponseDetails response,
- ControlLoopOrderedState orderedState) {
+ ControlLoopOrderedState orderedState) {
switch (orderedState) {
case UNINITIALISED:
handleUninitialisedState(controlLoop, orderedState, response);
@@ -189,16 +189,16 @@ public class ControlLoopHandler implements Closeable {
return;
}
- ControlLoop controlLoop = controlLoopMap.get(updateMsg.getControlLoopId());
+ var controlLoop = controlLoopMap.get(updateMsg.getControlLoopId());
- ParticipantResponseDetails response = new ParticipantResponseDetails(updateMsg);
+ var response = new ParticipantResponseDetails(updateMsg);
// TODO: Updates to existing ControlLoops are not supported yet (Addition/Removal of ControlLoop
// elements to existing ControlLoop has to be supported).
if (controlLoop != null) {
response.setResponseStatus(ParticipantResponseStatus.FAIL);
- response.setResponseMessage("Control loop " + updateMsg.getControlLoopId()
- + " already defined on participant " + participantId);
+ response.setResponseMessage(
+ "Control loop " + updateMsg.getControlLoopId() + " already defined on participant " + participantId);
messageSender.sendResponse(response);
return;
@@ -226,7 +226,7 @@ public class ControlLoopHandler implements Closeable {
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
response.setResponseMessage(
- "Control loop " + updateMsg.getControlLoopId() + " defined on participant " + participantId);
+ "Control loop " + updateMsg.getControlLoopId() + " defined on participant " + participantId);
messageSender.sendResponse(response);
}
@@ -239,15 +239,14 @@ public class ControlLoopHandler implements Closeable {
* @param response participant response
*/
private void handleUninitialisedState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- final ParticipantResponseDetails response) {
+ final ParticipantResponseDetails response) {
handleStateChange(controlLoop, orderedState, ControlLoopState.UNINITIALISED, response);
controlLoopMap.remove(controlLoop.getKey().asIdentifier());
for (ControlLoopElementListener clElementListener : listeners) {
try {
for (ControlLoopElement element : controlLoop.getElements().values()) {
- clElementListener.controlLoopElementStateChange(element.getId(), element.getState(),
- orderedState);
+ clElementListener.controlLoopElementStateChange(element.getId(), element.getState(), orderedState);
}
} catch (PfModelException e) {
LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition());
@@ -263,7 +262,7 @@ public class ControlLoopHandler implements Closeable {
* @param response participant response
*/
private void handlePassiveState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- final ParticipantResponseDetails response) {
+ final ParticipantResponseDetails response) {
handleStateChange(controlLoop, orderedState, ControlLoopState.PASSIVE, response);
}
@@ -275,19 +274,20 @@ public class ControlLoopHandler implements Closeable {
* @param response participant response
*/
private void handleRunningState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- final ParticipantResponseDetails response) {
+ final ParticipantResponseDetails response) {
handleStateChange(controlLoop, orderedState, ControlLoopState.RUNNING, response);
}
-
+
/**
* Method to update the state of control loop elements.
*
* @param controlLoop participant status in memory
- * @param orderedState orderedState
- * @param state new state of the control loop elements
+ * @param orderedState orderedState the new ordered state the participant should have
+ * @param newState new state of the control loop elements
+ * @param response the response to the state change request
*/
private void handleStateChange(ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- ControlLoopState newState, ParticipantResponseDetails response) {
+ ControlLoopState newState, ParticipantResponseDetails response) {
if (orderedState.equals(controlLoop.getOrderedState())) {
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
@@ -297,26 +297,24 @@ public class ControlLoopHandler implements Closeable {
if (!CollectionUtils.isEmpty(controlLoop.getElements().values())) {
controlLoop.getElements().values().forEach(element -> {
- element.setState(newState);
- element.setOrderedState(orderedState);
- }
- );
+ element.setState(newState);
+ element.setOrderedState(orderedState);
+ });
}
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
- response.setResponseMessage("ControlLoop state changed from " + controlLoop.getOrderedState()
- + " to " + orderedState);
+ response.setResponseMessage(
+ "ControlLoop state changed from " + controlLoop.getOrderedState() + " to " + orderedState);
controlLoop.setOrderedState(orderedState);
}
-
/**
* Get control loops as a {@link ConrolLoops} class.
*
* @return the control loops
*/
public ControlLoops getControlLoops() {
- ControlLoops controlLoops = new ControlLoops();
+ var controlLoops = new ControlLoops();
controlLoops.setControlLoopList(new ArrayList<>(controlLoopMap.values()));
return controlLoops;
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java
index be2fa1a30..3eae27267 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import javax.ws.rs.core.Response.Status;
import lombok.Getter;
-import lombok.experimental.Delegate;
import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate;
@@ -70,21 +69,22 @@ public class IntermediaryActivator extends ServiceManagerContainer {
* Instantiate the activator for participant.
*
* @param parameters the parameters for the participant intermediary
+ * @throws ControlLoopRuntimeException when the activation fails
*/
public IntermediaryActivator(final ParticipantIntermediaryParameters parameters) {
this.parameters = parameters;
topicSinks =
- TopicEndpointManager.getManager().addTopicSinks(parameters.getClampControlLoopTopics().getTopicSinks());
+ TopicEndpointManager.getManager().addTopicSinks(parameters.getClampControlLoopTopics().getTopicSinks());
- topicSources = TopicEndpointManager.getManager()
- .addTopicSources(parameters.getClampControlLoopTopics().getTopicSources());
+ topicSources =
+ TopicEndpointManager.getManager().addTopicSources(parameters.getClampControlLoopTopics().getTopicSources());
try {
this.msgDispatcher = new MessageTypeDispatcher(MSG_TYPE_NAMES);
} catch (final RuntimeException e) {
throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR,
- "topic message dispatcher failed to start", e);
+ "topic message dispatcher failed to start", e);
}
// @formatter:off
@@ -131,17 +131,14 @@ public class IntermediaryActivator extends ServiceManagerContainer {
*/
private void registerMsgDispatcher() {
msgDispatcher.register(ParticipantMessageType.PARTICIPANT_STATE_CHANGE.name(),
- (ScoListener<ParticipantStateChange>) new ParticipantStateChangeListener(
- participantHandler.get()));
+ (ScoListener<ParticipantStateChange>) new ParticipantStateChangeListener(participantHandler.get()));
msgDispatcher.register(ParticipantMessageType.PARTICIPANT_HEALTH_CHECK.name(),
- (ScoListener<ParticipantHealthCheck>) new ParticipantHealthCheckListener(
- participantHandler.get()));
+ (ScoListener<ParticipantHealthCheck>) new ParticipantHealthCheckListener(participantHandler.get()));
msgDispatcher.register(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_STATE_CHANGE.name(),
- (ScoListener<ParticipantControlLoopStateChange>) new ControlLoopStateChangeListener(
- participantHandler.get()));
+ (ScoListener<ParticipantControlLoopStateChange>) new ControlLoopStateChangeListener(
+ participantHandler.get()));
msgDispatcher.register(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_UPDATE.name(),
- (ScoListener<ParticipantControlLoopUpdate>) new ControlLoopUpdateListener(
- participantHandler.get()));
+ (ScoListener<ParticipantControlLoopUpdate>) new ControlLoopUpdateListener(participantHandler.get()));
for (final TopicSource source : topicSources) {
source.register(msgDispatcher);
}
@@ -158,6 +155,8 @@ public class IntermediaryActivator extends ServiceManagerContainer {
/**
* Return the participant handler.
+ *
+ * @return the participant handler
*/
public ParticipantHandler getParticipantHandler() {
return participantHandler.get();
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
index 980ab6ec1..913c050e3 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
@@ -90,7 +90,7 @@ public class ParticipantHandler implements Closeable {
return;
}
- ParticipantResponseDetails response = new ParticipantResponseDetails(stateChangeMsg);
+ var response = new ParticipantResponseDetails(stateChangeMsg);
switch (stateChangeMsg.getState()) {
case PASSIVE:
@@ -126,7 +126,7 @@ public class ParticipantHandler implements Closeable {
* @param healthCheckMsg participant health check message
*/
public void handleParticipantHealthCheck(final ParticipantHealthCheck healthCheckMsg) {
- ParticipantResponseDetails response = new ParticipantResponseDetails(healthCheckMsg);
+ var response = new ParticipantResponseDetails(healthCheckMsg);
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
response.setResponseMessage(healthStatus.toString());
@@ -194,6 +194,7 @@ public class ParticipantHandler implements Closeable {
*
* @param definition participant definition
* @param participantState participant state
+ * @return the participant
*/
public Participant updateParticipantState(ToscaConceptIdentifier definition,
ParticipantState participantState) {
@@ -201,7 +202,7 @@ public class ParticipantHandler implements Closeable {
LOGGER.debug("No participant with this ID {}", definition.getName());
return null;
}
- ParticipantResponseDetails response = new ParticipantResponseDetails();
+ var response = new ParticipantResponseDetails();
handleStateChange(participantState, response);
sender.sendResponse(response);
return getParticipant(definition.getName(), definition.getVersion());
@@ -210,11 +211,13 @@ public class ParticipantHandler implements Closeable {
/**
* Get participants as a {@link Participant} class.
*
+ * @param name the participant name to get
+ * @param version the version of the participant to get
* @return the participant
*/
public Participant getParticipant(String name, String version) {
if (participantId.getName().equals(name)) {
- Participant participant = new Participant();
+ var participant = new Participant();
participant.setDefinition(participantId);
participant.setParticipantState(state);
participant.setHealthStatus(healthStatus);