aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl')
-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
21 files changed, 204 insertions, 168 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);
}
}