summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuangrongFu <fu.guangrong@zte.com.cn>2018-03-08 17:22:12 +0800
committerGuangrongFu <fu.guangrong@zte.com.cn>2018-03-08 17:22:12 +0800
commit8109b02052d5a66f442d8418340ad3bd7272ff99 (patch)
tree7d1c3919bd23e0f164f936b97c491a2245bf00b1
parent81304def362b19075438af781727e21ce8374bae (diff)
Made Fields Private
Change-Id: I00ffe1aeb7e68cdfd93056fcc33c628c1c3ea63c Issue-ID: HOLMES-118 Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn>
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java15
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java4
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java6
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java8
4 files changed, 20 insertions, 13 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
index 2ade152..70ef0cb 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MQConfig.java
@@ -16,13 +16,20 @@
package org.onap.holmes.common.config;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
public class MQConfig {
- public String brokerIp;
+ private String brokerIp;
- public int brokerPort;
+ private int brokerPort;
- public String brokerUsername;
+ private String brokerUsername;
- public String brokerPassword;
+ private String brokerPassword;
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java
index 240f09b..c64bd59 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java
@@ -38,8 +38,8 @@ public class DmaapService {
@Inject
private AaiQuery aaiQuery;
- public static ConcurrentHashMap<String, String> loopControlNames = new ConcurrentHashMap<>();
- public static ConcurrentHashMap<String, String> alarmUniqueRequestID = new ConcurrentHashMap<>();
+ public static final ConcurrentHashMap<String, String> loopControlNames = new ConcurrentHashMap<>();
+ public static final ConcurrentHashMap<String, String> alarmUniqueRequestID = new ConcurrentHashMap<>();
public void publishPolicyMsg(PolicyMsg policyMsg, String dmaapConfigKey) {
try {
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java b/holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java
index fd91bbd..4bbffac 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/producer/MQProducer.java
@@ -48,9 +48,9 @@ public class MQProducer {
public void init() {
String brokerURL =
- "tcp://" + mqConfigProvider.get().brokerIp + ":" + mqConfigProvider.get().brokerPort;
- connectionFactory = new ActiveMQConnectionFactory(mqConfigProvider.get().brokerUsername,
- mqConfigProvider.get().brokerPassword, brokerURL);
+ "tcp://" + mqConfigProvider.get().getBrokerIp() + ":" + mqConfigProvider.get().getBrokerPort();
+ connectionFactory = new ActiveMQConnectionFactory(mqConfigProvider.get().getBrokerUsername(),
+ mqConfigProvider.get().getBrokerPassword(), brokerURL);
}
public void sendAlarmMQTopicMsg(VesAlarm alarm) {
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java
index d9dffeb..3fad981 100644
--- a/holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/producer/MQProducerTest.java
@@ -70,10 +70,10 @@ public class MQProducerTest {
@Test
public void init() {
MQConfig mqConfig = new MQConfig();
- mqConfig.brokerIp = "127.0.0.1";
- mqConfig.brokerPort = 61616;
- mqConfig.brokerPassword = "admin";
- mqConfig.brokerUsername = "admin";
+ mqConfig.setBrokerIp("127.0.0.1");
+ mqConfig.setBrokerPort(61616);
+ mqConfig.setBrokerPassword("admin");
+ mqConfig.setBrokerUsername("admin");
expect(mqConfigProvider.get()).andReturn(mqConfig).anyTimes();
PowerMock.replayAll();