use of com.thoughtworks.go.listener.SecurityConfigChangeListener in project gocd by gocd.
the class CcTrayActivityListenerTest method shouldInvokeConfigChangeHandlerWhenSecurityConfigChanges.
@Test
public void shouldInvokeConfigChangeHandlerWhenSecurityConfigChanges() throws InterruptedException {
CcTrayConfigChangeHandler ccTrayConfigChangeHandler = mock(CcTrayConfigChangeHandler.class);
CruiseConfig cruiseConfig = mock(CruiseConfig.class);
ArgumentCaptor<ConfigChangedListener> captor = ArgumentCaptor.forClass(ConfigChangedListener.class);
doNothing().when(goConfigService).register(captor.capture());
when(goConfigService.currentCruiseConfig()).thenReturn(cruiseConfig);
CcTrayActivityListener listener = new CcTrayActivityListener(goConfigService, mock(CcTrayJobStatusChangeHandler.class), mock(CcTrayStageStatusChangeHandler.class), ccTrayConfigChangeHandler);
listener.initialize();
listener.startDaemon();
List<ConfigChangedListener> listeners = captor.getAllValues();
assertThat(listeners.get(2) instanceof SecurityConfigChangeListener, is(true));
SecurityConfigChangeListener securityConfigChangeListener = (SecurityConfigChangeListener) listeners.get(2);
securityConfigChangeListener.onEntityConfigChange(new PluginRoleConfig());
waitForProcessingToHappen();
verify(ccTrayConfigChangeHandler).call(cruiseConfig);
}
use of com.thoughtworks.go.listener.SecurityConfigChangeListener in project gocd by gocd.
the class RemoveAdminPermissionFilter method initialize.
public void initialize() {
pluginRoleService.register(this);
goConfigService.register(this);
goConfigService.register(new SecurityConfigChangeListener() {
@Override
public void onEntityConfigChange(Object entity) {
lastChangedTime = timeProvider.currentTimeMillis();
}
});
}
Aggregations