You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2015/06/09 05:15:22 UTC
[16/75] [abbrv] [partial] directory-fortress-core git commit: FC-109
- rename rbac package to impl
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/FortressAntLoadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/FortressAntLoadTest.java b/src/test/java/org/apache/directory/fortress/core/impl/FortressAntLoadTest.java
new file mode 100644
index 0000000..a6f8967
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/FortressAntLoadTest.java
@@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+package org.apache.directory.fortress.core.impl;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import au.com.bytecode.opencsv.CSVWriter;
+import org.apache.directory.fortress.core.model.PermGrant;
+import org.apache.directory.fortress.core.model.PermObj;
+import org.apache.directory.fortress.core.model.Permission;
+import org.apache.directory.fortress.core.model.Role;
+import org.apache.directory.fortress.core.model.Session;
+import org.apache.directory.fortress.core.model.User;
+import org.apache.directory.fortress.core.model.UserRole;
+import org.apache.directory.fortress.core.model.Warning;
+import org.apache.tools.ant.Task;
+import org.junit.Test;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.directory.fortress.core.AccessMgr;
+import org.apache.directory.fortress.core.AccessMgrFactory;
+import org.apache.directory.fortress.core.ReviewMgr;
+import org.apache.directory.fortress.core.SecurityException;
+import org.apache.directory.fortress.core.ant.AddpermGrant;
+import org.apache.directory.fortress.core.ant.AddpermObj;
+import org.apache.directory.fortress.core.ant.AddpermOp;
+import org.apache.directory.fortress.core.ant.Addrole;
+import org.apache.directory.fortress.core.ant.Adduser;
+import org.apache.directory.fortress.core.ant.Adduserrole;
+import org.apache.directory.fortress.core.ant.FortressAntTask;
+import org.apache.directory.fortress.core.ant.PermAnt;
+import org.apache.directory.fortress.core.ant.UserAnt;
+import org.apache.directory.fortress.core.util.LogUtil;
+import org.apache.directory.fortress.core.util.Testable;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * The ReviewMgrAnt Tester component is used to verify results against XML load file. It is called by {@link
+ * FortressAntTask} after it completes
+ * its data load.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version 1.0
+ */
+public class FortressAntLoadTest implements Testable
+{
+ private static final String CLS_NM = FortressAntLoadTest.class.getName();
+ private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
+ // This static variable stores reference for input data. It must be static to make available for junit test
+ // methods.
+ private static FortressAntTask fortressAntTask;
+ private static String fileName;
+
+ /**
+ * This method is called by {@link FortressAntTask} via reflexion and invokes its JUnit tests to verify loaded
+ * data into LDAP against input data.
+ */
+ @Override
+ public synchronized void execute( Task task )
+ {
+ fortressAntTask = ( FortressAntTask ) task;
+ fileName = task.getProject().getName();
+ LOG.info( "execute FortressAntLoadTest JUnit tests on file name: " + fileName );
+ Result result = JUnitCore.runClasses( FortressAntLoadTest.class );
+ for ( Failure failure : result.getFailures() )
+ {
+ LOG.info( failure.toString() );
+ }
+ LOG.info( "TEST SUCCESS: " + result.wasSuccessful() );
+ }
+
+
+ @Test
+ public void testAuthorizations()
+ {
+ // gather permission input data:
+ List<AddpermOp> addpermOps = fortressAntTask.getAddpermOps();
+ List<PermAnt> permissions = addpermOps.get( 0 ).getPermOps();
+ // gather user input data:
+ List<Adduser> addusers = fortressAntTask.getAddusers();
+ List<UserAnt> users = addusers.get( 0 ).getUsers();
+ checkPermissions( "CHECK-PERMS", users, permissions );
+ }
+
+
+ /**
+ * @param msg
+ * @param permissions
+ */
+ private void checkPermissions( String msg, List<UserAnt> users, List<PermAnt> permissions )
+ {
+ String DATE_FORMAT = "E yyyy.MM.dd 'at' hh:mm:ss a zzz";
+ SimpleDateFormat format = new SimpleDateFormat( DATE_FORMAT );
+ Date now = new Date();
+ String szTimestamp = format.format( now );
+ AccessMgr accessMgr = null;
+ CSVWriter writer = null;
+ LogUtil.logIt( msg );
+ try
+ {
+ accessMgr = AccessMgrFactory.createInstance( TestUtils.getContext() );
+ writer = new CSVWriter( new FileWriter( fileName + ".csv" ), '\t' );
+ String[] entries = "user#resource#operation#result#assigned roles#activated roles#timestamp#warnings"
+ .split( "#" );
+ writer.writeNext( entries );
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "checkPermissions caught SecurityException creating AccessMgr rc=" + ex.getErrorId() + ", " +
+ "msg=" + ex.getMessage() + ex );
+ // Can't continue without AccessMgr
+ fail( ex.getMessage() );
+ }
+ catch ( IOException ioe )
+ {
+ String error = "File IO Exception=" + ioe;
+ LOG.warn( error );
+ // Can't continue without output file to write the results in
+ fail( ioe.getMessage() );
+ }
+ for ( UserAnt user : users )
+ {
+ try
+ {
+ List<String> warnings = null;
+ Session session = accessMgr.createSession( user, false );
+ assertNotNull( session );
+ if ( session.getWarnings() != null )
+ {
+ warnings = new ArrayList();
+ for ( Warning warning : session.getWarnings() )
+ {
+ warnings.add( warning.getMsg() );
+ }
+ }
+
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ List<UserRole> assignedRoles = reviewMgr.assignedRoles( user );
+
+ for ( PermAnt permAnt : permissions )
+ {
+ Boolean result = accessMgr.checkAccess( session, permAnt );
+ // TODO: send this message as CSV output file:
+ LOG.info( "User: " + user.getUserId() + " Perm Obj: " + permAnt.getObjName() + " Perm " +
+ "Operation: " + permAnt.getOpName() + " RESULT: " + result );
+ String[] entries = ( user.getUserId() + "#" + permAnt.getObjName() + "#" + permAnt.getOpName()
+ + "#" + result + "#" + assignedRoles + "#" + session.getUser().getRoles() + "#" + szTimestamp
+ + "#" + warnings ).split( "#" );
+ writer.writeNext( entries );
+ }
+ }
+ catch ( SecurityException ex )
+ {
+ // Log but don't fail test so entire permission matrix can be evaluated.
+ LOG.error( "checkPermissions caught SecurityException rc=" + ex.getErrorId() + ", " +
+ "msg=" + ex.getMessage() + ex );
+ }
+ }
+ try
+ {
+ writer.close();
+ }
+ catch ( IOException ioe )
+ {
+ // ignore
+ }
+ }
+
+
+ @Test
+ public void testPermissionRoles()
+ {
+ // gather permission to role grant input data:
+ List<AddpermGrant> addpermGrants = fortressAntTask.getAddpermGrants();
+ for ( AddpermGrant addpermGrant : addpermGrants )
+ {
+ List<PermGrant> permGrants = addpermGrant.getPermGrants();
+ permissionRoles( "PRM-RLS", permGrants );
+ }
+ }
+
+
+ private static void permissionRoles( String msg, List<PermGrant> permGrants )
+ {
+ LogUtil.logIt( msg );
+ Permission pOp;
+ try
+ {
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ for ( PermGrant permGrant : permGrants )
+ {
+ pOp = new Permission();
+ pOp.setObjName( permGrant.getObjName() );
+ pOp.setOpName( permGrant.getOpName() );
+ pOp.setObjId( permGrant.getObjId() );
+ List<String> roles = reviewMgr.permissionRoles( pOp );
+ assertNotNull( roles );
+ int indx = roles.indexOf( permGrant.getRoleNm() );
+ assertTrue( "Failed to find roleNm: " + permGrant.getRoleNm(), indx != -1 );
+ }
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "permissionRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(),
+ ex );
+ fail( ex.getMessage() );
+ }
+ }
+
+
+ @Test
+ public void testReadUser()
+ {
+ // gather user input data:
+ List<Adduser> addusers = fortressAntTask.getAddusers();
+ for ( Adduser adduser : addusers )
+ {
+ List<UserAnt> users = adduser.getUsers();
+ readUsers( "READ-USRS", users );
+ }
+ }
+
+
+ private static void readUsers( String msg, List<UserAnt> users )
+ {
+ LogUtil.logIt( msg );
+ try
+ {
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ for ( User user : users )
+ {
+ User entity = reviewMgr.readUser( user );
+ assertNotNull( entity );
+ UserTestData.assertEquals( entity, user );
+ }
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "readUsers caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
+ }
+
+
+ @Test
+ public void testReadRole()
+ {
+ // gather role input data:
+ List<Addrole> addroles = fortressAntTask.getAddroles();
+ for ( Addrole addrole : addroles )
+ {
+ List<Role> roles = addrole.getRoles();
+ readRoles( "RD-RLS", roles );
+ }
+ }
+
+
+ private static void readRoles( String msg, List<Role> roles )
+ {
+ LogUtil.logIt( msg );
+ try
+ {
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ for ( Role role : roles )
+ {
+ Role entity = reviewMgr.readRole( role );
+ assertNotNull( entity );
+ assertTrue( "Failed role name", entity.getName().equals( role.getName() ) );
+ TestUtils.assertTemporal( CLS_NM + ".assertEquals", role, entity );
+ }
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "readRoles caught SecurityException=" + ex.getMessage(), ex );
+ fail( ex.getMessage() );
+ }
+ }
+
+
+ @Test
+ public void testAssignedRoles()
+ {
+ // gather assigned user to role input data:
+ List<Adduserrole> adduserroles = fortressAntTask.getAdduserroles();
+ for ( Adduserrole adduserrole : adduserroles )
+ {
+ List<UserRole> userroles = adduserrole.getUserRoles();
+ assignedRoles( "ASGN-RLS", userroles );
+ }
+ }
+
+
+ private static void assignedRoles( String msg, List<UserRole> userroles )
+ {
+ LogUtil.logIt( msg );
+ try
+ {
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ for ( UserRole userrole : userroles )
+ {
+ List<UserRole> assignedRoles = reviewMgr.assignedRoles( new User( userrole.getUserId() ) );
+ assertNotNull( assignedRoles );
+ int indx = assignedRoles.indexOf( userrole );
+ assertTrue( "Failed userrole name", indx != -1 );
+ UserRole assignedRole = assignedRoles.get( indx );
+ TestUtils.assertTemporal( CLS_NM + ".assertEquals", userrole, assignedRole );
+ }
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "assignedRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(),
+ ex );
+ fail( ex.getMessage() );
+ }
+ }
+
+
+ @Test
+ public void testReadPermissionOp()
+ {
+ // gather permission operation input data:
+ List<AddpermOp> addpermOps = fortressAntTask.getAddpermOps();
+ for ( AddpermOp addpermOp : addpermOps )
+ {
+ List<PermAnt> permissions = addpermOp.getPermOps();
+ readPermissionOps( "RD-PRM-OPS", permissions );
+ }
+ }
+
+
+ /**
+ * @param msg
+ * @param permissions
+ */
+ private static void readPermissionOps( String msg, List<PermAnt> permissions )
+ {
+ LogUtil.logIt( msg );
+ try
+ {
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ for ( PermAnt permAnt : permissions )
+ {
+ Permission entity = reviewMgr.readPermission( permAnt );
+ assertNotNull( entity );
+ assertTrue( "Failed objName value compare", entity.getObjName().equals( permAnt.getObjName()
+ ) );
+ assertTrue( "Failed opName value compare", entity.getOpName().equals( permAnt.getOpName() ) );
+ }
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "readPermissionOps caught SecurityException rc=" + ex.getErrorId() + ", " +
+ "msg=" + ex.getMessage() + ex );
+ fail( ex.getMessage() );
+ }
+ }
+
+
+ @Test
+ public void testReadPermissionObj()
+ {
+ // gather permission object input data:
+ List<AddpermObj> addpermObjs = fortressAntTask.getAddpermObjs();
+ for ( AddpermObj addpermObj : addpermObjs )
+ {
+ List<PermObj> permObjs = addpermObj.getPermObjs();
+ readPermissionObjs( "RD-PRM-OBJS", permObjs );
+ }
+ }
+
+
+ private static void readPermissionObjs( String msg, List<PermObj> permObjs )
+ {
+ LogUtil.logIt( msg );
+ try
+ {
+ ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
+ for ( PermObj permObj : permObjs )
+ {
+ PermObj entity = reviewMgr.readPermObj( permObj );
+ assertNotNull( entity );
+ assertTrue( "Failed objName value compare", entity.getObjName().equals( permObj.getObjName()
+ ) );
+ }
+ }
+ catch ( SecurityException ex )
+ {
+ LOG.error( "readPermissionOps caught SecurityException rc=" + ex.getErrorId() + ", " +
+ "msg=" + ex.getMessage() + ex );
+ fail( ex.getMessage() );
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/FortressJUnitTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/FortressJUnitTest.java b/src/test/java/org/apache/directory/fortress/core/impl/FortressJUnitTest.java
new file mode 100755
index 0000000..e0a4178
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/FortressJUnitTest.java
@@ -0,0 +1,361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+package org.apache.directory.fortress.core.impl;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+import org.apache.directory.fortress.core.GlobalIds;
+
+/**
+ * This JUnit test class drives all of the Fortress Administration APIs contained within {@link AdminMgrImplTest},
+ * {@link DelegatedMgrImplTest}, {@link org.apache.directory.fortress.core.impl.PwPolicyMgrImpl} and {@link org.apache.directory.fortress.core.impl.AuditMgrImpl}.
+ * There are more than 125 distinct test cases that kicked off from within this JUnit test wrapper.
+ * Fortress JUnit test phases in this file include:
+ * 1. Tear-down data (optional) - during this phase previously loaded test data is removed from directory.
+ * 2. Buildup data - add it back.
+ * 3. Interrogate data - entity and security policy review APIs.
+ * 4. Check data - runtime security rule evaluations.
+ * 4. Audit data - validate audit log coverage.
+ * <p/>
+ * Note 1: Data is retained in LDAP directory after these tests run (assuming the client was able to connect
+ * to the LDAP server).
+ * Note 2: To delete old test data, run the "FortressJUnitDeleteTest" test cases after success on main (if repeatable
+ * runs of this class are not desired).
+ * Note 3: On test first run, assertions will fail on the teardown phase (#1) as (presumably) prior test data does
+ * not exist. The tests
+ * are designed to recover on repeated runs if/when ldap data falls out of synch - BUT - if/when errors do occur
+ * during repeat of buildup phase,
+ * delete the old test data manually in directory before trying again.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class FortressJUnitTest extends TestCase
+{
+ private static boolean adminEnabled;
+
+ public static boolean isAdminEnabled()
+ {
+ return adminEnabled;
+ }
+
+ private static void setAdminEnabled( boolean adminVal )
+ {
+ adminEnabled = adminVal;
+ }
+
+ private static boolean isFirstRun = getFirstRun();
+ //private static boolean isFirstRun = true;
+
+ private static boolean getFirstRun()
+ {
+ isFirstRun = !ReviewMgrImplTest.teardownRequired( "TD-RLS TR1", RoleTestData.ROLES_TR1 );
+ return isFirstRun;
+ }
+
+ public static boolean isFirstRun()
+ {
+ return isFirstRun;
+ }
+
+ @Deprecated
+ public static void setFirstRun( boolean firstRun )
+ {
+ isFirstRun = firstRun;
+ }
+
+ /**
+ * @return
+ */
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite();
+ //setAdminEnabled(false);
+ setAdminEnabled( true );
+ /***********************************************************/
+ /* 0. Load the base Admin Policy if need be:
+ /***********************************************************/
+ if ( DelegatedMgrImplTest.loadAdminPolicy() )
+ {
+ // ARBAC Buildup APIs:
+ suite.addTest( new DelegatedMgrImplTest( "testAddAdminUser" ) );
+ }
+
+ /***********************************************************/
+ /* 1. Tear Down Phase */
+ /***********************************************************/
+ if ( !isFirstRun() )
+ {
+ // PwPolicyMgr PW Policy Teardown:
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ suite.addTest( new PswdPolicyMgrImplTest( "testDeletePasswordPolicy" ) );
+ }
+
+ // AdminMgrImplTest RBAC Teardown APIs:
+ suite.addTest( new AdminMgrImplTest( "testRevokePermissionUser" ) );
+ suite.addTest( new AdminMgrImplTest( "testRevokePermissionRole" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeletePermissionOp" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeletePermissionObj" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeassignUser" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeleteUser" ) );
+ suite.addTest( new AdminMgrImplTest( "testForceDeleteUser" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeleteSsdRoleMember" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeleteDsdRoleMember" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeleteSsdSet" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeleteDsdSet" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeleteRoleInheritance" ) );
+ suite.addTest( new AdminMgrImplTest( "testDelRoleDescendant" ) );
+ suite.addTest( new AdminMgrImplTest( "testDelRoleAscendant" ) );
+ suite.addTest( new AdminMgrImplTest( "testDeleteRole" ) );
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ suite.addTest( new PswdPolicyMgrImplTest( "testDelete" ) );
+ }
+
+ // DelAdminMgr ARBAC Teardown APIs
+ suite.addTest( new DelegatedMgrImplTest( "testRevokePermissionRole" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDeassignAdminUser" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDeleteUser" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDeletePermission" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDelAdminRoleDescendant" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDelAdminRoleAscendant" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDeleteAdminRoleInheritance" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDeleteRole" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDeleteOrgInheritance" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDelOrgUnitDescendant" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDelOrgUnitAscendant" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testDeleteOrgUnit" ) );
+ //suite.addTest(new DelegatedMgrImplTest("testDeleteAdminUser"));
+ }
+
+ /***********************************************************/
+ /* 2. Build Up */
+ /***********************************************************/
+ // PW PolicyMgr APIs:
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ suite.addTest( new PswdPolicyMgrImplTest( "testAdd" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testUpdate" ) );
+ }
+
+ // DelegatedAdminMgrImplTest ARBAC Buildup APIs:
+ suite.addTest( new DelegatedMgrImplTest( "testAddOrgUnit" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testUpdateOrgUnit" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddOrgInheritance" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddOrgUnitDescendant" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddOrgUnitAscendants" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddRole" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testUpdateAdminRole" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddAdminRoleDescendant" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddAdminRoleAscendants" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddAdminRoleInheritance" ) );
+
+ suite.addTest( new DelegatedMgrImplTest( "testAddUser" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAddPermission" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testAssignAdminUser" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testGrantPermissionRole" ) );
+
+ // AdminMgr RBAC APIs:
+ suite.addTest( new AdminMgrImplTest( "testAddRole" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddRoleInheritance" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddRoleDescendant" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddRoleAscendants" ) );
+ suite.addTest( new AdminMgrImplTest( "testCreateSsdSet" ) );
+ suite.addTest( new AdminMgrImplTest( "testCreateDsdSet" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddSsdRoleMember" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddDsdRoleMember" ) );
+ suite.addTest( new AdminMgrImplTest( "testSsdCardinality" ) );
+ suite.addTest( new AdminMgrImplTest( "testDsdCardinality" ) );
+ suite.addTest( new AdminMgrImplTest( "testUpdateRole" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddUser" ) );
+ suite.addTest( new AdminMgrImplTest( "testUpdateUser" ) );
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ suite.addTest( new PswdPolicyMgrImplTest( "testUpdatePasswordPolicy" ) );
+ }
+ suite.addTest( new AdminMgrImplTest( "testAssignUser" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddPermissionObj" ) );
+ suite.addTest( new AdminMgrImplTest( "testUpdatePermissionObj" ) );
+ suite.addTest( new AdminMgrImplTest( "testAddPermissionOp" ) );
+ suite.addTest( new AdminMgrImplTest( "testUpdatePermissionOp" ) );
+ suite.addTest( new AdminMgrImplTest( "testGrantPermissionRole" ) );
+ suite.addTest( new AdminMgrImplTest( "testGrantPermissionUser" ) );
+
+ /***********************************************************/
+ /* 3. Interrogation */
+ /***********************************************************/
+ // DelReviewMgr ARBAC:
+ suite.addTest( new DelegatedMgrImplTest( "testReadOrgUnit" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testSearchOrgUnits" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testReadAdminRole" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testSearchAdminRole" ) );
+
+ // ReviewMgr RBAC:
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ suite.addTest( new PswdPolicyMgrImplTest( "testRead" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testSearch" ) );
+ }
+ suite.addTest( new ReviewMgrImplTest( "testReadRole" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindRoles" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindRoleNms" ) );
+ suite.addTest( new ReviewMgrImplTest( "testReadUser" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindUsers" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindUserIds" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAssignedRoles" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAssignedRoleNms" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAuthorizedRoles" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAuthorizedUsers" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAuthorizedUserIds" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAuthorizedUsersHier" ) );
+ suite.addTest( new ReviewMgrImplTest( "testReadPermissionObj" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindPermissionObjs" ) );
+ suite.addTest( new ReviewMgrImplTest( "testReadPermissionOp" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindPermissionOps" ) );
+ suite.addTest( new ReviewMgrImplTest( "testRolePermissions" ) );
+ suite.addTest( new ReviewMgrImplTest( "testPermissionRoles" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAuthorizedPermissionRoles" ) );
+ suite.addTest( new ReviewMgrImplTest( "testPermissionUsers" ) );
+ suite.addTest( new ReviewMgrImplTest( "testAuthorizedPermissionUsers" ) );
+ suite.addTest( new ReviewMgrImplTest( "testUserPermissions" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindSsdSets" ) );
+ suite.addTest( new ReviewMgrImplTest( "testFindDsdSets" ) );
+
+ /***********************************************************/
+ /* 4. Security Checks */
+ /***********************************************************/
+ // DelAccessMgr ARABC:
+ suite.addTest( new DelegatedMgrImplTest( "testCheckAccess" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testCanAssignUser" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testCanDeassignUser" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testCanGrantPerm" ) );
+ suite.addTest( new DelegatedMgrImplTest( "testCanRevokePerm" ) );
+
+ // AccessMgr RBAC:
+ suite.addTest( new AccessMgrImplTest( "testGetUserId" ) );
+ suite.addTest( new AccessMgrImplTest( "testGetUser" ) );
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ // These tests are reliant on OpenLDAP's pwpolicy overlay:
+ suite.addTest( new AdminMgrImplTest( "testResetPassword" ) );
+ suite.addTest( new AccessMgrImplTest( "testAuthenticateReset" ) );
+ suite.addTest( new AdminMgrImplTest( "testChangePassword" ) );
+ suite.addTest( new AccessMgrImplTest( "testAuthenticate" ) );
+ suite.addTest( new AdminMgrImplTest( "testLockUserAccount" ) );
+ suite.addTest( new AccessMgrImplTest( "testAuthenticateLocked" ) );
+ suite.addTest( new AdminMgrImplTest( "testUnlockUserAccount" ) );
+ }
+ suite.addTest( new AccessMgrImplTest( "testCreateSession" ) );
+ suite.addTest( new AccessMgrImplTest( "testCreateSessionTrusted" ) );
+ suite.addTest( new AccessMgrImplTest( "testCreateSessionHier" ) );
+ suite.addTest( new AccessMgrImplTest( "createSessionsDSD" ) );
+ // hit it again to make sure the caching is working good:
+ suite.addTest( new AccessMgrImplTest( "createSessionsDSD" ) );
+ suite.addTest( new AccessMgrImplTest( "testSessionRole" ) );
+ suite.addTest( new AccessMgrImplTest( "testCheckAccess" ) );
+ suite.addTest( new AccessMgrImplTest( "testAddActiveRole" ) );
+ suite.addTest( new AccessMgrImplTest( "testDropActiveRole" ) );
+ suite.addTest( new AccessMgrImplTest( "testSessionPermission" ) );
+ suite.addTest( new AccessMgrImplTest( "testCreateSessionWithRole" ) );
+ suite.addTest( new AccessMgrImplTest( "testCreateSessionWithRolesTrusted" ) );
+
+ // PwPolicyMgr PW Policy checks:
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ // These tests are reliant on OpenLDAP's pwpolicy overlay:
+ suite.addTest( new PswdPolicyMgrImplTest( "testMinAge" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testMaxAge" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testInHistory" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testMinLength" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testExpireWarning" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testGraceLoginLimit" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testMaxFailure" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testLockoutDuration" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testLockout" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testFailureCountInterval" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testMustChange" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testAllowUserChange" ) );
+ suite.addTest( new PswdPolicyMgrImplTest( "testSafeModify" ) );
+ }
+
+ /***********************************************************/
+ /* 5. Audit Checks */
+ /***********************************************************/
+ //suite.addTest(new AuditMgrImplTest("testSearchAuthNInvalid"));
+ if ( GlobalIds.IS_OPENLDAP )
+ {
+ // These tests reliant on OpenLDAP's slapo access log overlay:
+ suite.addTest( new AuditMgrImplTest( "testSearchBinds" ) );
+ suite.addTest( new AuditMgrImplTest( "testGetAuthZs" ) );
+ suite.addTest( new AuditMgrImplTest( "testSearchAuthZs" ) );
+ suite.addTest( new AuditMgrImplTest( "testSearchMods" ) );
+ suite.addTest( new AuditMgrImplTest( "testSearchAdminMods" ) );
+ }
+
+ suite.addTest( new FortressJUnitTest( "testDisplayCounters" ) );
+ return suite;
+ }
+
+ /**
+ * Constructor for the FortressJUnitTest object
+ *
+ * @param name Description of the Parameter
+ */
+ public FortressJUnitTest( String name )
+ {
+ super( name );
+ }
+
+ public void testDisplayCounters()
+ {
+ // TODO: fix me (removed for unboundid)
+/*
+ LdapCounters counters = UnboundIdDataProvider.getLdapCounters();
+ System.out.println( "NUMBER OF READS: " + counters.getRead() );
+ System.out.println( "NUMBER OF SEARCHES: " + counters.getSearch() );
+ System.out.println( "NUMBER OF COMPARES: " + counters.getCompare() );
+ System.out.println( "NUMBER OF BINDS: " + counters.getBind() );
+ System.out.println( "NUMBER OF ADDS: " + counters.getAdd() );
+ System.out.println( "NUMBER OF MODS: " + counters.getMod() );
+ System.out.println( "NUMBER OF DELETES: " + counters.getDelete() );
+*/
+ }
+
+ /**
+ * The JUnit setup method
+ *
+ * @throws Exception Description of the Exception
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ /**
+ * The teardown method for JUnit
+ *
+ * @throws Exception Description of the Exception
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/MyAnnotation.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/MyAnnotation.java b/src/test/java/org/apache/directory/fortress/core/impl/MyAnnotation.java
new file mode 100755
index 0000000..29ae859
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/MyAnnotation.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+package org.apache.directory.fortress.core.impl;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+
+@Retention(RetentionPolicy.RUNTIME)
+//@Target(ElementType.FIELD)
+//@Target(ElementType.TYPE)
+public @interface MyAnnotation {
+ public String name();
+ public String value();
+}
+
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/OrgUnitTestData.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/OrgUnitTestData.java b/src/test/java/org/apache/directory/fortress/core/impl/OrgUnitTestData.java
new file mode 100755
index 0000000..02b70d8
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/OrgUnitTestData.java
@@ -0,0 +1,925 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+package org.apache.directory.fortress.core.impl;
+
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.directory.fortress.core.model.OrgUnit;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Description of the Class
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class OrgUnitTestData extends TestCase
+{
+ private static final String CLS_NM = OrgUnitTestData.class.getName();
+ private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
+
+ public static final String[][] ORGS_USR_DEV0 =
+ {
+ {
+ "DEV0", /* NAME_COL */
+ "DEV Case T0", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ };
+
+ public static final String[][] ORGS_PRM_APP0 =
+ {
+ {
+ "APP0", /* NAME_COL */
+ "APP Case T0", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ };
+
+ public static final String[][] ORGS_DEV1 =
+ {
+ {
+ "DEV1", /* NAME_COL */
+ "DEV Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "DEV2", /* NAME_COL */
+ "DEV Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "DEV3", /* NAME_COL */
+ "DEV Case T3", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "DEV4", /* NAME_COL */
+ "DEV Case T4", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "DEV5", /* NAME_COL */
+ "DEV Case T5", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "DEV6", /* NAME_COL */
+ "DEV Case T6", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "DEV7", /* NAME_COL */
+ "DEV Case T7", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "DEV8", /* NAME_COL */
+ "DEV Case T8", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "DEV9", /* NAME_COL */
+ "DEV Case T9", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "DEV10", /* NAME_COL */
+ "DEV Case T10", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_APP1 =
+ {
+ {
+ "APP1", /* NAME_COL */
+ "APP Case T1", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "APP2", /* NAME_COL */
+ "APP Case T2", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "APP3", /* NAME_COL */
+ "APP Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "APP4", /* NAME_COL */
+ "APP Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "APP5", /* NAME_COL */
+ "APP Case T5", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "APP6", /* NAME_COL */
+ "APP Case T6", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "APP7", /* NAME_COL */
+ "APP Case T7", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "APP8", /* NAME_COL */
+ "APP Case T8", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "APP9", /* NAME_COL */
+ "APP Case T9", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "APP10", /* NAME_COL */
+ "APP Case T10", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_TO1 =
+ {
+ {
+ "oamT1UOrg1", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT1UOrg2", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT1UOrg3", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT1UOrg4", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT1UOrg5", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT1UOrg6", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT1UOrg7", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT1UOrg8", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT1UOrg9", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT1UOrg10", /* NAME_COL */
+ "Test Case T1", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_USR_TO2 =
+ {
+ {
+ "oamT2UOrg1", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg2", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT2UOrg2", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg3", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT2UOrg3", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg4", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT2UOrg4", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg5", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT2UOrg5", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg6", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT2UOrg6", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg7", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT2UOrg7", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg8", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT2UOrg8", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg9", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT2UOrg9", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "oamT2UOrg10", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT2UOrg10", /* NAME_COL */
+ "Test Case T2", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_PRM_TO3 =
+ {
+ {
+ "oamT3POrg1", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT3POrg2", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT3POrg3", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT3POrg4", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT3POrg5", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT3POrg6", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT3POrg7", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT3POrg8", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT3POrg9", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT3POrg10", /* NAME_COL */
+ "Test Case T3", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "T" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_PRM_TO4 =
+ {
+ {
+ "oamT4POrg1", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg2", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT4POrg2", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg3", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "oamT4POrg3", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg4", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT4POrg4", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg5", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT4POrg5", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg6", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT4POrg6", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg7", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT4POrg7", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg8", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT4POrg8", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg9", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT4POrg9", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "oamT4POrg10", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "oamT4POrg10", /* NAME_COL */
+ "Test Case T4", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_USR_TO5 =
+ {
+ {
+ "T5UOrg1", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "U", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T5UOrg2", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T5UOrg1", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T5UOrg3", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T5UOrg1", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "T5UOrg4", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T5UOrg2", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "T5UOrg5", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T5UOrg2", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+},
+ };
+
+ public static final String[][] ORGS_PRM_TO5 =
+ {
+ {
+ "T5POrg1", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "P", /* TYPE COL */
+ "", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T5POrg2", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T5POrg1", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T5POrg3", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T5POrg1", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "T5POrg4", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T5POrg2", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+},
+ {
+ "T5POrg5", /* NAME_COL */
+ "Test Case T5", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T5POrg2", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+},
+ };
+
+ public static final String[][] ORGS_USR_TO6_DSC =
+ {
+ {
+ "T6UOrg1", /* NAME_COL */
+ "Test Case T6U", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T6UOrg2,T6UOrg3", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T6UOrg2", /* NAME_COL */
+ "Test Case T6U", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T6UOrg4,T6UOrg5", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T6UOrg3", /* NAME_COL */
+ "Test Case T6U", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T6UOrg6,T6UOrg7", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_PRM_TO6_DSC =
+ {
+ {
+ "T6POrg1", /* NAME_COL */
+ "Test Case T6P", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T6POrg2,T6POrg3", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T6POrg2", /* NAME_COL */
+ "Test Case T6P", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T6POrg4,T6POrg5", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T6POrg3", /* NAME_COL */
+ "Test Case T6P", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T6POrg6,T6POrg7", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "D" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_USR_TO7_ASC =
+ {
+ {
+ "T7UOrg1", /* NAME_COL */
+ "Test Case T6U", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T7UOrg2,T7UOrg3", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "C" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T7UOrg2", /* NAME_COL */
+ "Test Case T2U", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T7UOrg4,T7UOrg5", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T7UOrg3", /* NAME_COL */
+ "Test Case T2U", /* DESC_COL */
+ "U", /* TYPE COL */
+ "T7UOrg6,T7UOrg7", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ public static final String[][] ORGS_PRM_TO7_ASC =
+ {
+ {
+ "T7POrg1", /* NAME_COL */
+ "Test Case T6P", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T7POrg2,T7POrg3", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "C" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T7POrg2", /* NAME_COL */
+ "Test Case T2P", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T7POrg4,T7POrg5", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+ },
+ {
+ "T7POrg3", /* NAME_COL */
+ "Test Case T2P", /* DESC_COL */
+ "P", /* TYPE COL */
+ "T7POrg6,T7POrg7", /* RELATIONSHIP_COL */
+ "", /* INHERITANCE_COL */
+ "A" /* INHERITANCE_FLAG_COL */
+}
+ };
+
+ /**
+ * The Fortress test data for junit uses 2-dimensional arrays.
+ */
+ private final static int NAME_COL = 0;
+ private final static int DESC_COL = 1;
+ private final static int TYPE_COL = 2;
+ private final static int RELATIONSHIP_COL = 3;
+ private final static int INHERITANCE_COL = 4;
+ private final static int INHERITANCE_FLAG_COL = 5;
+
+
+ /**
+ *
+ * @param ou
+ * @param ole
+ */
+ public static void assertEquals( OrgUnit ou, String[] ole )
+ {
+ assertEquals( CLS_NM + ".assertEquals failed compare ou name", getName( ole ), ou.getName() );
+ assertEquals( CLS_NM + ".assertEquals failed compare ou desc", getDescription( ole ), ou.getDescription() );
+ assertEquals( CLS_NM + ".assertEquals failed compare ou type", getType( ole ), ou.getType() );
+ LOG.debug( "assertEquals [" + ou.getName() + "] successful" );
+ }
+
+
+ /**
+ *
+ * @param ole
+ * @return
+ */
+ public static String getName( String[] ole )
+ {
+ return ole[NAME_COL];
+ }
+
+
+ /**
+ *
+ * @param ole
+ * @return
+ */
+ public static String getDescription( String[] ole )
+ {
+ return ole[DESC_COL];
+ }
+
+
+ /**
+ *
+ * @param ole
+ * @return
+ */
+ public static OrgUnit.Type getType( String[] ole )
+ {
+ if ( "P".equalsIgnoreCase( ole[TYPE_COL] ) )
+ {
+ return OrgUnit.Type.PERM;
+ }
+ else
+ {
+ return OrgUnit.Type.USER;
+ }
+ }
+
+
+ /**
+ *
+ * @param ole
+ * @return
+ */
+ public static Collection<String> getRelationship( Collection<String> parents, String[] ole )
+ {
+ String relationShip = ole[RELATIONSHIP_COL];
+
+ if ( StringUtils.isNotEmpty( relationShip ) )
+ {
+ StringTokenizer charSetTkn = new StringTokenizer( relationShip, TestUtils.DELIMITER_TEST_DATA );
+
+ if ( charSetTkn.countTokens() > 0 )
+ {
+ while ( charSetTkn.hasMoreTokens() )
+ {
+ String pOrg = charSetTkn.nextToken();
+ parents.add( pOrg );
+ }
+ }
+ }
+
+ return parents;
+ }
+
+
+ /**
+ *
+ * @param ole
+ * @return
+ */
+ public static Set<String> getInheritances( String[] ole )
+ {
+ Set<String> rels = new HashSet<>();
+ String inheritances = ole[INHERITANCE_COL];
+
+ if ( StringUtils.isNotEmpty( inheritances ) )
+ {
+ StringTokenizer charSetTkn = new StringTokenizer( inheritances, TestUtils.DELIMITER_TEST_DATA );
+
+ if ( charSetTkn.countTokens() > 0 )
+ {
+ while ( charSetTkn.hasMoreTokens() )
+ {
+ String pOrg = charSetTkn.nextToken();
+ rels.add( pOrg );
+ }
+ }
+ }
+
+ return rels;
+ }
+
+
+ /**
+ *
+ * @param ole
+ * @return
+ */
+ public static boolean isCreate( String[] ole )
+ {
+ return "C".equalsIgnoreCase( ole[INHERITANCE_FLAG_COL] );
+ }
+
+
+ /**
+ *
+ * @param ole
+ * @return
+ */
+ public static boolean isTree( String[] ole )
+ {
+ return "T".equalsIgnoreCase( ole[INHERITANCE_FLAG_COL] );
+ }
+
+
+ public static OrgUnit getOrgUnit( String[] ole )
+ {
+ OrgUnit ou = new OrgUnit();
+ ou.setName( getName( ole ) );
+ ou.setDescription( getDescription( ole ) );
+ ou.setType( getType( ole ) );
+
+ return ou;
+ }
+}
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/PRA.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/PRA.java b/src/test/java/org/apache/directory/fortress/core/impl/PRA.java
new file mode 100755
index 0000000..f26e009
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/PRA.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+package org.apache.directory.fortress.core.impl;
+
+
+/**
+ * Description of the Class
+ *
+ *@author Shawn McKinney
+ */
+public class PRA implements java.io.Serializable, Comparable
+{
+ private String pou;
+ private String urole;
+ private String arole;
+ private boolean canAssign;
+
+
+ @Override
+ public int hashCode()
+ {
+ int result = pou != null ? pou.hashCode() : 0;
+ result = 31 * result + ( urole != null ? urole.hashCode() : 0 );
+ result = 31 * result + ( arole != null ? arole.hashCode() : 0 );
+ result = 31 * result + ( canAssign ? 1 : 0 );
+ return result;
+ }
+
+
+ public PRA( String arole, String pou, String urole, boolean canAssign )
+ {
+ this.arole = arole;
+ this.pou = pou;
+ this.urole = urole;
+ this.canAssign = canAssign;
+ }
+
+
+ public int compareTo( Object o )
+ {
+ PRA k1 = this;
+ PRA k2 = ( PRA ) o;
+ String s1 = k1.getPou() + k1.getUrole() + k1.getArole();
+ String s2 = k2.getPou() + k2.getUrole() + k2.getArole();
+ return s1.compareToIgnoreCase( s2 );
+ }
+
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ return true;
+ if ( o == null || getClass() != o.getClass() )
+ return false;
+
+ PRA that = ( PRA ) o;
+
+ if ( !this.getPou().equalsIgnoreCase( that.getPou() ) )
+ return false;
+ if ( !this.getUrole().equalsIgnoreCase( that.getUrole() ) )
+ return false;
+ return this.getArole().equalsIgnoreCase( that.getArole() );
+ }
+
+
+ public String getPou()
+ {
+ return pou;
+ }
+
+
+ public void setPou( String pou )
+ {
+ this.pou = pou;
+ }
+
+
+ public String getUrole()
+ {
+ return urole;
+ }
+
+
+ public void setUrole( String urole )
+ {
+ this.urole = urole;
+ }
+
+
+ public String getArole()
+ {
+ return arole;
+ }
+
+
+ public void setArole( String arole )
+ {
+ this.arole = arole;
+ }
+
+
+ public boolean isCanAssign()
+ {
+ return canAssign;
+ }
+
+
+ public void setCanAssign( boolean canAssign )
+ {
+ this.canAssign = canAssign;
+ }
+}