Author: bdaw
Date: 2008-07-01 11:24:31 -0400 (Tue, 01 Jul 2008)
New Revision: 11232
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml
Log:
JBPORTAL-2019 - Notifications for identity
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml 2008-07-01
14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/build.xml 2008-07-01
15:24:31 UTC (rev 11232)
@@ -477,11 +477,11 @@
<x-test>
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>-->
+ <test todir="${test.reports}"
name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>
+ <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>-->
- <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
+ <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -134,7 +134,7 @@
log.debug("Delegating to DB module");
getDBModule().setProperty(user, name, propertyValue);
- fireUserProfileChangedEvent(user.getId(), user.getUserName(), name);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), name,
propertyValue);
return;
}
throw new IdentityException("Cannot process property - incorrect profile or
module configuration");
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -179,6 +179,8 @@
}
}
+ fireMembershipChangedEvent(role, users);
+
}
public void assignRoles(User user, Set roles) throws IdentityException
@@ -224,6 +226,8 @@
// Assign new roles
HibernateUserImpl ui = (HibernateUserImpl)user;
ui.setRoles(copy);
+
+ fireMembershipChangedEvent(user, roles);
}
//TODO:
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -22,7 +22,17 @@
package org.jboss.portal.identity.db;
import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+import org.jboss.portal.identity.event.RoleUpdatedEvent;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanProxyCreationException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
import java.util.Set;
import java.util.HashSet;
@@ -37,10 +47,14 @@
implements Role
{
+ /** . */
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(HibernateRoleImpl.class);
+
private Long key;
private String name;
private Set users;
private String displayName;
+ private IdentityEventBroadcaster eventBroadcaster;
/**
*
@@ -132,6 +146,14 @@
public void setDisplayName(String displayName)
{
this.displayName = displayName;
+
+ IdentityEventBroadcaster broadcaster = getEventBroadcaster();
+
+ if (broadcaster != null)
+ {
+ RoleUpdatedEvent event = new RoleUpdatedEvent(getId(), getName(), displayName);
+ broadcaster.fireEvent(event);
+ }
}
/**
@@ -146,4 +168,26 @@
{
return "Role[" + key + "," + name + "]";
}
+
+ private IdentityEventBroadcaster getEventBroadcaster()
+ {
+ if (eventBroadcaster == null)
+ {
+
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ IdentityServiceController identityService =
(IdentityServiceController)MBeanProxy.get(
+ IdentityServiceController.class, new
ObjectName("portal:service=Module,type=IdentityServiceController"),
mbeanServer);
+
+ eventBroadcaster =
(IdentityEventBroadcaster)identityService.getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to obtain IdentityEventBroadcaster. RoleUpdatedEvent
won't be broadcasted");
+ }
+ }
+
+ return eventBroadcaster;
+ }
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -207,6 +207,9 @@
HibernateRoleImpl role = new HibernateRoleImpl(name, displayName);
Session session = getCurrentSession();
session.save(role);
+
+ fireRoleCreatedEvent(role.getId(), role.getName());
+
return role;
}
catch (HibernateException e)
@@ -236,8 +239,13 @@
HibernateUserImpl user = (HibernateUserImpl)users.next();
user.getRoles().remove(role);
}
+
+ String name = role.getName();
+
session.delete(role);
session.flush();
+
+ fireRoleDestroyedEvent(id, name);
}
catch (HibernateException e)
{
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -162,7 +162,7 @@
{
dbUser.getProfileMap().remove(propertyName);
}
- fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName,
propertyValue);
}
public Map getProperties(User user) throws IdentityException
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java
(rev 0)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/MembershipChangedEvent.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -0,0 +1,92 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity.event;
+
+import java.util.Set;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class MembershipChangedEvent extends IdentityEvent
+{
+ private final Set userIds;
+
+ private final Set roleIds;
+
+ private final String representation;
+
+ public MembershipChangedEvent(Set userIds, Set roleIds)
+ {
+ if (userIds == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if (roleIds == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if (roleIds.size() > 1 && userIds.size() > 1)
+ {
+ throw new IllegalStateException("Either roleIds or userIds must contain
only one element");
+ }
+
+ this.userIds = userIds;
+ this.roleIds = roleIds;
+
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("MembershipChangedEvent[userIds=");
+ for (Iterator iterator = userIds.iterator(); iterator.hasNext();)
+ {
+ Object o = iterator.next();
+ if (iterator.hasNext())
+ {
+ sb.append(o.toString() + ", ");
+ }
+ else
+ {
+ sb.append(o.toString());
+ }
+ }
+ representation = sb.toString();
+ }
+
+ public Set getUserIds()
+ {
+ return userIds;
+ }
+
+ public Set getRoleIds()
+ {
+ return roleIds;
+ }
+
+ public String toString()
+ {
+ return representation;
+ }
+}
Copied:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java
(from rev 11138,
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserCreatedEvent.java)
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java
(rev 0)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleCreatedEvent.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity.event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RoleCreatedEvent extends IdentityEvent
+{
+
+ /** . */
+ private final Object roleId;
+
+ /** . */
+ private final String roleName;
+
+ public RoleCreatedEvent(Object roleId, String roleName)
+ {
+ if (roleId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (roleName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.roleId = roleId;
+ this.roleName = roleName;
+ }
+
+ public Object getRoleId()
+ {
+ return roleId;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public String toString()
+ {
+ return "RoleCreatedEvent[roleId=" + roleId + ",roleName=" +
roleName + "]";
+ }
+}
\ No newline at end of file
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java
(rev 0)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleDestroyedEvent.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity.event;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RoleDestroyedEvent extends IdentityEvent
+{
+
+ /** . */
+ private final Object roleId;
+
+ /** . */
+ private final String roleName;
+
+ public RoleDestroyedEvent(Object roleId, String roleName)
+ {
+ if (roleId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (roleName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.roleId = roleId;
+ this.roleName = roleName;
+ }
+
+ public Object getRoleId()
+ {
+ return roleId;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public String toString()
+ {
+ return "RoleDestroyedEvent[roleId=" + roleId + ",roleName=" +
roleName + "]";
+ }
+}
\ No newline at end of file
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java
(rev 0)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/RoleUpdatedEvent.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -0,0 +1,85 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity.event;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleUpdatedEvent extends IdentityEvent
+{
+ /** . */
+ private final Object roleId;
+
+ /** . */
+ private final String roleName;
+
+ /** . */
+ private String displayName;
+
+
+ public RoleUpdatedEvent(Object roleId, String roleName, String displayName)
+ {
+
+ this.displayName = displayName;
+ if (roleId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (roleName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (displayName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+
+ this.roleId = roleId;
+ this.roleName = roleName;
+ this.displayName = displayName;
+
+ }
+
+ public Object getRoleId()
+ {
+ return roleId;
+ }
+
+ public String getRoleName()
+ {
+ return roleName;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public String toString()
+ {
+ return "RoleUpdatedEvent[roleId=" + roleId + ",roleName=" +
roleName + ",displayName" + displayName + "]";
+ }
+
+}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -38,8 +38,12 @@
/** . */
private final String propertyName;
- public UserProfileChangedEvent(Object userId, String userName, String propertyName)
+ /** .*/
+ private Object newValue;
+
+ public UserProfileChangedEvent(Object userId, String userName, String propertyName,
Object newValue)
{
+ this.newValue = newValue;
if (userId == null)
{
throw new IllegalArgumentException();
@@ -52,9 +56,16 @@
{
throw new IllegalArgumentException();
}
+
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
this.userId = userId;
this.userName = userName;
this.propertyName = propertyName;
+ this.newValue = newValue;
}
public Object getUserId()
@@ -72,8 +83,13 @@
return propertyName;
}
+ public Object getNewValue()
+ {
+ return newValue;
+ }
+
public String toString()
{
- return "UserProfileChangedEvent[userId=" + userId +
",userName=" + userName + ",propertyName=" + propertyName +
"]";
+ return "UserProfileChangedEvent[userId=" + userId +
",userName=" + userName + ",propertyName=" + propertyName +
",propertyValue" + newValue + "]";
}
}
\ No newline at end of file
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -83,6 +83,8 @@
attrs.put(attr);
ldapContext.modifyAttributes(ldapr.getDn(),
DirContext.REPLACE_ATTRIBUTE,attrs);
+
+ fireRoleUpdatedEvent(ldapr.getId(), ldapr.getName(), name);
}
catch (NamingException e)
{
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -222,7 +222,11 @@
}
}
- return findRoleByName(name);
+ Role resultRole = findRoleByName(name);
+
+ fireRoleCreatedEvent(resultRole.getId(), resultRole.getName());
+
+ return resultRole;
}
//TODO: remove role assignments before?
@@ -246,6 +250,8 @@
{
log.debug("removing entry: " + ldapr.getDn());
ldapContext.unbind(ldapr.getDn());
+
+ fireRoleDestroyedEvent(ldapr.getId(), ldapr.getName());
}
catch (Exception e)
{
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -320,6 +320,7 @@
{
ldapContext.modifyAttributes(ldapRole.getDn(), DirContext.REMOVE_ATTRIBUTE,
attrs);
}
+ fireMembershipChangedEvent(role, users);
}
catch (NamingException e)
{
@@ -461,6 +462,8 @@
ldapContext.modifyAttributes(roleDN, mods);
}
+ fireMembershipChangedEvent(user, roles);
+
//and that should be all...
}
catch (NamingException e)
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -351,6 +351,8 @@
ldapContext.modifyAttributes(userDN, mods);
}
+ fireMembershipChangedEvent(role, users);
+
//and that should be all...
}
catch (NamingException e)
@@ -438,6 +440,8 @@
attrs.put(member);
ldapContext.modifyAttributes(ldapUser.getDn(), DirContext.REPLACE_ATTRIBUTE,
attrs);
+
+ fireMembershipChangedEvent(user, roles);
}
catch (NamingException e)
{
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -214,7 +214,7 @@
attrs.put(attr);
ldapContext.modifyAttributes(ldapUser.getDn(),
DirContext.REPLACE_ATTRIBUTE,attrs);
- fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName,
property);
}
catch (NamingException e)
{
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/MembershipModuleService.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -23,8 +23,16 @@
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.event.MembershipChangedEvent;
import org.jboss.portal.identity.info.ProfileInfo;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.HashSet;
+
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -48,4 +56,46 @@
{
this.profileInfo = profileInfo;
}
+
+ protected void fireMembershipChangedEvent(Set userIds, Set roleIds) throws
IdentityException
+ {
+ MembershipChangedEvent event = new MembershipChangedEvent(userIds, roleIds);
+ getIdentityEventBroadcaster().fireEvent(event);
+ }
+
+ protected void fireMembershipChangedEvent(User user, Set roles) throws
IdentityException
+ {
+
+ Set roleIds = new HashSet();
+ Set userIds = new HashSet();
+
+ userIds.add(user.getId());
+
+ for (Iterator iterator = roles.iterator(); iterator.hasNext();)
+ {
+ Role role = (Role)iterator.next();
+ roleIds.add(role.getId());
+ }
+
+ fireMembershipChangedEvent(userIds, roleIds);
+ }
+
+ protected void fireMembershipChangedEvent(Role role, Set users) throws
IdentityException
+ {
+
+ Set roleIds = new HashSet();
+ Set userIds = new HashSet();
+
+ roleIds.add(role.getId());
+
+ for (Iterator iterator = users.iterator(); iterator.hasNext();)
+ {
+ User user = (User)iterator.next();
+ userIds.add(user.getId());
+ }
+
+ fireMembershipChangedEvent(userIds, roleIds);
+ }
+
+
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -23,6 +23,10 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.event.RoleCreatedEvent;
+import org.jboss.portal.identity.event.RoleDestroyedEvent;
+import org.jboss.portal.identity.event.RoleUpdatedEvent;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
@@ -36,4 +40,25 @@
{
super(IdentityContext.TYPE_ROLE_MODULE);
}
+
+ protected void fireRoleCreatedEvent(Object roleId, String roleName) throws
IdentityException
+ {
+ RoleCreatedEvent event = new RoleCreatedEvent(roleId, roleName);
+ getIdentityEventBroadcaster().fireEvent(event);
+
+ }
+
+ protected void fireRoleDestroyedEvent(Object roleId, String roleName) throws
IdentityException
+ {
+ RoleDestroyedEvent event = new RoleDestroyedEvent(roleId, roleName);
+ getIdentityEventBroadcaster().fireEvent(event);
+
+ }
+
+ protected void fireRoleUpdatedEvent(Object roleId, String roleName, String
displayName) throws IdentityException
+ {
+ RoleUpdatedEvent event = new RoleUpdatedEvent(roleId, roleName, displayName);
+ getIdentityEventBroadcaster().fireEvent(event);
+ }
+
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -83,9 +83,9 @@
this.profileConfigFile = profileConfigFile;
}
- protected void fireUserProfileChangedEvent(Object userId, String userName, String
propertyName) throws IdentityException
+ protected void fireUserProfileChangedEvent(Object userId, String userName, String
propertyName, Object newValue) throws IdentityException
{
- IdentityEvent event = new UserProfileChangedEvent(userId, userName, propertyName);
+ IdentityEvent event = new UserProfileChangedEvent(userId, userName, propertyName,
newValue);
getIdentityEventBroadcaster().fireEvent(event);
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/IdentityTest.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -11,6 +11,14 @@
import org.jboss.portal.identity.ProfileMap;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.CachedUserImpl;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+import org.jboss.portal.identity.event.UserCreatedEvent;
+import org.jboss.portal.identity.event.MembershipChangedEvent;
+import org.jboss.portal.identity.event.RoleCreatedEvent;
+import org.jboss.portal.identity.event.RoleDestroyedEvent;
+import org.jboss.portal.identity.event.UserDestroyedEvent;
+import org.jboss.portal.identity.event.UserProfileChangedEvent;
import org.jboss.portal.common.util.CollectionBuilder;
import org.jboss.portal.common.p3p.P3PConstants;
@@ -176,13 +184,30 @@
public void testCreateUser() throws Exception
{
ctx.begin();
+
+ ctx.getEventBroadcaster().flushEventList();
User u3 = userModule.createUser("user3", "password");
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ UserCreatedEvent uce =
(UserCreatedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("user3", uce.getUserName());
+ ctx.getEventBroadcaster().flushEventList();
+
Role g1 = roleModule.findRoleByName("role1");
membershipModule.assignRoles(u3, Collections.singleton(g1));
Assert.assertEquals("user3", u3.getUserName());
assertNotNull(membershipModule.getRoles(u3));
Assert.assertEquals(1, membershipModule.getRoles(u3).size());
Assert.assertEquals("role1",
((Role)membershipModule.getRoles(u3).iterator().next()).getName());
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ MembershipChangedEvent mce =
(MembershipChangedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals(1, mce.getUserIds().size());
+ assertEquals(1, mce.getRoleIds().size());
+ ctx.getEventBroadcaster().flushEventList();
+
+
+
ctx.commit();
ctx.begin();
@@ -213,9 +238,16 @@
public void testCreateRole() throws Exception
{
+ ctx.getEventBroadcaster().flushEventList();
ctx.begin();
Role g3 = roleModule.createRole("role3", "roleName");
Assert.assertEquals("role3", g3.getName());
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ RoleCreatedEvent rce =
(RoleCreatedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("role3", rce.getRoleName());
+ ctx.getEventBroadcaster().flushEventList();
+
ctx.commit();
ctx.begin();
@@ -260,10 +292,17 @@
public void testRemoveRole() throws Exception
{
+ ctx.getEventBroadcaster().flushEventList();
ctx.begin();
Role g1 = roleModule.findRoleByName("role1");
Object id = g1.getId();
roleModule.removeRole(id);
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ RoleDestroyedEvent rde =
(RoleDestroyedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("role1", rde.getRoleName());
+ ctx.getEventBroadcaster().flushEventList();
+
try
{
roleModule.findRoleById(id);
@@ -292,6 +331,7 @@
public void testRemoveUser() throws Exception
{
ctx.begin();
+ ctx.getEventBroadcaster().flushEventList();
User u1 = userModule.findUserByUserName("user1");
Object id = u1.getId();
userModule.removeUser(id);
@@ -303,6 +343,12 @@
catch (IdentityException expected)
{
}
+
+ assertEquals(1, ctx.getEventBroadcaster().getEventList().size());
+ UserDestroyedEvent rde =
(UserDestroyedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals("user1", rde.getUserName());
+ ctx.getEventBroadcaster().flushEventList();
+
ctx.commit();
ctx.begin();
@@ -518,9 +564,18 @@
{
}*/
//map.put(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, "true");
+
+ ctx.getEventBroadcaster().flushEventList();
+
userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL,
Boolean.TRUE);
assertEquals(Boolean.TRUE.toString(), userProfileModule.getProperty(user,
User.INFO_USER_VIEW_EMAIL_VIEW_REAL).toString());
+ UserProfileChangedEvent upue =
(UserProfileChangedEvent)ctx.getEventBroadcaster().getEventList().iterator().next();
+ assertEquals(user.getUserName(), upue.getUserName());
+ assertEquals(User.INFO_USER_VIEW_EMAIL_VIEW_REAL, upue.getPropertyName());
+ assertEquals(Boolean.TRUE, upue.getNewValue());
+ ctx.getEventBroadcaster().flushEventList();
+
// Test boolean property
userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL,
Boolean.FALSE);
//assertEquals(Boolean.FALSE.toString(),
map.get(User.INFO_USER_VIEW_EMAIL_VIEW_REAL).toString());
@@ -744,5 +799,9 @@
void begin();
void commit();
+
+ IdentityContext getIdentityContext();
+
+ TestEventBroadcaster getEventBroadcaster() throws Exception;
}
}
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java
(rev 0)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestEventBroadcaster.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -0,0 +1,53 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.identity;
+
+import org.jboss.portal.identity.event.IdentityEvent;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class TestEventBroadcaster implements IdentityEventBroadcaster
+{
+ List eventList = new LinkedList();
+
+ public void fireEvent(IdentityEvent event)
+ {
+ eventList.add(event);
+ }
+
+ public List getEventList()
+ {
+ return eventList;
+ }
+
+ public void flushEventList()
+ {
+ eventList = new LinkedList();
+ }
+}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -48,6 +48,9 @@
import org.jboss.kernel.Kernel;
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import java.util.List;
+import java.util.LinkedList;
+
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
@@ -70,13 +73,8 @@
IdentityContext identityContext = bootstrapIdentityContext(kernel);
// IdentityEventBroadcaster
- IdentityEventBroadcaster broadcaster = new IdentityEventBroadcaster()
- {
- public void fireEvent(IdentityEvent event)
- {
- // Noop
- }
- };
+ IdentityEventBroadcaster broadcaster = new TestEventBroadcaster();
+
//
try
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -87,11 +87,13 @@
utc.populate();
}
+
+
public void testWorking() throws Exception
{
@@ -139,7 +141,7 @@
utc.testCreateRole();
}
- public void testCountUser() throws Exception
+ public void testCountUser() throws Exception
{
utc.testCountUser();
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -25,9 +25,11 @@
import org.jboss.portal.test.framework.embedded.HibernateSupport;
import org.jboss.portal.test.framework.mc.TestRuntimeContext;
import org.jboss.portal.test.identity.IdentityTest;
+import org.jboss.portal.test.identity.TestEventBroadcaster;
import org.jboss.portal.test.framework.junit.POJOJUnitTest;
import org.jboss.portal.test.framework.junit.JUnitAdapter;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.identity.service.UserProfileModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
import org.jboss.portal.identity.service.RoleModuleService;
@@ -197,5 +199,14 @@
assertTrue(hibernate.commitTransaction());
}
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+ public TestEventBroadcaster getEventBroadcaster() throws Exception
+ {
+ return
(TestEventBroadcaster)getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+
}
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -8,6 +8,7 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.identity.service.UserModuleService;
import org.jboss.portal.identity.service.RoleModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2008-07-01
14:25:37 UTC (rev 11231)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2008-07-01
15:24:31 UTC (rev 11232)
@@ -29,12 +29,14 @@
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
import org.jboss.portal.test.framework.mc.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DSConfig;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
import org.jboss.portal.test.framework.embedded.HibernateSupport;
import org.jboss.portal.test.framework.junit.JUnitAdapter;
import org.jboss.portal.test.framework.junit.POJOJUnitTest;
+import org.jboss.portal.test.identity.TestEventBroadcaster;
import org.opends.server.tools.LDAPModify;
//import org.jboss.portal.test.framework.embedded.apacheds.ApacheDSService;
@@ -275,9 +277,19 @@
mainCtx.unbind(name);
}
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+
+ public TestEventBroadcaster getEventBroadcaster() throws Exception
+ {
+ return
(TestEventBroadcaster)getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+
/*public LDAPConnectionContext createConnectionContext()
- {
- *//*return new LDAPConnectionContext(directoryServerConfigParameter.getName(),
+{
+ *//*return new LDAPConnectionContext(directoryServerConfigParameter.getName(),
directoryServerConfigParameter.getURL(),
directoryServerConfigParameter.getContextFactory(),
directoryServerConfigParameter.getAdminDN(),
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml 2008-07-01
14:25:37 UTC (rev 11231)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/testsuite/build.xml 2008-07-01
15:24:31 UTC (rev 11232)
@@ -140,28 +140,8 @@
<target name="clean">
<!-- remove generated test xml files -->
<delete>
- <fileset dir="../cms" includes="output/tests/*.log"/>
- <fileset dir="../cms"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../core"
includes="output/tests/*.log"/>
- <fileset dir="../core"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../format" includes="*.log"/>
- <fileset dir="../format"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../faces" includes="*.log"/>
- <fileset dir="../faces"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../server" includes="*.log"/>
- <fileset dir="../server"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../portlet" includes="*.log"/>
- <fileset dir="../portlet"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../portlet-federation"
includes="*.log"/>
- <fileset dir="../portlet-federation"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../portlet-server" includes="*.log"/>
- <fileset dir="../portlet-server"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../security" includes="*.log"/>
- <fileset dir="../security"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
<fileset dir="../identity" includes="*.log"/>
<fileset dir="../identity"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
- <fileset dir="../wsrp" includes="*.log"/>
- <fileset dir="../wsrp"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>
<!--
<fileset dir="../theme" includes="*.log"/>
<fileset dir="../theme"
includes="output/tests/TEST-*.xml,output/tests/TEST-*.txt"/>