Skip to content

Commit 74ca1d6

Browse files
committed
fix spotless check
1 parent 7959661 commit 74ca1d6

File tree

3 files changed

+38
-35
lines changed

3 files changed

+38
-35
lines changed

cloudfoundry-operations/src/main/java/org/cloudfoundry/operations/applications/ApplicationManifestUtilsV3.java

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@
2626
import java.nio.file.Files;
2727
import java.nio.file.Path;
2828
import java.nio.file.StandardOpenOption;
29+
import java.util.HashMap;
2930
import java.util.List;
3031
import java.util.Map;
3132
import java.util.Optional;
3233
import java.util.TreeMap;
33-
import java.util.HashMap;
3434
import java.util.regex.Pattern;
3535
import java.util.stream.Stream;
36-
3736
import org.cloudfoundry.client.v3.Metadata;
3837
import org.cloudfoundry.client.v3.processes.HealthCheckType;
3938
import org.cloudfoundry.client.v3.processes.ReadinessHealthCheckType;
@@ -176,7 +175,8 @@ private static ManifestV3Application.Builder toApplicationManifest(
176175
raw -> getSidecar((Map<String, Object>) raw, variables),
177176
builder::sidecar);
178177

179-
as(application,
178+
as(
179+
application,
180180
"metadata",
181181
variables,
182182
raw -> getMetadata((Map<String, Object>) raw, variables),
@@ -261,30 +261,16 @@ private static ManifestV3Service getService(Object raw, Map<String, String> vari
261261
return builder.build();
262262
}
263263

264-
private static Metadata getMetadata(
265-
Map<String, Object> raw,
266-
Map<String, String> variables) {
264+
private static Metadata getMetadata(Map<String, Object> raw, Map<String, String> variables) {
267265

268266
if (raw == null) return null;
269267

270268
Map<String, String> labels = new HashMap<>();
271269
Map<String, String> annotations = new HashMap<>();
272270

273-
asMap(
274-
raw,
275-
"labels",
276-
variables,
277-
String.class::cast,
278-
labels::put
279-
);
271+
asMap(raw, "labels", variables, String.class::cast, labels::put);
280272

281-
asMap(
282-
raw,
283-
"annotations",
284-
variables,
285-
String.class::cast,
286-
annotations::put
287-
);
273+
asMap(raw, "annotations", variables, String.class::cast, annotations::put);
288274

289275
if (labels.isEmpty() && annotations.isEmpty()) {
290276
return null;
@@ -300,7 +286,6 @@ private static Metadata getMetadata(
300286
return builder.build();
301287
}
302288

303-
304289
private static Map<String, Object> toYaml(ManifestV3 manifest) {
305290
Map<String, Object> yaml = new TreeMap<>();
306291
yaml.put("version", manifest.getVersion());

cloudfoundry-operations/src/test/java/org/cloudfoundry/operations/applications/ApplicationManifestUtilsV3Test.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
import java.io.IOException;
66
import java.nio.file.Files;
77
import java.nio.file.Path;
8-
9-
import org.cloudfoundry.client.v3.processes.ReadinessHealthCheckType;
108
import org.cloudfoundry.client.v3.Metadata;
9+
import org.cloudfoundry.client.v3.processes.ReadinessHealthCheckType;
1110
import org.junit.jupiter.api.Test;
1211

1312
class ApplicationManifestUtilsV3Test {
@@ -72,7 +71,9 @@ void testWithMetadata() throws IOException {
7271
.metadata(
7372
Metadata.builder()
7473
.label("test-label", "test-label-value")
75-
.annotation("test-annotation", "test-annotation-value")
74+
.annotation(
75+
"test-annotation",
76+
"test-annotation-value")
7677
.build())
7778
.build())
7879
.build();
@@ -87,7 +88,10 @@ void testWithMetadataOnlyLabel() throws IOException {
8788
.application(
8889
ManifestV3Application.builder()
8990
.name("test-app")
90-
.metadata(Metadata.builder().label("test-label", "test-label-value").build())
91+
.metadata(
92+
Metadata.builder()
93+
.label("test-label", "test-label-value")
94+
.build())
9195
.build())
9296
.build();
9397

@@ -101,7 +105,12 @@ void testWithMetadataOnlyAnnotation() throws IOException {
101105
.application(
102106
ManifestV3Application.builder()
103107
.name("test-app")
104-
.metadata(Metadata.builder().annotation("test-annotation", "test-annotation-value").build())
108+
.metadata(
109+
Metadata.builder()
110+
.annotation(
111+
"test-annotation",
112+
"test-annotation-value")
113+
.build())
105114
.build())
106115
.build();
107116

integration-test/src/test/java/org/cloudfoundry/operations/ApplicationsTest.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,8 @@ public void pushManifestV3() throws IOException {
794794
public void pushManifestV3WithMetadata() throws IOException {
795795
String applicationName = this.nameFactory.getApplicationName();
796796
Map<String, String> labels = Collections.singletonMap("test-label", "test-label-value");
797-
Map<String, String> annotations = Collections.singletonMap("test-annotation", "test-annotation-value");
797+
Map<String, String> annotations =
798+
Collections.singletonMap("test-annotation", "test-annotation-value");
798799

799800
this.cloudFoundryOperations
800801
.applications()
@@ -806,24 +807,32 @@ public void pushManifestV3WithMetadata() throws IOException {
806807
ManifestV3Application.builder()
807808
.buildpack("staticfile_buildpack")
808809
.disk(512)
809-
.healthCheckType(ApplicationHealthCheck.PORT)
810+
.healthCheckType(
811+
ApplicationHealthCheck.PORT)
810812
.memory(64)
811813
.name(applicationName)
812814
.metadata(
813-
org.cloudfoundry.client.v3.Metadata.builder()
815+
org.cloudfoundry.client.v3
816+
.Metadata.builder()
814817
.labels(labels)
815-
.annotations(annotations)
818+
.annotations(
819+
annotations)
816820
.build())
817-
.path(new ClassPathResource("test-application.zip").getFile().toPath())
821+
.path(
822+
new ClassPathResource(
823+
"test-application.zip")
824+
.getFile()
825+
.toPath())
818826
.build())
819827
.build())
820828
.build())
821829
.map(manifest -> manifest.getMetadata())
822830
.as(StepVerifier::create)
823-
.consumeNextWith(metadata -> {
824-
assertThat(metadata.getLabels()).containsAllEntriesOf(labels);
825-
assertThat(metadata.getAnnotations()).containsAllEntriesOf(annotations);
826-
})
831+
.consumeNextWith(
832+
metadata -> {
833+
assertThat(metadata.getLabels()).containsAllEntriesOf(labels);
834+
assertThat(metadata.getAnnotations()).containsAllEntriesOf(annotations);
835+
})
827836
.expectComplete()
828837
.verify(Duration.ofMinutes(5));
829838
}

0 commit comments

Comments
 (0)