FC-73 - Add debug mode for Ant admin scripts
diff --git a/src/main/java/us/jts/fortress/rbac/FortEntity.java b/src/main/java/us/jts/fortress/rbac/FortEntity.java
index fd97297..a2d09b5 100755
--- a/src/main/java/us/jts/fortress/rbac/FortEntity.java
+++ b/src/main/java/us/jts/fortress/rbac/FortEntity.java
@@ -182,7 +182,7 @@
/**
- * Set the contextId for this record. The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT
+ * Return the contextId for this record. The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT
*
* @return value maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
*/
@@ -193,7 +193,7 @@
/**
- * Return the contextId associated with this record. The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT.
+ * Set the contextId associated with this record. The contextId is used for multi-tenancy to isolate data sets within a particular sub-tree within DIT.
* Package private to prevent outside classes from setting.
*
* @param contextId maps to sub-tree in DIT, for example ou=contextId, dc=jts, dc = com.
diff --git a/src/test/java/us/jts/fortress/rbac/FortressAntLoadTest.java b/src/test/java/us/jts/fortress/rbac/FortressAntLoadTest.java
index 0a962b8..66f01d1 100644
--- a/src/test/java/us/jts/fortress/rbac/FortressAntLoadTest.java
+++ b/src/test/java/us/jts/fortress/rbac/FortressAntLoadTest.java
@@ -7,6 +7,7 @@
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -35,14 +36,12 @@
import us.jts.fortress.util.LogUtil;
import us.jts.fortress.util.Testable;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+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
+ * 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 Shawn McKinney
@@ -52,12 +51,14 @@
{
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.
+ // 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.
+ * 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 )
@@ -93,21 +94,20 @@
*/
private void checkPermissions( String msg, List<UserAnt> users, List<PermAnt> permissions )
{
- //String DATE_FORMAT = "yyyyMMdd HHmmssSSS";
String DATE_FORMAT = "E yyyy.MM.dd 'at' hh:mm:ss a zzz";
- // Sep 22, 2013 8:38:38 AM
- SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
+ SimpleDateFormat format = new SimpleDateFormat( DATE_FORMAT );
Date now = new Date();
- String szTimestamp = format.format(now);
+ 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".split("#");
- writer.writeNext(entries);
+ 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 )
{
@@ -116,7 +116,7 @@
// Can't continue without AccessMgr
fail( ex.getMessage() );
}
- catch(IOException ioe)
+ catch ( IOException ioe )
{
String error = "File IO Exception=" + ioe;
LOG.warn( error );
@@ -127,8 +127,17 @@
{
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 );
@@ -139,8 +148,10 @@
// TODO: send this message as CSV output file:
LOG.info( "User: " + user.getUserId() + " Perm Obj: " + permAnt.getObjectName() + " Perm " +
"Operation: " + permAnt.getOpName() + " RESULT: " + result );
- String[] entries = (user.getUserId() + "#" + permAnt.getObjectName() + "#" + permAnt.getOpName() + "#" + result + "#" + assignedRoles + "#" + session.getUser().getRoles() + "#" + szTimestamp).split("#");
- writer.writeNext(entries);
+ String[] entries = ( user.getUserId() + "#" + permAnt.getObjectName() + "#" + permAnt.getOpName()
+ + "#" + result + "#" + assignedRoles + "#" + session.getUser().getRoles() + "#" + szTimestamp
+ + "#" + warnings ).split( "#" );
+ writer.writeNext( entries );
}
}
catch ( SecurityException ex )
@@ -154,7 +165,7 @@
{
writer.close();
}
- catch(IOException ioe)
+ catch ( IOException ioe )
{
// ignore
}