Skip to content

Commit edff248

Browse files
committed
Polishing
This commit adds support for a (previously) undocumented change in Jobs that was blocking integration test execution, adds some more integration tests, and polishes some code formatting. It also includes an addition to test skipping to allow for PCF2.9. Once such a test environment becomes available the skipping, and the skipped tests, may need updating. [resolves #1008][resolves #1030] Signed-off-by: Paul Harris <harrisp@vmware.com>
1 parent 2ad5a4c commit edff248

10 files changed

Lines changed: 304 additions & 169 deletions

File tree

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ public Mono<CreateDomainResponse> create(CreateDomainRequest request) {
5959
.checkpoint();
6060
}
6161

62-
@Override
63-
public Mono<UpdateDomainResponse> update(UpdateDomainRequest request) {
64-
return patch(request, UpdateDomainResponse.class, builder -> builder.pathSegment("domains", request.getDomainId()))
65-
.checkpoint();
66-
}
67-
6862
@Override
6963
public Mono<String> delete(DeleteDomainRequest request) {
7064
return delete(request, builder -> builder.pathSegment("domains", request.getDomainId()))
@@ -94,4 +88,10 @@ public Mono<Void> unshare(UnshareDomainRequest request) {
9488
return delete(request, Void.class, builder -> builder.pathSegment("domains", request.getDomainId(), "relationships", "shared_organizations", request.getOrganizationId()))
9589
.checkpoint();
9690
}
91+
92+
@Override
93+
public Mono<UpdateDomainResponse> update(UpdateDomainRequest request) {
94+
return patch(request, UpdateDomainResponse.class, builder -> builder.pathSegment("domains", request.getDomainId()))
95+
.checkpoint();
96+
}
9797
}

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/domains/ReactorDomainsV3Test.java

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,64 @@ public void list() {
240240
.verify(Duration.ofSeconds(5));
241241
}
242242

243+
@Test
244+
public void share() {
245+
mockRequest(InteractionContext.builder()
246+
.request(TestRequest.builder()
247+
.method(POST).path("/domains/test-domain-id/relationships/shared_organizations")
248+
.payload("fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_request.json")
249+
.build())
250+
.response(TestResponse.builder()
251+
.status(OK)
252+
.payload("fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_response.json")
253+
.build())
254+
.build());
255+
256+
this.domains
257+
.share(ShareDomainRequest.builder()
258+
.domainId("test-domain-id")
259+
.data(Relationship.builder()
260+
.id("404f3d89-3f89-6z72-8188-751b298d88d5")
261+
.build())
262+
.data(Relationship.builder()
263+
.id("416d3d89-3f89-8h67-2189-123b298d3592")
264+
.build())
265+
.build())
266+
.as(StepVerifier::create)
267+
.expectNext(ShareDomainResponse.builder()
268+
.data(Relationship.builder()
269+
.id("404f3d89-3f89-6z72-8188-751b298d88d5")
270+
.build())
271+
.data(Relationship.builder()
272+
.id("416d3d89-3f89-8h67-2189-123b298d3592")
273+
.build())
274+
.build())
275+
.expectComplete()
276+
.verify(Duration.ofSeconds(5));
277+
}
278+
279+
@Test
280+
public void unshare() {
281+
mockRequest(InteractionContext.builder()
282+
.request(TestRequest.builder()
283+
.method(DELETE).path("/domains/test-domain-id/relationships/shared_organizations/test-org-id")
284+
.build())
285+
.response(TestResponse.builder()
286+
.status(NO_CONTENT)
287+
.build())
288+
.build());
289+
290+
this.domains
291+
.unshare(UnshareDomainRequest.builder()
292+
.domainId("test-domain-id")
293+
.organizationId("test-org-id")
294+
.build())
295+
.as(StepVerifier::create)
296+
.expectNext()
297+
.expectComplete()
298+
.verify(Duration.ofSeconds(5));
299+
}
300+
243301
@Test
244302
public void update() {
245303
mockRequest(InteractionContext.builder()
@@ -303,62 +361,4 @@ public void update() {
303361
.expectComplete()
304362
.verify(Duration.ofSeconds(5));
305363
}
306-
307-
@Test
308-
public void share() {
309-
mockRequest(InteractionContext.builder()
310-
.request(TestRequest.builder()
311-
.method(POST).path("/domains/test-domain-id/relationships/shared_organizations")
312-
.payload("fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_request.json")
313-
.build())
314-
.response(TestResponse.builder()
315-
.status(OK)
316-
.payload("fixtures/client/v3/domains/POST_{id}_relationships_shared_organizations_response.json")
317-
.build())
318-
.build());
319-
320-
this.domains
321-
.share(ShareDomainRequest.builder()
322-
.domainId("test-domain-id")
323-
.data(Relationship.builder()
324-
.id("404f3d89-3f89-6z72-8188-751b298d88d5")
325-
.build())
326-
.data(Relationship.builder()
327-
.id("416d3d89-3f89-8h67-2189-123b298d3592")
328-
.build())
329-
.build())
330-
.as(StepVerifier::create)
331-
.expectNext(ShareDomainResponse.builder()
332-
.data(Relationship.builder()
333-
.id("404f3d89-3f89-6z72-8188-751b298d88d5")
334-
.build())
335-
.data(Relationship.builder()
336-
.id("416d3d89-3f89-8h67-2189-123b298d3592")
337-
.build())
338-
.build())
339-
.expectComplete()
340-
.verify(Duration.ofSeconds(5));
341-
}
342-
343-
@Test
344-
public void unshare() {
345-
mockRequest(InteractionContext.builder()
346-
.request(TestRequest.builder()
347-
.method(DELETE).path("/domains/test-domain-id/relationships/shared_organizations/test-org-id")
348-
.build())
349-
.response(TestResponse.builder()
350-
.status(NO_CONTENT)
351-
.build())
352-
.build());
353-
354-
this.domains
355-
.unshare(UnshareDomainRequest.builder()
356-
.domainId("test-domain-id")
357-
.organizationId("test-org-id")
358-
.build())
359-
.as(StepVerifier::create)
360-
.expectNext()
361-
.expectComplete()
362-
.verify(Duration.ofSeconds(5));
363-
}
364364
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/DomainsV3.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ public interface DomainsV3 {
5555
*/
5656
Mono<ListDomainsResponse> list(ListDomainsRequest request);
5757

58+
/**
59+
* Makes <a href="http://v3-apidocs.cloudfoundry.org/version/3.77.0/index.html#share-a-domain">Share a Domain</a> request
60+
*
61+
* @param request The Share a Domain request
62+
* @return the response from the Share a Domain request
63+
*/
64+
Mono<ShareDomainResponse> share(ShareDomainRequest request);
65+
5866
/**
5967
* Makes <a href="http://v3-apidocs.cloudfoundry.org/version/3.77.0/index.html#unshare-a-domain">Unshare a Domain</a> request
6068
*
@@ -71,12 +79,4 @@ public interface DomainsV3 {
7179
*/
7280
Mono<UpdateDomainResponse> update(UpdateDomainRequest request);
7381

74-
/**
75-
* Makes <a href="http://v3-apidocs.cloudfoundry.org/version/3.77.0/index.html#share-a-domain">Share a Domain</a> request
76-
*
77-
* @param request The Share a Domain request
78-
* @return the response from the Share a Domain request
79-
*/
80-
Mono<ShareDomainResponse> share(ShareDomainRequest request);
81-
8282
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/domains/_ShareDomainResponse.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@
1818

1919
import com.fasterxml.jackson.annotation.JsonProperty;
2020
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
21-
import org.cloudfoundry.AllowNulls;
2221
import org.cloudfoundry.Nullable;
23-
import org.cloudfoundry.client.v3.Link;
2422
import org.cloudfoundry.client.v3.Relationship;
2523
import org.immutables.value.Value;
2624

2725
import java.util.List;
28-
import java.util.Map;
2926

3027
/**
3128
* The response payload for the Share Domain operation

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/jobs/Job.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,10 @@ public abstract class Job extends Resource {
4444
@JsonProperty("state")
4545
public abstract JobState getState();
4646

47+
/**
48+
* Collection of warnings that occurred while processing the job.
49+
*/
50+
@JsonProperty("warnings")
51+
public abstract List<Warning> getWarnings();
52+
4753
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/jobs/JobState.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public enum JobState {
3434
*/
3535
FAILED("FAILED"),
3636

37+
/**
38+
* The polling state
39+
*/
40+
POLLING("POLLING"),
41+
3742
/**
3843
* The processing state
3944
*/
@@ -52,6 +57,8 @@ public static JobState from(String s) {
5257
return COMPLETE;
5358
case "failed":
5459
return FAILED;
60+
case "polling":
61+
return POLLING;
5562
case "processing":
5663
return PROCESSING;
5764
default:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2013-2020 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.cloudfoundry.client.v3.jobs;
18+
19+
import com.fasterxml.jackson.annotation.JsonProperty;
20+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
21+
import org.immutables.value.Value;
22+
23+
/**
24+
* The warning object
25+
*/
26+
@JsonDeserialize
27+
@Value.Immutable
28+
abstract class _Warning {
29+
30+
/**
31+
* Detailed description of the warning
32+
*/
33+
@JsonProperty("detail")
34+
abstract String getDetail();
35+
36+
}

integration-test/src/test/java/org/cloudfoundry/CloudFoundryVersion.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public enum CloudFoundryVersion {
4646

4747
PCF_2_8(Version.forIntegers(2, 142, 0)),
4848

49+
PCF_2_9(Version.forIntegers(2, 145, 0)),
50+
4951
UNSPECIFIED(Version.forIntegers(0));
5052

5153
private final Version version;

0 commit comments

Comments
 (0)