directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject [18/51] [partial] directory-fortress-core git commit: FC-109 - rename rbac package to impl
Date Tue, 02 Jun 2015 18:36:43 GMT
http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/AdminRoleTestData.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/AdminRoleTestData.java b/src/test/java/org/apache/directory/fortress/core/impl/AdminRoleTestData.java
new file mode 100755
index 0000000..574e4d8
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/AdminRoleTestData.java
@@ -0,0 +1,1018 @@
+/*
+ *   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.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.AdminRole;
+import org.apache.directory.fortress.core.util.time.Constraint;
+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 AdminRoleTestData extends TestCase
+{
+    private static final String CLS_NM = AdminRoleTestData.class.getName();
+    private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
+
+    public static final String[][] AROLES_SUPER =
+        {
+            {
+                "fortress-core-super-admin", /* NAME_COL */
+                "fortress core super admin role", /* DESC_COL */
+                "0", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "DEV0", /* OSU_COL */
+                "APP0" /* OSP_COL */
+        }
+    };
+    /**
+      * Test Case TR1:
+     */
+    public static final String[][] AROLES_TR1 =
+        {
+            {
+                "oamAdmin1", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role1", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role2", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg1,oamT2UOrg1", /* OSU_COL */
+                "oamT3POrg1,oamT4POrg1" /* OSP_COL */
+        },
+            {
+                "oamAdmin2", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role2", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role3", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg2,oamT2UOrg2", /* OSU_COL */
+                "oamT3POrg2,oamT4POrg2" /* OSP_COL */
+    },
+            {
+                "oamAdmin3", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role3", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role4", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg3,oamT2UOrg3", /* OSU_COL */
+                "oamT3POrg3,oamT4POrg3" /* OSP_COL */
+},
+            {
+                "oamAdmin4", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMre.getBeginRange(EOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role4", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role5", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg4,oamT2UOrg4", /* OSUre.getBeginRange(_COL */
+                "oamT3POrg4,oamT4POrg4" /* OSP_COL */
+},
+            {
+                "oamAdmin5", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOre.getBeginRange(CKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role5", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role6", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg5,oamT2UOrg5", /* OSU_COL */
+                "oamT3POrg5,oamT4POrg5" /* OSP_COL */
+},
+            {
+                "oamAdmin6", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role6", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role7", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg6,oamT2UOrg6", /* OSU_COL */
+                "oamT3POrg6,oamT4POrg6" /* OSP_COL */
+},
+            {
+                "oamAdmin7", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role7", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role8", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg7,oamT2UOrg7", /* OSU_COL */
+                "oamT3POrg7,oamT4POrg7" /* OSP_COL */
+},
+            {
+                "oamAdmin8", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role8", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role9", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg8,oamT2UOrg8", /* OSU_COL */
+                "oamT3POrg8,oamT4POrg8" /* OSP_COL */
+},
+            {
+                "oamAdmin9", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role9", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role10", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "oamT1UOrg9,oamT2UOrg9", /* OSU_COL */
+                "oamT3POrg9,oamT4POrg9" /* OSP_COL */
+},
+            {
+                "oamAdmin10", /* NAME_COL */
+                "Test Case TR1", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "oamT14Role1", /* BEGIN_RANGE_COL (child) */
+                "oamT14Role10", /* END_RANGE_COL (parent) */
+                "F", /* IS_BEGIN_INCLUSIVE */
+                "F", /* IS_END_INCLUSIVE */
+                "oamT1UOrg10,oamT2UOrg10", /* OSU_COL */
+                "oamT3POrg10,oamT4POrg10" /* OSP_COL */
+},
+    };
+
+    public static final String[][] AROLES_TR2 =
+        {
+            {
+                "oamT2UAdmin1", /* NAME_COL */
+                "Test Case TR2", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[3] ), /* BEGIN_RANGE_COL (child) */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[0] ), /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_USR_TO5[0] ), /* OSU_COL */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_PRM_TO5[0] ) /* OSP_COL */
+        },
+            {
+                "oamT2UAdmin2", /* NAME_COL */
+                "Test Case TR2", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[3] ), /* BEGIN_RANGE_COL (child) */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[0] ), /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "F", /* IS_END_INCLUSIVE */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_USR_TO5[1] ), /* OSU_COL */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_PRM_TO5[1] ) /* OSP_COL */
+    },
+            {
+                "oamT2UAdmin3", /* NAME_COL */
+                "Test Case TR2", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[4] ), /* BEGIN_RANGE_COL (child) */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[0] ), /* END_RANGE_COL (parent) */
+                "F", /* IS_BEGIN_INCLUSIVE */
+                "F", /* IS_END_INCLUSIVE */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_USR_TO5[2] ), /* OSU_COL */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_PRM_TO5[2] ) /* OSP_COL */
+},
+            {
+                "oamT2UAdmin4", /* NAME_COL */
+                "Test Case TR2", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[3] ), /* BEGIN_RANGE_COL (child) */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[1] ), /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "F", /* IS_END_INCLUSIVE */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_USR_TO5[3] ), /* OSU_COL */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_PRM_TO5[3] ) /* OSP_COL */
+},
+            {
+                "oamT2UAdmin5", /* NAME_COL */
+                "Test Case TR2", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[5] ), /* BEGIN_RANGE_COL (child) */
+                RoleTestData.getName( RoleTestData.ROLES_TR15_ARBAC[4] ), /* END_RANGE_COL (parent) */
+                "F", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_USR_TO5[4] ), /* OSU_COL */
+                OrgUnitTestData.getName( OrgUnitTestData.ORGS_PRM_TO5[4] ) /* OSP_COL */
+}
+    };
+
+    public static final String[][] AROLES_TR3 =
+        {
+            {
+                "T3AdmRle1", /* NAME_COL */
+                "Admin Role1 TR3", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+        },
+            {
+                "T3AdmRle2", /* NAME_COL */
+                "Admin Role2 TR3", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+    },
+            {
+                "T3AdmRle3", /* NAME_COL */
+                "Admin Role3 TR3", /* DESC_COL */
+                "30", /* TIMEOUT_COL */
+                "0000", /* BTIME_COL */
+                "0000", /* ETIME_COL */
+                "20090101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "1234567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+}
+    };
+
+    public static final String[][] AROLES_TR3_UPD =
+        {
+            {
+                "T3AdmRle1", /* NAME_COL */
+                "Admin Role1 TR3 Updated", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+        },
+            {
+                "T3AdmRle2", /* NAME_COL */
+                "Admin Role1 TR3 Updated", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "1700", /* BTIME_COL */
+                "2300", /* ETIME_COL */
+                "20110501", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "12345", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+    },
+            {
+                "T3AdmRle3", /* NAME_COL */
+                "Admin Role3 TR3 Updated", /* DESC_COL */
+                "45", /* TIMEOUT_COL */
+                "2300", /* BTIME_COL */
+                "0700", /* ETIME_COL */
+                "20110301", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "34567", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "T", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+}
+    };
+
+    public static final String[][] AROLES_TR4_ASC =
+        {
+            {
+                "T4AdmRle1", /* NAME_COL */
+                "Admin Role1 TR4 ASC", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T4AdmRle2,T4AdmRle3", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "C", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+        },
+            {
+                "T4AdmRle2", /* NAME_COL */
+                "Admin Role2 TR4 ASC", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T4AdmRle4,T4AdmRle5", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "A", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+    },
+            {
+                "T4AdmRle3", /* NAME_COL */
+                "Admin Role3 TR4 ASC", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T4AdmRle6,T4AdmRle7", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "A", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+    };
+
+    public static final String[][] AROLES_TR5_DSC =
+        {
+            {
+                "T5AdmRle1", /* NAME_COL */
+                "Admin Role1 TR5 DSC", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T5AdmRle2,T5AdmRle3", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "D", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+        },
+            {
+                "T5AdmRle2", /* NAME_COL */
+                "Admin Role2 TR5 DSC", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T5AdmRle4,T5AdmRle5", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "D", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+    },
+            {
+                "T5AdmRle3", /* NAME_COL */
+                "Admin Role3 TR5 DSC", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T5AdmRle6,T5AdmRle7", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "D", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+    };
+
+    public static final String[][] AROLES_TR6_HIER =
+        {
+            {
+                "T6AdmRle1", /* NAME_COL */
+                "Admin Role1 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle2", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+        },
+            {
+                "T6AdmRle2", /* NAME_COL */
+                "Admin Role2 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle3", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+    },
+            {
+                "T6AdmRle3", /* NAME_COL */
+                "Admin Role3 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle4", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+            {
+                "T6AdmRle4", /* NAME_COL */
+                "Admin Role4 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle5", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+            {
+                "T6AdmRle5", /* NAME_COL */
+                "Admin Role5 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle6", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+            {
+                "T6AdmRle6", /* NAME_COL */
+                "Admin Role6 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle7", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+            {
+                "T6AdmRle7", /* NAME_COL */
+                "Admin Role7 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle8", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+            {
+                "T6AdmRle8", /* NAME_COL */
+                "Admin Role8 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle9", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+            {
+                "T6AdmRle9", /* NAME_COL */
+                "Admin Role9 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "T6AdmRle10", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_COL */
+},
+            {
+                "T6AdmRle10", /* NAME_COL */
+                "Admin Role10 TR6 HIER", /* DESC_COL */
+                "15", /* TIMEOUT_COL */
+                "0800", /* BTIME_COL */
+                "1700", /* ETIME_COL */
+                "20110101", /* BDATE_COL */
+                "21000101", /* EDATE_COL */
+                "20500101", /* BLOCKDATE_COL */
+                "20500115", /* ELOCKDATE_COL */
+                "23456", /* DAYMASK_COL */
+                "", /* RELATIONSHIP_COL */
+                "", /* INHERITANCE_COL */
+                "", /* INHERITANCE_FLAG_COL */
+                "", /* BEGIN_RANGE_COL (child) */
+                "", /* END_RANGE_COL (parent) */
+                "T", /* IS_BEGIN_INCLUSIVE */
+                "T", /* IS_END_INCLUSIVE */
+                "", /* OSU_COL */
+                "" /* OSP_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 TIMEOUT_COL = 2;
+    private final static int BTIME_COL = 3;
+    private final static int ETIME_COL = 4;
+    private final static int BDATE_COL = 5;
+    private final static int EDATE_COL = 6;
+    private final static int BLOCKDATE_COL = 7;
+    private final static int ELOCKDATE_COL = 8;
+    private final static int DAYMASK_COL = 9;
+    private final static int RELATIONSHIP_COL = 10;
+    private final static int INHERITANCE_COL = 11;
+    private final static int INHERITANCE_FLAG_COL = 12;
+    */
+    private final static int BEGIN_RANGE_COL = 13;
+    private final static int END_RANGE_COL = 14;
+    private final static int IS_BEGIN_INCLUSIVE = 15;
+    private final static int IS_END_INCLUSIVE = 16;
+    private final static int OSU = 17;
+    private final static int OSP = 18;
+
+
+    private static Set<String> getOsU( String[] rle )
+    {
+        Set<String> members = new HashSet<>();
+        if ( StringUtils.isNotEmpty( rle[OSU] ) )
+        {
+            StringTokenizer charSetTkn = new StringTokenizer( rle[OSU], TestUtils.DELIMITER_TEST_DATA );
+            if ( charSetTkn.countTokens() > 0 )
+            {
+                while ( charSetTkn.hasMoreTokens() )
+                {
+                    String member = charSetTkn.nextToken();
+                    members.add( member );
+                }
+            }
+        }
+        return members;
+    }
+
+
+    private static Set<String> getOsP( String[] rle )
+    {
+        Set<String> members = new HashSet<>();
+        if ( StringUtils.isNotEmpty( rle[OSP] ) )
+        {
+            StringTokenizer charSetTkn = new StringTokenizer( rle[OSP], TestUtils.DELIMITER_TEST_DATA );
+            if ( charSetTkn.countTokens() > 0 )
+            {
+                while ( charSetTkn.hasMoreTokens() )
+                {
+                    String member = charSetTkn.nextToken();
+                    members.add( member );
+                }
+            }
+        }
+        return members;
+    }
+
+
+    private static String getBeginRange( String[] rle )
+    {
+        return rle[BEGIN_RANGE_COL];
+    }
+
+
+    private static String getEndRange( String[] rle )
+    {
+        return rle[END_RANGE_COL];
+    }
+
+
+    private static boolean isBeginInclusive( String[] rle )
+    {
+        boolean result = false;
+        if ( StringUtils.isNotEmpty( rle[IS_BEGIN_INCLUSIVE] )
+            && rle[IS_BEGIN_INCLUSIVE].equalsIgnoreCase( "T" ) )
+        {
+            result = true;
+        }
+
+        return result;
+    }
+
+
+    private static boolean isEndInclusive( String[] rle )
+    {
+        boolean result = false;
+        if ( StringUtils.isNotEmpty( rle[IS_END_INCLUSIVE] ) && rle[IS_END_INCLUSIVE].equalsIgnoreCase( "T" ) )
+        {
+            result = true;
+        }
+
+        return result;
+    }
+
+
+    public static AdminRole getRole( String[] rle )
+    {
+        AdminRole role = ( AdminRole ) getRoleConstraint( rle );
+        role.setName( RoleTestData.getName( rle ) );
+        role.setDescription( RoleTestData.getDescription( rle ) );
+        role.setOsU( getOsU( rle ) );
+        role.setOsP( getOsP( rle ) );
+        role.setBeginRange( getBeginRange( rle ) );
+        role.setEndRange( getEndRange( rle ) );
+        role.setBeginInclusive( isBeginInclusive( rle ) );
+        role.setEndInclusive( isEndInclusive( rle ) );
+        return role;
+    }
+
+
+    private static Constraint getRoleConstraint( String[] rle )
+    {
+        AdminRole role = new AdminRole();
+        role.setBeginDate( RoleTestData.getBeginDate( rle ) );
+        role.setEndDate( RoleTestData.getEndDate( rle ) );
+        role.setBeginLockDate( RoleTestData.getBeginLockDate( rle ) );
+        role.setEndLockDate( RoleTestData.getEndLockDate( rle ) );
+        role.setBeginTime( RoleTestData.getBeginTime( rle ) );
+        role.setEndTime( RoleTestData.getEndTime( rle ) );
+        role.setDayMask( RoleTestData.getDayMask( rle ) );
+        role.setTimeout( RoleTestData.getTimeOut( rle ) );
+        return role;
+    }
+
+
+    /**
+     *
+     * @param role
+     * @param rle
+     */
+    public static void assertEquals( AdminRole role, String[] rle )
+    {
+        RoleTestData.assertEquals( role, rle );
+        LOG.debug( "assertEquals [" + role.getName() + "] successful" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/AuditMgrImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/AuditMgrImplTest.java b/src/test/java/org/apache/directory/fortress/core/impl/AuditMgrImplTest.java
new file mode 100755
index 0000000..7869f72
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/AuditMgrImplTest.java
@@ -0,0 +1,462 @@
+/*
+ *   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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.directory.fortress.core.model.AuthZ;
+import org.apache.directory.fortress.core.model.Bind;
+import org.apache.directory.fortress.core.model.Mod;
+import org.apache.directory.fortress.core.model.Session;
+import org.apache.directory.fortress.core.model.User;
+import org.apache.directory.fortress.core.model.UserAudit;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.directory.fortress.core.AuditMgr;
+import org.apache.directory.fortress.core.AuditMgrFactory;
+import org.apache.directory.fortress.core.SecurityException;
+import org.apache.directory.fortress.core.util.LogUtil;
+
+
+/**
+ * AccessMgrImpl Tester.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AuditMgrImplTest extends TestCase
+{
+    private static final String CLS_NM = AuditMgrImplTest.class.getName();
+    private static Session adminSess = null;
+    private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
+
+
+    public AuditMgrImplTest( String name )
+    {
+        super( name );
+    }
+
+
+    public void setUp() throws Exception
+    {
+        super.setUp();
+    }
+
+
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+    }
+
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite();
+        //suite.addTest(new AuditMgrImplTest("testSearchBinds"));
+        //suite.addTest(new AuditMgrImplTest("testSearchAuthNInvalid"));
+        //suite.addTest(new AuditMgrImplTest("testGetAuthZs"));
+        suite.addTest( new AuditMgrImplTest( "testSearchAuthZs" ) );
+        //suite.addTest(new AuditMgrImplTest("testSearchMods"));
+        //suite.addTest(new AuditMgrImplTest("testSearchAdminMods"));
+        return suite;
+    }
+
+
+    /**
+     *
+     */
+    public void testSearchAdminMods()
+    {
+        searchAdminMods( "SESS-USRS RBAC TU0", UserTestData.USERS_TU0, PermTestData.ADMINMGR_OBJ,
+            PermTestData.ADMINMGR_OPS );
+        searchAdminMods( "SESS-USRS ARBAC TU0", UserTestData.USERS_TU0, PermTestData.DELEGATEDMGR_OBJ,
+            PermTestData.DELEGATEDMGR_OPS );
+        searchAdminMods( "SESS-USRS PWPOLICY TU0", UserTestData.USERS_TU0, PermTestData.PSWDMGR_OBJ,
+            PermTestData.PSWDMGR_OPS );
+    }
+
+    private static Map disabled = loadAuditMap();
+
+
+    private static Map<String, String> loadAuditMap()
+    {
+        disabled = new HashMap();
+        disabled.put("AdminMgrImpl.updateSsdSet", null);
+        disabled.put("AdminMgrImpl.updateDsdSet", null);
+        disabled.put("PwPolicyMgrImpl.search", null);
+        //disabled.put("AdminMgrImpl.changePassword", null);
+        //disabled.put("AdminMgrRestImpl.changePassword", null);
+        LOG.info( "loadAuditMap isFirstRun [" + FortressJUnitTest.isFirstRun() + "]" );
+        if ( FortressJUnitTest.isFirstRun() )
+        {
+            disabled.put( "AdminMgrImpl.deleteRole", null );
+            disabled.put( "AdminMgrImpl.deleteUser", null );
+            disabled.put( "AdminMgrImpl.deassignUser", null );
+            disabled.put( "AdminMgrImpl.deletePermission", null );
+            disabled.put( "AdminMgrImpl.deletePermObj", null );
+            disabled.put( "AdminMgrImpl.revokePermission", null );
+            disabled.put( "AdminMgrImpl.revokePermissionUser", null );
+            disabled.put( "AdminMgrImpl.deleteInheritance", null );
+            disabled.put( "AdminMgrImpl.deleteSsdRoleMember", null );
+            disabled.put( "AdminMgrImpl.deleteSsdSet", null );
+            disabled.put( "AdminMgrImpl.deleteDsdRoleMember", null );
+            disabled.put( "AdminMgrImpl.deleteDsdSet", null );
+            disabled.put( "AdminMgrImpl.disableUser", null );
+
+            disabled.put( "DelAdminMgrImpl.deleteRole", null );
+            disabled.put( "DelAdminMgrImpl.deassignUser", null );
+            disabled.put( "DelAdminMgrImpl.deleteOU", null );
+            disabled.put( "DelAdminMgrImpl.deleteInheritanceOU", null );
+            disabled.put( "DelAdminMgrImpl.deleteInheritanceRole", null );
+
+            disabled.put( "PwPolicyMgrImpl.deletePasswordPolicy", null );
+            disabled.put( "PwPolicyMgrImpl.delete", null );
+        }
+        return disabled;
+    }
+
+
+    private static boolean isAudit( String objName, String opName )
+    {
+        return !disabled.containsKey( objName + "." + opName );
+    }
+
+
+    /**
+     *
+     * @param msg
+     * @param uArray
+     */
+    private static void searchAdminMods( String msg, String[][] uArray, String[][] oArray, String[][] opArray )
+    {
+        LogUtil.logIt( msg );
+        try
+        {
+            AuditMgr auditMgr = getManagedAuditMgr();
+            for ( String[] usr : uArray )
+            {
+                User user = UserTestData.getUser( usr );
+                // now search for successful session creation events:
+                UserAudit uAudit = new UserAudit();
+                uAudit.setUserId( user.getUserId() );
+                for ( String[] obj : oArray )
+                {
+                    String objName = AdminUtil.getObjName( PermTestData.getName( obj ) );
+                    uAudit.setObjName( objName );
+                    for ( String[] op : opArray )
+                    {
+                        uAudit.setOpName( PermTestData.getName( op ) );
+                        List<Mod> mods = auditMgr.searchAdminMods( uAudit );
+                        assertNotNull( mods );
+
+                        assertTrue(
+                            CLS_NM + "searchAdminMods failed search for successful authentication user ["
+                                + user.getUserId() + "] object [" + objName + "] operation ["
+                                + PermTestData.getName( op ) + "]",
+                            mods.size() > 0 || !isAudit( objName, PermTestData.getName( op ) ) );
+                        boolean result = mods.size() > 0 || !isAudit( objName, PermTestData.getName( op ) );
+                        LOG.debug( "searchAdminMods search user [" + user.getUserId() + "] object ["
+                            + objName + "] operation [" + PermTestData.getName( op ) + "] result: " + result );
+                        //System.out.println("searchAdminMods search user [" + user.getUserId() + "] object [" + objName + "] operation [" + PermTestData.getName(op) + "] result: " + result);
+                    }
+                }
+            }
+            LOG.debug( "searchAdminMods successful" );
+        }
+        catch ( SecurityException ex )
+        {
+            LOG.error(
+                "searchAdminMods: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+                    + ex.getMessage(), ex );
+            fail( ex.getMessage() );
+        }
+    }
+
+
+    /**
+     *
+     */
+    public void testSearchMods()
+    {
+        searchMods( "SESS-USRS TU1_UPD", UserTestData.USERS_TU1_UPD );
+        searchMods( "SESS-USRS TU3", UserTestData.USERS_TU3 );
+        searchMods( "SESS-USRS TU4", UserTestData.USERS_TU4 );
+    }
+
+
+    /**
+     *
+     * @param msg
+     * @param uArray
+     */
+    private static void searchMods( String msg, String[][] uArray )
+    {
+        LogUtil.logIt( msg );
+        try
+        {
+            AuditMgr auditMgr = getManagedAuditMgr();
+            for ( String[] usr : uArray )
+            {
+                User user = UserTestData.getUser( usr );
+                // now search for successful session creation events:
+                UserAudit uAudit = new UserAudit();
+                uAudit.setUserId( user.getUserId() );
+                uAudit.setFailedOnly( false );
+                List<Mod> mods = auditMgr.searchUserSessions( uAudit );
+                assertNotNull( mods );
+                assertTrue(
+                    CLS_NM + "searchUserSessions failed search for successful authentication user [" + user.getUserId()
+                        + "]", mods.size() > 0 );
+            }
+            LOG.debug( "searchUserSessions successful" );
+        }
+        catch ( SecurityException ex )
+        {
+            LOG.error( "searchUserSessions: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+                + ex.getMessage(), ex );
+            fail( ex.getMessage() );
+        }
+    }
+
+
+    public void testSearchAuthZs()
+    {
+        searchAuthZs( "GET-AUTHZ TU1_UPD", UserTestData.USERS_TU1_UPD, PermTestData.OBJS_TOB1, PermTestData.OPS_TOP1, false );
+        searchAuthZs( "GET-AUTHZ TU3", UserTestData.USERS_TU3, PermTestData.OBJS_TOB3, PermTestData.OPS_TOP3, false );
+        searchAuthZs( "GET-AUTHZ TU4", UserTestData.USERS_TU4, PermTestData.OBJS_TOB2, PermTestData.OPS_TOP2, false );
+
+        // search for failed only:
+        searchAuthZs( "GET-AUTHZ TU1_UPD", UserTestData.USERS_TU1_UPD, PermTestData.OBJS_TOB3, PermTestData.OPS_TOP3, true );
+        searchAuthZs( "GET-AUTHZ TU3", UserTestData.USERS_TU3, PermTestData.OBJS_TOB2, PermTestData.OPS_TOP2, true );
+        searchAuthZs( "GET-AUTHZ TU4", UserTestData.USERS_TU4, PermTestData.OBJS_TOB3, PermTestData.OPS_TOP3, true );
+    }
+
+
+    /**
+     *
+     * @param msg
+     * @param uArray
+     */
+    private static void searchAuthZs( String msg, String[][] uArray, String[][] oArray, String[][] opArray,
+        boolean failedOnly )
+    {
+        LogUtil.logIt( msg );
+        try
+        {
+            AuditMgr auditMgr = getManagedAuditMgr();
+            for ( String[] usr : uArray )
+            {
+                User user = UserTestData.getUser( usr );
+                // now search for successful authentications:
+                UserAudit uAudit = new UserAudit();
+                uAudit.setUserId( user.getUserId() );
+                uAudit.setFailedOnly( false );
+                for ( String[] obj : oArray )
+                {
+                    uAudit.setObjName( PermTestData.getName( obj ) );
+                    for ( String[] op : opArray )
+                    {
+                        uAudit.setOpName( PermTestData.getName( op ) );
+                        uAudit.setObjId( PermTestData.getObjId( op ) );
+                        uAudit.setFailedOnly( failedOnly );
+                        List<AuthZ> authZs = auditMgr.searchAuthZs( uAudit );
+                        assertNotNull( authZs );
+                        assertTrue(
+                            CLS_NM + "searchAuthZs failedOnly=" + failedOnly + ", search authorizations user ["
+                                + user.getUserId() + "], objName [" + uAudit.getObjName() + "], opName [" + uAudit.getOpName() + "], objId [" + uAudit.getObjId() + "]", authZs.size() > 0 );
+                    }
+                }
+            }
+            LOG.debug( "searchAuthZs successful" );
+        }
+        catch ( SecurityException ex )
+        {
+            LOG.error(
+                "searchAuthZs: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+                    + ex.getMessage(), ex );
+            fail( ex.getMessage() );
+        }
+    }
+
+
+    /**
+     *
+     */
+    public void testGetAuthZs()
+    {
+        getAuthZs( "GET-AUTHZ TU1_UPD", UserTestData.USERS_TU1_UPD );
+        getAuthZs( "GET-AUTHZ TU3", UserTestData.USERS_TU3 );
+        getAuthZs( "GET-AUTHZ TU4", UserTestData.USERS_TU4 );
+    }
+
+
+    /**
+     *
+     * @param msg
+     * @param uArray
+     */
+    private static void getAuthZs( String msg, String[][] uArray )
+    {
+        LogUtil.logIt( msg );
+        try
+        {
+            AuditMgr auditMgr = getManagedAuditMgr();
+            for ( String[] usr : uArray )
+            {
+                User user = UserTestData.getUser( usr );
+                // now search for successful authentications:
+                UserAudit uAudit = new UserAudit();
+                uAudit.setUserId( user.getUserId() );
+                uAudit.setFailedOnly( false );
+                List<AuthZ> authZs = auditMgr.getUserAuthZs( uAudit );
+                assertNotNull( authZs );
+                assertTrue(
+                    CLS_NM + "getUserAuthZs failed search for successful authorization user [" + user.getUserId() + "]",
+                    authZs.size() > 0 );
+
+                // now search for failed authentications:
+                uAudit.setFailedOnly( true );
+                authZs = auditMgr.getUserAuthZs( uAudit );
+                assertNotNull( authZs );
+                assertTrue( CLS_NM + "getUserAuthZs failed search for failed authorization user [" + user.getUserId()
+                    + "]", authZs.size() > 0 );
+            }
+            LOG.debug( "getUserAuthZs successful" );
+        }
+        catch ( SecurityException ex )
+        {
+            LOG.error(
+                "getUserAuthZs: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+                    + ex.getMessage(), ex );
+            fail( ex.getMessage() );
+        }
+    }
+
+
+    /**
+     *
+     */
+    public void testSearchAuthNInvalid()
+    {
+        searchAuthNInvalid( "INV-AUTHN" );
+    }
+
+
+    /**
+     *
+     * @param msg
+     */
+    private static void searchAuthNInvalid( String msg )
+    {
+        LogUtil.logIt( msg );
+        try
+        {
+            AuditMgr auditMgr = getManagedAuditMgr();
+            UserAudit uAudit = new UserAudit();
+            List<AuthZ> resultSet = auditMgr.searchInvalidUsers( uAudit );
+            assertNotNull( resultSet );
+            assertTrue( CLS_NM + "searchInvalidUsers failed search for invalid authentications", resultSet.size() > 0 );
+            LOG.debug( "searchInvalidUsers successful" );
+        }
+        catch ( SecurityException ex )
+        {
+            LOG.error( "searchInvalidUsers: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+                + ex.getMessage(), ex );
+            fail( ex.getMessage() );
+        }
+    }
+
+
+    /**
+     *
+     */
+    public void testSearchBinds()
+    {
+        searchBinds( "BIND-USRS TU1_UPD", UserTestData.USERS_TU1_UPD );
+        searchBinds( "BIND-USRS TU2_CHG", UserTestData.USERS_TU2_CHG );
+        searchBinds( "BIND-USRS TU3", UserTestData.USERS_TU3 );
+        searchBinds( "BIND-USRS TU4", UserTestData.USERS_TU4 );
+    }
+
+
+    /**
+     *
+     * @param msg
+     * @param uArray
+     */
+    private static void searchBinds( String msg, String[][] uArray )
+    {
+        LogUtil.logIt( msg );
+        try
+        {
+            AuditMgr auditMgr = getManagedAuditMgr();
+            for ( String[] usr : uArray )
+            {
+                User user = UserTestData.getUser( usr );
+                // now search for successful authentications:
+                UserAudit uAudit = new UserAudit();
+                uAudit.setUserId( user.getUserId() );
+                uAudit.setFailedOnly( false );
+                List<Bind> binds = auditMgr.searchBinds( uAudit );
+                assertNotNull( binds );
+                assertTrue(
+                    CLS_NM + "searchBinds failed search for successful authentication user [" + user.getUserId() + "]",
+                    binds.size() > 0 );
+
+                // now search for failed authentications:
+                uAudit.setFailedOnly( true );
+                binds = auditMgr.searchBinds( uAudit );
+                assertNotNull( binds );
+                assertTrue( CLS_NM + "searchBinds failed search for failed authentication user [" + user.getUserId()
+                    + "]", binds.size() > 0 );
+            }
+            LOG.debug( "searchBinds successful" );
+        }
+        catch ( SecurityException ex )
+        {
+            LOG.error(
+                "searchBinds: failed with SecurityException rc=" + ex.getErrorId() + ", msg="
+                    + ex.getMessage(), ex );
+            fail( ex.getMessage() );
+        }
+    }
+
+
+    /**
+     *
+     * @return
+     * @throws org.apache.directory.fortress.core.SecurityException
+     */
+    private static AuditMgr getManagedAuditMgr() throws SecurityException
+    {
+        if ( FortressJUnitTest.isAdminEnabled() && adminSess == null )
+        {
+            adminSess = DelegatedMgrImplTest.createAdminSession();
+        }
+        return AuditMgrFactory.createInstance( TestUtils.getContext(), adminSess );
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/ba64d26a/src/test/java/org/apache/directory/fortress/core/impl/CacheSample.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/impl/CacheSample.java b/src/test/java/org/apache/directory/fortress/core/impl/CacheSample.java
new file mode 100644
index 0000000..311c9d7
--- /dev/null
+++ b/src/test/java/org/apache/directory/fortress/core/impl/CacheSample.java
@@ -0,0 +1,181 @@
+/*
+ *   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.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sf.ehcache.search.Attribute;
+import net.sf.ehcache.search.Query;
+import net.sf.ehcache.search.Result;
+import net.sf.ehcache.search.Results;
+
+import org.apache.directory.fortress.core.model.SDSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.directory.fortress.core.util.cache.Cache;
+import org.apache.directory.fortress.core.util.cache.CacheMgr;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: smckinn
+ * Date: 6/2/12
+ * Time: 12:49 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class CacheSample
+{
+    private static final String CLS_NM = CacheSample.class.getName();
+    private static final Logger LOG = LoggerFactory.getLogger( CLS_NM );
+    private static final SdP sdP = new SdP();
+    private Cache cache;
+
+
+    private void initializeCache()
+    {
+        CacheMgr cacheManager = CacheMgr.getInstance();
+        cache = cacheManager.getCache( "fortress.dsd" );
+    }
+
+
+    private void loadCache()
+    {
+        try
+        {
+            SDSet sdSet = new SDSet();
+            sdSet.setType( SDSet.SDType.DYNAMIC );
+            sdSet.setName( "" );
+            List<SDSet> dsds = sdP.search( sdSet );
+            if ( dsds != null )
+            {
+                for ( SDSet dsd : dsds )
+                {
+                    Set<String> members = dsd.getMembers();
+                    if ( members != null )
+                    {
+                        for ( String member : members )
+                        {
+                            DsdCacheEntry entry = new DsdCacheEntry( member, dsd );
+                            String key = dsd.getName() + ":" + member;
+                            cache.put( key, entry );
+                            LOG.info( "Add DSD key: " + key + " members: " + dsd.getMembers() + " to the cache" );
+                        }
+                    }
+                }
+            }
+            else
+            {
+                LOG.info( "No records found for loading into test cache" );
+            }
+        }
+        catch ( org.apache.directory.fortress.core.SecurityException se )
+        {
+            String error = " static initializer caught SecurityException=" + se.getMessage() + " rc="
+                + se.getErrorId();
+            LOG.error( error );
+        }
+    }
+
+
+    void runTests()
+    {
+        loadCache();
+        Attribute<String> member = cache.getSearchAttribute( "member" );
+        Query query = cache.createQuery();
+        query.includeKeys();
+        query.includeValues();
+        Set<String> roles = new HashSet<>();
+        roles.add( "oamt17dsd1" );
+        roles.add( "oamt17dsd4" );
+        roles.add( "oamT13DSD6" );
+        roles.add( "oamT16SDR7" );
+        query.addCriteria( member.in( roles ) );
+        Results results = query.execute();
+        System.out.println( " Size: " + results.size() );
+        System.out.println( "----Results-----\n" );
+        Set<SDSet> resultSet = new HashSet<>();
+
+        for ( Result result : results.all() )
+        {
+            DsdCacheEntry entry = ( DsdCacheEntry ) result.getValue();
+            resultSet.add( entry.getSdSet() );
+        }
+
+        for ( SDSet sdSet : resultSet )
+        {
+            LOG.info( "Found SDSet: " + sdSet.getName() );
+        }
+    }
+
+
+    /**
+     * put your documentation comment here
+     *
+     * @param args
+     */
+    public static void main( String[] args )
+    {
+        LOG.info( "main Test #args=" + args.length );
+        CacheSample sample = new CacheSample();
+        sample.initializeCache();
+        sample.runTests();
+    }
+
+    public class DsdCacheEntry
+    {
+        private String member;
+        private SDSet sdSet;
+
+
+        public DsdCacheEntry( String member, SDSet sdSet )
+        {
+            this.sdSet = sdSet;
+            this.member = member;
+        }
+
+
+        public String getMember()
+        {
+            return member;
+        }
+
+
+        public void setMember( String member )
+        {
+            this.member = member;
+        }
+
+
+        public SDSet getSdSet()
+        {
+            return sdSet;
+        }
+
+
+        public void setSdSet( SDSet sdSet )
+        {
+            this.sdSet = sdSet;
+        }
+    }
+}
\ No newline at end of file


Mime
View raw message