Search in sources :

Example 11 with IdentityMgtEventListener

use of org.wso2.carbon.identity.mgt.IdentityMgtEventListener in project identity-governance by wso2-extensions.

the class IdentityMgtEventListenerTest method mockHandleEvent.

private void mockHandleEvent() throws Exception {
    identityMgtEventListener = spy(IdentityMgtEventListener.class);
    userStoreManager = Mockito.mock(UserStoreManager.class);
    realmConfiguration = Mockito.mock(RealmConfiguration.class);
    tenantManager = Mockito.mock(TenantManager.class);
    when(realmService.getTenantManager()).thenReturn(tenantManager);
    when(tenantManager.getDomain(SAMPLE_TENANT_ID)).thenReturn(SAMPLE_TENANT_DOMAIN);
    TestUtils.startTenantFlow(SAMPLE_TENANT_DOMAIN);
    when(userStoreManager.getTenantId()).thenReturn(SAMPLE_TENANT_ID);
    when(userStoreManager.getRealmConfiguration()).thenReturn(realmConfiguration);
    when(realmConfiguration.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME)).thenReturn("PRIMARY");
    Map<String, Object> properties = new HashMap<>();
    Event identityMgtEvent = new Event("sampleEvent", properties);
    doNothing().when(identityEventService).handleEvent(any(Event.class));
    identityEventService.handleEvent(identityMgtEvent);
}
Also used : RealmConfiguration(org.wso2.carbon.user.api.RealmConfiguration) HashMap(java.util.HashMap) Event(org.wso2.carbon.identity.event.event.Event) UserStoreManager(org.wso2.carbon.user.core.UserStoreManager) TenantManager(org.wso2.carbon.user.core.tenant.TenantManager)

Aggregations

UserIdentityClaimsDO (org.wso2.carbon.identity.mgt.dto.UserIdentityClaimsDO)8 UserStoreException (org.wso2.carbon.user.core.UserStoreException)6 IdentityErrorMsgContext (org.wso2.carbon.identity.core.model.IdentityErrorMsgContext)4 PolicyViolationException (org.wso2.carbon.identity.mgt.policy.PolicyViolationException)4 UserIdentityDataStore (org.wso2.carbon.identity.mgt.store.UserIdentityDataStore)4 HashMap (java.util.HashMap)3 IdentityException (org.wso2.carbon.identity.base.IdentityException)3 Activate (org.osgi.service.component.annotations.Activate)2 NotificationDataDTO (org.wso2.carbon.identity.mgt.dto.NotificationDataDTO)2 UserStoreException (org.wso2.carbon.user.api.UserStoreException)2 Hashtable (java.util.Hashtable)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 AxisObserver (org.apache.axis2.engine.AxisObserver)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1 Event (org.wso2.carbon.identity.event.event.Event)1 IdentityGovernanceServiceImpl (org.wso2.carbon.identity.governance.IdentityGovernanceServiceImpl)1 DefaultNotificationChannelManager (org.wso2.carbon.identity.governance.internal.service.impl.notification.DefaultNotificationChannelManager)1 IdentityMgtEventListener (org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener)1 IdentityStoreEventListener (org.wso2.carbon.identity.governance.listener.IdentityStoreEventListener)1