summaryrefslogtreecommitdiffstats
path: root/auth/auth-core
diff options
context:
space:
mode:
Diffstat (limited to 'auth/auth-core')
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java85
-rw-r--r--auth/auth-core/test/keyfile27
2 files changed, 74 insertions, 38 deletions
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java
index 6413b099..8630aadf 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/env/test/JU_AuthzEnv.java
@@ -21,87 +21,97 @@
******************************************************************************/
package org.onap.aaf.auth.env.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
+import org.junit.*;
import java.io.IOException;
import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
import java.util.Properties;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.cadi.Access;
import org.onap.aaf.cadi.PropAccess;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.onap.aaf.cadi.config.Config;
-import junit.framework.Assert;
-
-@RunWith(PowerMockRunner.class)
public class JU_AuthzEnv {
- private static final org.onap.aaf.cadi.Access.Level DEBUG = null;
+
AuthzEnv authzEnv;
- enum Level {DEBUG, INFO, AUDIT, INIT, WARN, ERROR};
+
+ ByteArrayOutputStream outStream;
+ ByteArrayOutputStream errStream;
@Before
- public void setUp(){
- PropAccess access = null;
- Properties props = null;
+ public void setUp() {
+ outStream = new ByteArrayOutputStream();
+ errStream = new ByteArrayOutputStream();
+
+ System.setOut(new PrintStream(outStream));
+ System.setErr(new PrintStream(errStream));
+
authzEnv = new AuthzEnv();
+ }
+
+ @After
+ public void tearDown() {
+ System.setOut(System.out);
+ System.setErr(System.err);
+ }
+
+ @Test
+ @SuppressWarnings("unused")
+ public void testConstructors() {
AuthzEnv authzEnv1 = new AuthzEnv("Test");
- AuthzEnv authzEnv2 = new AuthzEnv(props);
- AuthzEnv authzEnv3 = new AuthzEnv(access);
+ AuthzEnv authzEnv2 = new AuthzEnv((PropAccess)null);
+ AuthzEnv authzEnv3 = new AuthzEnv((Properties)null);
}
@Test
public void testTransRate() {
- Long Result = authzEnv.transRate();
- assertNotNull(Result);
+ Long Result = authzEnv.transRate();
+ assertNotNull(Result);
}
@Test
public void checkNewTransNoAvg() {
-
- Assert.assertNotNull(authzEnv.newTransNoAvg());
+ assertNotNull(authzEnv.newTransNoAvg());
}
@Test
public void checkNewTrans() {
- Assert.assertNotNull(authzEnv.newTrans());
+ assertNotNull(authzEnv.newTrans());
}
@Test
public void checkPropAccess() {
- Assert.assertNotNull(authzEnv.access());
+ assertNotNull(authzEnv.access());
}
@Test
public void checkgetProperties() { //TODO:[GABE]No setter for this, add?
- Assert.assertNotNull(authzEnv.getProperties());
- Assert.assertNotNull(authzEnv.getProperties("test"));
+ assertNotNull(authzEnv.getProperties());
+ assertNotNull(authzEnv.getProperties("test"));
}
@Test
public void checkPropertyGetters(){
authzEnv.setProperty("key","value");
- Assert.assertEquals(authzEnv.getProperty("key"), "value");
- Assert.assertEquals(authzEnv.getProperty("key","value"), "value");
+ assertEquals(authzEnv.getProperty("key"), "value");
+ assertEquals(authzEnv.getProperty("key","value"), "value");
}
@Test
public void checkPropertySetters(){
- Assert.assertEquals(authzEnv.getProperty("key","value"), authzEnv.setProperty("key","value"));
+ assertEquals(authzEnv.getProperty("key","value"), authzEnv.setProperty("key","value"));
}
-// @Test(expected = IOException.class) //TODO: AAF-111 make fail not happen
-// public void testDecryptException() throws IOException{
-// String encrypted = "enc:";
-// authzEnv.setProperty(Config.CADI_KEYFILE, "test");//TODO: Figure out setter for this
-// authzEnv.decrypt(encrypted, true);
-// authzEnv.decrypt("", false); //TODO: AAF-111 fail without logging a fail
-// }
+ @Test(expected = IOException.class)
+ public void testDecryptException() throws IOException{
+ authzEnv.setProperty(Config.CADI_KEYFILE, "test/keyfile");
+ authzEnv.decrypt(null, false);
+ }
@Test
public void testDecrypt() throws IOException{
@@ -114,7 +124,7 @@ public class JU_AuthzEnv {
public void testClassLoader() {
ClassLoader cLoad = mock(ClassLoader.class);
cLoad = authzEnv.classLoader();
- Assert.assertNotNull(cLoad);
+ assertNotNull(cLoad);
}
@Test
@@ -149,10 +159,9 @@ public class JU_AuthzEnv {
Access.Level lvl = Access.Level.DEBUG;
Access.Level lvl1 = Access.Level.AUDIT;
boolean test = authzEnv.willLog(lvl);
- Assert.assertFalse(test);
+ assertFalse(test);
test = authzEnv.willLog(lvl1);
- Assert.assertTrue(test);
-
+ assertTrue(test);
}
@Test
diff --git a/auth/auth-core/test/keyfile b/auth/auth-core/test/keyfile
new file mode 100644
index 00000000..e84bd616
--- /dev/null
+++ b/auth/auth-core/test/keyfile
@@ -0,0 +1,27 @@
+9zgJxUXT1CrzC_A2Z0PdKi3n9l6zmErB26ZlSXCCyloxi3bGqD3lNHC3aFHfgC8-ZwNMuLBM93WY
+JV4sEacNodHGjgmAqSVyMHiPTEP4XRrydfjXAvaBIERcU1Yvu4pa4Mq25RXLHt8tIAnToFVbq82n
+bjkfdcv2-shgwkEvRiNIdK5TITO8JTvTRWND5MqXc9gnCKkR6Rl5dU5QGIB2SxWOPCvKBBWeUGRO
+bSinrjkI-iXabuLOYUaGo6FI_XAU5S9WxvfrDVpBijUAGJW8QZe1oBIo5QmQlx6ONB4ohjEu89ZZ
+gTee22MvSNUvaT8IGbj_Zt_TyuCqcdmkVahWp5ffeK2J3bmHActAC2IxXD4yV-sFLB7PW7I8KMA7
+tML3Lcy9ozmYa2E8N8B9uQ0zMHz_TVpPvj5xkVF4_FEKOTD1mkf-JYC1CyzwJS2YWWxO6fqsxIjD
+1qB4OJudv4RK6hSxdVrNxc_wchVAGXV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