@@ -51,6 +51,9 @@ public final class ServiceKeysTest extends AbstractIntegrationTest {
5151 @ Autowired
5252 private Mono <String > serviceBrokerId ;
5353
54+ @ Autowired
55+ private String serviceName ;
56+
5457 @ Autowired
5558 private Mono <String > spaceId ;
5659
@@ -61,7 +64,7 @@ public void create() {
6164 String serviceKeyName = this .nameFactory .getServiceKeyName ();
6265
6366 Mono .when (this .serviceBrokerId , this .spaceId )
64- .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , spaceId )))
67+ .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , this . serviceName , spaceId )))
6568 .then (serviceInstanceId -> this .cloudFoundryClient .serviceKeys ()
6669 .create (CreateServiceKeyRequest .builder ()
6770 .parameter ("test-key" , "test-value" )
@@ -83,7 +86,7 @@ public void delete() {
8386 String serviceKeyName = this .nameFactory .getServiceKeyName ();
8487
8588 Mono .when (this .serviceBrokerId , this .spaceId )
86- .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , spaceId )))
89+ .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , this . serviceName , spaceId )))
8790 .then (serviceInstanceId -> createServiceKeyId (this .cloudFoundryClient , serviceInstanceId , serviceKeyName ))
8891 .then (serviceKeyId -> this .cloudFoundryClient .serviceKeys ()
8992 .delete (DeleteServiceKeyRequest .builder ()
@@ -102,7 +105,7 @@ public void get() {
102105 String serviceKeyName = this .nameFactory .getServiceKeyName ();
103106
104107 Mono .when (this .serviceBrokerId , this .spaceId )
105- .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , spaceId )))
108+ .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , this . serviceName , spaceId )))
106109 .then (serviceInstanceId -> createServiceKeyId (this .cloudFoundryClient , serviceInstanceId , serviceKeyName ))
107110 .then (serviceKeyId -> this .cloudFoundryClient .serviceKeys ()
108111 .get (GetServiceKeyRequest .builder ()
@@ -121,7 +124,7 @@ public void list() {
121124 String serviceKeyName = this .nameFactory .getServiceKeyName ();
122125
123126 Mono .when (this .serviceBrokerId , this .spaceId )
124- .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , spaceId )))
127+ .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , this . serviceName , spaceId )))
125128 .then (serviceInstanceId -> createServiceKeyId (this .cloudFoundryClient , serviceInstanceId , serviceKeyName ))
126129 .thenMany (PaginationUtils
127130 .requestClientV2Resources (page -> this .cloudFoundryClient .serviceKeys ()
@@ -142,7 +145,7 @@ public void listFilterByName() {
142145 String serviceKeyName = this .nameFactory .getServiceKeyName ();
143146
144147 Mono .when (this .serviceBrokerId , this .spaceId )
145- .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , spaceId )))
148+ .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , this . serviceName , spaceId )))
146149 .then (serviceInstanceId -> createServiceKeyId (this .cloudFoundryClient , serviceInstanceId , serviceKeyName ))
147150 .thenMany (PaginationUtils
148151 .requestClientV2Resources (page -> this .cloudFoundryClient .serviceKeys ()
@@ -163,7 +166,7 @@ public void listFilterByServiceInstanceId() {
163166 String serviceKeyName = this .nameFactory .getServiceKeyName ();
164167
165168 Mono .when (this .serviceBrokerId , this .spaceId )
166- .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , spaceId )))
169+ .then (function ((serviceBrokerId , spaceId ) -> createServiceInstanceId (this .cloudFoundryClient , serviceBrokerId , serviceInstanceName , this . serviceName , spaceId )))
167170 .then (serviceInstanceId -> createServiceKeyId (this .cloudFoundryClient , serviceInstanceId , serviceKeyName )
168171 .then (Mono .just (serviceInstanceId )))
169172 .flatMapMany (serviceInstanceId -> PaginationUtils
@@ -179,8 +182,8 @@ public void listFilterByServiceInstanceId() {
179182 .verify (Duration .ofMinutes (5 ));
180183 }
181184
182- private static Mono <String > createServiceInstanceId (CloudFoundryClient cloudFoundryClient , String serviceBrokerId , String serviceInstanceName , String spaceId ) {
183- return getPlanId (cloudFoundryClient , serviceBrokerId )
185+ private static Mono <String > createServiceInstanceId (CloudFoundryClient cloudFoundryClient , String serviceBrokerId , String serviceInstanceName , String serviceName , String spaceId ) {
186+ return getPlanId (cloudFoundryClient , serviceBrokerId , serviceName )
184187 .then (planId -> requestCreateServiceInstance (cloudFoundryClient , planId , serviceInstanceName , spaceId ))
185188 .map (ResourceUtils ::getId );
186189 }
@@ -190,8 +193,8 @@ private static Mono<String> createServiceKeyId(CloudFoundryClient cloudFoundryCl
190193 .map (ResourceUtils ::getId );
191194 }
192195
193- private static Mono <String > getPlanId (CloudFoundryClient cloudFoundryClient , String serviceBrokerId ) {
194- return requestListServices (cloudFoundryClient , serviceBrokerId )
196+ private static Mono <String > getPlanId (CloudFoundryClient cloudFoundryClient , String serviceBrokerId , String serviceName ) {
197+ return requestListServices (cloudFoundryClient , serviceBrokerId , serviceName )
195198 .single ()
196199 .map (ResourceUtils ::getId )
197200 .flatMapMany (serviceId -> requestListServicePlans (cloudFoundryClient , serviceId ))
@@ -239,11 +242,12 @@ private static Flux<ServicePlanResource> requestListServicePlans(CloudFoundryCli
239242 .build ()));
240243 }
241244
242- private static Flux <ServiceResource > requestListServices (CloudFoundryClient cloudFoundryClient , String serviceBrokerId ) {
245+ private static Flux <ServiceResource > requestListServices (CloudFoundryClient cloudFoundryClient , String serviceBrokerId , String serviceName ) {
243246 return PaginationUtils
244247 .requestClientV2Resources (page -> cloudFoundryClient .services ()
245248 .list (ListServicesRequest .builder ()
246249 .page (page )
250+ .label (serviceName )
247251 .serviceBrokerId (serviceBrokerId )
248252 .build ()));
249253 }
0 commit comments