aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTschaen, Brendan <ctschaen@att.com>2019-06-02 13:56:14 -0400
committerTschaen, Brendan <ctschaen@att.com>2019-06-02 13:56:14 -0400
commitb7431be81e01554b21a94c2e7c1b1a527c329845 (patch)
tree232578071c8210d3fdd59486bbbe19da9772ac9b /src
parentfdf19711e482e5c22f3d6fdb18e0bc052ec37e4e (diff)
Increase MusicUtil Code Coverage
Change-Id: I99bdec64d00a3822e4f40ed75b496c591b070057 Issue-ID: MUSIC-405 Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main/java/org/onap/music/main/MusicUtil.java16
-rw-r--r--src/test/java/org/onap/music/unittests/MusicUtilTest.java114
2 files changed, 114 insertions, 16 deletions
diff --git a/src/main/java/org/onap/music/main/MusicUtil.java b/src/main/java/org/onap/music/main/MusicUtil.java
index 2ad7117b..17e3fcf6 100755
--- a/src/main/java/org/onap/music/main/MusicUtil.java
+++ b/src/main/java/org/onap/music/main/MusicUtil.java
@@ -642,22 +642,6 @@ public class MusicUtil {
return response;
}
-
- public static Map<String,String> extractBasicAuthentication(String authorization){
- Map<String,String> authValues = new HashMap<>();
- if(authorization == null) {
- authValues.put("ERROR", "Authorization cannot be null");
- return authValues;
- }
- authorization = authorization.replaceFirst("Basic", "");
- String decoded = Base64.base64Decode(authorization);
- StringTokenizer token = new StringTokenizer(decoded, ":");
- authValues.put(MusicUtil.USERID, token.nextToken());
- authValues.put(MusicUtil.PASSWORD,token.nextToken());
- return authValues;
-
- }
-
public static boolean isValidConsistency(String consistency) {
for (String string : cosistencyLevel) {
if (string.equalsIgnoreCase(consistency))
diff --git a/src/test/java/org/onap/music/unittests/MusicUtilTest.java b/src/test/java/org/onap/music/unittests/MusicUtilTest.java
index 21b943f0..2b6e0f5a 100644
--- a/src/test/java/org/onap/music/unittests/MusicUtilTest.java
+++ b/src/test/java/org/onap/music/unittests/MusicUtilTest.java
@@ -180,4 +180,118 @@ public class MusicUtilTest {
assertFalse(MusicUtil.isValidConsistency("TEST"));
}
+ @Test
+ public void testLockUsing() {
+ MusicUtil.setLockUsing("testlock");
+ assertEquals("testlock", MusicUtil.getLockUsing());
+ }
+
+ @Test
+ public void testAAFAdminUrl() {
+ MusicUtil.setAafAdminUrl("aafAdminURL.com");
+ assertEquals("aafAdminURL.com", MusicUtil.getAafAdminUrl());
+ }
+
+ @Test
+ public void testAAFEndpointUrl() {
+ MusicUtil.setAafEndpointUrl("aafEndpointURL.com");
+ assertEquals("aafEndpointURL.com", MusicUtil.getAafEndpointUrl());
+ }
+
+ @Test
+ public void testNamespace() {
+ MusicUtil.setMusicNamespace("musicNamespace");
+ assertEquals("musicNamespace", MusicUtil.getMusicNamespace());
+ }
+
+ @Test
+ public void testAAFRole() {
+ MusicUtil.setAdminAafRole("aafRole");
+ assertEquals("aafRole", MusicUtil.getAdminAafRole());
+ }
+
+ @Test
+ public void testAdminId() {
+ MusicUtil.setAdminId("adminId");
+ assertEquals("adminId", MusicUtil.getAdminId());
+ }
+
+ @Test
+ public void testAdminPass() {
+ MusicUtil.setAdminPass("pass");
+ assertEquals("pass", MusicUtil.getAdminPass());
+ }
+
+ @Test
+ public void testCassaPort() {
+ MusicUtil.setCassandraPort(1234);
+ assertEquals(1234, MusicUtil.getCassandraPort());
+ }
+
+ @Test
+ public void testBuild() {
+ MusicUtil.setBuild("testbuild");
+ assertEquals("testbuild", MusicUtil.getBuild());
+ }
+
+ @Test
+ public void testNotifyInterval() {
+ MusicUtil.setNotifyInterval(123);
+ assertEquals(123, MusicUtil.getNotifyInterval());
+ }
+
+ @Test
+ public void testNotifyTimeout() {
+ MusicUtil.setNotifyTimeOut(789);
+ assertEquals(789, MusicUtil.getNotifyTimeout());
+ }
+
+ @Test
+ public void testTransId() {
+ MusicUtil.setTransIdPrefix("prefix");
+ assertEquals("prefix-", MusicUtil.getTransIdPrefix());
+ }
+
+
+ @Test
+ public void testConversationIdPrefix() {
+ MusicUtil.setConversationIdPrefix("prefix-");
+ assertEquals("prefix-", MusicUtil.getConversationIdPrefix());
+ }
+
+ @Test
+ public void testClientIdPrefix() {
+ MusicUtil.setClientIdPrefix("clientIdPrefix");
+ assertEquals("clientIdPrefix-", MusicUtil.getClientIdPrefix());
+ }
+
+ @Test
+ public void testMessageIdPrefix() {
+ MusicUtil.setMessageIdPrefix("clientIdPrefix");
+ assertEquals("clientIdPrefix-", MusicUtil.getMessageIdPrefix());
+ }
+
+ @Test
+ public void testTransIdPrefix() {
+ MusicUtil.setTransIdPrefix("transIdPrefix");
+ assertEquals("transIdPrefix-", MusicUtil.getTransIdPrefix());
+ }
+
+ @Test
+ public void testconvIdReq() {
+ MusicUtil.setConversationIdRequired("conversationIdRequired");
+ assertEquals("conversationIdRequired", MusicUtil.getConversationIdRequired());
+ }
+
+ @Test
+ public void testClientIdRequired() {
+ MusicUtil.setClientIdRequired("conversationIdRequired");
+ assertEquals("conversationIdRequired", MusicUtil.getClientIdRequired());
+ }
+
+ @Test
+ public void testMessageIdRequired() {
+ MusicUtil.setMessageIdRequired("msgIdRequired");
+ assertEquals("msgIdRequired", MusicUtil.getMessageIdRequired());
+ }
}