Change-Id: I8cf3f4caf4701be7fd95bb35f94f75592d7b4c05
Signed-off-by: dglFromAtt <dgl@research.att.com>
Issue-ID: DMAAP-295
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jettyVersion>9.3.9.v20160517</jettyVersion>
<eelf.version>0.0.1</eelf.version>
<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>
<!-- SONAR -->
<jacoco.version>0.7.7.201606060606</jacoco.version>
<sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
private String topicMgrCred;
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();
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 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);
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());
public boolean makeTopicConnection( MR_Cluster cluster ) {
logger.info( "connect to cluster: " + cluster.getDcaeLocationName());
try {
byte[] postData = postTopic.getBytes();
logger.info( "post fields=" + postData.toString() );
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");
uc.setRequestMethod("POST");
uc.setRequestProperty("Content-Type", "application/json");
uc.setRequestProperty( "charset", "utf-8");
private String mmProvCred;
private String unit_test;
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" );
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 ) {
}
public boolean makeTopicConnection( MR_Cluster cluster, String topic, String overrideFqdn ) {
try {
byte[] postData = postMessage.getBytes();
logger.info( "post fields=" + postMessage );
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");
uc.setRequestMethod("POST");
uc.setRequestProperty("Content-Type", "application/json");
uc.setRequestProperty( "charset", "utf-8");
private String dcaeLocationName;
private String fqdn;
private String dcaeLocationName;
private String fqdn;
- private String[] hosts;
private DmaapTimestamp lastMod;
private String topicProtocol;
private String topicPort;
private DmaapTimestamp lastMod;
private String topicProtocol;
private String topicPort;
public MR_Cluster() {
this.topicProtocol = defaultTopicProtocol;
this.topicPort = defaultTopicPort;
public MR_Cluster() {
this.topicProtocol = defaultTopicProtocol;
this.topicPort = defaultTopicPort;
- this.hosts = new String[3];
this.lastMod = new DmaapTimestamp();
this.lastMod.mark();
this.lastMod = new DmaapTimestamp();
this.lastMod.mark();
- // 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,
// new style constructor
public MR_Cluster( String dLN,
String port ) {
this.dcaeLocationName = dLN;
this.fqdn = f;
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();
this.lastMod = new DmaapTimestamp();
this.lastMod.mark();
- public String[] getHosts() {
- return hosts;
- }
-
- public void setHosts(String[] hosts) {
- this.hosts = hosts;
- }
public String getTopicProtocol() {
return topicProtocol;
public String getTopicProtocol() {
return topicProtocol;
public void testMR_ClusterClassConstructor() {
MR_Cluster t = new MR_Cluster( d, fqdn, "http", "3904");
public void testMR_ClusterClassConstructor() {
MR_Cluster t = new MR_Cluster( d, fqdn, "http", "3904");
assertTrue( t.getDcaeLocationName() == d );
assertTrue( t.getFqdn() == fqdn );
assertTrue( t.getDcaeLocationName() == d );
assertTrue( t.getFqdn() == fqdn );
public void testw3() {
MR_Cluster t = new MR_Cluster();
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 );
assertTrue( t.getDcaeLocationName() == null );
assertTrue( t.getFqdn() == null );
reqEntity = Entity.entity( cluster, MediaType.APPLICATION_JSON );
// update with incorrect key
reqEntity = Entity.entity( cluster, MediaType.APPLICATION_JSON );
// update with incorrect key
base_version=${major}.${minor}.${patch}
# Release must be completed with git revision # in Jenkins
base_version=${major}.${minor}.${patch}
# Release must be completed with git revision # in Jenkins