aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-simulator/src/main
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2021-06-21 16:45:27 +0100
committerFrancescoFioraEst <francesco.fiora@est.tech>2021-06-28 10:36:54 +0100
commit7f7f0c5790dc63e43a59c53154e796239ab34cbb (patch)
tree39a8682b04502e99bc8575ec636613de193ade03 /participant/participant-impl/participant-impl-simulator/src/main
parent077406d881b8b03456f76d246a4db44d13780999 (diff)
Convert Intermediary Participant to Spring and refactor Participants
Issue-ID: POLICY-3370 Change-Id: I1541fc47b35c91f9ec86ab768bc3cec2cd78647c Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-simulator/src/main')
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java3
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java16
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java11
-rw-r--r--participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml8
4 files changed, 6 insertions, 32 deletions
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java
index 9f6e4aa4b..8267df477 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/ParticipantSimulatorApplication.java
@@ -23,6 +23,7 @@ package org.onap.policy.clamp.controlloop.participant.simulator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
+import org.springframework.context.annotation.ComponentScan;
/**
* Starter.
@@ -30,6 +31,8 @@ import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
*/
@SpringBootApplication
@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.simulator.main.parameters")
+@ComponentScan({"org.onap.policy.clamp.controlloop.participant.simulator",
+ "org.onap.policy.clamp.controlloop.participant.intermediary"})
public class ParticipantSimulatorApplication {
public static void main(String[] args) {
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java
index f4e6791ec..c890ec247 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/config/ParticipantConfig.java
@@ -20,9 +20,6 @@
package org.onap.policy.clamp.controlloop.participant.simulator.config;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryFactory;
-import org.onap.policy.clamp.controlloop.participant.simulator.main.parameters.ParticipantSimulatorParameters;
import org.onap.policy.clamp.controlloop.participant.simulator.main.rest.RequestResponseLoggingFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -32,19 +29,6 @@ import org.springframework.context.annotation.Configuration;
public class ParticipantConfig {
/**
- * Create ParticipantIntermediaryApi.
- *
- * @param parameters the Participant Dcae Parameters
- * @return ParticipantIntermediaryApi
- */
- @Bean
- public ParticipantIntermediaryApi participantIntermediaryApi(ParticipantSimulatorParameters parameters) {
- ParticipantIntermediaryApi intermediaryApi = new ParticipantIntermediaryFactory().createApiImplementation();
- intermediaryApi.init(parameters.getIntermediaryParameters());
- return intermediaryApi;
- }
-
- /**
* logging Filter configuration.
*
* @return FilterRegistrationBean
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
index 5110ac6a6..99579006c 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
+++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameters.java
@@ -25,8 +25,7 @@ import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.common.parameters.validation.ParameterGroupConstraint;
-import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;
@@ -38,13 +37,9 @@ import org.springframework.validation.annotation.Validated;
@Getter
@Setter
@ConfigurationProperties(prefix = "participant")
-public class ParticipantSimulatorParameters {
+public class ParticipantSimulatorParameters implements ParticipantParameters {
- @NotNull
@Valid
- private ParticipantIntermediaryParameters intermediaryParameters;
-
@NotNull
- @ParameterGroupConstraint
- private PolicyModelsProviderParameters databaseProviderParameters;
+ private ParticipantIntermediaryParameters intermediaryParameters;
}
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
index a45636b34..82e3b89f1 100644
--- a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
@@ -35,11 +35,3 @@ participant:
topic: POLICY-NOTIFICATION
servers[0]: ${topicServer:message-router}
topicCommInfrastructure: dmaap
- databaseProviderParameters:
- name: PolicyProviderParameterGroup
- implementation: org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl
- databaseDriver: org.mariadb.jdbc.Driver
- databaseUrl: jdbc:mariadb://mariadb:3306/cdsparticipantsim
- databaseUser: policy
- databasePassword: P01icY
- persistenceUnit: ToscaConceptTest