aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java42
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java9
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/MR_Cluster.java45
-rw-r--r--src/test/java/org/onap/dmaap/dbcapi/model/MR_ClusterTest.java4
-rw-r--r--src/test/java/org/onap/dmaap/dbcapi/resources/MR_ClusterResourceTest.java2
-rw-r--r--version.properties2
7 files changed, 42 insertions, 64 deletions
diff --git a/pom.xml b/pom.xml
index a95b13f..22dcc7a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -324,7 +324,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jettyVersion>9.3.9.v20160517</jettyVersion>
<eelf.version>0.0.1</eelf.version>
- <artifact.version>1.0.4-SNAPSHOT</artifact.version>
+ <artifact.version>1.0.5-SNAPSHOT</artifact.version>
<!-- SONAR -->
<jacoco.version>0.7.7.201606060606</jacoco.version>
<sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
diff --git a/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java b/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java
index a8ace78..4db6ca3 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/client/MrProvConnection.java
@@ -54,37 +54,31 @@ public class MrProvConnection extends BaseLoggingClass{
private String topicMgrCred;
+ private boolean useAAF;
+ private String user;
+ private String encPwd;
- private String getCred( ) {
+ public MrProvConnection() {
String mechIdProperty = "aaf.TopicMgrUser";
String pwdProperty = "aaf.TopicMgrPassword";
DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
- logger.info( "templog:getCred: 10");
+ user = p.getProperty( mechIdProperty, "noMechId@domain.netset.com" );
+ encPwd = p.getProperty( pwdProperty, "notSet" );
+ useAAF= "true".equalsIgnoreCase(p.getProperty("UseAAF", "false"));
+ topicMgrCred = getCred();
+
+ }
+
+ private String getCred( ) {
- String user = p.getProperty( mechIdProperty, "noMechId@domain.netset.com" );
- logger.info( "templog:getCred: 20");
String pwd = "";
- String encPwd = p.getProperty( pwdProperty, "notSet" );
- logger.info( "templog:getCred: 30");
-
- AafDecrypt decryptor = new AafDecrypt();
- logger.info( "templog:getCred: 40");
+ AafDecrypt decryptor = new AafDecrypt();
pwd = decryptor.decrypt(encPwd);
- logger.info( "templog:getCred: 50");
-
- return user + ":" + pwd;
-
-
-
+ return user + ":" + pwd;
}
- public MrProvConnection( ) {
- topicMgrCred = getCred();
-
- }
-
public boolean makeTopicConnection( MR_Cluster cluster ) {
logger.info( "connect to cluster: " + cluster.getDcaeLocationName());
@@ -162,8 +156,12 @@ public class MrProvConnection extends BaseLoggingClass{
try {
byte[] postData = postTopic.getBytes();
logger.info( "post fields=" + postData.toString() );
- uc.setRequestProperty("Authorization", auth);
- logger.info( "Authenticating with " + auth );
+
+ // when not using AAF, do not attempt Basic Authentication
+ if ( useAAF ) {
+ uc.setRequestProperty("Authorization", auth);
+ logger.info( "Authenticating with " + auth );
+ }
uc.setRequestMethod("POST");
uc.setRequestProperty("Content-Type", "application/json");
uc.setRequestProperty( "charset", "utf-8");
diff --git a/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java b/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java
index e1ea955..18fdeba 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/client/MrTopicConnection.java
@@ -47,13 +47,14 @@ public class MrTopicConnection extends BaseLoggingClass {
private String mmProvCred;
private String unit_test;
-
+ private boolean useAAF;
public MrTopicConnection(String user, String pwd ) {
mmProvCred = new String( user + ":" + pwd );
DmaapConfig p = (DmaapConfig)DmaapConfig.getConfig();
unit_test = p.getProperty( "UnitTest", "No" );
+ useAAF= "true".equalsIgnoreCase(p.getProperty("UseAAF", "false"));
}
public boolean makeTopicConnection( MR_Cluster cluster, String topic, String overrideFqdn ) {
@@ -126,8 +127,10 @@ public class MrTopicConnection extends BaseLoggingClass {
try {
byte[] postData = postMessage.getBytes();
logger.info( "post fields=" + postMessage );
- uc.setRequestProperty("Authorization", auth);
- logger.info( "Authenticating with " + auth );
+ if ( useAAF ) {
+ uc.setRequestProperty("Authorization", auth);
+ logger.info( "Authenticating with " + auth );
+ }
uc.setRequestMethod("POST");
uc.setRequestProperty("Content-Type", "application/json");
uc.setRequestProperty( "charset", "utf-8");
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/MR_Cluster.java b/src/main/java/org/onap/dmaap/dbcapi/model/MR_Cluster.java
index 8185083..a6827a9 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/MR_Cluster.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/MR_Cluster.java
@@ -31,7 +31,6 @@ public class MR_Cluster extends DmaapObject {
private String dcaeLocationName;
private String fqdn;
- private String[] hosts;
private DmaapTimestamp lastMod;
private String topicProtocol;
private String topicPort;
@@ -47,7 +46,6 @@ public class MR_Cluster extends DmaapObject {
public MR_Cluster() {
this.topicProtocol = defaultTopicProtocol;
this.topicPort = defaultTopicPort;
- this.hosts = new String[3];
this.lastMod = new DmaapTimestamp();
this.lastMod.mark();
@@ -55,24 +53,7 @@ public class MR_Cluster extends DmaapObject {
}
- // Deprecate this constructor
- public MR_Cluster( String dLN,
- String f,
- String a,
- String[] h ) {
- this.dcaeLocationName = dLN;
- this.fqdn = f;
- this.hosts = new String[3];
- this.hosts[0] = h[0];
- this.hosts[1] = h[1];
- this.hosts[2] = h[2];
- this.topicProtocol = defaultTopicProtocol;
- this.topicPort = defaultTopicPort;
- this.lastMod = new DmaapTimestamp();
- this.lastMod.mark();
- debugLogger.debug( "depracated MR_Cluster constructor w initialization complete" + this.lastMod.getVal() );
- }
// new style constructor
public MR_Cluster( String dLN,
@@ -81,12 +62,19 @@ public class MR_Cluster extends DmaapObject {
String port ) {
this.dcaeLocationName = dLN;
this.fqdn = f;
- this.hosts = new String[3];
- this.hosts[0] = fqdn;
- this.hosts[1] = fqdn;
- this.hosts[2] = fqdn;
- this.topicProtocol = prot;
- this.topicPort = port;
+
+ if ( prot == null || prot.isEmpty() ) {
+ this.topicProtocol = defaultTopicProtocol;
+ } else {
+ this.topicProtocol = prot;
+ }
+ if ( port == null || port.isEmpty() ) {
+ this.topicPort = defaultTopicPort;
+ } else {
+ this.topicPort = port;
+ }
+
+
this.lastMod = new DmaapTimestamp();
this.lastMod.mark();
@@ -108,13 +96,6 @@ public class MR_Cluster extends DmaapObject {
this.fqdn = fqdn;
}
- public String[] getHosts() {
- return hosts;
- }
-
- public void setHosts(String[] hosts) {
- this.hosts = hosts;
- }
public String getTopicProtocol() {
return topicProtocol;
diff --git a/src/test/java/org/onap/dmaap/dbcapi/model/MR_ClusterTest.java b/src/test/java/org/onap/dmaap/dbcapi/model/MR_ClusterTest.java
index df102e3..ebe7b1e 100644
--- a/src/test/java/org/onap/dmaap/dbcapi/model/MR_ClusterTest.java
+++ b/src/test/java/org/onap/dmaap/dbcapi/model/MR_ClusterTest.java
@@ -59,8 +59,6 @@ public class MR_ClusterTest {
public void testMR_ClusterClassConstructor() {
MR_Cluster t = new MR_Cluster( d, fqdn, "http", "3904");
-
- t.getHosts();
assertTrue( t.getDcaeLocationName() == d );
assertTrue( t.getFqdn() == fqdn );
@@ -70,8 +68,6 @@ public class MR_ClusterTest {
public void testw3() {
MR_Cluster t = new MR_Cluster();
- String[] h = { "host1", "host2", "host3" };
- t.setHosts( h );
assertTrue( t.getDcaeLocationName() == null );
assertTrue( t.getFqdn() == null );
diff --git a/src/test/java/org/onap/dmaap/dbcapi/resources/MR_ClusterResourceTest.java b/src/test/java/org/onap/dmaap/dbcapi/resources/MR_ClusterResourceTest.java
index 4d4c731..2ff17d8 100644
--- a/src/test/java/org/onap/dmaap/dbcapi/resources/MR_ClusterResourceTest.java
+++ b/src/test/java/org/onap/dmaap/dbcapi/resources/MR_ClusterResourceTest.java
@@ -111,7 +111,7 @@ public class MR_ClusterResourceTest extends JerseyTest {
}
// now change a field
- cluster.setHosts( h );
+
reqEntity = Entity.entity( cluster, MediaType.APPLICATION_JSON );
// update with incorrect key
diff --git a/version.properties b/version.properties
index d49958a..5416ded 100644
--- a/version.properties
+++ b/version.properties
@@ -27,7 +27,7 @@
major=1
minor=0
-patch=4
+patch=5
base_version=${major}.${minor}.${patch}
# Release must be completed with git revision # in Jenkins