File tree Expand file tree Collapse file tree 4 files changed +53
-9
lines changed
cloudfoundry-client-reactor/src/test
java/org/cloudfoundry/reactor/client/v3/processes
resources/fixtures/client/v3/processes
cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/processes Expand file tree Collapse file tree 4 files changed +53
-9
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,38 @@ public void getProcessStatistics() {
185185 .expectComplete ()
186186 .verify (Duration .ofSeconds (5 ));
187187 }
188+
189+ @ Test
190+ public void getProcessStatisticsWithNullFields () {
191+ mockRequest (InteractionContext .builder ()
192+ .request (TestRequest .builder ()
193+ .method (GET ).path ("/processes/test-id/stats" )
194+ .build ())
195+ .response (TestResponse .builder ()
196+ .status (OK )
197+ .payload ("fixtures/client/v3/processes/GET_{id}_stats_with_null_fields_response.json" )
198+ .build ())
199+ .build ());
200+
201+ this .processes
202+ .getStatistics (GetProcessStatisticsRequest .builder ()
203+ .processId ("test-id" )
204+ .build ())
205+ .as (StepVerifier ::create )
206+ .expectNext (GetProcessStatisticsResponse .builder ()
207+ .resource (ProcessStatisticsResource .builder ()
208+ .type ("web" )
209+ .index (0 )
210+ .state (ProcessState .STARTING )
211+ .usage (ProcessUsage .builder ().build ())
212+ .host ("" )
213+ .uptime (4L )
214+ .fileDescriptorQuota (16384L )
215+ .build ())
216+ .build ())
217+ .expectComplete ()
218+ .verify (Duration .ofSeconds (5 ));
219+ }
188220
189221 @ Test
190222 public void list () {
Original file line number Diff line number Diff line change 1+ {
2+ "resources" : [
3+ {
4+ "type" : " web" ,
5+ "index" : 0 ,
6+ "state" : " STARTING" ,
7+ "usage" : {},
8+ "host" : " " ,
9+ "instance_ports" : [],
10+ "uptime" : 4 ,
11+ "mem_quota" : null ,
12+ "disk_quota" : null ,
13+ "fds_quota" : 16384
14+ }
15+ ]
16+ }
Original file line number Diff line number Diff line change @@ -31,21 +31,12 @@ protected void check() {
3131 if (getState () == ProcessState .STARTING || getState () == ProcessState .RUNNING || getState () == ProcessState .CRASHED ) {
3232 List <String > missing = new ArrayList <>();
3333
34- if (getDiskQuota () == null ) {
35- missing .add ("diskQuota" );
36- }
3734 if (getFileDescriptorQuota () == null ) {
3835 missing .add ("fileDescriptorQuota" );
3936 }
4037 if (getHost () == null ) {
4138 missing .add ("host" );
4239 }
43- if (getMemoryQuota () == null ) {
44- missing .add ("memoryQuota" );
45- }
46- if (getUsage () == null ) {
47- missing .add ("usage" );
48- }
4940
5041 if (!missing .isEmpty ()) {
5142 throw new IllegalStateException ("Cannot build ProcessStatisticsResource, some of required attributes are not set " + missing );
Original file line number Diff line number Diff line change 1818
1919import com .fasterxml .jackson .annotation .JsonProperty ;
2020import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
21+ import org .cloudfoundry .Nullable ;
2122import org .immutables .value .Value ;
2223
2324/**
@@ -31,24 +32,28 @@ abstract class _ProcessUsage {
3132 * The CPU
3233 */
3334 @ JsonProperty ("cpu" )
35+ @ Nullable
3436 abstract Double getCpu ();
3537
3638 /**
3739 * The disk
3840 */
3941 @ JsonProperty ("disk" )
42+ @ Nullable
4043 abstract Long getDisk ();
4144
4245 /**
4346 * The memory
4447 */
4548 @ JsonProperty ("mem" )
49+ @ Nullable
4650 abstract Long getMemory ();
4751
4852 /**
4953 * The time
5054 */
5155 @ JsonProperty ("time" )
56+ @ Nullable
5257 abstract String getTime ();
5358
5459}
You can’t perform that action at this time.
0 commit comments