Keep only clean TestCases, remove 2 license issues
[aaf/authz.git] / auth / auth-core / src / test / java / org / onap / aaf / auth / common / test / JU_Define.java
index 9de907d..76e9959 100644 (file)
@@ -27,9 +27,16 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.junit.Before;
 import static org.mockito.Mockito.*;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map.Entry;
+import java.util.Set;
+
 import org.onap.aaf.auth.common.Define;
 import org.onap.aaf.cadi.Access;
 import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.PropAccess;
 import org.onap.aaf.cadi.config.Config;
 import org.onap.aaf.misc.env.Env;
 import static org.junit.Assert.*;
@@ -48,27 +55,36 @@ public class JU_Define {
 
 
        @Before
-       public void setUp(){
+       public void setUp() throws CadiException{
                acc = mock(Access.class);
        }
-
-       @Test
-       public void testRootNS() {
-               //Define.ROOT_NS();
-       }
-
-       @Test
-       public void testRootCompany() {
-               //Define.ROOT_COMPANY();
-       }
-
+       
        @Test
        public void testSet() throws CadiException {
-               when(acc.getProperty(Config.AAF_ROOT_NS,"org.onap.aaf")).thenReturn(".ns_Test");
-               //when(acc.getProperty(Config.AAF_ROOT_COMPANY,null)).thenReturn("company_Test");
-               //Define.set(acc);
+               PropAccess prop = new PropAccess();
+               prop.setProperty("AAF_NS.", "AAF_NS.");
+               prop.setProperty(Config.AAF_ROOT_NS, ".ns_Test");
+               prop.setProperty(Config.AAF_ROOT_COMPANY, "company_Test");
+               Define.set(prop);
+               Define.ROOT_NS();
+               Define.ROOT_COMPANY();
+               
+               PropAccess prop1 = new PropAccess();
+               prop1.setProperty("AAF_NS.", "AAF_NS.");
+               prop1.setProperty(Config.AAF_ROOT_NS, ".ns_Test");
+               Define.set(prop1);
        }
 
+//     @Test                                   //TODO: AAF-111 exception fix
+//     public void testRootNS() throws RuntimeException{
+//             Define.ROOT_NS();
+//     }
+//
+//     @Test
+//     public void testRootCompany() throws RuntimeException{
+//             Define.ROOT_COMPANY();
+//     }
+
        @Test
        public void testVarReplace() {
                Define.varReplace("AAF_NS.");