Skip to content

Commit a7e0a59

Browse files
committed
Polishing
Minor formatting changes and tweaking some tests to fit convention. Signed-off-by: Paul Harris <[email protected]>
1 parent ecf74ab commit a7e0a59

File tree

14 files changed

+145
-124
lines changed

14 files changed

+145
-124
lines changed

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/applications/ReactorApplicationsV3Test.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ public void create() {
143143
.build())
144144
.build())
145145
.metadata(Metadata.builder()
146-
.label("isLive", Boolean.toString(true))
147-
.annotation("version", "1.2.3")
148-
.build())
146+
.annotation("version", "1.2.3")
147+
.label("isLive", "true")
148+
.build())
149149
.build())
150150
.as(StepVerifier::create)
151151
.expectNext(CreateApplicationResponse.builder()
@@ -169,9 +169,9 @@ public void create() {
169169
.build())
170170
.build())
171171
.metadata(Metadata.builder()
172-
.label("isLive", Boolean.toString(true))
173-
.annotation("version", "1.2.3")
174-
.build())
172+
.annotation("version", "1.2.3")
173+
.label("isLive", "true")
174+
.build())
175175
.link("self", Link.builder()
176176
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
177177
.build())
@@ -272,10 +272,10 @@ public void get() {
272272
.build())
273273
.build())
274274
.metadata(Metadata.builder()
275-
.label("isLive", Boolean.toString(false))
276-
.label("maintenance", Boolean.toString(true))
277-
.annotation("version", "1.2.4")
278-
.build())
275+
.annotation("version", "1.2.4")
276+
.label("isLive", "false")
277+
.label("maintenance", "true")
278+
.build())
279279
.link("self", Link.builder()
280280
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
281281
.build())
@@ -639,9 +639,9 @@ public void list() {
639639
.build())
640640
.build())
641641
.metadata(Metadata.builder()
642-
.label("isLive", Boolean.toString(true))
643-
.annotation("version", "1.2.3")
644-
.build())
642+
.annotation("version", "1.2.3")
643+
.label("isLive", "true")
644+
.build())
645645
.link("self", Link.builder()
646646
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
647647
.build())
@@ -1447,10 +1447,10 @@ public void update() {
14471447
.build())
14481448
.build())
14491449
.metadata(Metadata.builder()
1450-
.label("isLive", Boolean.toString(false))
1451-
.label("maintenance", Boolean.toString(true))
1452-
.annotation("version", "1.2.4")
1453-
.build())
1450+
.annotation("version", "1.2.4")
1451+
.label("isLive", "false")
1452+
.label("maintenance", "true")
1453+
.build())
14541454
.build())
14551455
.as(StepVerifier::create)
14561456
.expectNext(UpdateApplicationResponse.builder()
@@ -1474,10 +1474,10 @@ public void update() {
14741474
.build())
14751475
.build())
14761476
.metadata(Metadata.builder()
1477-
.label("isLive", Boolean.toString(false))
1478-
.label("maintenance", Boolean.toString(true))
1479-
.annotation("version", "1.2.4")
1480-
.build())
1477+
.annotation("version", "1.2.4")
1478+
.label("isLive", "false")
1479+
.label("maintenance", "true")
1480+
.build())
14811481
.link("self", Link.builder()
14821482
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
14831483
.build())

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/serviceInstances/ReactorServiceInstancesV3Test.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444

4545
import static io.netty.handler.codec.http.HttpMethod.DELETE;
4646
import static io.netty.handler.codec.http.HttpMethod.GET;
47-
import static io.netty.handler.codec.http.HttpMethod.POST;
4847
import static io.netty.handler.codec.http.HttpMethod.PATCH;
48+
import static io.netty.handler.codec.http.HttpMethod.POST;
4949
import static io.netty.handler.codec.http.HttpResponseStatus.CREATED;
5050
import static io.netty.handler.codec.http.HttpResponseStatus.NO_CONTENT;
5151
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
@@ -228,7 +228,7 @@ public void unshare() {
228228
.expectComplete()
229229
.verify(Duration.ofSeconds(5));
230230
}
231-
231+
232232
@Test
233233
public void update() {
234234
mockRequest(InteractionContext.builder()
@@ -246,20 +246,31 @@ public void update() {
246246
.update(UpdateServiceInstanceRequest.builder()
247247
.serviceInstanceId("68d54d31-9b3a-463b-ba94-e8e4c32edbac")
248248
.metadata(Metadata.builder()
249-
.label("test", "yes")
250-
.annotation("data", "potato")
251-
.build())
249+
.annotation("note", "detailed information")
250+
.label("key", "value")
251+
.build())
252252
.build())
253253
.as(StepVerifier::create)
254254
.expectNext(UpdateServiceInstanceResponse.builder()
255-
.id("68d54d31-9b3a-463b-ba94-e8e4c32edbac")
256-
.metadata(Metadata.builder()
257-
.label("test", "yes")
258-
.annotation("data", "potato")
259-
.build())
260-
.name("my_service_instance1")
261-
.createdAt("2017-11-17T13:54:21Z")
255+
.createdAt("2017-11-17T13:54:21Z")
256+
.id("85ccdcad-d725-4109-bca4-fd6ba062b5c8")
257+
.link("space", Link.builder()
258+
.href("https://api.example.org/v3/spaces/ae0031f9-dd49-461c-a945-df40e77c39cb")
259+
.build())
260+
.metadata(Metadata.builder()
261+
.annotation("note", "detailed information")
262+
.label("key", "value")
263+
.build())
264+
.name("my_service_instance")
265+
.relationships(ServiceInstanceRelationships.builder()
266+
.space(ToOneRelationship.builder()
267+
.data(Relationship.builder()
268+
.id("ae0031f9-dd49-461c-a945-df40e77c39cb")
269+
.build())
262270
.build())
271+
.build())
272+
.updatedAt("2017-11-17T13:54:21Z")
273+
.build())
263274
.expectComplete()
264275
.verify(Duration.ofSeconds(5));
265276
}
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"metadata": {
3-
"labels": {
4-
"test": "yes"
5-
},
6-
"annotations": {
7-
"data": "potato"
8-
}
9-
}
10-
}
2+
"metadata": {
3+
"labels": {
4+
"key": "value"
5+
},
6+
"annotations": {
7+
"note": "detailed information"
8+
}
9+
}
10+
}
Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
{
2-
"guid": "68d54d31-9b3a-463b-ba94-e8e4c32edbac",
3-
"created_at": "2017-11-17T13:54:21Z",
4-
"name": "my_service_instance1",
5-
"metadata": {
6-
"labels": {
7-
"test": "yes"
8-
},
9-
"annotations": {
10-
"data": "potato"
11-
}
12-
}
13-
}
2+
"guid": "85ccdcad-d725-4109-bca4-fd6ba062b5c8",
3+
"created_at": "2017-11-17T13:54:21Z",
4+
"updated_at": "2017-11-17T13:54:21Z",
5+
"name": "my_service_instance",
6+
"relationships": {
7+
"space": {
8+
"data": {
9+
"guid": "ae0031f9-dd49-461c-a945-df40e77c39cb"
10+
}
11+
}
12+
},
13+
"metadata": {
14+
"labels": {
15+
"key": "value"
16+
},
17+
"annotations": {
18+
"note": "detailed information"
19+
}
20+
},
21+
"links": {
22+
"space": {
23+
"href": "https://api.example.org/v3/spaces/ae0031f9-dd49-461c-a945-df40e77c39cb"
24+
}
25+
}
26+
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/_Metadata.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616

1717
package org.cloudfoundry.client.v3;
1818

19-
import java.util.Map;
20-
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2121
import org.cloudfoundry.AllowNulls;
2222
import org.cloudfoundry.Nullable;
2323
import org.immutables.value.Value;
2424

25-
import com.fasterxml.jackson.annotation.JsonProperty;
26-
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
25+
import java.util.Map;
2726

2827
/**
2928
* The metadata payload for a resource
@@ -33,19 +32,19 @@
3332
abstract class _Metadata {
3433

3534
/**
36-
* The metadata lables
35+
* The metadata annotations
3736
*/
38-
@JsonProperty("labels")
37+
@JsonProperty("annotations")
3938
@AllowNulls
4039
@Nullable
41-
abstract Map<String, String> getLabels();
40+
abstract Map<String, String> getAnnotations();
4241

4342
/**
44-
* The metadata annotations
43+
* The metadata labels
4544
*/
46-
@JsonProperty("annotations")
45+
@JsonProperty("labels")
4746
@AllowNulls
4847
@Nullable
49-
abstract Map<String, String> getAnnotations();
48+
abstract Map<String, String> getLabels();
5049

5150
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/applications/Application.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public abstract class Application extends Resource {
3333
@JsonProperty("lifecycle")
3434
public abstract Lifecycle getLifecycle();
3535

36+
/**
37+
* The metadata
38+
*/
39+
@JsonProperty("metadata")
40+
@Nullable
41+
public abstract Metadata getMetadata();
42+
3643
/**
3744
* The name
3845
*/
@@ -51,12 +58,5 @@ public abstract class Application extends Resource {
5158
*/
5259
@JsonProperty("state")
5360
public abstract ApplicationState getState();
54-
55-
/**
56-
* The metadata
57-
*/
58-
@JsonProperty("metadata")
59-
@Nullable
60-
public abstract Metadata getMetadata();
6161

6262
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/applications/_CreateApplicationRequest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ abstract class _CreateApplicationRequest {
4848
@Nullable
4949
abstract Lifecycle getLifecycle();
5050

51+
/**
52+
* The metadata
53+
*/
54+
@JsonProperty("metadata")
55+
@Nullable
56+
abstract Metadata getMetadata();
57+
5158
/**
5259
* The name
5360
*/
@@ -59,12 +66,5 @@ abstract class _CreateApplicationRequest {
5966
*/
6067
@JsonProperty("relationships")
6168
abstract ApplicationRelationships getRelationships();
62-
63-
/**
64-
* The metadata
65-
*/
66-
@JsonProperty("metadata")
67-
@Nullable
68-
abstract Metadata getMetadata();
6969

7070
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/applications/_ListApplicationsRequest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ abstract class _ListApplicationsRequest extends PaginatedRequest {
3535
@FilterParameter("guids")
3636
abstract List<String> getApplicationIds();
3737

38+
/**
39+
* The metadata query
40+
*/
41+
@FilterParameter("label_selector")
42+
@Nullable
43+
abstract String getLabelSelector();
44+
3845
/**
3946
* The names
4047
*/
@@ -52,12 +59,5 @@ abstract class _ListApplicationsRequest extends PaginatedRequest {
5259
*/
5360
@FilterParameter("space_guids")
5461
abstract List<String> getSpaceIds();
55-
56-
/**
57-
* The metadata query
58-
*/
59-
@FilterParameter("label_selector")
60-
@Nullable
61-
abstract String getLabelSelector();
62-
62+
6363
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/applications/_UpdateApplicationRequest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,17 @@ abstract class _UpdateApplicationRequest {
4444
@Nullable
4545
abstract Lifecycle getLifecycle();
4646

47-
/**
48-
* The name
49-
*/
50-
@JsonProperty("name")
51-
@Nullable
52-
abstract String getName();
53-
5447
/**
5548
* The metadata
5649
*/
5750
@JsonProperty("metadata")
5851
@Nullable
5952
abstract Metadata getMetadata();
6053

54+
/**
55+
* The name
56+
*/
57+
@JsonProperty("name")
58+
@Nullable
59+
abstract String getName();
6160
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/serviceInstances/ServiceInstance.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
*/
2727
public abstract class ServiceInstance extends Resource {
2828

29+
/**
30+
* The metadata
31+
*/
32+
@JsonProperty("metadata")
33+
@Nullable
34+
public abstract Metadata getMetadata();
35+
2936
/**
3037
* The name
3138
*/
@@ -38,12 +45,5 @@ public abstract class ServiceInstance extends Resource {
3845
@JsonProperty("relationships")
3946
@Nullable
4047
public abstract ServiceInstanceRelationships getRelationships();
41-
42-
/**
43-
* The metadata
44-
*/
45-
@JsonProperty("metadata")
46-
@Nullable
47-
public abstract Metadata getMetadata();
4848

4949
}

0 commit comments

Comments
 (0)