use of com.openshift.restclient.IWatcher in project jbosstools-openshift by jbosstools.
the class WatchManager method startWatch.
public void startWatch(final IProject project, final IOpenShiftConnection connection) {
AtomicReference<IWatcher> watcherRef = new AtomicReference<>();
for (String kind : KINDS) {
if (watches.putIfAbsent(new WatchKey(connection, project, kind), watcherRef) == null) {
WatchListener listener = new WatchListener(project, connection, kind, 0, 0);
startWatch(project, 0, 0, listener);
}
}
}
use of com.openshift.restclient.IWatcher in project jbosstools-openshift by jbosstools.
the class WatchManagerTest method testStartStopWatch.
@Test
@SuppressWarnings("unchecked")
public void testStartStopWatch() {
// given
when(project.accept(any(CapabilityVisitor.class), isNull())).thenReturn(client);
IWatcher watchClient = mock(IWatcher.class);
when(client.watch(any(), any(), any())).thenReturn(watchClient);
// when - then
WatchManager.getInstance().startWatch(project, connection);
verify(client, timeout(200).times(WatchManager.KINDS.length)).watch(any(), any(), any());
WatchManager.getInstance().stopWatch(project, connection);
verify(watchClient, timeout(200).times(WatchManager.KINDS.length)).stop();
}
Aggregations