Fix sonar bugs in apex-pdp 18/69918/1
authorramverma <ram.krishna.verma@ericsson.com>
Fri, 5 Oct 2018 14:36:11 +0000 (15:36 +0100)
committerramverma <ram.krishna.verma@ericsson.com>
Fri, 5 Oct 2018 14:36:46 +0000 (15:36 +0100)
Change-Id: I1ab9b9d9b0b8d1655301959d7d6b9ab3cc87eba3
Issue-ID: POLICY-954
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ZooKeeperServerServiceProvider.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java

index 1c28388..1949769 100644 (file)
@@ -89,6 +89,7 @@ public class ZooKeeperServerServiceProvider {
         catch (InterruptedException | IOException ie) {
             String message = "Zookeeper server start failed";
             LOGGER.warn(message, ie);
+            Thread.currentThread().interrupt();
             throw new ApexException(message, ie);
         }
         
index d4cb2ab..1b2b443 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.policy.apex.plugins.event.carrier.jms;
 
+import java.util.Base64;
 import java.util.Properties;
 
 import javax.naming.Context;
@@ -86,7 +87,7 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
     private static final String  DEFAULT_INITIAL_CTXT_FACTORY  = "org.jboss.naming.remote.client.InitialContextFactory";
     private static final String  DEFAULT_PROVIDER_URL          = "remote://localhost:4447";
     private static final String  DEFAULT_SECURITY_PRINCIPAL    = "userid";
-    private static final String  DEFAULT_SECURITY_CREDENTIALS  = "password";
+    private static final String  DEFAULT_SECURITY_CREDENTIALS  = "cGFzc3dvcmQ=";
     private static final String  DEFAULT_CONSUMER_TOPIC        = "apex-in";
     private static final String  DEFAULT_PRODUCER_TOPIC        = "apex-out";
     private static final int     DEFAULT_CONSUMER_WAIT_TIME    = 100;
@@ -103,7 +104,7 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
     private String  initialContextFactory = DEFAULT_INITIAL_CTXT_FACTORY;
     private String  providerUrl           = DEFAULT_PROVIDER_URL;
     private String  securityPrincipal     = DEFAULT_SECURITY_PRINCIPAL;
-    private String  securityCredentials   = DEFAULT_SECURITY_CREDENTIALS;
+    private String  securityCredentials   = getDefaultCredential();
     private String  producerTopic         = DEFAULT_PRODUCER_TOPIC;
     private String  consumerTopic         = DEFAULT_CONSUMER_TOPIC;
     private int     consumerWaitTime      = DEFAULT_CONSUMER_WAIT_TIME;
@@ -382,4 +383,8 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
     private boolean isNullOrBlank(final String stringValue) {
         return stringValue == null || stringValue.trim().length() == 0;
     }
+    
+    private String getDefaultCredential() {
+        return new String(Base64.getDecoder().decode(DEFAULT_SECURITY_CREDENTIALS.getBytes()));
+    }
 }