use of org.wso2.carbon.apimgt.notification.DefaultKeyManagerEventHandlerImpl in project carbon-apimgt by wso2.
the class ApimgtNotificationServiceComponent method activate.
@Activate
protected void activate(ComponentContext ctxt) {
ctxt.getBundleContext().registerService(KeyManagerEventHandler.class, new DefaultKeyManagerEventHandlerImpl(), null);
ctxt.getBundleContext().registerService(EventHandler.class, new WebhooksSubscriptionEventHandler(), null);
ctxt.getBundleContext().registerService(EventHandler.class, new WebhooksDeliveryEventHandler(), null);
ctxt.getBundleContext().registerService(NotificationEventService.class, new NotificationEventService(), null);
}
use of org.wso2.carbon.apimgt.notification.DefaultKeyManagerEventHandlerImpl in project carbon-apimgt by wso2.
the class AbstractKeyManagerEventHandlerTest method handleTokenRevocationEventTest.
@Test
public void handleTokenRevocationEventTest() throws Exception {
TokenRevocationEvent tokenRevocationEvent = new TokenRevocationEvent();
Assert.assertTrue(StringUtils.isBlank(tokenRevocationEvent.getTokenType()));
RevocationRequestPublisher revocationRequestPublisher = Mockito.mock(RevocationRequestPublisher.class);
PowerMockito.mockStatic(RevocationRequestPublisher.class);
PowerMockito.when(RevocationRequestPublisher.getInstance()).thenReturn(revocationRequestPublisher);
doNothing().when(revocationRequestPublisher).publishRevocationEvents(Mockito.anyString(), Mockito.anyLong(), Mockito.anyObject());
Properties properties = Mockito.mock(Properties.class);
whenNew(Properties.class).withNoArguments().thenReturn(properties);
ApiMgtDAO apiMgtDAO = Mockito.mock(ApiMgtDAO.class);
PowerMockito.mockStatic(ApiMgtDAO.class);
PowerMockito.when(ApiMgtDAO.getInstance()).thenReturn(apiMgtDAO);
DefaultKeyManagerEventHandlerImpl defaultKeyManagerEventHandler = new DefaultKeyManagerEventHandlerImpl();
Boolean result = defaultKeyManagerEventHandler.handleTokenRevocationEvent(tokenRevocationEvent);
Assert.assertTrue(result);
Assert.assertEquals("Default", tokenRevocationEvent.getTokenType());
}
Aggregations