Skip to content

Commit adca825

Browse files
committed
refactor: simplify test-specific constructor
1 parent 61d1f8a commit adca825

File tree

3 files changed

+7
-24
lines changed

3 files changed

+7
-24
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/DefaultEventHandler.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,12 @@ public DefaultEventHandler(ConfiguredController<R> controller) {
6262
controller.getConfiguration().getConfigurationService().getTerminationTimeoutSeconds());
6363
}
6464

65-
DefaultEventHandler(
66-
EventDispatcher<R> eventDispatcher,
67-
String relatedControllerName,
68-
Retry retry,
69-
int concurrentReconciliationThreads) {
65+
DefaultEventHandler(EventDispatcher<R> dispatcher, String relatedControllerName, Retry retry) {
7066
this(
71-
eventDispatcher,
67+
dispatcher,
7268
relatedControllerName,
7369
retry,
74-
concurrentReconciliationThreads,
70+
ConfigurationService.DEFAULT_RECONCILIATION_THREADS_NUMBER,
7571
ConfigurationService.DEFAULT_TERMINATION_TIMEOUT_SECONDS);
7672
}
7773

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/CustomResourceSelectorTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.junit.jupiter.api.Test;
1818
import org.mockito.ArgumentCaptor;
1919

20-
import io.javaoperatorsdk.operator.api.config.ConfigurationService;
2120
import io.javaoperatorsdk.operator.processing.event.DefaultEvent;
2221
import io.javaoperatorsdk.operator.processing.event.DefaultEventSourceManager;
2322
import io.javaoperatorsdk.operator.sample.simple.TestCustomResource;
@@ -33,11 +32,7 @@ class CustomResourceSelectorTest {
3332
mock(DefaultEventSourceManager.class);
3433

3534
private final DefaultEventHandler defaultEventHandler =
36-
new DefaultEventHandler(
37-
eventDispatcherMock,
38-
"Test",
39-
null,
40-
ConfigurationService.DEFAULT_RECONCILIATION_THREADS_NUMBER);
35+
new DefaultEventHandler(eventDispatcherMock, "Test", null);
4136

4237
@BeforeEach
4338
public void setup() {

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/DefaultEventHandlerTest.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.slf4j.LoggerFactory;
2626

2727
import io.fabric8.kubernetes.client.Watcher;
28-
import io.javaoperatorsdk.operator.api.config.ConfigurationService;
2928
import io.javaoperatorsdk.operator.processing.event.DefaultEventSourceManager;
3029
import io.javaoperatorsdk.operator.processing.event.Event;
3130
import io.javaoperatorsdk.operator.processing.event.internal.CustomResourceEvent;
@@ -48,18 +47,11 @@ class DefaultEventHandlerTest {
4847
private TimerEventSource retryTimerEventSourceMock = mock(TimerEventSource.class);
4948

5049
private DefaultEventHandler defaultEventHandler =
51-
new DefaultEventHandler(
52-
eventDispatcherMock,
53-
"Test",
54-
null,
55-
ConfigurationService.DEFAULT_RECONCILIATION_THREADS_NUMBER);
50+
new DefaultEventHandler(eventDispatcherMock, "Test", null);
5651

5752
private DefaultEventHandler defaultEventHandlerWithRetry =
58-
new DefaultEventHandler(
59-
eventDispatcherMock,
60-
"Test",
61-
GenericRetry.defaultLimitedExponentialRetry(),
62-
ConfigurationService.DEFAULT_RECONCILIATION_THREADS_NUMBER);
53+
new DefaultEventHandler(eventDispatcherMock, "Test",
54+
GenericRetry.defaultLimitedExponentialRetry());
6355

6456
@BeforeEach
6557
public void setup() {

0 commit comments

Comments
 (0)