diff options
author | dglFromAtt <dgl@research.att.com> | 2019-01-07 15:58:44 -0500 |
---|---|---|
committer | dglFromAtt <dgl@research.att.com> | 2019-01-07 16:32:39 -0500 |
commit | 2941d6a78d2eec8c6fb87d44e14f512b314e31f0 (patch) | |
tree | 76a68e3a83e36ab9efd3449b396599a8415dc29f /src/main/java | |
parent | 536c6aabdfd2bcdc493501a9498fb8a97d208c0b (diff) |
Stop referencing unused properties
A few fields for dmaap object were still being set assuming that values
came from properties file. Furthermore, a private variable in the
DmaapService class was not set to new value from request.
Result was that lack of property caused topicNsRoot field to be null,
and then the null was used to compose AAF action/instance values incorrectly.
Also fixed some test code to initialize properly.
Change-Id: Iffabf5728fdfb2f9496c7eb248cb1ed9e1cc1536
Signed-off-by: dglFromAtt <dgl@research.att.com>
Issue-ID: DMAAP-933
Signed-off-by: dglFromAtt <dgl@research.att.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java | 16 | ||||
-rw-r--r-- | src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java | 14 |
2 files changed, 13 insertions, 17 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java index 11b0d15..934b7bb 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java +++ b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java @@ -200,22 +200,18 @@ public class DatabaseClass extends BaseLoggingClass { mirrors = new HashMap<>(); } dmaap.init(new Dmaap("0", "", "", "", "", "", "", "")); - // check for, and set up initial data, if it isn't already there + // force initial read from DB, if it exists + @SuppressWarnings("unused") Dmaap dmx = dmaap.get(); - if ("0".equals(dmx.getVersion())) { - - dmx = new Dmaap("0", "", "", "", "", "", "", ""); - dmx.setDmaapName(p.getProperty("DmaapName")); - dmx.setDrProvUrl("https://" + p.getProperty("DR.provhost", "notSet")); - dmx.setTopicNsRoot(p.getProperty("topicNsRoot")); - dmx.setBridgeAdminTopic("DCAE_MM_AGENT"); + + // old code in this spot would read from properties file as part of init. + // but all those properties are now set via /dmaap API - dmaap.update(dmx); - } } catch (Exception e) { errorLogger.error("Error", e); errorLogger.error(DmaapbcLogMessageEnum.DB_UPDATE_ERROR, e.getMessage()); } + } public static synchronized String getNextClientId() { diff --git a/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java b/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java index 9d9b922..48ee661 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java +++ b/src/main/java/org/onap/dmaap/dbcapi/service/DmaapService.java @@ -58,7 +58,7 @@ public class DmaapService extends BaseLoggingClass { String topicFactory; // = "org.openecomp.dcae.dmaap.topicFactory"; String topicMgrRole; // = "org.openecomp.dmaapBC.TopicMgr"; - String dcaeTopicNs; // = "org.openecomp.dcae.dmaap"; + private boolean multiSite; @@ -66,14 +66,14 @@ public class DmaapService extends BaseLoggingClass { DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig(); topicFactory = p.getProperty("MR.TopicFactoryNS", "MR.topicFactoryNS.not.set"); topicMgrRole = p.getProperty("MR.TopicMgrRole", "MR.TopicMgrRole.not.set" ); - dcaeTopicNs = dmaapholder.get().getTopicNsRoot(); + multiSite = "true".equalsIgnoreCase(p.getProperty("MR.multisite", "true")); noEnvironmentPrefix = p.getProperty( "AAF.NoEnvironmentPrefix", "org.onap"); logger.info( "DmaapService settings: " + " topicFactory=" + topicFactory + " topicMgrRole=" + topicMgrRole + - " dcaeTopicNs=" + dcaeTopicNs + + " multisite=" + multiSite + " noEnvironmentPrefix=" + noEnvironmentPrefix ); @@ -93,7 +93,7 @@ public class DmaapService extends BaseLoggingClass { nd.setLastMod(); dmaapholder.update(nd); - + AafService aaf = new AafService( ServiceType.AAF_Admin); ApiPolicy apiPolicy = new ApiPolicy(); if ( apiPolicy.getUseAuthClass() ) { @@ -137,7 +137,7 @@ public class DmaapService extends BaseLoggingClass { if ( ! dmaap.isStatusValid() || ! nd.getDmaapName().equals(dmaap.getDmaapName()) || dmaap.getVersion().equals( "0") ) { nd.setLastMod(); dmaapholder.update(nd); //need to set this so the following perms will pick up any new vals. - dcaeTopicNs = dmaapholder.get().getTopicNsRoot(); + //dcaeTopicNs = dmaapholder.get().getTopicNsRoot(); ApiPolicy apiPolicy = new ApiPolicy(); if ( apiPolicy.getUseAuthClass()) { ApiPerms p = new ApiPerms(); @@ -194,7 +194,7 @@ public class DmaapService extends BaseLoggingClass { private boolean setTopicMgtPerms( Dmaap nd, AafService aaf ){ String[] actions = { "create", "destroy" }; - String instance = ":" + dcaeTopicNs + "." + nd.getDmaapName() + ".mr.topic:" + dcaeTopicNs + "." + nd.getDmaapName(); + String instance = ":" + nd.getTopicNsRoot() + "." + nd.getDmaapName() + ".mr.topic:" + nd.getTopicNsRoot() + "." + nd.getDmaapName(); for( String action : actions ) { @@ -214,7 +214,7 @@ public class DmaapService extends BaseLoggingClass { } } - String t = dcaeTopicNs +"." + nd.getDmaapName() + ".mr.topic"; + String t = nd.getTopicNsRoot() +"." + nd.getDmaapName() + ".mr.topic"; String[] s = { "view", "pub", "sub" }; actions = s; instance = "*"; |