Search in sources :

Example 6 with IdentityEventMessageContext

use of org.wso2.carbon.identity.event.bean.IdentityEventMessageContext in project carbon-identity-framework by wso2.

the class IdentityEventMessageContextTest method testSetEvent.

@Test
public void testSetEvent() {
    Event setEvent = new Event("setEvent");
    IdentityEventMessageContext identityEventMessageContext = new IdentityEventMessageContext(event);
    identityEventMessageContext.setEvent(setEvent);
    Assert.assertEquals(identityEventMessageContext.getEvent(), setEvent);
}
Also used : Event(org.wso2.carbon.identity.event.event.Event) IdentityEventMessageContext(org.wso2.carbon.identity.event.bean.IdentityEventMessageContext) Test(org.testng.annotations.Test)

Example 7 with IdentityEventMessageContext

use of org.wso2.carbon.identity.event.bean.IdentityEventMessageContext in project carbon-identity-framework by wso2.

the class AbstractEventHandlerTest method testCanHandle.

@Test
public void testCanHandle() throws IdentityEventException {
    Event event = new Event("eventName");
    IdentityEventMessageContext messageContext = new IdentityEventMessageContext(event);
    TestEventHandler testEventHandler = new TestEventHandler();
    testEventHandler.init(moduleConfiguration);
    boolean canHandle = testEventHandler.canHandle(messageContext);
    Assert.assertFalse(canHandle);
    subscriptionList.add(new Subscription("eventName", new Properties()));
    canHandle = testEventHandler.canHandle(messageContext);
    Assert.assertTrue(canHandle);
}
Also used : Event(org.wso2.carbon.identity.event.event.Event) Subscription(org.wso2.carbon.identity.event.bean.Subscription) Properties(java.util.Properties) IdentityEventMessageContext(org.wso2.carbon.identity.event.bean.IdentityEventMessageContext) Test(org.testng.annotations.Test) IdentityBaseTest(org.wso2.carbon.identity.testutil.IdentityBaseTest)

Example 8 with IdentityEventMessageContext

use of org.wso2.carbon.identity.event.bean.IdentityEventMessageContext in project identity-governance by wso2-extensions.

the class CodeInvalidationHandler method canHandle.

public boolean canHandle(MessageContext messageContext) throws IdentityRuntimeException {
    Event event = ((IdentityEventMessageContext) messageContext).getEvent();
    String eventName = event.getEventName();
    if (IdentityEventConstants.Event.POST_DELETE_USER.equals(eventName)) {
        return true;
    }
    return false;
}
Also used : Event(org.wso2.carbon.identity.event.event.Event) IdentityEventMessageContext(org.wso2.carbon.identity.event.bean.IdentityEventMessageContext)

Aggregations

IdentityEventMessageContext (org.wso2.carbon.identity.event.bean.IdentityEventMessageContext)8 Event (org.wso2.carbon.identity.event.event.Event)6 Test (org.testng.annotations.Test)3 AbstractEventHandler (org.wso2.carbon.identity.event.handler.AbstractEventHandler)3 Subscription (org.wso2.carbon.identity.event.bean.Subscription)2 List (java.util.List)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Log (org.apache.commons.logging.Log)1 LogFactory (org.apache.commons.logging.LogFactory)1 ConsentManager (org.wso2.carbon.consent.mgt.core.ConsentManager)1 ConsentManagementException (org.wso2.carbon.consent.mgt.core.exception.ConsentManagementException)1 ReceiptListResponse (org.wso2.carbon.consent.mgt.core.model.ReceiptListResponse)1 IdentityRuntimeException (org.wso2.carbon.identity.base.IdentityRuntimeException)1 IdentityConsentMgtUtils (org.wso2.carbon.identity.consent.mgt.IdentityConsentMgtUtils)1 IdentityConsentDataHolder (org.wso2.carbon.identity.consent.mgt.internal.IdentityConsentDataHolder)1 MessageContext (org.wso2.carbon.identity.core.bean.context.MessageContext)1 InitConfig (org.wso2.carbon.identity.core.handler.InitConfig)1 LambdaExceptionUtils.rethrowConsumer (org.wso2.carbon.identity.core.util.LambdaExceptionUtils.rethrowConsumer)1 IdentityEventConstants (org.wso2.carbon.identity.event.IdentityEventConstants)1