Merge "Cleanup JUnits"
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/JU_ErrMessageTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
similarity index 98%
rename from cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/JU_ErrMessageTest.java
rename to cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
index 7094b1a..273affd 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/JU_ErrMessageTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/client/test/JU_ErrMessageTest.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.aaf.client;
+package org.onap.aaf.cadi.aaf.client.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/marshal/JU_CertsMarshalTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/marshal/JU_CertsMarshalTest.java
deleted file mode 100644
index 9ac6b27..0000000
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/marshal/JU_CertsMarshalTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * *
- ******************************************************************************/
-package org.onap.aaf.cadi.aaf.marshal;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.aaf.cadi.aaf.marshal.CertsMarshal;
-import org.onap.aaf.misc.rosetta.ParseException;
-
-public class JU_CertsMarshalTest {
-
- @Test
- public void test() throws ParseException {
- CertsMarshal marshal = new CertsMarshal();
- assertNotNull(marshal);
- }
-
- @Test
- public void test2() throws ParseException {
- CertsMarshal marshal = new CertsMarshal();
- assertNotNull(marshal);
- }
-
- @Test
- public void test3() throws ParseException {
- CertsMarshal marshal = new CertsMarshal();
- assertNotNull(marshal);
- }
-}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthnTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthnTest.java
deleted file mode 100644
index c4000e2..0000000
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/JU_AAFAuthnTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START====================================================
- * * org.onap.aaf
- * * ===========================================================================
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * * ===========================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * * ============LICENSE_END====================================================
- * *
- * *
- ******************************************************************************/
-package org.onap.aaf.cadi.aaf.v2_0;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Mockito.when;
-
-import javax.net.ssl.HttpsURLConnection;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.onap.aaf.cadi.AbsUserCache;
-import org.onap.aaf.cadi.CadiException;
-import org.onap.aaf.cadi.aaf.AAFPermission;
-import org.onap.aaf.cadi.client.Future;
-import org.onap.aaf.cadi.config.Config;
-import org.onap.aaf.misc.env.APIException;
-
-public class JU_AAFAuthnTest {
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private AAFCon<HttpsURLConnection> con;
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private Future<String> fp;
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private AbsUserCache<AAFPermission> cache;
-
-
- @Before
- public void setup() throws APIException, CadiException {
- MockitoAnnotations.initMocks(this);
- when(con.client(Config.AAF_DEFAULT_VERSION).read("/authn/basicAuth", "text/plain")).thenReturn(fp);
- }
- /*TODO broken JUNIT with MOCKITO
- *
- * reduce size of this test file by looping thru conOfClient instead of copy pasta?
- *
- * These appear to receive data but cannot validate them. Maybe due to @before
- * Possible fixes for tomorrow: look into auth,validate, @before mockito, @mock issues?
- *
- */
- @Test
- public void testAAFAuthnAAFConOfCLIENT() throws Exception {
- when(fp.get(anyInt())).thenReturn(false);
- when(fp.code()).thenReturn(401);
- when(fp.header("WWW-Authenticate")).thenReturn("Basic realm=\"Value\"");
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn();
-// assertNotNull(auth.validate("NewUser", "New Password"));;
- }
-
- @Test
- public void testAAFAuthnAAFConOfCLIENTAbsUserCacheOfAAFPermission() throws Exception {
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn(cache);
- assertNotNull(auth);
- }
- //TODO broken JUNIT with MOCKITO
- @Test
- public void testAAFAuthnAAFConOfCLIENT1() throws Exception {
- when(fp.get(anyInt())).thenReturn(false);
- when(fp.code()).thenReturn(401);
- when(fp.header("WWW-Authenticate")).thenReturn("Basic realm=\"Value\"");
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn();
-
-// assertNotNull(auth.validate("NewUser1", "New Password1"));;
- }
-
- @Test
- public void testAAFAuthnAAFConOfCLIENTAbsUserCacheOfAAFPermission1() throws Exception {
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn(cache);
- assertNotNull(auth);
- }
- //TODO broken JUNIT with MOCKITO
- @Test
- public void testAAFAuthnAAFConOfCLIENT2() throws Exception {
- when(fp.get(anyInt())).thenReturn(false);
- when(fp.code()).thenReturn(401);
- when(fp.header("WWW-Authenticate")).thenReturn("Basic realm=\"Value\"");
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn();
-
-// assertNotNull(auth.validate("NewUser2", "New Password2"));;
- }
-
- @Test
- public void testAAFAuthnAAFConOfCLIENTAbsUserCacheOfAAFPermission2() throws Exception {
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn(cache);
- assertNotNull(auth);
-
- }
- //TODO broken JUNIT with MOCKITO
- @Test
- public void testAAFAuthnAAFConOfCLIENT3() throws Exception {
- when(fp.get(anyInt())).thenReturn(false);
- when(fp.code()).thenReturn(401);
- when(fp.header("WWW-Authenticate")).thenReturn("Basic realm=\"Value\"");
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn();
-
-// assertNotNull(auth.validate("NewUser3", "New Password3"));;
- }
-
- @Test
- public void testAAFAuthnAAFConOfCLIENTAbsUserCacheOfAAFPermission3() throws Exception {
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn(cache);
- assertNotNull(auth);
-
- }
- //TODO broken JUNIT with MOCKITO
- @Test
- public void testAAFAuthnAAFConOfCLIENT4() throws Exception {
- when(fp.get(anyInt())).thenReturn(false);
- when(fp.code()).thenReturn(401);
- when(fp.header("WWW-Authenticate")).thenReturn("Basic realm=\"Value\"");
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn();
-
-// assertNotNull(auth.validate("NewUser4", "New Password4"));;
- }
-
- @Test
- public void testAAFAuthnAAFConOfCLIENTAbsUserCacheOfAAFPermission4() throws Exception {
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn(cache);
- assertNotNull(auth);
-
- }
- //TODO broken JUNIT with MOCKITO
- @Test
- public void testAAFAuthnAAFConOfCLIENT5() throws Exception {
- when(fp.get(anyInt())).thenReturn(false);
- when(fp.code()).thenReturn(401);
- when(fp.header("WWW-Authenticate")).thenReturn("Basic realm=\"Value\"");
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn();
-
-// assertNotNull(auth.validate("NewUser5", "New Password5"));;
- }
-
- @Test
- public void testAAFAuthnAAFConOfCLIENTAbsUserCacheOfAAFPermission5() throws Exception {
- AAFAuthn<HttpsURLConnection> auth = con.newAuthn(cache);
- assertNotNull(auth);
-
- }
-}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
index c000495..4c5af01 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java
@@ -71,9 +71,7 @@
// Item i = al.first();
// i = al.next(i);
// i = al.best();
- // System.out.println("hi");
// } catch (Exception e) {
- // e.printStackTrace();
// Assert.fail();
// }
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/lur/aaf/test/JU_JMeter.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/lur/aaf/test/JU_JMeter.java
index 187a4b7..13df1ac 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/lur/aaf/test/JU_JMeter.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/lur/aaf/test/JU_JMeter.java
@@ -21,9 +21,13 @@
******************************************************************************/
package org.onap.aaf.cadi.lur.aaf.test;
+import org.junit.*;
+
import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileReader;
+import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.HttpURLConnection;
@@ -32,8 +36,6 @@
import java.util.List;
import java.util.Properties;
-import org.junit.BeforeClass;
-import org.junit.Test;
import org.onap.aaf.cadi.Permission;
import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.aaf.v2_0.AAFAuthn;
@@ -55,8 +57,17 @@
private static AAFTaf<HttpURLConnection> aafTaf;
private static PropAccess access;
+ private static ByteArrayOutputStream outStream;
+ private static ByteArrayOutputStream errStream;
+
@BeforeClass
public static void before() throws Exception {
+ outStream = new ByteArrayOutputStream();
+ errStream = new ByteArrayOutputStream();
+
+ System.setOut(new PrintStream(outStream));
+ System.setErr(new PrintStream(errStream));
+
if(aafLur==null) {
Properties props = System.getProperties();
props.setProperty("AFT_LATITUDE", "32.780140");
@@ -106,6 +117,21 @@
}
}
+ @Before
+ public void setup() {
+ outStream = new ByteArrayOutputStream();
+ errStream = new ByteArrayOutputStream();
+
+ System.setOut(new PrintStream(outStream));
+ System.setErr(new PrintStream(errStream));
+ }
+
+ @After
+ public void tearDown() {
+ System.setOut(System.out);
+ System.setErr(System.err);
+ }
+
private static class Princ implements Principal {
private String name;
public Princ(String name) {
@@ -136,7 +162,7 @@
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
- Assert.assertFalse(sw.toString(),true);
+ Assert.fail(sw.toString());
}
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthToken.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
similarity index 73%
rename from cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthToken.java
rename to cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
index 0ddb3f4..11d58ea 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthToken.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_AAFToken.java
@@ -22,53 +22,29 @@
package org.onap.aaf.cadi.oauth.test;
import static org.junit.Assert.*;
+import org.junit.*;
import java.util.UUID;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.oauth.AAFToken;
-import junit.framework.Assert;
-
-public class JU_OAuthToken {
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
+public class JU_AAFToken {
@Test
public void testMax() throws CadiException {
UUID uuid = new UUID(Long.MAX_VALUE,Long.MAX_VALUE);
String token = AAFToken.toToken(uuid);
- System.out.println(token);
UUID uuid2 = AAFToken.fromToken(token);
- Assert.assertEquals(uuid, uuid2);
+ assertEquals(uuid, uuid2);
}
@Test
public void testMin() throws CadiException {
UUID uuid = new UUID(Long.MIN_VALUE,Long.MIN_VALUE);
String token = AAFToken.toToken(uuid);
- System.out.println(token);
UUID uuid2 = AAFToken.fromToken(token);
- Assert.assertEquals(uuid, uuid2);
+ assertEquals(uuid, uuid2);
}
@Test
@@ -76,11 +52,19 @@
for(int i=0;i<100;++i) {
UUID uuid = UUID.randomUUID();
String token = AAFToken.toToken(uuid);
- System.out.println(token);
UUID uuid2 = AAFToken.fromToken(token);
- Assert.assertEquals(uuid, uuid2);
+ assertEquals(uuid, uuid2);
}
}
+ @Test
+ public void nullTest() {
+ // Invalid characters
+ assertNull(AAFToken.fromToken("~~invalid characters~~"));
+
+ // Invalid CADI tokens
+ assertNull(AAFToken.fromToken("ABCDEF"));
+ assertNull(AAFToken.fromToken("12345678901234567890123456789012345678"));
+ }
}
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
index 4092636..8d43c1b 100644
--- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java
@@ -21,6 +21,8 @@
package org.onap.aaf.cadi.oauth.test;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
import java.net.ConnectException;
import java.util.Date;
import java.util.GregorianCalendar;
@@ -51,11 +53,16 @@
public class JU_OAuthTest {
+ private ByteArrayOutputStream outStream;
+
private static PropAccess access;
private static TokenClientFactory tcf;
@BeforeClass
public static void setUpBeforeClass() {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ System.setOut(new PrintStream(outStream));
+
access = new PropAccess();
try {
tcf = TokenClientFactory.instance(access);
@@ -71,10 +78,13 @@
@Before
public void setUp() throws Exception {
+ outStream = new ByteArrayOutputStream();
+ System.setOut(new PrintStream(outStream));
}
@After
public void tearDown() throws Exception {
+ System.setOut(System.out);
}
@Test
@@ -190,32 +200,31 @@
}
}
} catch (Exception e) {
- e.printStackTrace();
// Assert.fail();
}
}
- private TokenClient testROPCFlow(final String url, final String client_id, final String client_secret, String user, String password, final String ... scope) throws Exception {
- TokenClient tclient = tcf.newClient(url,3000);
- tclient.client_creds(client_id, client_secret);
- if(user!=null && password!=null) {
- tclient.password(user,password);
- }
- Result<TimedToken> rt = tclient.getToken(scope);
- if(rt.isOK()) {
- print(rt.value);
- Result<Introspect> rti = tclient.introspect(rt.value.getAccessToken());
- if(rti.isOK()) {
- print(rti.value);
- } else {
- printAndFail(rti);
- }
- } else {
- printAndFail(rt);
- }
- return tclient;
- }
+// private TokenClient testROPCFlow(final String url, final String client_id, final String client_secret, String user, String password, final String ... scope) throws Exception {
+// TokenClient tclient = tcf.newClient(url,3000);
+// tclient.client_creds(client_id, client_secret);
+// if(user!=null && password!=null) {
+// tclient.password(user,password);
+// }
+// Result<TimedToken> rt = tclient.getToken(scope);
+// if(rt.isOK()) {
+// print(rt.value);
+// Result<Introspect> rti = tclient.introspect(rt.value.getAccessToken());
+// if(rti.isOK()) {
+// print(rti.value);
+// } else {
+// printAndFail(rti);
+// }
+// } else {
+// printAndFail(rt);
+// }
+// return tclient;
+// }
private String serviceCall(TzClient tzClient) throws Exception {
return tzClient.best(new Retryable<String>() {
@@ -230,10 +239,10 @@
}
});
}
- private void printAndFail(Result<?> rt) {
- System.out.printf("HTTP Code %d: %s\n", rt.code, rt.error);
- Assert.fail(rt.toString());
- }
+// private void printAndFail(Result<?> rt) {
+// System.out.printf("HTTP Code %d: %s\n", rt.code, rt.error);
+// Assert.fail(rt.toString());
+// }
private void print(Token t) {
GregorianCalendar exp_date = new GregorianCalendar();
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
index 30496d7..2d252ea 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java
@@ -86,128 +86,24 @@
try {
this.access = access;
// reuse DME2 Properties for convenience if specific Properties don't exist
- String keyStore = access.getProperty(Config.CADI_KEYSTORE,null);
- if(keyStore!=null && !new File(keyStore).exists()) {
- throw new CadiException(keyStore + " does not exist");
- }
- String keyStorePasswd = access.getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
- keyStorePasswd = keyStorePasswd==null?null:access.decrypt(keyStorePasswd,false);
- String trustStore = access.getProperty(Config.CADI_TRUSTSTORE, null);
- if(trustStore!=null && !new File(trustStore).exists()) {
- throw new CadiException(trustStore + " does not exist");
- }
- String trustStorePasswd = access.getProperty(Config.CADI_TRUSTSTORE_PASSWORD, null);
- trustStorePasswd = trustStorePasswd==null?"changeit"/*defacto Java Trust Pass*/:access.decrypt(trustStorePasswd,false);
- default_alias = access.getProperty(Config.CADI_ALIAS,null);
- String keyPasswd = access.getProperty(Config.CADI_KEY_PASSWORD,null);
- keyPasswd = keyPasswd==null?keyStorePasswd:access.decrypt(keyPasswd,false);
- String tips=access.getProperty(Config.CADI_TRUST_MASKS, null);
- if(tips!=null) {
- access.log(Level.INIT,"Explicitly accepting valid X509s from",tips);
- String[] ipsplit = tips.split(REGEX_COMMA);
- trustMasks = new NetMask[ipsplit.length];
- for(int i=0;i<ipsplit.length;++i) {
- try {
- trustMasks[i]=new NetMask(ipsplit[i]);
- } catch (MaskFormatException e) {
- throw new AccessException("Invalid IP Mask in " + Config.CADI_TRUST_MASKS,e);
- }
- }
- }
- String https_protocols = Config.logProp(access,Config.CADI_PROTOCOLS,
- access.getProperty(HTTPS_PROTOCOLS,HTTPS_PROTOCOLS_DEFAULT)
+ initializeKeyManager();
+
+ initializeTrustManager();
+
+ default_alias = access.getProperty(Config.CADI_ALIAS, null);
+
+ initializeTrustMasks();
+
+ String https_protocols = Config.logProp(access, Config.CADI_PROTOCOLS,
+ access.getProperty(HTTPS_PROTOCOLS, HTTPS_PROTOCOLS_DEFAULT)
);
- System.setProperty(HTTPS_PROTOCOLS,https_protocols);
+ System.setProperty(HTTPS_PROTOCOLS, https_protocols);
System.setProperty(JDK_TLS_CLIENT_PROTOCOLS, https_protocols);
if("1.7".equals(System.getProperty("java.specification.version")) && https_protocols.contains("TLSv1.2")) {
System.setProperty(Config.HTTPS_CIPHER_SUITES, Config.HTTPS_CIPHER_SUITES_DEFAULT);
- }
-
- KeyManagerFactory kmf = KeyManagerFactory.getInstance(SslKeyManagerFactoryAlgorithm);
- File file;
-
-
- if(keyStore==null || keyStorePasswd == null) {
- km = new X509KeyManager[0];
- } else {
- ArrayList<X509KeyManager> kmal = new ArrayList<X509KeyManager>();
- for(String ksname : keyStore.split(REGEX_COMMA)) {
- file = new File(ksname);
- String keystoreFormat;
- if(ksname.endsWith(".p12") || ksname.endsWith(".pkcs12")) {
- keystoreFormat = "PKCS12";
- } else {
- keystoreFormat = "JKS";
- }
- if(file.exists()) {
- FileInputStream fis = new FileInputStream(file);
- try {
- KeyStore ks = KeyStore.getInstance(keystoreFormat);
- ks.load(fis, keyStorePasswd.toCharArray());
- kmf.init(ks, keyPasswd.toCharArray());
- } finally {
- fis.close();
- }
- }
- }
- for(KeyManager km : kmf.getKeyManagers()) {
- if(km instanceof X509KeyManager) {
- kmal.add((X509KeyManager)km);
- }
- }
- km = new X509KeyManager[kmal.size()];
- kmal.toArray(km);
- }
-
- TrustManagerFactory tmf = TrustManagerFactory.getInstance(SslKeyManagerFactoryAlgorithm);
- if(trustStore!=null) {
- for(String tsname : trustStore.split(REGEX_COMMA)) {
- file = new File(tsname);
- if(file.exists()) {
- FileInputStream fis = new FileInputStream(file);
- try {
- KeyStore ts = KeyStore.getInstance("JKS");
- ts.load(fis, trustStorePasswd.toCharArray());
- tmf.init(ts);
- } finally {
- fis.close();
- }
- }
- }
- TrustManager tms[] = tmf.getTrustManagers();
- if(tms!=null) {
- tm = new X509TrustManager[tms==null?0:tms.length];
- for(int i=0;i<tms.length;++i) {
- try {
- tm[i]=(X509TrustManager)tms[i];
- } catch (ClassCastException e) {
- access.log(Level.WARN, "Non X509 TrustManager", tm[i].getClass().getName(),"skipped in SecurityInfo");
- }
- }
- }
- }
-
- if(trustMasks!=null) {
- final HostnameVerifier origHV = HttpsURLConnection.getDefaultHostnameVerifier();
- HttpsURLConnection.setDefaultHostnameVerifier(maskHV = new HostnameVerifier() {
- @Override
- public boolean verify(final String urlHostName, final SSLSession session) {
- try {
- // This will pick up /etc/host entries as well as DNS
- InetAddress ia = InetAddress.getByName(session.getPeerHost());
- for(NetMask tmask : trustMasks) {
- if(tmask.isInNet(ia.getHostAddress())) {
- return true;
- }
- }
- } catch (UnknownHostException e) {
- // It's ok. do normal Verify
- }
- return origHV.verify(urlHostName,session);
- };
- });
- }
+ }
+
ctx = SSLContext.getInstance("TLS");
ctx.init(km, tm, null);
SSLContext.setDefault(ctx);
@@ -249,9 +145,134 @@
public void setSocketFactoryOn(HttpsURLConnection hsuc) {
hsuc.setSSLSocketFactory(scf);
- if(maskHV!=null && !maskHV.equals(hsuc.getHostnameVerifier())) {
+ if(maskHV != null && !maskHV.equals(hsuc.getHostnameVerifier())) {
hsuc.setHostnameVerifier(maskHV);
}
}
+
+ protected void initializeKeyManager() throws CadiException, IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException, UnrecoverableKeyException {
+ String keyStore = access.getProperty(Config.CADI_KEYSTORE, null);
+ if(keyStore != null && !new File(keyStore).exists()) {
+ throw new CadiException(keyStore + " does not exist");
+ }
+ String keyStorePasswd = access.getProperty(Config.CADI_KEYSTORE_PASSWORD, null);
+ keyStorePasswd = (keyStorePasswd == null) ? null : access.decrypt(keyStorePasswd, false);
+
+ String keyPasswd = access.getProperty(Config.CADI_KEY_PASSWORD, null);
+ keyPasswd = (keyPasswd == null) ? keyStorePasswd : access.decrypt(keyPasswd, false);
+
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(SslKeyManagerFactoryAlgorithm);
+ if(keyStore == null || keyStorePasswd == null) {
+ km = new X509KeyManager[0];
+ } else {
+ ArrayList<X509KeyManager> kmal = new ArrayList<X509KeyManager>();
+ File file;
+ for(String ksname : keyStore.split(REGEX_COMMA)) {
+ file = new File(ksname);
+ String keystoreFormat;
+ if(ksname.endsWith(".p12") || ksname.endsWith(".pkcs12")) {
+ keystoreFormat = "PKCS12";
+ } else {
+ keystoreFormat = "JKS";
+ }
+ if(file.exists()) {
+ FileInputStream fis = new FileInputStream(file);
+ try {
+ KeyStore ks = KeyStore.getInstance(keystoreFormat);
+ ks.load(fis, keyStorePasswd.toCharArray());
+ kmf.init(ks, keyPasswd.toCharArray());
+ } finally {
+ fis.close();
+ }
+ }
+ }
+ for(KeyManager km : kmf.getKeyManagers()) {
+ if(km instanceof X509KeyManager) {
+ kmal.add((X509KeyManager)km);
+ }
+ }
+ km = new X509KeyManager[kmal.size()];
+ kmal.toArray(km);
+ }
+ }
+
+ protected void initializeTrustManager() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, CadiException {
+ String trustStore = access.getProperty(Config.CADI_TRUSTSTORE, null);
+ if(trustStore != null && !new File(trustStore).exists()) {
+ throw new CadiException(trustStore + " does not exist");
+ }
+
+ String trustStorePasswd = access.getProperty(Config.CADI_TRUSTSTORE_PASSWORD, null);
+ trustStorePasswd = (trustStorePasswd == null) ? "changeit"/*defacto Java Trust Pass*/ : access.decrypt(trustStorePasswd, false);
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(SslKeyManagerFactoryAlgorithm);
+ if(trustStore != null) {
+ File file;
+ for(String tsname : trustStore.split(REGEX_COMMA)) {
+ file = new File(tsname);
+ if(file.exists()) {
+ FileInputStream fis = new FileInputStream(file);
+ try {
+ KeyStore ts = KeyStore.getInstance("JKS");
+ ts.load(fis, trustStorePasswd.toCharArray());
+ tmf.init(ts);
+ } finally {
+ fis.close();
+ }
+ }
+ }
+
+ TrustManager tms[] = tmf.getTrustManagers();
+ if(tms != null) {
+ tm = new X509TrustManager[(tms == null) ? 0 : tms.length];
+ for(int i = 0; i < tms.length; ++i) {
+ try {
+ tm[i] = (X509TrustManager)tms[i];
+ } catch (ClassCastException e) {
+ access.log(Level.WARN, "Non X509 TrustManager", tm[i].getClass().getName(), "skipped in SecurityInfo");
+ }
+ }
+ }
+ }
+
+ }
+
+ protected void initializeTrustMasks() throws AccessException {
+ String tips = access.getProperty(Config.CADI_TRUST_MASKS, null);
+ if(tips != null) {
+ access.log(Level.INIT, "Explicitly accepting valid X509s from", tips);
+ String[] ipsplit = tips.split(REGEX_COMMA);
+ trustMasks = new NetMask[ipsplit.length];
+ for(int i = 0; i < ipsplit.length; ++i) {
+ try {
+ trustMasks[i] = new NetMask(ipsplit[i]);
+ } catch (MaskFormatException e) {
+ throw new AccessException("Invalid IP Mask in " + Config.CADI_TRUST_MASKS, e);
+ }
+ }
+ }
+
+ if(trustMasks != null) {
+ final HostnameVerifier origHV = HttpsURLConnection.getDefaultHostnameVerifier();
+ HttpsURLConnection.setDefaultHostnameVerifier(maskHV = new HostnameVerifier() {
+ @Override
+ public boolean verify(final String urlHostName, final SSLSession session) {
+ try {
+ // This will pick up /etc/host entries as well as DNS
+ InetAddress ia = InetAddress.getByName(session.getPeerHost());
+ for(NetMask tmask : trustMasks) {
+ if(tmask.isInNet(ia.getHostAddress())) {
+ return true;
+ }
+ }
+ } catch (UnknownHostException e) {
+ // It's ok. do normal Verify
+ }
+ return origHV.verify(urlHostName, session);
+ };
+ });
+ }
+ }
+
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_Get.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_Get.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
index 5f89060..586c50c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_Get.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_Get.java
@@ -19,7 +19,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.config;
+package org.onap.aaf.cadi.config.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_GetAccess.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_GetAccess.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_GetAccess.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_GetAccess.java
index 5acd39f..36da307 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_GetAccess.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_GetAccess.java
@@ -19,7 +19,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.config;
+package org.onap.aaf.cadi.config.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_MultiGet.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MultiGet.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_MultiGet.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MultiGet.java
index e678421..6510bdc 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_MultiGet.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_MultiGet.java
@@ -19,7 +19,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.config;
+package org.onap.aaf.cadi.config.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_SecurityInfoC.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_SecurityInfoC.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
index ecd514f..27014b9 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_SecurityInfoC.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_SecurityInfoC.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.config;
+package org.onap.aaf.cadi.config.test;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_UsersDump.java b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_UsersDump.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_UsersDump.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_UsersDump.java
index f6e366a..63b8cf2 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/config/JU_UsersDump.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/config/test/JU_UsersDump.java
@@ -19,13 +19,11 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.config;
+package org.onap.aaf.cadi.config.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
-import static org.mockito.Mockito.*;
import org.junit.*;
-import org.mockito.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/filter/JU_FCGetTest.java b/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_FCGetTest.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/filter/JU_FCGetTest.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_FCGetTest.java
index 967334a..694c59e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/filter/JU_FCGetTest.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/filter/test/JU_FCGetTest.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.filter;
+package org.onap.aaf.cadi.filter.test;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_ConfigPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_ConfigPrincipal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
index 897744e..9853f88 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_ConfigPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_ConfigPrincipal.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.lur;
+package org.onap.aaf.cadi.lur.test;
import org.junit.*;
import static org.junit.Assert.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_LocalLur.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_LocalLur.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
index 8388fa5..fd8e357 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_LocalLur.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalLur.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.lur;
+package org.onap.aaf.cadi.lur.test;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_LocalPermission.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalPermission.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_LocalPermission.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalPermission.java
index abc178a..f4b051a 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_LocalPermission.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_LocalPermission.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.lur;
+package org.onap.aaf.cadi.lur.test;
import static org.junit.Assert.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_NullLur.java b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_NullLur.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_NullLur.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_NullLur.java
index d5740b3..1a7293d 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/lur/JU_NullLur.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/lur/test/JU_NullLur.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.lur;
+package org.onap.aaf.cadi.lur.test;
import java.security.Principal;
import java.util.List;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_BasicPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_BasicPrincipal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
index 0faaca1..dee7fc2 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_BasicPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_BasicPrincipal.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_CachedBasicPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_CachedBasicPrincipal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
index 39da6c0..aa9a01a 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_CachedBasicPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_CachedBasicPrincipal.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_Kind.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_Kind.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
index c66539c..e9bd799 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_Kind.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_Kind.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_OAuth2FormPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_OAuth2FormPrincipal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
index a7c14aa..c0b1c2a 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_OAuth2FormPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_OAuth2FormPrincipal.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_StringTagLookup.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_StringTagLookup.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
index ff1f3f8..cce8625 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_StringTagLookup.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_StringTagLookup.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_TaggedPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_TaggedPrincipal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
index 4674db7..2bbfee2 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_TaggedPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TaggedPrincipal.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_TrustPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_TrustPrincipal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
index 4a7333e..12b4bc9 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_TrustPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_TrustPrincipal.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_UnAuthPrincipal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_UnAuthPrincipal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
index 9d694a5..c009513 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_UnAuthPrincipal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_UnAuthPrincipal.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_X509Principal.java b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_X509Principal.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
index a45ce24..e62dda4 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/principal/JU_X509Principal.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/principal/test/JU_X509Principal.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.principal;
+package org.onap.aaf.cadi.principal.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/dos/JU_DenialOfServiceTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
similarity index 99%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/dos/JU_DenialOfServiceTaf.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
index 40933b4..ce49654 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/dos/JU_DenialOfServiceTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/dos/test/JU_DenialOfServiceTaf.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.taf.dos;
+package org.onap.aaf.cadi.taf.dos.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_EpiTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_EpiTaf.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
index baab0b6..a119059 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_EpiTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_EpiTaf.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.taf;
+package org.onap.aaf.cadi.taf.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_NullTaf.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_NullTaf.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
index 9131172..f42184d 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_NullTaf.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_NullTaf.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.taf;
+package org.onap.aaf.cadi.taf.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_PuntTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_PuntTafResp.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
index 8c5397d..516f404 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_PuntTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_PuntTafResp.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.taf;
+package org.onap.aaf.cadi.taf.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_TrustNotTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_TrustNotTafResp.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
index 798348e..b032c02 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_TrustNotTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustNotTafResp.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.taf;
+package org.onap.aaf.cadi.taf.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_TrustTafResp.java b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_TrustTafResp.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
index 04e3a1f..10b5f14 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/taf/JU_TrustTafResp.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/taf/test/JU_TrustTafResp.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.taf;
+package org.onap.aaf.cadi.taf.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Chmod.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Chmod.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
index 215980f..6211418 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Chmod.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Chmod.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_FQI.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_FQI.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
index 5717783..bcd2f77 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_FQI.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_FQI.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_JsonOutputStream.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_JsonOutputStream.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
index d07652a..da3557c 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_JsonOutputStream.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_JsonOutputStream.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_MaskFormatException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_MaskFormatException.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
index 6a60df6..ea74343 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_MaskFormatException.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_MaskFormatException.java
@@ -20,7 +20,7 @@
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_NetMask.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
similarity index 97%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_NetMask.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
index be3b1b3..403f1f1 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_NetMask.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_NetMask.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.assertEquals;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Pool.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Pool.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
index ef4bc68..7920932 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Pool.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Split.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Split.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
index e375f6c..12be4e1 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Split.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Split.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_SubStandardConsole.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_SubStandardConsole.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
index 9e6a175..4d8e8f8 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_SubStandardConsole.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_SubStandardConsole.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_TheConsole.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
similarity index 96%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_TheConsole.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
index f168c7f..40f88a3 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_TheConsole.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_TheConsole.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.assertEquals;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_UserChainManip.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_UserChainManip.java
similarity index 98%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_UserChainManip.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_UserChainManip.java
index 949d034..21f8c21 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_UserChainManip.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_UserChainManip.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Vars.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
similarity index 99%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Vars.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
index 345c8ca..32ca8f8 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/util/JU_Vars.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java
@@ -18,7 +18,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.util;
+package org.onap.aaf.cadi.util.test;
import static org.junit.Assert.assertEquals;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/wsse/JU_WSSE_Read.java b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSE_Read.java
similarity index 99%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/wsse/JU_WSSE_Read.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSE_Read.java
index 26dd43b..599987d 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/wsse/JU_WSSE_Read.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_WSSE_Read.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.wsse;
+package org.onap.aaf.cadi.wsse.test;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/wsse/JU_XReader.java b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
similarity index 99%
rename from cadi/core/src/test/java/org/onap/aaf/cadi/test/wsse/JU_XReader.java
rename to cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
index dd90e22..15fe114 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/wsse/JU_XReader.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/wsse/test/JU_XReader.java
@@ -19,7 +19,7 @@
* *
* *
******************************************************************************/
-package org.onap.aaf.cadi.test.wsse;
+package org.onap.aaf.cadi.wsse.test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;