Skip to content

Commit f92fe3c

Browse files
committed
Merge branch 'reduce-port-tests' into 4.x
2 parents 1752f15 + 376c50c commit f92fe3c

File tree

5 files changed

+0
-275
lines changed

5 files changed

+0
-275
lines changed

integration-test/src/test/java/org/cloudfoundry/client/v2/ApplicationsTest.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -601,45 +601,6 @@ public void listRoutesFilterByPath() {
601601
.verify(Duration.ofMinutes(5));
602602
}
603603

604-
@Test
605-
public void listRoutesFilterByPort() {
606-
String applicationName = this.nameFactory.getApplicationName();
607-
String domainName = this.nameFactory.getDomainName();
608-
609-
Mono
610-
.zip(this.organizationId, this.spaceId)
611-
.flatMap(function((organizationId, spaceId) -> Mono.zip(
612-
Mono.just(organizationId),
613-
Mono.just(spaceId),
614-
createApplicationId(this.cloudFoundryClient, spaceId, applicationName)
615-
)))
616-
.flatMap(function((organizationId, spaceId, applicationId) -> Mono.zip(
617-
Mono.just(applicationId),
618-
createApplicationRoute(this.cloudFoundryClient, organizationId, spaceId, domainName, applicationId)
619-
)))
620-
.flatMap(function((applicationId, routeResponse) -> Mono.zip(
621-
Mono.just(ResourceUtils.getId(routeResponse)),
622-
PaginationUtils
623-
.requestClientV2Resources(page -> {
624-
ListApplicationRoutesRequest.Builder builder = ListApplicationRoutesRequest.builder()
625-
.applicationId(applicationId)
626-
.page(page);
627-
628-
Optional.ofNullable(ResourceUtils.getEntity(routeResponse).getPort()).ifPresent(builder::port);
629-
630-
return this.cloudFoundryClient.applicationsV2()
631-
.listRoutes(builder
632-
.build());
633-
})
634-
.single()
635-
.map(ResourceUtils::getId)
636-
)))
637-
.as(StepVerifier::create)
638-
.consumeNextWith(tupleEquality())
639-
.expectComplete()
640-
.verify(Duration.ofMinutes(5));
641-
}
642-
643604
@Test
644605
public void listServiceBindings() {
645606
String applicationName = this.nameFactory.getApplicationName();

integration-test/src/test/java/org/cloudfoundry/client/v2/ServiceInstancesTest.java

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@
4848
import org.cloudfoundry.client.v2.serviceplans.ServicePlanResource;
4949
import org.cloudfoundry.client.v2.services.ListServicesRequest;
5050
import org.cloudfoundry.client.v2.services.ServiceResource;
51-
import org.cloudfoundry.client.v2.shareddomains.CreateSharedDomainRequest;
52-
import org.cloudfoundry.client.v2.shareddomains.CreateSharedDomainResponse;
5351
import 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;
5752
import org.cloudfoundry.util.JobUtils;
5853
import org.cloudfoundry.util.LastOperationUtils;
5954
import 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()

integration-test/src/test/java/org/cloudfoundry/client/v2/UserProvidedServicesTest.java

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
import org.cloudfoundry.client.v2.userprovidedserviceinstances.UpdateUserProvidedServiceInstanceResponse;
4242
import org.cloudfoundry.client.v2.userprovidedserviceinstances.UserProvidedServiceInstanceResource;
4343
import org.cloudfoundry.routing.RoutingClient;
44-
import org.cloudfoundry.routing.v1.routergroups.ListRouterGroupsRequest;
45-
import org.cloudfoundry.routing.v1.routergroups.ListRouterGroupsResponse;
46-
import org.cloudfoundry.routing.v1.routergroups.RouterGroup;
4744
import org.cloudfoundry.util.PaginationUtils;
4845
import org.cloudfoundry.util.ResourceUtils;
4946
import org.junit.Test;
@@ -278,39 +275,6 @@ public void listRoutesFilterByPath() {
278275
.verify(Duration.ofMinutes(5));
279276
}
280277

281-
@Test
282-
public void listRoutesFilterByPort() {
283-
String domainName = this.nameFactory.getDomainName();
284-
String instanceName = this.nameFactory.getServiceInstanceName();
285-
Integer port = this.nameFactory.getPort();
286-
287-
Mono.zip(
288-
getRouterGroupId(this.routingClient, DEFAULT_ROUTER_GROUP)
289-
.flatMap(routerGroupId -> createTcpDomainId(this.cloudFoundryClient, domainName, routerGroupId)),
290-
this.spaceId
291-
)
292-
.flatMap(function((domainId, spaceId) -> Mono.zip(
293-
createUserProvidedServiceInstanceId(this.cloudFoundryClient, instanceName, spaceId),
294-
createRouteId(this.cloudFoundryClient, domainId, port, spaceId))
295-
))
296-
.flatMap(function((instanceId, routeId) -> requestAssociateRoute(this.cloudFoundryClient, instanceId, routeId)
297-
.thenReturn(instanceId)))
298-
.flatMapMany(instanceId -> Mono.zip(
299-
Mono.just(instanceId),
300-
PaginationUtils.requestClientV2Resources(page -> this.cloudFoundryClient.userProvidedServiceInstances()
301-
.listRoutes(ListUserProvidedServiceInstanceRoutesRequest.builder()
302-
.page(page)
303-
.port(port.toString())
304-
.userProvidedServiceInstanceId(instanceId)
305-
.build()))
306-
.map(resource -> ResourceUtils.getEntity(resource).getServiceInstanceId())
307-
.single()))
308-
.as(StepVerifier::create)
309-
.consumeNextWith(tupleEquality())
310-
.expectComplete()
311-
.verify(Duration.ofMinutes(5));
312-
}
313-
314278
@Test
315279
public void listServiceBindings() {
316280
String applicationName = this.nameFactory.getApplicationName();
@@ -394,29 +358,11 @@ private static Mono<String> createRouteId(CloudFoundryClient cloudFoundryClient,
394358
.map(ResourceUtils::getId);
395359
}
396360

397-
private static Mono<String> createRouteId(CloudFoundryClient cloudFoundryClient, String domainId, Integer port, String spaceId) {
398-
return requestCreateRoute(cloudFoundryClient, domainId, port, spaceId)
399-
.map(ResourceUtils::getId);
400-
}
401-
402-
private static Mono<String> createTcpDomainId(CloudFoundryClient cloudFoundryClient, String name, String routerGroupId) {
403-
return requestCreateTcpDomain(cloudFoundryClient, name, routerGroupId)
404-
.map(ResourceUtils::getId);
405-
}
406-
407361
private static Mono<String> createUserProvidedServiceInstanceId(CloudFoundryClient cloudFoundryClient, String instanceName, String spaceId) {
408362
return requestCreateUserProvidedServiceInstance(cloudFoundryClient, instanceName, spaceId)
409363
.map(ResourceUtils::getId);
410364
}
411365

412-
private static Mono<String> getRouterGroupId(RoutingClient routingClient, String routerGroupName) {
413-
return requestListRouterGroups(routingClient)
414-
.flatMapIterable(ListRouterGroupsResponse::getRouterGroups)
415-
.filter(group -> routerGroupName.equals(group.getName()))
416-
.single()
417-
.map(RouterGroup::getRouterGroupId);
418-
}
419-
420366
private static Mono<AssociateUserProvidedServiceInstanceRouteResponse> requestAssociateRoute(CloudFoundryClient cloudFoundryClient, String instanceId, String routeId) {
421367
return cloudFoundryClient.userProvidedServiceInstances()
422368
.associateRoute(AssociateUserProvidedServiceInstanceRouteRequest.builder()
@@ -451,23 +397,6 @@ private static Mono<CreateRouteResponse> requestCreateRoute(CloudFoundryClient c
451397
.build());
452398
}
453399

454-
private static Mono<CreateRouteResponse> requestCreateRoute(CloudFoundryClient cloudFoundryClient, String domainId, Integer port, String spaceId) {
455-
return cloudFoundryClient.routes()
456-
.create(CreateRouteRequest.builder()
457-
.domainId(domainId)
458-
.port(port)
459-
.spaceId(spaceId)
460-
.build());
461-
}
462-
463-
private static Mono<CreateSharedDomainResponse> requestCreateTcpDomain(CloudFoundryClient cloudFoundryClient, String name, String routerGroupId) {
464-
return cloudFoundryClient.sharedDomains()
465-
.create(CreateSharedDomainRequest.builder()
466-
.name(name)
467-
.routerGroupId(routerGroupId)
468-
.build());
469-
}
470-
471400
private static Mono<CreateUserProvidedServiceInstanceResponse> requestCreateUserProvidedServiceInstance(CloudFoundryClient cloudFoundryClient, String instanceName, String spaceId) {
472401
return cloudFoundryClient.userProvidedServiceInstances()
473402
.create(CreateUserProvidedServiceInstanceRequest.builder()
@@ -477,12 +406,6 @@ private static Mono<CreateUserProvidedServiceInstanceResponse> requestCreateUser
477406
.build());
478407
}
479408

480-
private static Mono<ListRouterGroupsResponse> requestListRouterGroups(RoutingClient routingClient) {
481-
return routingClient.routerGroups()
482-
.list(ListRouterGroupsRequest.builder()
483-
.build());
484-
}
485-
486409
private static Flux<UserProvidedServiceInstanceResource> requestListUserProvidedServiceInstances(CloudFoundryClient cloudFoundryClient, String instanceName) {
487410
return PaginationUtils
488411
.requestClientV2Resources(page -> cloudFoundryClient.userProvidedServiceInstances()

integration-test/src/test/java/org/cloudfoundry/client/v3/ApplicationsTest.java

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -503,41 +503,6 @@ public void listApplicationRoutesByPath() {
503503
.verify(Duration.ofMinutes(5));
504504
}
505505

506-
//TODO: Establish router group availability. This test has not been verified.
507-
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_10)
508-
public void listApplicationRoutesByPort() {
509-
String applicationName = this.nameFactory.getApplicationName();
510-
String domainName = this.nameFactory.getDomainName();
511-
Integer port = this.nameFactory.getPort();
512-
513-
this.organizationId
514-
.flatMap(organizationId -> Mono.zip(
515-
createDomainId(this.cloudFoundryClient, domainName, organizationId),
516-
this.spaceId
517-
))
518-
519-
.flatMap(function((domainId, spaceId) -> Mono.zip(
520-
createApplicationId(this.cloudFoundryClient, applicationName, spaceId),
521-
createRouteId(this.cloudFoundryClient, domainId, null, "listApplicationRoutesByPort", null, port, spaceId)
522-
)))
523-
.flatMapMany(function((applicationId, routeId) -> requestReplaceDestinations(this.cloudFoundryClient, applicationId, routeId)
524-
.thenReturn(applicationId)))
525-
.flatMap(applicationId -> PaginationUtils.requestClientV3Resources(page ->
526-
this.cloudFoundryClient.applicationsV3()
527-
.listRoutes(ListApplicationRoutesRequest.builder()
528-
.applicationId(applicationId)
529-
.port(port)
530-
.page(page)
531-
.build())))
532-
.filter(route -> route.getMetadata().getLabels().containsKey("test-listApplicationRoutesByPort-key"))
533-
.map(RouteResource::getMetadata)
534-
.map(Metadata::getLabels)
535-
.as(StepVerifier::create)
536-
.expectNext(Collections.singletonMap("test-listApplicationRoutesByPort-key", "test-listApplicationRoutesByPort-value"))
537-
.expectComplete()
538-
.verify(Duration.ofMinutes(5));
539-
}
540-
541506
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_9)
542507
@Test
543508
public void listApplicationRoutesBySpaceId() {
@@ -991,23 +956,6 @@ private static Mono<GetPackageResponse> requestGetPackage(CloudFoundryClient clo
991956
.build());
992957
}
993958

994-
private static Flux<ApplicationResource> requestListApplications(CloudFoundryClient cloudFoundryClient, String applicationName) {
995-
return PaginationUtils.requestClientV3Resources(page ->
996-
cloudFoundryClient.applicationsV3()
997-
.list(ListApplicationsRequest.builder()
998-
.name(applicationName)
999-
.page(page)
1000-
.build()));
1001-
}
1002-
1003-
private static Flux<DropletResource> requestListDroplets(CloudFoundryClient cloudFoundryClient) {
1004-
return PaginationUtils.requestClientV3Resources(page ->
1005-
cloudFoundryClient.droplets()
1006-
.list(ListDropletsRequest.builder()
1007-
.page(page)
1008-
.build()));
1009-
}
1010-
1011959
private static Mono<ReplaceRouteDestinationsResponse> requestReplaceDestinations(CloudFoundryClient cloudFoundryClient, String applicationId, String routeId) {
1012960
return cloudFoundryClient.routesV3()
1013961
.replaceDestinations(ReplaceRouteDestinationsRequest.builder()

integration-test/src/test/java/org/cloudfoundry/client/v3/RoutesTest.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -364,32 +364,6 @@ public void listByPath() {
364364
.verify(Duration.ofMinutes(5));
365365
}
366366

367-
//TODO: Establish router group availability. This test has not been verified.
368-
public void listByPort() {
369-
String domainName = this.nameFactory.getDomainName();
370-
Integer port = this.nameFactory.getPort();
371-
372-
this.organizationId
373-
.flatMap(organizationId -> Mono.zip(
374-
createDomainId(this.cloudFoundryClient, domainName, organizationId),
375-
this.spaceId
376-
))
377-
.flatMap(function((domainId, spaceId) -> requestCreateRoute(this.cloudFoundryClient, domainId, null, "listByPort", null, port, spaceId)))
378-
.thenMany(PaginationUtils.requestClientV3Resources(page ->
379-
this.cloudFoundryClient.routesV3()
380-
.list(ListRoutesRequest.builder()
381-
.port(port)
382-
.page(page)
383-
.build())))
384-
.filter(route -> route.getMetadata().getLabels().containsKey("test-listByPort-key"))
385-
.map(RouteResource::getMetadata)
386-
.map(Metadata::getLabels)
387-
.as(StepVerifier::create)
388-
.expectNext(Collections.singletonMap("test-listByPort-key", "test-listByPort-value"))
389-
.expectComplete()
390-
.verify(Duration.ofMinutes(5));
391-
}
392-
393367
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_9)
394368
@Test
395369
public void listBySpaceId() {

0 commit comments

Comments
 (0)