use of org.wso2.carbon.identity.event.IdentityEventConfigBuilder in project carbon-identity-framework by wso2.
the class AbstractEventHandlerTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
String home = IdentityEventConfigBuilder.class.getResource("/").getFile();
String config = IdentityEventConfigBuilder.class.getResource("/").getFile();
System.setProperty("carbon.home", home);
System.setProperty("carbon.config.dir.path", config);
subscriptionList = new ArrayList<>();
moduleConfiguration = Mockito.mock(ModuleConfiguration.class);
Mockito.doReturn(subscriptionList).when(moduleConfiguration).getSubscriptions();
IdentityEventConfigBuilder identityEventConfigBuilder = Mockito.mock(IdentityEventConfigBuilder.class);
Field field = IdentityEventConfigBuilder.class.getDeclaredField("notificationMgtConfigBuilder");
field.setAccessible(true);
field.set(null, identityEventConfigBuilder);
Mockito.doReturn(moduleConfiguration).when(identityEventConfigBuilder).getModuleConfigurations(moduleName);
moduleConfigurationMap = new HashMap<>();
Mockito.doReturn(moduleConfigurationMap).when(identityEventConfigBuilder).getModuleConfiguration();
Mockito.doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
return moduleConfigurationMap.get(invocationOnMock.getArguments()[0]);
}
}).when(identityEventConfigBuilder).getModuleConfigurations(Matchers.anyString());
ModuleConfiguration moduleConfiguration2 = new ModuleConfiguration(new Properties(), subscriptionList);
moduleConfigurationMap.put("TestEventHandler", moduleConfiguration2);
}
Aggregations