File tree 4 files changed +53
-9
lines changed
cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/processes
cloudfoundry-client-reactor/src/test
java/org/cloudfoundry/reactor/client/v3/processes
resources/fixtures/client/v3/processes
4 files changed +53
-9
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,38 @@ public void getProcessStatistics() {
185
185
.expectComplete ()
186
186
.verify (Duration .ofSeconds (5 ));
187
187
}
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
+ }
188
220
189
221
@ Test
190
222
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() {
31
31
if (getState () == ProcessState .STARTING || getState () == ProcessState .RUNNING || getState () == ProcessState .CRASHED ) {
32
32
List <String > missing = new ArrayList <>();
33
33
34
- if (getDiskQuota () == null ) {
35
- missing .add ("diskQuota" );
36
- }
37
34
if (getFileDescriptorQuota () == null ) {
38
35
missing .add ("fileDescriptorQuota" );
39
36
}
40
37
if (getHost () == null ) {
41
38
missing .add ("host" );
42
39
}
43
- if (getMemoryQuota () == null ) {
44
- missing .add ("memoryQuota" );
45
- }
46
- if (getUsage () == null ) {
47
- missing .add ("usage" );
48
- }
49
40
50
41
if (!missing .isEmpty ()) {
51
42
throw new IllegalStateException ("Cannot build ProcessStatisticsResource, some of required attributes are not set " + missing );
Original file line number Diff line number Diff line change 18
18
19
19
import com .fasterxml .jackson .annotation .JsonProperty ;
20
20
import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
21
+ import org .cloudfoundry .Nullable ;
21
22
import org .immutables .value .Value ;
22
23
23
24
/**
@@ -31,24 +32,28 @@ abstract class _ProcessUsage {
31
32
* The CPU
32
33
*/
33
34
@ JsonProperty ("cpu" )
35
+ @ Nullable
34
36
abstract Double getCpu ();
35
37
36
38
/**
37
39
* The disk
38
40
*/
39
41
@ JsonProperty ("disk" )
42
+ @ Nullable
40
43
abstract Long getDisk ();
41
44
42
45
/**
43
46
* The memory
44
47
*/
45
48
@ JsonProperty ("mem" )
49
+ @ Nullable
46
50
abstract Long getMemory ();
47
51
48
52
/**
49
53
* The time
50
54
*/
51
55
@ JsonProperty ("time" )
56
+ @ Nullable
52
57
abstract String getTime ();
53
58
54
59
}
You can’t perform that action at this time.
0 commit comments