summaryrefslogtreecommitdiffstats
path: root/shiro/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'shiro/src/test/java/org/onap')
-rw-r--r--shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java54
1 files changed, 29 insertions, 25 deletions
diff --git a/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java b/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java
index 591a56c..f915538 100644
--- a/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java
+++ b/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java
@@ -27,9 +27,7 @@ import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.subject.PrincipalCollection;
-import org.junit.Test;
import org.onap.aaf.cadi.aaf.AAFPermission;
-import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.shiro.AAFRealm;
import org.onap.aaf.cadi.shiro.AAFShiroPermission;
@@ -37,31 +35,37 @@ import junit.framework.Assert;
public class JU_AAFRealm {
- // TODO: Ian - fix this test
- // @Test
- // public void test() {
- // // NOTE This is a live test. This JUnit needs to be built with "Mock"
- // try {
- // System.setProperty(Config.CADI_PROP_FILES, "/opt/app/osaaf/etc/org.osaaf.common.props");
- // TestAAFRealm ar = new TestAAFRealm();
-
- // UsernamePasswordToken upt = new UsernamePasswordToken("jonathan@people.osaaf.org", "new2You!");
- // AuthenticationInfo ani = ar.authn(upt);
-
- // AuthorizationInfo azi = ar.authz(ani.getPrincipals());
- // // Change this to something YOU have, Sai...
-
- // testAPerm(true,azi,"org.access","something","*");
- // testAPerm(false,azi,"org.accessX","something","*");
- // } catch (Throwable t) {
- // t.printStackTrace();
- // Assert.fail();
- // }
- // }
+/*
+ @Test
+ public void test() {
+ // NOTE This is a live test. This JUnit needs to be built with "Mock" before it can be
+ // an official JUNIT
+ try {
+ System.setProperty(Config.CADI_PROP_FILES, "/opt/app/osaaf/local/org.onap.aai.props");
+ TestAAFRealm ar = new TestAAFRealm();
+
+ //UsernamePasswordToken upt = new UsernamePasswordToken("demo@people.osaaf.org", "demo123456!");
+ UsernamePasswordToken upt = new UsernamePasswordToken("AAI", "AAI");
+
+ AuthenticationInfo ani = ar.authn(upt);
+
+ AuthorizationInfo azi = ar.authz(ani.getPrincipals());
+ // Change this to something YOU have, Sai...
+
+ testAPerm(true,azi,"org.onap.aai","resources","something","get");
+ testAPerm(false,azi,"org.osaaf.nons","resources","something","get");
+ // testAPerm(true,azi,"name","org.access","something","*");
+ // testAPerm(false,azi,"org.accessX","something","*");
+ } catch (Throwable t) {
+ t.printStackTrace();
+ Assert.fail();
+ }
+ }
+*/
- private void testAPerm(boolean expect, AuthorizationInfo azi, String name, String type, String instance, String action) {
+ private void testAPerm(boolean expect, AuthorizationInfo azi, String ns, String type, String instance, String action) {
- AAFShiroPermission testPerm = new AAFShiroPermission(new AAFPermission(type,name,instance,action,new ArrayList<String>()));
+ AAFShiroPermission testPerm = new AAFShiroPermission(new AAFPermission(ns,type,instance,action,new ArrayList<String>()));
boolean any = false;
for(Permission p : azi.getObjectPermissions()) {