summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth/auth-cass/docker/backup/backup.sh26
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java6
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java3
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java97
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java98
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java35
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java42
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java23
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java4
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java28
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java27
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java27
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java29
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java27
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java79
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java105
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java48
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java18
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java63
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java30
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java30
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java90
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java34
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java32
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java34
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java32
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java33
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java35
-rw-r--r--auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java30
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java15
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java8
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java21
-rw-r--r--auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java5
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java2
-rw-r--r--cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java4
-rw-r--r--cadi/shiro/pom.xml8
36 files changed, 878 insertions, 350 deletions
diff --git a/auth/auth-cass/docker/backup/backup.sh b/auth/auth-cass/docker/backup/backup.sh
index db59d16e..1359d3de 100644
--- a/auth/auth-cass/docker/backup/backup.sh
+++ b/auth/auth-cass/docker/backup/backup.sh
@@ -1,28 +1,32 @@
# BEGIN Store prev
-if [ -e "6day" ]; then
- rm -Rf 6day
+BD=/opt/app/osaaf/backup
+if [ -e "$BD/6day" ]; then
+ rm -Rf $BD/6day
fi
-PREV=6day
-for D in 5day 4day 3day 2day yesterday; do
+PREV=$BD/6day
+for D in $BD/5day $BD/4day $BD/3day $BD/2day $BD/yesterday; do
if [ -e "$D" ]; then
mv "$D" "$PREV"
fi
PREV="$D"
done
-if [ -e "today" ]; then
- mv today yesterday
- gzip yesterday/*
+if [ -e "$BD/today" ]; then
+ if [ -e "$BD/backup.log" ]; then
+ mv $BD/backup.log $BD/today
+ fi
+ gzip $BD/today/*
+ mv $BD/today $BD/yesterday
fi
+mkdir $BD/today
+
# END Store prev
date
docker exec -t aaf_cass bash -c "mkdir -p /opt/app/cass_backup"
-docker container cp cbackup.sh aaf_cass:/opt/app/cass_backup/backup.sh
+docker container cp $BD/cbackup.sh aaf_cass:/opt/app/cass_backup/backup.sh
# echo "login as Root, then run \nbash /opt/app/cass_backup/backup.sh"
docker exec -t aaf_cass bash /opt/app/cass_backup/backup.sh
-mkdir today
-docker container cp aaf_cass:/opt/app/cass_backup/. today
-
+docker container cp aaf_cass:/opt/app/cass_backup/. $BD/today
date
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
index 1f679075..b7b17c90 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
@@ -40,23 +40,23 @@ import org.onap.aaf.auth.dao.cass.DelegateDAO;
import org.onap.aaf.auth.dao.cass.FutureDAO;
import org.onap.aaf.auth.dao.cass.Namespace;
import org.onap.aaf.auth.dao.cass.NsDAO;
+import org.onap.aaf.auth.dao.cass.NsDAO.Data;
import org.onap.aaf.auth.dao.cass.NsSplit;
import org.onap.aaf.auth.dao.cass.NsType;
import org.onap.aaf.auth.dao.cass.PermDAO;
import org.onap.aaf.auth.dao.cass.RoleDAO;
import org.onap.aaf.auth.dao.cass.Status;
import org.onap.aaf.auth.dao.cass.UserRoleDAO;
-import org.onap.aaf.auth.dao.cass.NsDAO.Data;
import org.onap.aaf.auth.dao.hl.Question.Access;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.env.AuthzTrans.REQD_TYPE;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.auth.org.Executor;
import org.onap.aaf.auth.org.Organization;
-import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.auth.org.Organization.Expiration;
import org.onap.aaf.auth.org.Organization.Identity;
import org.onap.aaf.auth.org.Organization.Policy;
+import org.onap.aaf.auth.org.OrganizationException;
public class Function {
@@ -735,7 +735,7 @@ public class Function {
private Result<Void> checkValidID(AuthzTrans trans, Date now, String user) {
Organization org = trans.org();
- if (user.endsWith(org.getRealm())) {
+ if (org.supportsRealm(user)) {
try {
if (org.getIdentity(trans, user) == null) {
return Result.err(Status.ERR_Denied,
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java
index e87df80b..bbc84ecb 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/JU_Cmd.java
@@ -28,6 +28,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
+import static org.mockito.Mockito.*;
import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.Cmd;
import org.onap.aaf.auth.cmd.Param;
@@ -49,8 +50,6 @@ import org.onap.aaf.misc.env.impl.BasicEnv;
import aaf.v2_0.History;
import aaf.v2_0.History.Item;
-import static org.mockito.Mockito.*;
-
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
index 4da21e82..a3f3f42a 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Admin.java
@@ -22,8 +22,17 @@
package org.onap.aaf.auth.cmd.test.ns;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -31,42 +40,70 @@ import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.ns.Admin;
+import org.onap.aaf.auth.cmd.ns.ListUsersContact;
import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Admin {
-// private static Admin admin;
-//
-// @BeforeClass
-// public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = org.onap.aaf.auth.cmd.test.JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// admin = new Admin(ns);
-// }
-//
-// @Test
-// public void exec() {
-// try {
-// assertEquals(admin._exec(0, "add", "del", "reset", "extend"), 500);
-// } catch (Exception e) {
-// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-// }
-// }
-//
+ private static Admin admin;
+
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+
+ @Before
+ public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ NS ns = new NS(aafcli);
+ admin = new Admin(ns);
+
+ }
+
// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// admin.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
+// public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+// Item value = mock(Item.class);
+// Locator.Item item = new Locator.Item() {
+// };
+// when(loc.best()).thenReturn(value);
+// URI uri = new URI("http://java.sun.com/j2se/1.3/");
+// when(loc.get(value)).thenReturn(uri);
+// SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+// HRcli hcli = new HRcli(hman, uri, item, secSet);
+// String[] strArr = {"add", "del","add","add"};
+// admin._exec(0, strArr);
+//
// }
-
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ admin.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
index 4ef49cbc..3dd338fe 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Attrib.java
@@ -22,9 +22,23 @@
package org.onap.aaf.auth.cmd.test.ns;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import static org.mockito.Mockito.*;
+import org.mockito.Mockito;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,41 +47,65 @@ import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.ns.Attrib;
import org.onap.aaf.auth.cmd.ns.NS;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Attrib {
-// private static Attrib attrib;
-//
-// @BeforeClass
-// public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// attrib = new Attrib(ns);
-// }
-//
-// @Test
-// public void exec() {
-// try {
-// attrib._exec(0, "add", "del", "reset", "extend");
-// } catch (Exception e) {
-// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-// }
-// }
-//
+ private static Attrib attrib;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+ @Before
+ public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ NS ns = new NS(aafcli);
+ attrib = new Attrib(ns);
+ }
+
// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// attrib.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
+// public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+// Item value = mock(Item.class);
+// Locator.Item item = new Locator.Item() {
+// };
+// when(loc.best()).thenReturn(value);
+// URI uri = new URI("http://java.sun.com/j2se/1.3/");
+// when(loc.get(value)).thenReturn(uri);
+// SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+// HRcli hcli = new HRcli(hman, uri, item, secSet);
+// String[] strArr = {"add","upd","del","add","upd","del"};
+// attrib._exec(0, strArr);
+//
// }
-
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ attrib.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java
index 86e05539..592f6274 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Create.java
@@ -39,28 +39,25 @@ public class JU_Create {
private static Create create;//might need to replace import with org.onap.aaf.auth.cmd.perm
-// @BeforeClass
-// public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// create = new Create(ns);
-// }
-
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @BeforeClass
+ public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ create = new Create(ns);
}
+
+
- //@Test
- public void exec() {
- try {
- assertEquals(create._exec(0, "add", "del", "reset", "extend"), 500);
- } catch (Exception e) {
- assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
- }
- }
+// @Test
+// public void exec() {
+// try {
+// assertEquals(create._exec(0, "add", "del", "reset", "extend"), 500);
+// } catch (Exception e) {
+// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
+// }
+// }
- //@Test
+ @Test
public void detailedHelp() {
boolean hasNoError = true;
try {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java
index 0623b095..c4086818 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Delete.java
@@ -39,16 +39,16 @@ import org.onap.aaf.misc.env.APIException;
public class JU_Delete {
-// private static Delete delete;//import may be org.onap.aaf.auth.cmd.perm
-//
-// @BeforeClass
-// public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// delete = new Delete(ns);
-//
-// }
-//
+ private static Delete delete;//import may be org.onap.aaf.auth.cmd.perm
+
+ @BeforeClass
+ public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ delete = new Delete(ns);
+
+ }
+
// @Test
// public void exec() {
// try {
@@ -57,17 +57,17 @@ public class JU_Delete {
// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
// }
// }
-//
-// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// delete.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
-// }
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ delete.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
+ }
@Test //TODO: Temporary fix AAF-111
public void netYetTested() {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java
index 7c65939b..7bec934f 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Describe.java
@@ -45,14 +45,14 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Describe {
-// private static Describe desc;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// desc = new Describe(ns);
-// }
+ private static Describe desc;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ desc = new Describe(ns);
+ }
//
// @Test
// public void exec() {
@@ -70,9 +70,10 @@ public class JU_Describe {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ desc.detailedHelp(0, sb );
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java
index 99ad284b..f62a8182 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java
@@ -14,10 +14,10 @@
* 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.auth.cmd.test.ns;
import static org.junit.Assert.*;
@@ -78,5 +78,5 @@ public class JU_List {
list.report(null, "test");
list.report(fu, "test");
}
-
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java
index 9ff82d13..c36088f3 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListActivity.java
@@ -42,16 +42,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
-// private static ListActivity lsActivity;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// List ls = new List(ns);
-// lsActivity = new ListActivity(ls);
-// }
-//
+ private static ListActivity lsActivity;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ List ls = new List(ns);
+ lsActivity = new ListActivity(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -68,9 +68,11 @@ public class JU_ListActivity {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsActivity.detailedHelp(0, sb );
}
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java
index aacf842e..40136f2e 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListAdminResponsible.java
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListAdminResponsible {
-// private static ListAdminResponsible lsAdminRes;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// List ls = new List(ns);
-// lsAdminRes = new ListAdminResponsible(ls);
-// }
-//
+ private static ListAdminResponsible lsAdminRes;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ List ls = new List(ns);
+ lsAdminRes = new ListAdminResponsible(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -68,9 +68,10 @@ public class JU_ListAdminResponsible {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsAdminRes.detailedHelp(0, sb );
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java
index 19000109..cba37108 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListByName.java
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByName {
-// private static ListByName lsByName;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// List ls = new List(ns);
-// lsByName = new ListByName(ls);
-// }
-//
+ private static ListByName lsByName;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ List ls = new List(ns);
+ lsByName = new ListByName(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,9 +67,10 @@ public class JU_ListByName {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsByName.detailedHelp(0, sb );
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java
index 5695c624..5723f19f 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListChildren.java
@@ -41,17 +41,17 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListChildren {
-//
-// private static ListChildren lsChildren;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// List ls = new List(ns);
-// lsChildren = new ListChildren(ls);
-// }
-//
+
+ private static ListChildren lsChildren;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ List ls = new List(ns);
+ lsChildren = new ListChildren(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -68,9 +68,10 @@ public class JU_ListChildren {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsChildren.detailedHelp(0, sb );
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java
index ad36151a..a1b0da19 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListNsKeysByAttrib.java
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListNsKeysByAttrib {
-// private static ListNsKeysByAttrib lsNsKeys;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// List ls = new List(ns);
-// lsNsKeys = new ListNsKeysByAttrib(ls);
-// }
-//
+ private static ListNsKeysByAttrib lsNsKeys;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ List ls = new List(ns);
+ lsNsKeys = new ListNsKeysByAttrib(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,9 +67,10 @@ public class JU_ListNsKeysByAttrib {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsNsKeys.detailedHelp(0, sb );
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java
new file mode 100644
index 00000000..e44a8219
--- /dev/null
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsers.java
@@ -0,0 +1,79 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.auth.cmd.test.ns;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.ns.List;
+import org.onap.aaf.auth.cmd.ns.ListUsers;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.misc.env.APIException;
+
+import aaf.v2_0.Users;
+
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.junit.Test;
+
+public class JU_ListUsers {
+
+ AAFcli cli;
+ NS ns;
+ List list;
+ ListUsers lUsers;
+
+ @Before
+ public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
+ cli = JU_AAFCli.getAAfCli();
+ ns = new NS(cli);
+ list = new List(ns);
+ lUsers = new ListUsers(list);
+ }
+
+ @Test
+ public void testReports() throws DatatypeConfigurationException {
+ Users.User user = new Users.User();
+ GregorianCalendar gcal = new GregorianCalendar();
+ XMLGregorianCalendar xgcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal);
+ user.setExpires(xgcal);
+
+ lUsers.report("header", "ns");
+ lUsers.report("subHead");
+ lUsers.report("prefix", user);
+ }
+
+}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java
new file mode 100644
index 00000000..20a5f2c0
--- /dev/null
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersContact.java
@@ -0,0 +1,105 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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.auth.cmd.test.ns;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.ns.List;
+import org.onap.aaf.auth.cmd.ns.ListUsers;
+import org.onap.aaf.auth.cmd.ns.ListUsersContact;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.junit.Test;
+
+public class JU_ListUsersContact {
+
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+ NS ns;
+ List list;
+ ListUsers lUsers;
+ ListUsersContact lUContact;
+
+ @Before
+ public void setUp() throws LocatorException, APIException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ ns = new NS(aafcli);
+ list = new List(ns);
+ lUsers = new ListUsers(list);
+ }
+
+// @Test
+// public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+// lUContact = new ListUsersContact(lUsers);
+// Item value = mock(Item.class);
+// Locator.Item item = new Locator.Item() {
+// };
+// when(loc.best()).thenReturn(value);
+// URI uri = new URI("http://java.sun.com/j2se/1.3/");
+// when(loc.get(value)).thenReturn(uri);
+// SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+// HRcli hcli = new HRcli(hman, uri, item, secSet);
+// lUContact._exec(0, "test");
+//
+// }
+
+ @Test
+ public void testDetailedHelp() {
+ lUContact = new ListUsersContact(lUsers);
+ StringBuilder sb = new StringBuilder();
+ lUContact.detailedHelp(0, sb);
+ }
+
+}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java
index ae136064..9f61b009 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersInRole.java
@@ -39,17 +39,17 @@ import org.onap.aaf.auth.cmd.test.JU_AAFCli;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListUsersInRole {
-// private static ListUsersInRole lsUserinRole;
-//
-// @BeforeClass
-// public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options
-// ListUsers lsU = new ListUsers(ls);
-// lsUserinRole = new ListUsersInRole(lsU);
-// }
-//
+ private static ListUsersInRole lsUserinRole;
+
+ @BeforeClass
+ public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ List ls = new List(ns);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options
+ ListUsers lsU = new ListUsers(ls);
+ lsUserinRole = new ListUsersInRole(lsU);
+ }
+
// @Test
// public void exec() {
// try {
@@ -58,20 +58,16 @@ public class JU_ListUsersInRole {
// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
// }
// }
-//
-// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// lsUserinRole.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
-// }
-
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsUserinRole.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java
index b8e83e6c..62984d63 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_ListUsersWithPerm.java
@@ -50,15 +50,15 @@ public class JU_ListUsersWithPerm {
lsUserWithPerm = new ListUsersWithPerm(lsU);
}
- @Test
- public void exec() {
- try {
- assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500);
- } catch (Exception e) {
- assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]");
-
- }
- }
+// @Test
+// public void exec() {
+// try {
+// assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500);
+// } catch (Exception e) {
+// assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]");
+//
+// }
+// }
@Test
public void detailedHelp() {
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
new file mode 100644
index 00000000..39698c39
--- /dev/null
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_Owner.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * ============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.auth.cmd.test.ns;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.ns.Create;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.cmd.ns.Owner;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+
+import static org.mockito.Mockito.*;
+import org.junit.Test;
+
+public class JU_Owner {
+
+ private static Owner owner;
+
+ @BeforeClass
+ public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ owner = new Owner(ns);
+ }
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ owner.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
+ }
+
+}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java
index 08fb7d4e..8b9a8f23 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_CreateDelete.java
@@ -40,15 +40,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_CreateDelete {
-// private static CreateDelete createDel;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// createDel = new CreateDelete(role);
-// }
-//
+ private static CreateDelete createDel;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ createDel = new CreateDelete(role);
+ }
+
// @Test
// public void exec() {
// try {
@@ -65,8 +65,14 @@ public class JU_CreateDelete {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ boolean hasNoError = true;
+ try {
+ createDel.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java
index ee62f53e..e7ac12a0 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_Describe.java
@@ -40,15 +40,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_Describe {
-// private static Describe desc;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// desc = new Describe(role);
-// }
-//
+ private static Describe desc;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ desc = new Describe(role);
+ }
+
// @Test
// public void exec() {
// try {
@@ -65,8 +65,14 @@ public class JU_Describe {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ desc.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
new file mode 100644
index 00000000..2334e1b8
--- /dev/null
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_List.java
@@ -0,0 +1,90 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.cmd.test.role;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.role.List;
+import org.onap.aaf.auth.cmd.role.Role;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.cmd.Cmd;
+import org.onap.aaf.auth.cmd.Param;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.client.Future;
+import org.onap.aaf.cadi.client.Rcli;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.GeneralSecurityException;
+import java.security.Principal;
+
+import org.junit.Test;
+
+public class JU_List {
+
+ AAFcli cli;
+
+ private class ListRolesStub extends List {
+
+ public ListRolesStub(Role parent) {
+ super(parent);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ }
+
+ @Before
+ public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException{
+ cli = JU_AAFCli.getAAfCli();
+ }
+
+ @Test
+ public void testRoles() throws APIException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ Role role = new Role(cli);
+ ListRolesStub listStub = new ListRolesStub(role);
+ Future future = mock(Future.class);
+ Rcli rcli = mock(Rcli.class);
+
+ Class c = listStub.getClass();
+ Class[] cArg = new Class[3];
+ cArg[0] = Future.class;
+ cArg[1] = Rcli.class;
+ cArg[2] = String.class;//Steps to test a protected method
+ //Method listMethod = c.getDeclaredMethod("list", cArg);
+ //listMethod.setAccessible(true);
+ //listMethod.invoke(listStub, future, rcli, "test");
+
+ }
+
+}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java
index 87530f6c..e09035ca 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListActivity.java
@@ -40,17 +40,17 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListActivity {
-//
-// private static ListActivity lsActivity;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// List ls = new List(role);
-// lsActivity = new ListActivity(ls);
-// }
-//
+
+ private static ListActivity lsActivity;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ List ls = new List(role);
+ lsActivity = new ListActivity(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,8 +67,14 @@ public class JU_ListActivity {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsActivity.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java
index 9d6baf9e..6017905c 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNS.java
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByNS {
-// private static ListByNS lsByNS;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// List ls = new List(role);
-// lsByNS = new ListByNS(ls);
-// }
-//
+ private static ListByNS lsByNS;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ List ls = new List(role);
+ lsByNS = new ListByNS(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,8 +67,14 @@ public class JU_ListByNS {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByNS.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java
index f2106c4c..6c2f1b44 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByNameOnly.java
@@ -40,17 +40,17 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByNameOnly {
-//
-// private static ListByNameOnly lsByName;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// List ls = new List(role);
-// lsByName = new ListByNameOnly(ls);
-// }
-//
+
+ private static ListByNameOnly lsByName;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ List ls = new List(role);
+ lsByName = new ListByNameOnly(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,8 +67,14 @@ public class JU_ListByNameOnly {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByName.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java
index cfa068b0..65f2c6f0 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByPerm.java
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByPerm {
-// private static ListByPerm lsByPerm;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// List ls = new List(role);
-// lsByPerm = new ListByPerm(ls);
-// }
-//
+ private static ListByPerm lsByPerm;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ List ls = new List(role);
+ lsByPerm = new ListByPerm(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,8 +67,14 @@ public class JU_ListByPerm {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByPerm.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java
index 66c118cb..37accbbc 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByRole.java
@@ -41,16 +41,16 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByRole {
-// private static ListByRole lsByRole;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// List ls = new List(role);
-// lsByRole = new ListByRole(ls);
-// }
-//
+ private static ListByRole lsByRole;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ List ls = new List(role);
+ lsByRole = new ListByRole(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,8 +67,15 @@ public class JU_ListByRole {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByRole.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java
index 140998d6..d03511b4 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_ListByUser.java
@@ -40,17 +40,17 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_ListByUser {
-//
-// private static ListByUser lsByUser;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// List ls = new List(role);
-// lsByUser = new ListByUser(ls);
-// }
-//
+
+ private static ListByUser lsByUser;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ List ls = new List(role);
+ lsByUser = new ListByUser(ls);
+ }
+
// @Test
// public void exec() {
// try {
@@ -67,8 +67,15 @@ public class JU_ListByUser {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByUser.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java
index 25acfff6..fa835961 100644
--- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java
+++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/role/JU_User.java
@@ -41,15 +41,15 @@ import org.onap.aaf.misc.env.APIException;
@RunWith(MockitoJUnitRunner.class)
public class JU_User {
-// private static User user;
-//
-// @BeforeClass
-// public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// Role role = new Role(cli);
-// user = new User(role);
-// }
-//
+ private static User user;
+
+ @BeforeClass
+ public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ Role role = new Role(cli);
+ user = new User(role);
+ }
+
// @Test
// public void exec() {
// try {
@@ -66,8 +66,14 @@ public class JU_User {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ user.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
index 6d7a3586..8476e06c 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
@@ -78,6 +78,12 @@ public interface Organization {
* @return
*/
public String getRealm();
+
+ public boolean supportsRealm(String user);
+
+ public void addSupportedRealm(String r);
+
+
String getDomain();
@@ -373,6 +379,15 @@ public interface Organization {
}
@Override
+ public boolean supportsRealm(String r) {
+ return false;
+ }
+
+ @Override
+ public void addSupportedRealm(String r) {
+ }
+
+ @Override
public String getDomain() {
return N_A;
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
index 843e2682..57d37d0b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
@@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.cadi.util.FQI;
+import org.onap.aaf.cadi.util.Split;
import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.impl.BasicEnv;
@@ -98,6 +99,13 @@ public class OrganizationFactory {
Class<Organization> cls = (Class<Organization>) Class.forName(orgClass);
Constructor<Organization> cnst = cls.getConstructor(Env.class,String.class);
org = cnst.newInstance(env,orgNS);
+ String other_realms = env.getProperty(orgNS+".also_supports");
+ if(other_realms!=null) {
+ for(String r : Split.splitTrim(',', other_realms)) {
+ org.addSupportedRealm(r);
+ }
+ }
+
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException |
InstantiationException | IllegalAccessException | IllegalArgumentException |
InvocationTargetException e) {
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
index 5674e247..935f99bf 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
@@ -56,9 +56,12 @@ public class DefaultOrg implements Organization {
final String realm;
private final String NAME,mailHost,mailFrom;
+ private final Set<String> supportedRealms;
public DefaultOrg(Env env, String realm) throws OrganizationException {
this.realm = realm;
+ supportedRealms=new HashSet<String>();
+ supportedRealms.add(realm);
domain=FQI.reverseDomain(realm);
atDomain = '@'+domain;
String s;
@@ -668,5 +671,21 @@ public class DefaultOrg implements Organization {
return addressArray;
}
-
+ private String extractRealm(final String r) {
+ int at;
+ if((at=r.indexOf('@'))>=0) {
+ return FQI.reverseDomain(r.substring(at+1));
+ }
+ return r;
+ }
+ @Override
+ public boolean supportsRealm(final String r) {
+ return supportedRealms.contains(extractRealm(r)) || r.endsWith(realm);
}
+
+ @Override
+ public synchronized void addSupportedRealm(final String r) {
+ supportedRealms.add(extractRealm(r));
+ }
+
+}
diff --git a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java
index e6f058a4..d4606284 100644
--- a/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java
+++ b/auth/auth-deforg/src/test/java/org/onap/aaf/org/test/JU_DefaultOrg.java
@@ -109,6 +109,11 @@ public class JU_DefaultOrg {
assertTrue(realmTest == REALM);
}
+ public void supportsRealm() {
+ String otherRealm = "org.ossaf.something";
+ defaultOrg.addSupportedRealm(otherRealm);
+ assertTrue(defaultOrg.supportsRealm(otherRealm));
+ }
//@Test
public void testGetName() throws OrganizationException{
String testName = defaultOrg.getName();
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
index 446bf46d..a6bbbb0b 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/validation/ServiceValidator.java
@@ -153,7 +153,7 @@ public class ServiceValidator extends Validator {
str = str.substring(0,idx);
}
- if(cd.id.endsWith(org.getRealm())) {
+ if(org.supportsRealm(cd.id)) {
if(isNew && (str=org.isValidID(trans, str)).length()>0) {
msg(cd.id,str);
}
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
index 31e5d32c..52be7d5e 100644
--- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
+++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java
@@ -163,6 +163,10 @@ public class JU_CmdLine {
assertThat(outContent.toString().length(), is(2074));
String filePath = "test/output_key";
+ File testDir = new File("test");
+ if(!testDir.exists()) {
+ testDir.mkdirs();
+ }
CmdLine.main(new String[]{"keygen", filePath});
File keyfile = new File(filePath);
assertTrue(Files.isReadable(Paths.get(filePath)));
diff --git a/cadi/shiro/pom.xml b/cadi/shiro/pom.xml
index 88509d82..0346dbe7 100644
--- a/cadi/shiro/pom.xml
+++ b/cadi/shiro/pom.xml
@@ -92,10 +92,16 @@
<groupId>org.onap.aaf.authz</groupId>
<artifactId>aaf-cadi-aaf</artifactId>
</dependency>
- <dependency>
+ <!--<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.4.0</version>
+ </dependency> -->
+
+ <dependency>
+ <groupId>org.apache.shiro</groupId>
+ <artifactId>shiro-core</artifactId>
+ <version>1.3.2</version>
</dependency>
</dependencies>