2
2
3
3
import static org .junit .Assert .*;
4
4
5
- import io .kubernetes .client .ApiException ;
6
5
import io .kubernetes .client .informer .EventType ;
7
6
import io .kubernetes .client .informer .ListerWatcher ;
8
7
import io .kubernetes .client .models .V1ListMeta ;
9
8
import io .kubernetes .client .models .V1ObjectMeta ;
10
9
import io .kubernetes .client .models .V1Pod ;
11
10
import io .kubernetes .client .models .V1PodList ;
12
- import io .kubernetes .client .util .CallGeneratorParams ;
13
11
import io .kubernetes .client .util .Watch ;
14
- import io .kubernetes .client .util .Watchable ;
15
12
import java .util .Arrays ;
16
13
import java .util .concurrent .atomic .AtomicBoolean ;
17
14
import java .util .concurrent .atomic .AtomicInteger ;
@@ -37,24 +34,10 @@ public void testControllerProcessDeltas() throws InterruptedException {
37
34
new DeltaFIFO <>(Cache ::deletionHandlingMetaNamespaceKeyFunc , new Cache ());
38
35
39
36
AtomicBoolean runOnce = new AtomicBoolean (false );
40
- ListerWatcher <V1Pod , V1PodList > listerWatcher =
41
- new ListerWatcher <V1Pod , V1PodList >() {
42
- @ Override
43
- public V1PodList list (CallGeneratorParams params ) throws ApiException {
44
- return podList ;
45
- }
46
37
47
- @ Override
48
- public Watchable <V1Pod > watch (CallGeneratorParams params ) throws ApiException {
49
- if (!runOnce .get ()) {
50
- runOnce .set (true );
51
- return new MockWatch <V1Pod >(
52
- new Watch .Response <V1Pod >(EventType .MODIFIED .name (), foo3 ));
53
- } else {
54
- return new MockWatch <V1Pod >();
55
- }
56
- }
57
- };
38
+ ListerWatcher <V1Pod , V1PodList > listerWatcher =
39
+ new MockRunOnceListerWatcher <V1Pod , V1PodList >(
40
+ podList , new Watch .Response <V1Pod >(EventType .MODIFIED .name (), foo3 ));
58
41
59
42
Controller <V1Pod , V1PodList > controller =
60
43
new Controller <>(
0 commit comments