aboutsummaryrefslogtreecommitdiffstats
path: root/models-sim/policy-models-sim-pdp/src/main
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2019-07-05 13:00:35 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2019-07-05 13:00:35 +0000
commitc5231f939d724dd59cb385d8521924a1bff19cee (patch)
treebed6d13d5986b0cd5f3b8d0fcea8b7010d951340 /models-sim/policy-models-sim-pdp/src/main
parentb359a4b56b4527b3215b89e7d637da9fbcb022af (diff)
Remove topic.properties and incorporate into overall config file for pdp-simulator
Change-Id: Iac882c7ffb28a80ef474d15a90307cd68b78d417 Issue-ID: POLICY-1744 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'models-sim/policy-models-sim-pdp/src/main')
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorCommandLineArguments.java1
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java13
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java3
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/package/docker/pdp-sim.sh13
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/package/tarball/assembly.xml1
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/resources/config/OnapPfConfig.json12
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/resources/config/topic.properties22
7 files changed, 19 insertions, 46 deletions
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorCommandLineArguments.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorCommandLineArguments.java
index 50d2bd2ad..8eff1af42 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorCommandLineArguments.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorCommandLineArguments.java
@@ -165,7 +165,6 @@ public class PdpSimulatorCommandLineArguments {
*/
public void validate() throws PdpSimulatorException {
validateReadableFile("pdp simulator configuration", configurationFilePath);
- validateReadableFile("pdp simulator properties", propertyFilePath);
}
/**
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
index 78330135a..ee974c579 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
@@ -21,9 +21,9 @@
package org.onap.policy.models.sim.pdp;
-import java.io.FileInputStream;
import java.util.Arrays;
import java.util.Properties;
+import org.onap.policy.common.endpoints.utils.ParameterUtils;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.sim.pdp.exception.PdpSimulatorException;
import org.onap.policy.models.sim.pdp.parameters.PdpSimulatorParameterGroup;
@@ -80,16 +80,7 @@ public class PdpSimulatorMain {
}
// Read the properties
- final Properties topicProperties = new Properties();
- try {
- final String propFile = arguments.getFullPropertyFilePath();
- try (FileInputStream stream = new FileInputStream(propFile)) {
- topicProperties.load(stream);
- }
- } catch (final Exception e) {
- LOGGER.error(PDP_SIMULATOR_FAIL_MSG, e);
- return;
- }
+ Properties topicProperties = ParameterUtils.getTopicProperties(parameterGroup.getTopicParameterGroup());
// create the activator
activator = new PdpSimulatorActivator(parameterGroup, topicProperties);
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java
index 58c583901..1b4df7bc6 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java
@@ -21,7 +21,7 @@
package org.onap.policy.models.sim.pdp.parameters;
import lombok.Getter;
-
+import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
@@ -36,6 +36,7 @@ import org.onap.policy.common.parameters.annotations.NotNull;
@Getter
public class PdpSimulatorParameterGroup extends ParameterGroupImpl {
private PdpStatusParameters pdpStatusParameters;
+ private TopicParameterGroup topicParameterGroup;
/**
* Create the pdp simulator parameter group.
diff --git a/models-sim/policy-models-sim-pdp/src/main/package/docker/pdp-sim.sh b/models-sim/policy-models-sim-pdp/src/main/package/docker/pdp-sim.sh
index b0e3ba0e5..2316ccecf 100644
--- a/models-sim/policy-models-sim-pdp/src/main/package/docker/pdp-sim.sh
+++ b/models-sim/policy-models-sim-pdp/src/main/package/docker/pdp-sim.sh
@@ -30,13 +30,11 @@ KEYSTORE_PASSWD="Pol1cy_0nap"
TRUSTSTORE="${PDP_SIM_HOME}/etc/ssl/policy-truststore"
TRUSTSTORE_PASSWD="Pol1cy_0nap"
-if [ "$#" -eq 2 ]
+if [ "$#" -eq 1 ]
then
CONFIG_FILE=$1
- PROPERTIES_FILE=$2
else
CONFIG_FILE=${CONFIG_FILE}
- PROPERTIES_FILE=${PROPERTIES_FILE}
fi
if [ -z "$CONFIG_FILE" ]
@@ -44,12 +42,7 @@ then
CONFIG_FILE="$PDP_SIM_HOME/etc/config/OnapPfConfig.json"
fi
-if [ -z "$PROPERTIES_FILE" ]
-then
- PROPERTIES_FILE="$PDP_SIM_HOME/etc/config/topic.properties"
-fi
-
-echo "PDP simulatior configuration file: $CONFIG_FILE and properties file: $PROPERTIES_FILE"
+echo "PDP simulatior configuration file: $CONFIG_FILE
$JAVA_HOME/bin/java \
-cp "$PDP_SIM_HOME/etc:$PDP_SIM_HOME/lib/*" \
@@ -59,4 +52,4 @@ $JAVA_HOME/bin/java \
-Djavax.net.ssl.trustStorePassword="$TRUSTSTORE_PASSWD" \
-Dlogback.configurationFile=$PDP_SIM_HOME/etc/logback.xml \
org.onap.policy.models.sim.pdp.PdpSimulatorMain \
- -c $CONFIG_FILE -p $PROPERTIES_FILE
+ -c $CONFIG_FILE
diff --git a/models-sim/policy-models-sim-pdp/src/main/package/tarball/assembly.xml b/models-sim/policy-models-sim-pdp/src/main/package/tarball/assembly.xml
index 25ffc65a9..2fc66d12b 100644
--- a/models-sim/policy-models-sim-pdp/src/main/package/tarball/assembly.xml
+++ b/models-sim/policy-models-sim-pdp/src/main/package/tarball/assembly.xml
@@ -50,7 +50,6 @@
</directory>
<includes>
<include>OnapPfConfig.json</include>
- <include>topic.properties</include>
</includes>
<outputDirectory>etc/config</outputDirectory>
<lineEnding>unix</lineEnding>
diff --git a/models-sim/policy-models-sim-pdp/src/main/resources/config/OnapPfConfig.json b/models-sim/policy-models-sim-pdp/src/main/resources/config/OnapPfConfig.json
index ff7903c78..cb8c4dd0f 100644
--- a/models-sim/policy-models-sim-pdp/src/main/resources/config/OnapPfConfig.json
+++ b/models-sim/policy-models-sim-pdp/src/main/resources/config/OnapPfConfig.json
@@ -5,5 +5,17 @@
"pdpType":"apex",
"description":"Pdp Heartbeat",
"supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}]
+ },
+ "topicParameterGroup": {
+ "topicSources" : [{
+ "topic" : "POLICY-PDP-PAP",
+ "servers" : [ "message-router:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }],
+ "topicSinks" : [{
+ "topic" : "POLICY-PDP-PAP",
+ "servers" : [ "message-router:3904" ],
+ "topicCommInfrastructure" : "dmaap"
+ }]
}
} \ No newline at end of file
diff --git a/models-sim/policy-models-sim-pdp/src/main/resources/config/topic.properties b/models-sim/policy-models-sim-pdp/src/main/resources/config/topic.properties
deleted file mode 100644
index 0139bb38a..000000000
--- a/models-sim/policy-models-sim-pdp/src/main/resources/config/topic.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2019 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-dmaap.source.topics=POLICY-PDP-PAP
-dmaap.sink.topics=POLICY-PDP-PAP
-dmaap.source.topics.POLICY-PDP-PAP.servers= message-router:3904
-dmaap.sink.topics.POLICY-PDP-PAP.servers= message-router:3904 \ No newline at end of file