diff options
author | Dominic Lunanuova <dgl@research.att.com> | 2019-05-14 12:58:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-05-14 12:58:26 +0000 |
commit | c81973deba0c2eeaaa424b398bed50c5cc8faece (patch) | |
tree | a0a0db43c379271dd7229683c5f5bd0da8e39802 /src/main | |
parent | 9a8bdf20dbaf2f7e5ad473a60f9b083505ad908c (diff) | |
parent | 1ef01702fd6e5b1742cb67a6614b97948e263e5f (diff) |
Merge "Junits for TopicService"
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java index 68dfd51..08e58be 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java +++ b/src/main/java/org/onap/dmaap/dbcapi/service/TopicService.java @@ -59,13 +59,13 @@ public class TopicService extends BaseLoggingClass { // REF: https://wiki.web.att.com/pages/viewpage.action?pageId=519703122 private static String defaultGlobalMrHost; - private Map<String, Topic> mr_topics = DatabaseClass.getTopics(); + private Map<String, Topic> mr_topics; private static DmaapService dmaapSvc = new DmaapService(); - private MR_ClientService clientService = new MR_ClientService(); - private MR_ClusterService clusters = new MR_ClusterService(); - private DcaeLocationService locations = new DcaeLocationService(); - private MirrorMakerService bridge = new MirrorMakerService(); + private MR_ClientService clientService; + private MR_ClusterService clusters; + private DcaeLocationService locations; + private MirrorMakerService bridge; private static String centralCname; private static boolean createTopicRoles; @@ -74,22 +74,33 @@ public class TopicService extends BaseLoggingClass { public TopicService(){ - DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig(); + this(DatabaseClass.getTopics(), new MR_ClientService(), (DmaapConfig)DmaapConfig.getConfig(), + new MR_ClusterService(), new DcaeLocationService(), new MirrorMakerService()); + + } + + TopicService(Map<String, Topic> mr_topics, MR_ClientService clientService, DmaapConfig p, + MR_ClusterService clusters, DcaeLocationService locations, MirrorMakerService bridge) { + this.mr_topics = mr_topics; + this.clientService = clientService; defaultGlobalMrHost = p.getProperty("MR.globalHost", "global.host.not.set"); centralCname = p.getProperty("MR.CentralCname"); createTopicRoles = "true".equalsIgnoreCase(p.getProperty("aaf.CreateTopicRoles", "true")); String unit_test = p.getProperty( "UnitTest", "No" ); - if ( unit_test.equals( "Yes" ) ) { + if ( "Yes".equals(unit_test)) { strictGraph = false; } mmPerMR = "true".equalsIgnoreCase(p.getProperty("MirrorMakerPerMR", "true")); - logger.info( "TopicService properties: CentralCname=" + centralCname + + logger.info( "TopicService properties: CentralCname=" + centralCname + " defaultGlobarlMrHost=" + defaultGlobalMrHost + " createTopicRoles=" + createTopicRoles + " mmPerMR=" + mmPerMR ); + this.clusters = clusters; + this.locations = locations; + this.bridge = bridge; } - - public Map<String, Topic> getTopics() { + + public Map<String, Topic> getTopics() { return mr_topics; } @@ -104,7 +115,7 @@ public class TopicService extends BaseLoggingClass { ArrayList<Topic> topics = new ArrayList<>(mr_topics.values()); if ( withClients ) { for( Topic topic: topics ) { - topic.setClients( clientService.getAllMrClients(topic.getFqtn())); + topic.setClients(clientService.getAllMrClients(topic.getFqtn())); } } return topics; |