aboutsummaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorsg481n <sg481n@att.com>2017-10-02 20:56:03 +0000
committersg481n <sg481n@att.com>2017-10-02 20:56:08 +0000
commitf27fd3309a24006a6cbb0fec7f41edae8759aa1c (patch)
tree37ae303ef32711fdaa07fa05fc33a233b186bd41 /core/src
parenta73c9f7ff27e074cf64aa798705c898911cf7439 (diff)
Improve code coverage for aaf cadi modules
Issue-ID: AAF-79 Change-Id: I51d05fb06eae4d8adedfd3efe4e143dc5bc990d0 Signed-off-by: sg481n <sg481n@att.com>
Diffstat (limited to 'core/src')
-rw-r--r--core/src/test/java/org/onap/aaf/cadi/JU_PropAccessTest.java21
-rw-r--r--core/src/test/java/org/onap/aaf/cadi/lur/JU_ConfigPrincipalTest.java33
2 files changed, 54 insertions, 0 deletions
diff --git a/core/src/test/java/org/onap/aaf/cadi/JU_PropAccessTest.java b/core/src/test/java/org/onap/aaf/cadi/JU_PropAccessTest.java
index 163058a..907b5e1 100644
--- a/core/src/test/java/org/onap/aaf/cadi/JU_PropAccessTest.java
+++ b/core/src/test/java/org/onap/aaf/cadi/JU_PropAccessTest.java
@@ -83,6 +83,27 @@ public class JU_PropAccessTest {
String[] args = {"key=value1","wow=wow1"};
p = new PropAccess(args);
}
+
+ @Test
+ public void testPropAccesstwo() throws IOException {
+ PropAccess p = new PropAccess(new Object());
+
+ assertNotNull(p);
+ assertNotNull(p.getProperties());
+ assertNull(p.getProperty("everythingone"));
+
+ p.setProperty("prop12", "value12");
+ assertEquals(p.getProperty("prop12"), "value12");
+
+ p.setProperty(Config.CADI_KEYFILE, "value12");
+ assertEquals(p.getProperty("prop12"), "value12");
+
+ p.setLogLevel(Level.INFO);
+ assertTrue(p.willLog(Level.INFO));
+ p.log(Level.DEBUG, new Object());
+ String[] args = {"key=value12","wow=wow12"};
+ p = new PropAccess(args);
+ }
}
diff --git a/core/src/test/java/org/onap/aaf/cadi/lur/JU_ConfigPrincipalTest.java b/core/src/test/java/org/onap/aaf/cadi/lur/JU_ConfigPrincipalTest.java
index a8a413f..ec5d0a8 100644
--- a/core/src/test/java/org/onap/aaf/cadi/lur/JU_ConfigPrincipalTest.java
+++ b/core/src/test/java/org/onap/aaf/cadi/lur/JU_ConfigPrincipalTest.java
@@ -135,4 +135,37 @@ public class JU_ConfigPrincipalTest {
assertEquals(p.toString(), "Demo");
assertTrue(p.getAsBasicAuthHeader().startsWith("Basic"));
}
+
+ @Test
+ public void testConfigPrincipalStringByteArray5() throws IOException {
+ byte[] bytes = "password".getBytes();
+ ConfigPrincipal p = new ConfigPrincipal("Demo", bytes);
+
+ assertEquals(p.getName(), "Demo");
+ assertEquals(p.getCred(), bytes);
+ assertEquals(p.toString(), "Demo");
+ assertTrue(p.getAsBasicAuthHeader().startsWith("Basic"));
+ }
+
+ @Test
+ public void testConfigPrincipalStringByteArray6() throws IOException {
+ byte[] bytes = "password".getBytes();
+ ConfigPrincipal p = new ConfigPrincipal("Demo", bytes);
+
+ assertEquals(p.getName(), "Demo");
+ assertEquals(p.getCred(), bytes);
+ assertEquals(p.toString(), "Demo");
+ assertTrue(p.getAsBasicAuthHeader().startsWith("Basic"));
+ }
+
+ @Test
+ public void testConfigPrincipalStringByteArray7() throws IOException {
+ byte[] bytes = "password".getBytes();
+ ConfigPrincipal p = new ConfigPrincipal("Demo", bytes);
+
+ assertEquals(p.getName(), "Demo");
+ assertEquals(p.getCred(), bytes);
+ assertEquals(p.toString(), "Demo");
+ assertTrue(p.getAsBasicAuthHeader().startsWith("Basic"));
+ }
}