Skip to content

Commit 77f9032

Browse files
committed
chore: bump spotless 2.44.1 and format code
Signed-off-by: Attila Mészáros <[email protected]>
1 parent d7c72b4 commit 77f9032

File tree

8 files changed

+65
-77
lines changed

8 files changed

+65
-77
lines changed

operator-framework-bom/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
4646
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
4747
<maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
48-
<spotless.version>2.43.0</spotless.version>
48+
<spotless.version>2.44.1</spotless.version>
4949
</properties>
5050

5151
<dependencyManagement>

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Utils.java

+2-13
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,8 @@ public static boolean debugThreadPool() {
9797
return getBooleanFromSystemPropsOrDefault(DEBUG_THREAD_POOL_ENV_KEY, false);
9898
}
9999

100-
static boolean getBooleanFromSystemPropsOrDefault(String propertyName, boolean defaultValue) {
101-
var property = System.getProperty(propertyName);
102-
if (property == null) {
103-
return defaultValue;
104-
} else {
105-
property = property.trim().toLowerCase();
106-
return switch (property) {
107-
case "true" -> true;
108-
case "false" -> false;
109-
default -> defaultValue;
110-
};
111-
}
112-
}
100+
static boolean getBooleanFromSystemPropsOrDefault(String propertyName,
101+
boolean defaultValue) {var property=System.getProperty(propertyName);if(property==null){return defaultValue;}else{property=property.trim().toLowerCase();return switch(property){case"true"->true;case"false"->false;default->defaultValue;};}}
113102

114103
public static Class<?> getFirstTypeArgumentFromExtendedClass(Class<?> clazz) {
115104
return getTypeArgumentFromExtendedClassByIndex(clazz, 0);

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/BaseWorkflowResult.java

+20-14
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,26 @@ DetailBuilder<R> markForDelete() {
168168
}
169169

170170

171-
record Detail<R>(Exception error, ReconcileResult<R> reconcileResult,
172-
DetailedCondition.Result activationConditionResult,
173-
DetailedCondition.Result deletePostconditionResult,
174-
DetailedCondition.Result readyPostconditionResult,
175-
DetailedCondition.Result reconcilePostconditionResult,
176-
boolean deleted, boolean visited, boolean markedForDelete) {
177-
178-
boolean isConditionWithTypeMet(Condition.Type conditionType) {
179-
return getResultForConditionWithType(conditionType).map(DetailedCondition.Result::isSuccess)
180-
.orElse(true);
181-
}
171+
record Detail<R>(
172+
Exception error, ReconcileResult<R>reconcileResult,
173+
DetailedCondition.Result activationConditionResult,
174+
DetailedCondition.
175+
Result deletePostconditionResult,
176+
DetailedCondition.
177+
Result readyPostconditionResult,
178+
DetailedCondition.
179+
Result reconcilePostconditionResult,
180+
boolean deleted,
181+
boolean visited,
182+
boolean markedForDelete)
183+
{
184+
185+
boolean isConditionWithTypeMet(Condition.Type conditionType) {
186+
return getResultForConditionWithType(conditionType).map(DetailedCondition.Result::isSuccess)
187+
.orElse(true);
188+
}
182189

183-
Optional<DetailedCondition.Result<?>> getResultForConditionWithType(
190+
Optional<DetailedCondition.Result<?>> getResultForConditionWithType(
184191
Condition.Type conditionType) {
185192
return switch (conditionType) {
186193
case ACTIVATION -> Optional.ofNullable(activationConditionResult);
@@ -189,5 +196,4 @@ Optional<DetailedCondition.Result<?>> getResultForConditionWithType(
189196
case RECONCILE -> Optional.ofNullable(reconcilePostconditionResult);
190197
};
191198
}
192-
}
193-
}
199+
}}

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,9 @@ private static <T extends HasMetadata> SecondaryToPrimaryMapper<T> fromMetadata(
119119
}
120120

121121
public static ResourceID fromString(String cacheKey) {
122-
if (cacheKey == null) {
123-
return null;
124-
}
122+
if(cacheKey==null){return null;}
125123

126-
final String[] split = cacheKey.split("/");
127-
return switch (split.length) {
128-
case 1 -> new ResourceID(split[0]);
129-
case 2 -> new ResourceID(split[1], split[0]);
130-
default -> throw new IllegalArgumentException("Cannot extract a ResourceID from " + cacheKey);
131-
};
124+
final String[]split=cacheKey.split("/");return switch(split.length){case 1->new ResourceID(split[0]);case 2->new ResourceID(split[1],split[0]);default->throw new IllegalArgumentException("Cannot extract a ResourceID from "+cacheKey);};
132125
}
133126

134127
/**

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/dependent/workflow/CRDPresentActivationConditionTest.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ void setup() {
3737

3838

3939
@Test
40-
void checkCRDIfNotCheckedBefore() {
41-
when(checkerMock.checkIfCRDPresent(any(),any())).thenReturn(true);
40+
void checkCRDIfNotCheckedBefore() {
41+
when(checkerMock.checkIfCRDPresent(any(), any())).thenReturn(true);
4242

43-
assertThat(condition.isMet(dr,null,context)).isTrue();
44-
verify(checkerMock, times(1)).checkIfCRDPresent(any(),any());
45-
}
43+
assertThat(condition.isMet(dr, null, context)).isTrue();
44+
verify(checkerMock, times(1)).checkIfCRDPresent(any(), any());
45+
}
4646

4747
@Test
4848
void instantMetCallSkipsApiCall() {
@@ -65,17 +65,17 @@ void intervalExpiredAPICheckedAgain() throws InterruptedException {
6565
}
6666

6767
@Test
68-
void crdIsNotCheckedAnymoreIfIfOnceFound() throws InterruptedException {
69-
when(checkerMock.checkIfCRDPresent(any(),any())).thenReturn(true);
68+
void crdIsNotCheckedAnymoreIfIfOnceFound() throws InterruptedException {
69+
when(checkerMock.checkIfCRDPresent(any(), any())).thenReturn(true);
7070

71-
condition.isMet(dr,null,context);
72-
verify(checkerMock, times(1)).checkIfCRDPresent(any(),any());
71+
condition.isMet(dr, null, context);
72+
verify(checkerMock, times(1)).checkIfCRDPresent(any(), any());
7373

74-
Thread.sleep(TEST_CHECK_INTERVAL_WITH_SLACK);
74+
Thread.sleep(TEST_CHECK_INTERVAL_WITH_SLACK);
7575

76-
condition.isMet(dr,null,context);
77-
verify(checkerMock, times(1)).checkIfCRDPresent(any(),any());
78-
}
76+
condition.isMet(dr, null, context);
77+
verify(checkerMock, times(1)).checkIfCRDPresent(any(), any());
78+
}
7979

8080
@Test
8181
void crdNotCheckedAnymoreIfCountExpires() throws InterruptedException {

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,13 @@ void executionOfReconciliationShouldNotStartIfProcessorStopped() throws Interrup
421421
o.withConcurrentReconciliationThreads(1);
422422
});
423423
eventProcessor =
424-
spy(new EventProcessor(controllerConfiguration(null, rateLimiterMock, configurationService),
425-
reconciliationDispatcherMock,
426-
eventSourceManagerMock, null));
424+
spy(new EventProcessor(controllerConfiguration(null, rateLimiterMock, configurationService),
425+
reconciliationDispatcherMock,
426+
eventSourceManagerMock, null));
427427
eventProcessor.start();
428428

429-
eventProcessor.handleEvent(prepareCREvent(new ResourceID("test1","default")));
430-
eventProcessor.handleEvent(prepareCREvent(new ResourceID("test1","default")));
429+
eventProcessor.handleEvent(prepareCREvent(new ResourceID("test1", "default")));
430+
eventProcessor.handleEvent(prepareCREvent(new ResourceID("test1", "default")));
431431
eventProcessor.stop();
432432

433433
// wait until both event should be handled

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/polling/PerResourcePollingEventSourceTest.java

+21-21
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public void setup() {
4444
when(context.getPrimaryCache()).thenReturn(resourceCache);
4545

4646
setUpSource(new PerResourcePollingEventSource<>(SampleExternalResource.class, context,
47-
new PerResourcePollingConfigurationBuilder<>(supplier, Duration.ofMillis(PERIOD))
48-
.withCacheKeyMapper(r -> r.getName() + "#" + r.getValue())
49-
.build()));
47+
new PerResourcePollingConfigurationBuilder<>(supplier, Duration.ofMillis(PERIOD))
48+
.withCacheKeyMapper(r -> r.getName() + "#" + r.getValue())
49+
.build()));
5050
}
5151

5252
@Test
@@ -147,44 +147,44 @@ void getsValueFromCacheOrSupplier() {
147147
@Test
148148
void supportsDynamicPollingDelay() {
149149
when(supplier.fetchResources(any()))
150-
.thenReturn(Set.of(SampleExternalResource.testResource1()));
151-
when(supplier.fetchDelay(any(),any()))
152-
.thenReturn(Optional.of(Duration.ofMillis(PERIOD)))
153-
.thenReturn(Optional.of(Duration.ofMillis(PERIOD*2)));
150+
.thenReturn(Set.of(SampleExternalResource.testResource1()));
151+
when(supplier.fetchDelay(any(), any()))
152+
.thenReturn(Optional.of(Duration.ofMillis(PERIOD)))
153+
.thenReturn(Optional.of(Duration.ofMillis(PERIOD * 2)));
154154

155155
source.onResourceCreated(testCustomResource);
156156

157157
await().pollDelay(Duration.ofMillis(PERIOD)).atMost(Duration.ofMillis((long) (1.5 * PERIOD)))
158-
.pollInterval(Duration.ofMillis(20))
159-
.untilAsserted(() -> verify(supplier,times(1)).fetchResources(any()));
158+
.pollInterval(Duration.ofMillis(20))
159+
.untilAsserted(() -> verify(supplier, times(1)).fetchResources(any()));
160160
// verifying that it is not called as with normal interval
161-
await().pollDelay(Duration.ofMillis(PERIOD)).atMost(Duration.ofMillis((long) (1.5*PERIOD)))
162-
.pollInterval(Duration.ofMillis(20))
163-
.untilAsserted(() -> verify(supplier,times(1)).fetchResources(any()));
161+
await().pollDelay(Duration.ofMillis(PERIOD)).atMost(Duration.ofMillis((long) (1.5 * PERIOD)))
162+
.pollInterval(Duration.ofMillis(20))
163+
.untilAsserted(() -> verify(supplier, times(1)).fetchResources(any()));
164164
await().pollDelay(Duration.ofMillis(PERIOD)).atMost(Duration.ofMillis(2 * PERIOD))
165-
.pollInterval(Duration.ofMillis(20))
166-
.untilAsserted(() -> verify(supplier,times(2)).fetchResources(any()));
165+
.pollInterval(Duration.ofMillis(20))
166+
.untilAsserted(() -> verify(supplier, times(2)).fetchResources(any()));
167167
}
168168

169169
@Test
170170
void deleteEventCancelsTheScheduling() {
171171
when(supplier.fetchResources(any()))
172-
.thenReturn(Set.of(SampleExternalResource.testResource1()));
172+
.thenReturn(Set.of(SampleExternalResource.testResource1()));
173173

174174
source.onResourceCreated(testCustomResource);
175175

176176
await().pollDelay(Duration.ofMillis(PERIOD))
177-
.atMost(Duration.ofMillis((2* PERIOD)))
178-
.pollInterval(Duration.ofMillis(20))
179-
.untilAsserted(() -> verify(supplier,times(1)).fetchResources(any()));
177+
.atMost(Duration.ofMillis((2 * PERIOD)))
178+
.pollInterval(Duration.ofMillis(20))
179+
.untilAsserted(() -> verify(supplier, times(1)).fetchResources(any()));
180180

181181
when(resourceCache.get(any())).thenReturn(Optional.empty());
182182
source.onResourceDeleted(testCustomResource);
183183

184184
// check if not called again
185-
await().pollDelay(Duration.ofMillis(2*PERIOD))
186-
.atMost(Duration.ofMillis((4* PERIOD)))
187-
.untilAsserted(() -> verify(supplier,times(1)).fetchResources(any()));
185+
await().pollDelay(Duration.ofMillis(2 * PERIOD))
186+
.atMost(Duration.ofMillis((4 * PERIOD)))
187+
.untilAsserted(() -> verify(supplier, times(1)).fetchResources(any()));
188188
}
189189

190190
}

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<maven-install-plugin.version>3.1.3</maven-install-plugin.version>
9292
<git-commit-id-maven-plugin.version>9.0.1</git-commit-id-maven-plugin.version>
9393
<jib-maven-plugin.version>3.4.4</jib-maven-plugin.version>
94-
<spotless.version>2.43.0</spotless.version>
94+
<spotless.version>2.44.1</spotless.version>
9595
</properties>
9696

9797
<dependencyManagement>

0 commit comments

Comments
 (0)