15
15
16
16
import io .fabric8 .kubernetes .client .CustomResource ;
17
17
import io .fabric8 .kubernetes .client .Watcher ;
18
- import io .javaoperatorsdk .operator .Metrics ;
19
18
import io .javaoperatorsdk .operator .TestUtils ;
20
19
import io .javaoperatorsdk .operator .api .Context ;
21
20
import io .javaoperatorsdk .operator .api .DeleteControl ;
22
21
import io .javaoperatorsdk .operator .api .ResourceController ;
23
22
import io .javaoperatorsdk .operator .api .RetryInfo ;
24
23
import io .javaoperatorsdk .operator .api .UpdateControl ;
25
- import io .javaoperatorsdk .operator .api .config .ConfigurationService ;
26
24
import io .javaoperatorsdk .operator .api .config .ControllerConfiguration ;
27
25
import io .javaoperatorsdk .operator .processing .event .Event ;
28
26
import io .javaoperatorsdk .operator .processing .event .internal .CustomResourceEvent ;
@@ -42,7 +40,6 @@ class EventDispatcherTest {
42
40
private final ResourceController <CustomResource > controller = mock (ResourceController .class );
43
41
private ControllerConfiguration <CustomResource > configuration =
44
42
mock (ControllerConfiguration .class );
45
- private final ConfigurationService configService = mock (ConfigurationService .class );
46
43
private final EventDispatcher .CustomResourceFacade customResourceFacade =
47
44
mock (EventDispatcher .CustomResourceFacade .class );
48
45
@@ -54,9 +51,6 @@ void setup() {
54
51
55
52
when (configuration .getFinalizer ()).thenReturn (DEFAULT_FINALIZER );
56
53
when (configuration .useFinalizer ()).thenCallRealMethod ();
57
- when (configuration .getName ()).thenReturn ("EventDispatcherTestController" );
58
- when (configService .getMetrics ()).thenReturn (Metrics .NOOP );
59
- when (configuration .getConfigurationService ()).thenReturn (configService );
60
54
when (controller .createOrUpdateResource (eq (testCustomResource ), any ()))
61
55
.thenReturn (UpdateControl .updateCustomResource (testCustomResource ));
62
56
when (controller .deleteResource (eq (testCustomResource ), any ()))
@@ -141,6 +135,7 @@ void callsDeleteIfObjectHasFinalizerAndMarkedForDelete() {
141
135
@ Test
142
136
void callDeleteOnControllerIfMarkedForDeletionWhenNoFinalizerIsConfigured () {
143
137
configureToNotUseFinalizer ();
138
+
144
139
markForDeletion (testCustomResource );
145
140
146
141
eventDispatcher .handleExecution (
@@ -161,9 +156,6 @@ void doNotCallDeleteIfMarkedForDeletionWhenFinalizerHasAlreadyBeenRemoved() {
161
156
162
157
private void configureToNotUseFinalizer () {
163
158
ControllerConfiguration <CustomResource > configuration = mock (ControllerConfiguration .class );
164
- when (configuration .getName ()).thenReturn ("EventDispatcherTestController" );
165
- when (configService .getMetrics ()).thenReturn (Metrics .NOOP );
166
- when (configuration .getConfigurationService ()).thenReturn (configService );
167
159
when (configuration .useFinalizer ()).thenReturn (false );
168
160
eventDispatcher = new EventDispatcher (controller , configuration , customResourceFacade );
169
161
}
0 commit comments