4848import org .cloudfoundry .client .v2 .serviceplans .ServicePlanResource ;
4949import org .cloudfoundry .client .v2 .services .ListServicesRequest ;
5050import org .cloudfoundry .client .v2 .services .ServiceResource ;
51- import org .cloudfoundry .client .v2 .shareddomains .CreateSharedDomainRequest ;
52- import org .cloudfoundry .client .v2 .shareddomains .CreateSharedDomainResponse ;
5351import org .cloudfoundry .routing .RoutingClient ;
54- import org .cloudfoundry .routing .v1 .routergroups .ListRouterGroupsRequest ;
55- import org .cloudfoundry .routing .v1 .routergroups .ListRouterGroupsResponse ;
56- import org .cloudfoundry .routing .v1 .routergroups .RouterGroup ;
5752import org .cloudfoundry .util .JobUtils ;
5853import org .cloudfoundry .util .LastOperationUtils ;
5954import org .cloudfoundry .util .PaginationUtils ;
@@ -623,41 +618,6 @@ public void listRoutesFilterByPath() {
623618 .verify (Duration .ofMinutes (5 ));
624619 }
625620
626- @ Test
627- public void listRoutesFilterByPort () {
628- String domainName = this .nameFactory .getDomainName ();
629- Integer port = this .nameFactory .getPort ();
630- String serviceInstanceName = this .nameFactory .getServiceInstanceName ();
631-
632- Mono .zip (this .organizationId , this .spaceId )
633- .flatMap (function ((organizationId , spaceId ) -> Mono .zip (
634- getRouterGroupId (this .routingClient , DEFAULT_ROUTER_GROUP )
635- .flatMap (routerGroupId -> createTcpDomainId (this .cloudFoundryClient , domainName , routerGroupId )),
636- createServiceInstanceId (this .cloudFoundryClient , this .serviceBrokerId , serviceInstanceName , this .serviceName , spaceId ),
637- Mono .just (spaceId )
638- )))
639- .flatMap (function ((domainId , serviceInstanceId , spaceId ) -> Mono .zip (
640- createRouteId (this .cloudFoundryClient , domainId , port , spaceId ),
641- Mono .just (serviceInstanceId ))
642- ))
643- .flatMap (function ((routeId , serviceInstanceId ) -> requestBindServiceInstanceRoute (this .cloudFoundryClient , routeId , serviceInstanceId )
644- .thenReturn (serviceInstanceId )))
645- .flatMapMany (serviceInstanceId -> Mono .zip (
646- Mono .just (serviceInstanceId ),
647- PaginationUtils .requestClientV2Resources (page -> this .cloudFoundryClient .serviceInstances ()
648- .listRoutes (ListServiceInstanceRoutesRequest .builder ()
649- .page (page )
650- .port (port .toString ())
651- .serviceInstanceId (serviceInstanceId )
652- .build ()))
653- .map (resource -> ResourceUtils .getEntity (resource ).getServiceInstanceId ())
654- .single ()))
655- .as (StepVerifier ::create )
656- .consumeNextWith (tupleEquality ())
657- .expectComplete ()
658- .verify (Duration .ofMinutes (5 ));
659- }
660-
661621 @ Test
662622 public void listServiceBindings () {
663623 String applicationName = this .nameFactory .getApplicationName ();
@@ -825,11 +785,6 @@ private static Mono<String> createRouteId(CloudFoundryClient cloudFoundryClient,
825785 .map (ResourceUtils ::getId );
826786 }
827787
828- private static Mono <String > createRouteId (CloudFoundryClient cloudFoundryClient , String domainId , Integer port , String spaceId ) {
829- return requestCreateRoute (cloudFoundryClient , domainId , port , spaceId )
830- .map (ResourceUtils ::getId );
831- }
832-
833788 private static Mono <String > createServiceBindingId (CloudFoundryClient cloudFoundryClient , String applicationId , String serviceInstanceId ) {
834789 return requestCreateServiceBinding (cloudFoundryClient , applicationId , serviceInstanceId )
835790 .map (ResourceUtils ::getId );
@@ -847,11 +802,6 @@ private static Mono<String> createServiceKeyId(CloudFoundryClient cloudFoundryCl
847802 .map (ResourceUtils ::getId );
848803 }
849804
850- private static Mono <String > createTcpDomainId (CloudFoundryClient cloudFoundryClient , String name , String routerGroupId ) {
851- return requestCreateTcpDomain (cloudFoundryClient , name , routerGroupId )
852- .map (ResourceUtils ::getId );
853- }
854-
855805 private static Mono <String > getPlanId (CloudFoundryClient cloudFoundryClient , String serviceBrokerId , String serviceName ) {
856806 return requestListServices (cloudFoundryClient , serviceBrokerId , serviceName )
857807 .filter (resource -> serviceName .equals (ResourceUtils .getEntity (resource ).getLabel ()))
@@ -862,14 +812,6 @@ private static Mono<String> getPlanId(CloudFoundryClient cloudFoundryClient, Str
862812 .map (ResourceUtils ::getId );
863813 }
864814
865- private static Mono <String > getRouterGroupId (RoutingClient routingClient , String routerGroupName ) {
866- return requestListRouterGroups (routingClient )
867- .flatMapIterable (ListRouterGroupsResponse ::getRouterGroups )
868- .filter (group -> routerGroupName .equals (group .getName ()))
869- .single ()
870- .map (RouterGroup ::getRouterGroupId );
871- }
872-
873815 private static Mono <BindServiceInstanceRouteResponse > requestBindServiceInstanceRoute (CloudFoundryClient cloudFoundryClient , String routeId , String serviceInstanceId ) {
874816 return cloudFoundryClient .serviceInstances ()
875817 .bindRoute (BindServiceInstanceRouteRequest .builder ()
@@ -894,15 +836,6 @@ private static Mono<CreatePrivateDomainResponse> requestCreatePrivateDomain(Clou
894836 .build ());
895837 }
896838
897- private static Mono <CreateRouteResponse > requestCreateRoute (CloudFoundryClient cloudFoundryClient , String domainId , Integer port , String spaceId ) {
898- return cloudFoundryClient .routes ()
899- .create (CreateRouteRequest .builder ()
900- .domainId (domainId )
901- .port (port )
902- .spaceId (spaceId )
903- .build ());
904- }
905-
906839 private static Mono <CreateRouteResponse > requestCreateRoute (CloudFoundryClient cloudFoundryClient , String domainId , String hostName , String path , String spaceId ) {
907840 return cloudFoundryClient .routes ()
908841 .create (CreateRouteRequest .builder ()
@@ -939,20 +872,6 @@ private static Mono<CreateServiceKeyResponse> requestCreateServiceKey(CloudFound
939872 .build ());
940873 }
941874
942- private static Mono <CreateSharedDomainResponse > requestCreateTcpDomain (CloudFoundryClient cloudFoundryClient , String name , String routerGroupId ) {
943- return cloudFoundryClient .sharedDomains ()
944- .create (CreateSharedDomainRequest .builder ()
945- .name (name )
946- .routerGroupId (routerGroupId )
947- .build ());
948- }
949-
950- private static Mono <ListRouterGroupsResponse > requestListRouterGroups (RoutingClient routingClient ) {
951- return routingClient .routerGroups ()
952- .list (ListRouterGroupsRequest .builder ()
953- .build ());
954- }
955-
956875 private static Flux <RouteResource > requestListRoutes (CloudFoundryClient cloudFoundryClient , String serviceInstanceId ) {
957876 return PaginationUtils
958877 .requestClientV2Resources (page -> cloudFoundryClient .serviceInstances ()
0 commit comments