aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTschaen, Brendan (bt054f) <bt054f@att.com>2018-09-19 10:47:10 -0400
committerTschaen, Brendan (bt054f) <bt054f@att.com>2018-09-19 10:51:16 -0400
commitb47e674a791db4ed18d46965d2db91998c473c6b (patch)
tree26738cca5ee700c0adec6835acbf7f2bc6e49858
parent3a23f55f4d220eec87cbf7f490eedbdf0ca04ecd (diff)
Update prom to use music 3.x
Change-Id: I0c5cfa07695df47fb4429723541c8fbfb0523cb8 Issue-ID: MUSIC-93 Signed-off-by: Tschaen, Brendan (bt054f) <bt054f@att.com>
-rwxr-xr-xsampleApp/config.json16
-rw-r--r--src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java12
-rw-r--r--src/test/java/org/onap/music/prom/musicinterface/MusicHandleTest.java2
3 files changed, 15 insertions, 15 deletions
diff --git a/sampleApp/config.json b/sampleApp/config.json
index dd3ac8f..962e605 100755
--- a/sampleApp/config.json
+++ b/sampleApp/config.json
@@ -1,9 +1,9 @@
{
- "appName":"",
+ "app-name":"appusingprom",
"aid":"",
- "namespace":"",
- "userid":"",
- "password":"",
+ "namespace":"prom1",
+ "userid":"uid",
+ "password":"pw",
"ensure-active-0": "./ensureSdncActive.sh",
"ensure-active-1": "./ensureSdncActive.sh",
"ensure-passive-0":"./ensureSdncStandby.sh",
@@ -12,8 +12,8 @@
"restart-prom-1":"",
"core-monitor-sleep-time":"1000",
"prom-timeout":"5000",
- "noOfRetryAttempts":"3",
- "replicaIdList":["0", "1"],
- "musicLocation":"127.0.0.1",
- "musicVersion":2
+ "no-of-retry-attempts":"3",
+ "replica-id-list":["0", "1"],
+ "music-location":["127.0.0.1"],
+ "music-version":2
}
diff --git a/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java b/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java
index d62a1d2..83d148b 100644
--- a/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java
+++ b/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java
@@ -40,6 +40,7 @@ import com.sun.jersey.api.client.WebResource.Builder;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.json.JSONConfiguration;
+import java.util.Base64;
public class MusicHandle {
private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicHandle.class);
@@ -61,13 +62,10 @@ public class MusicHandle {
if (!namespace.equals("")) {
builder.header("ns", namespace);
}
- if (!userId.equals("")) {
- builder.header("userId", userId);
+ if (!userId.equals("") && !password.equals("")) {
+ String authString = Base64.getEncoder().encodeToString((userId + ":" + password).getBytes());
+ builder.header("Authorization", "Basic " + authString);
}
- if (!password.equals("")) {
- builder.header("password", password);
- }
-
return builder;
}
@@ -119,6 +117,8 @@ public class MusicHandle {
WebResource webResource = createMusicWebResource(musicUrl+"/keyspaces/"+keyspaceName);
+ Builder b = addMusicHeaders(webResource);
+ logger.error("music handle create keyspace eventual: " + b);
ClientResponse response = addMusicHeaders(webResource)
.post(ClientResponse.class, jsonKp);
diff --git a/src/test/java/org/onap/music/prom/musicinterface/MusicHandleTest.java b/src/test/java/org/onap/music/prom/musicinterface/MusicHandleTest.java
index 48f75c3..120d80c 100644
--- a/src/test/java/org/onap/music/prom/musicinterface/MusicHandleTest.java
+++ b/src/test/java/org/onap/music/prom/musicinterface/MusicHandleTest.java
@@ -63,7 +63,7 @@ public class MusicHandleTest {
public void before() throws Exception {
PowerMockito.mockStatic(ConfigReader.class);
ArrayList<String> urls = new ArrayList<String>();
- Collections.addAll(urls, "1.2.3.4", "5.6.7.8");
+ Collections.addAll(urls, "10.1.2.3", "10.4.5.6");
PowerMockito.when(ConfigReader.getConfigAttribute(Mockito.anyString(), Mockito.anyString()))
.thenCallRealMethod();