27
27
import org .cloudfoundry .client .v2 .buildpacks .CreateBuildpackResponse ;
28
28
import org .cloudfoundry .client .v2 .buildpacks .DeleteBuildpackRequest ;
29
29
import org .cloudfoundry .client .v2 .buildpacks .GetBuildpackRequest ;
30
- import org .cloudfoundry .client .v2 .buildpacks .LifecycleType ;
31
30
import org .cloudfoundry .client .v2 .buildpacks .ListBuildpacksRequest ;
32
31
import org .cloudfoundry .client .v2 .buildpacks .UpdateBuildpackRequest ;
33
32
import org .cloudfoundry .client .v2 .buildpacks .UploadBuildpackRequest ;
@@ -58,16 +57,11 @@ public void create() {
58
57
.name (buildpackName )
59
58
.position (2 )
60
59
.build ())
61
- .map (ResourceUtils ::getEntity )
60
+ .thenMany (requestListBuildpacks (this .cloudFoundryClient , buildpackName ))
61
+ .map (BuildpackResource ::getEntity )
62
+ .map (BuildpackEntity ::getName )
62
63
.as (StepVerifier ::create )
63
- .expectNext (
64
- BuildpackEntity .builder ()
65
- .enabled (false )
66
- .locked (true )
67
- .name (buildpackName )
68
- .position (2 )
69
- .lifecycle (LifecycleType .BUILDPACK )
70
- .build ())
64
+ .expectNext (buildpackName )
71
65
.expectComplete ()
72
66
.verify (Duration .ofMinutes (5 ));
73
67
}
@@ -130,15 +124,9 @@ public void get() {
130
124
.buildpackId (buildpackId )
131
125
.build ()))
132
126
.map (ResourceUtils ::getEntity )
127
+ .map (BuildpackEntity ::getName )
133
128
.as (StepVerifier ::create )
134
- .expectNext (
135
- BuildpackEntity .builder ()
136
- .enabled (false )
137
- .locked (false )
138
- .name (buildpackName )
139
- .position (3 )
140
- .lifecycle (LifecycleType .BUILDPACK )
141
- .build ())
129
+ .expectNext (buildpackName )
142
130
.expectComplete ()
143
131
.verify (Duration .ofMinutes (5 ));
144
132
}
@@ -160,15 +148,9 @@ public void list() {
160
148
.build ()))
161
149
.map (ResourceUtils ::getEntity )
162
150
.filter (entity -> buildpackName .equals (entity .getName ())))
151
+ .map (BuildpackEntity ::getName )
163
152
.as (StepVerifier ::create )
164
- .expectNext (
165
- BuildpackEntity .builder ()
166
- .enabled (false )
167
- .locked (false )
168
- .name (buildpackName )
169
- .position (3 )
170
- .lifecycle (LifecycleType .BUILDPACK )
171
- .build ())
153
+ .expectNext (buildpackName )
172
154
.expectComplete ()
173
155
.verify (Duration .ofMinutes (5 ));
174
156
}
@@ -181,24 +163,17 @@ public void listFilterByName() {
181
163
.flatMapMany (
182
164
buildpackId ->
183
165
PaginationUtils .requestClientV2Resources (
184
- page ->
185
- this .cloudFoundryClient
186
- .buildpacks ()
187
- .list (
188
- ListBuildpacksRequest
189
- . builder ( )
190
- . name ( buildpackName )
191
- . build ()) )
192
- .map (ResourceUtils :: getEntity ) )
166
+ page ->
167
+ this .cloudFoundryClient
168
+ .buildpacks ()
169
+ .list (
170
+ ListBuildpacksRequest . builder ()
171
+ . name ( buildpackName )
172
+ . build ())) )
173
+ . map ( ResourceUtils :: getEntity )
174
+ .map (BuildpackEntity :: getName )
193
175
.as (StepVerifier ::create )
194
- .expectNext (
195
- BuildpackEntity .builder ()
196
- .enabled (false )
197
- .locked (false )
198
- .name (buildpackName )
199
- .position (3 )
200
- .lifecycle (LifecycleType .BUILDPACK )
201
- .build ())
176
+ .expectNext (buildpackName )
202
177
.expectComplete ()
203
178
.verify (Duration .ofMinutes (5 ));
204
179
}
@@ -221,14 +196,8 @@ public void update() {
221
196
.build ()))
222
197
.map (ResourceUtils ::getEntity )
223
198
.as (StepVerifier ::create )
224
- .expectNext (
225
- BuildpackEntity .builder ()
226
- .enabled (true )
227
- .locked (true )
228
- .name (buildpackName )
229
- .position (2 )
230
- .lifecycle (LifecycleType .BUILDPACK )
231
- .build ())
199
+ .expectNextMatches (
200
+ b -> b .getEnabled () && b .getLocked () && b .getPosition ().equals (2 ))
232
201
.expectComplete ()
233
202
.verify (Duration .ofMinutes (5 ));
234
203
}
@@ -251,16 +220,9 @@ public void upload() throws IOException {
251
220
.filename (filename )
252
221
.build ()))
253
222
.map (ResourceUtils ::getEntity )
223
+ .map (BuildpackEntity ::getFilename )
254
224
.as (StepVerifier ::create )
255
- .expectNext (
256
- BuildpackEntity .builder ()
257
- .enabled (false )
258
- .filename (filename )
259
- .locked (false )
260
- .name (buildpackName )
261
- .position (3 )
262
- .lifecycle (LifecycleType .BUILDPACK )
263
- .build ())
225
+ .expectNext (filename )
264
226
.expectComplete ()
265
227
.verify (Duration .ofMinutes (5 ));
266
228
}
@@ -283,16 +245,9 @@ public void uploadDirectory() throws IOException {
283
245
.filename (filename )
284
246
.build ()))
285
247
.map (ResourceUtils ::getEntity )
248
+ .map (BuildpackEntity ::getFilename )
286
249
.as (StepVerifier ::create )
287
- .expectNext (
288
- BuildpackEntity .builder ()
289
- .enabled (false )
290
- .filename (filename + ".zip" )
291
- .locked (false )
292
- .name (buildpackName )
293
- .position (3 )
294
- .lifecycle (LifecycleType .BUILDPACK )
295
- .build ())
250
+ .expectNext (filename + ".zip" )
296
251
.expectComplete ()
297
252
.verify (Duration .ofMinutes (5 ));
298
253
}
0 commit comments