Package org.activiti.engine.delegate.event

Examples of org.activiti.engine.delegate.event.ActivitiMembershipEvent


      // Add membership
      membershipListener.clearEventsReceived();
      identityService.createMembership("kermit", "sales");
      assertEquals(1, membershipListener.getEventsReceived().size());
      assertTrue(membershipListener.getEventsReceived().get(0) instanceof ActivitiMembershipEvent);
      ActivitiMembershipEvent event = (ActivitiMembershipEvent) membershipListener.getEventsReceived().get(0);
      assertEquals(ActivitiEventType.MEMBERSHIP_CREATED, event.getType());
      assertEquals("sales", event.getGroupId());
      assertEquals("kermit", event.getUserId());
      assertNull(event.getExecutionId());
      assertNull(event.getProcessDefinitionId());
      assertNull(event.getProcessInstanceId());
      membershipListener.clearEventsReceived();
     
      // Delete membership
      identityService.deleteMembership("kermit", "sales");
      assertEquals(1, membershipListener.getEventsReceived().size());
      assertTrue(membershipListener.getEventsReceived().get(0) instanceof ActivitiMembershipEvent);
      event = (ActivitiMembershipEvent) membershipListener.getEventsReceived().get(0);
      assertEquals(ActivitiEventType.MEMBERSHIP_DELETED, event.getType());
      assertEquals("sales", event.getGroupId());
      assertEquals("kermit", event.getUserId());
      assertNull(event.getExecutionId());
      assertNull(event.getProcessDefinitionId());
      assertNull(event.getProcessInstanceId());
      membershipListener.clearEventsReceived();
     
      // Deleting group will dispatch an event, informing ALL memberships are deleted
      identityService.createMembership("kermit", "sales");
      membershipListener.clearEventsReceived();
      identityService.deleteGroup(group.getId());
     
      assertEquals(2, membershipListener.getEventsReceived().size());
      assertTrue(membershipListener.getEventsReceived().get(0) instanceof ActivitiMembershipEvent);
      event = (ActivitiMembershipEvent) membershipListener.getEventsReceived().get(0);
      assertEquals(ActivitiEventType.MEMBERSHIPS_DELETED, event.getType());
      assertEquals("sales", event.getGroupId());
      assertNull(event.getUserId());
      assertNull(event.getExecutionId());
      assertNull(event.getProcessDefinitionId());
      assertNull(event.getProcessInstanceId());
      membershipListener.clearEventsReceived();
    } finally {
      processEngineConfiguration.getEventDispatcher().removeEventListener(membershipListener);
      if(user != null) {
        identityService.deleteUser(user.getId());
View Full Code Here

TOP

Related Classes of org.activiti.engine.delegate.event.ActivitiMembershipEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.