summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-01-25 14:40:42 +0100
committerPatrick Brady <pb071s@att.com>2018-01-25 19:20:34 +0000
commitd69363aa407120d7230030828b7e16195f3b01d8 (patch)
tree707870eb746a85ec2f1b9bb30d2810d66063aace
parent493b57fb04d86bbe99fb562e8379f9ead9ceeb5e (diff)
DmaapUtil fixes
Change-Id: Ia2d18d6c235df21a2d890382d8220cf36b975d36 Issue-ID: APPC-517 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
-rw-r--r--appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapUtil.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapUtil.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapUtil.java
index da1b0fa38..7a65311df 100644
--- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapUtil.java
+++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapUtil.java
@@ -31,9 +31,14 @@ import java.io.InputStream;
import java.util.Properties;
public class DmaapUtil {
- private final static String delimiter = "_";
+
+ private static final char DELIMITER = '_';
+
+ private DmaapUtil() {
+ }
+
private static String createPreferredRouteFileIfNotExist(String topic) throws IOException {
- String topicPreferredRouteFileName = null;
+ String topicPreferredRouteFileName;
topicPreferredRouteFileName = topic+"preferredRoute.properties";
File fo= new File(topicPreferredRouteFileName);
if(!fo.exists()) {
@@ -41,7 +46,7 @@ public class DmaapUtil {
InputStream inputStream = classLoader.getResourceAsStream("preferredRoute.txt");
Properties props = new Properties();
props.load(inputStream);
- String fileName = topic != null ? topic+delimiter+"MR1" : delimiter+"MR1";
+ String fileName = topic != null ? topic+ DELIMITER +"MR1" : DELIMITER +"MR1";
props.setProperty("preferredRouteKey", fileName);
topicPreferredRouteFileName = topic + "preferredRoute.properties";
props.store(new FileOutputStream(topicPreferredRouteFileName), "preferredRoute.properties file created on the fly for topic:" + topic + " on:" + System.currentTimeMillis());
@@ -51,14 +56,12 @@ public class DmaapUtil {
public static String createConsumerPropFile(String topic, Properties props)throws IOException {
String defaultProfFileName = "consumer.properties";
- String topicConsumerPropFileName = createConsumerProducerPropFile(topic, defaultProfFileName,props);
- return topicConsumerPropFileName;
+ return createConsumerProducerPropFile(topic, defaultProfFileName,props);
}
public static String createProducerPropFile(String topic, Properties props)throws IOException {
String defaultProfFileName = "producer.properties";
- String topicConsumerPropFileName = createConsumerProducerPropFile(topic, defaultProfFileName,props);
- return topicConsumerPropFileName;
+ return createConsumerProducerPropFile(topic, defaultProfFileName,props);
}
private static String createConsumerProducerPropFile(String topic, String defaultProfFileName, Properties props) throws IOException {
@@ -76,8 +79,8 @@ public class DmaapUtil {
defaultProps.setProperty("DME2preferredRouterFilePath",preferredRouteFileName);
String id = defaultProps.getProperty("id");
String topicConsumerPropFileName = defaultProfFileName;
- topicConsumerPropFileName = id != null ? id+delimiter+topicConsumerPropFileName : delimiter+topicConsumerPropFileName;
- topicConsumerPropFileName = topic != null ? topic+delimiter+topicConsumerPropFileName : delimiter+topicConsumerPropFileName;
+ topicConsumerPropFileName = id != null ? id+ DELIMITER +topicConsumerPropFileName : DELIMITER +topicConsumerPropFileName;
+ topicConsumerPropFileName = topic != null ? topic+ DELIMITER +topicConsumerPropFileName : DELIMITER +topicConsumerPropFileName;
defaultProps.store(new FileOutputStream(topicConsumerPropFileName), defaultProfFileName+" file created on the fly for topic:"+topic+" on:"+System.currentTimeMillis());
return topicConsumerPropFileName;