assertFalse( "Object should not be authorized", testAuth1.isAuthorized() );
assertEquals( "Object should be updated", authorizeCount++, testAuth1.getAuthCount() );
CommandManager cmgr = Application.instance().getActiveWindow().getCommandManager();
ActionCommand cmdWrite = cmgr.getActionCommand( "cmdWrite" );
ActionCommand cmdAdmin = cmgr.getActionCommand( "cmdAdmin" );
ActionCommand cmdAdminAlias = cmgr.getActionCommand( "cmdAdminAlias" );
assertFalse( "Object should not be authorized", cmdWrite.isAuthorized() );
assertFalse( "Object should not be authorized", cmdAdmin.isAuthorized() );
assertFalse( "Object should not be authorized", cmdAdminAlias.isAuthorized() );
// Now login with ROLE_WRITE
Authentication auth = TestAuthenticationManager.makeAuthentication( "test", "test", "ROLE_WRITE" );
securityManager.doLogin( auth );
assertTrue( "Object should be authorized", cmdWrite.isAuthorized() );
assertFalse( "Object should not be authorized", cmdAdmin.isAuthorized() );
assertFalse( "Object should not be authorized", cmdAdminAlias.isAuthorized() );
assertFalse( "Object should not be authorized", testAuth1.isAuthorized() );
assertEquals( "Object should be updated", authorizeCount++, testAuth1.getAuthCount() );
// Now login with ROLE_ADMIN
auth = TestAuthenticationManager.makeAuthentication( "test", "test", "ROLE_ADMIN" );
securityManager.doLogin( auth );
assertTrue( "Object should be authorized", cmdWrite.isAuthorized() );
assertTrue( "Object should be authorized", cmdAdmin.isAuthorized() );
assertTrue( "Object should be authorized", cmdAdminAlias.isAuthorized() );
assertTrue( "Object should be authorized", testAuth1.isAuthorized() );
assertEquals( "Object should be updated", authorizeCount++, testAuth1.getAuthCount() );
}