1
- package com . github . containersolutions .operator ;
2
-
3
- import com . github . containersolutions .operator .api .ResourceController ;
4
- import com . github . containersolutions .operator .api .UpdateControl ;
5
- import com . github . containersolutions .operator .processing .CustomResourceEvent ;
6
- import com . github . containersolutions .operator .processing .EventDispatcher ;
7
- import com . github . containersolutions .operator .processing .retry .GenericRetry ;
8
- import com . github . containersolutions .operator .sample .TestCustomResource ;
1
+ package io . javaoperatorsdk .operator ;
2
+
3
+ import io . javaoperatorsdk .operator .api .ResourceController ;
4
+ import io . javaoperatorsdk .operator .api .UpdateControl ;
5
+ import io . javaoperatorsdk .operator .processing .CustomResourceEvent ;
6
+ import io . javaoperatorsdk .operator .processing .EventDispatcher ;
7
+ import io . javaoperatorsdk .operator .processing .retry .GenericRetry ;
8
+ import io . javaoperatorsdk .operator .sample .TestCustomResource ;
9
9
import io .fabric8 .kubernetes .api .model .ObjectMetaBuilder ;
10
10
import io .fabric8 .kubernetes .client .CustomResource ;
11
11
import io .fabric8 .kubernetes .client .Watcher ;
12
+ import io .javaoperatorsdk .operator .api .Controller ;
12
13
import org .junit .jupiter .api .Assertions ;
13
14
import org .junit .jupiter .api .BeforeEach ;
14
15
import org .junit .jupiter .api .Test ;
15
16
import org .mockito .ArgumentMatchers ;
16
17
17
- import static com .github .containersolutions .operator .api .Controller .DEFAULT_FINALIZER ;
18
18
import static org .junit .jupiter .api .Assertions .assertEquals ;
19
19
import static org .mockito .Mockito .*;
20
20
@@ -28,7 +28,7 @@ class EventDispatcherTest {
28
28
@ BeforeEach
29
29
void setup () {
30
30
eventDispatcher = new EventDispatcher (controller ,
31
- DEFAULT_FINALIZER , customResourceFacade , false );
31
+ Controller . DEFAULT_FINALIZER , customResourceFacade , false );
32
32
33
33
testCustomResource = getResource ();
34
34
@@ -45,7 +45,7 @@ void callCreateOrUpdateOnNewResource() {
45
45
46
46
@ Test
47
47
void updatesOnlyStatusSubResource () {
48
- testCustomResource .getMetadata ().getFinalizers ().add (DEFAULT_FINALIZER );
48
+ testCustomResource .getMetadata ().getFinalizers ().add (Controller . DEFAULT_FINALIZER );
49
49
when (controller .createOrUpdateResource (eq (testCustomResource ), any ()))
50
50
.thenReturn (UpdateControl .updateStatusSubResource (testCustomResource ));
51
51
@@ -67,13 +67,13 @@ void adsDefaultFinalizerOnCreateIfNotThere() {
67
67
eventDispatcher .handleEvent (customResourceEvent (Watcher .Action .MODIFIED , testCustomResource ));
68
68
verify (controller , times (1 ))
69
69
.createOrUpdateResource (argThat (testCustomResource ->
70
- testCustomResource .getMetadata ().getFinalizers ().contains (DEFAULT_FINALIZER )), any ());
70
+ testCustomResource .getMetadata ().getFinalizers ().contains (Controller . DEFAULT_FINALIZER )), any ());
71
71
}
72
72
73
73
@ Test
74
74
void callsDeleteIfObjectHasFinalizerAndMarkedForDelete () {
75
75
testCustomResource .getMetadata ().setDeletionTimestamp ("2019-8-10" );
76
- testCustomResource .getMetadata ().getFinalizers ().add (DEFAULT_FINALIZER );
76
+ testCustomResource .getMetadata ().getFinalizers ().add (Controller . DEFAULT_FINALIZER );
77
77
78
78
eventDispatcher .handleEvent (customResourceEvent (Watcher .Action .MODIFIED , testCustomResource ));
79
79
@@ -183,7 +183,7 @@ void doesNotMarkNewGenerationInCaseOfException() {
183
183
184
184
void generationAwareMode () {
185
185
eventDispatcher = new EventDispatcher (controller ,
186
- DEFAULT_FINALIZER , customResourceFacade , true );
186
+ Controller . DEFAULT_FINALIZER , customResourceFacade , true );
187
187
}
188
188
189
189
private void markForDeletion (CustomResource customResource ) {
@@ -202,7 +202,7 @@ CustomResource getResource() {
202
202
.withDeletionGracePeriodSeconds (10L )
203
203
.withGeneration (10L )
204
204
.withName ("name" )
205
- .withFinalizers (DEFAULT_FINALIZER )
205
+ .withFinalizers (Controller . DEFAULT_FINALIZER )
206
206
.withNamespace ("namespace" )
207
207
.withResourceVersion ("resourceVersion" )
208
208
.withSelfLink ("selfLink" )
0 commit comments