Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,7 @@ Name | Description
`TEST_PROXY_PORT` | _(Optional)_ The port of a proxy to route all requests through. Defaults to `8080`.
`TEST_PROXY_USERNAME` | _(Optional)_ The username for a proxy to route all requests through
`TEST_SKIPSSLVALIDATION` | _(Optional)_ Whether to skip SSL validation when connecting to the Cloud Foundry instance. Defaults to `false`.
`SKIP_BROWSER_AUTH_TESTS` | _(Optional)_ Set to `true` to skip integration tests that require browser-based authentication (e.g., SSO tests). Useful when the Cloud Foundry instance's UAA does not have browser-based authentication configured. Defaults to `false`.
`SKIP_METRIC_REGISTRAR_TESTS` | _(Optional)_ Set to `true` to skip integration tests that require the Metric Registrar service (e.g., MetricRegistrarTest). Useful when the Cloud Foundry instance does not have the Metric Registrar service available. Defaults to `false`.
`SKIP_TCP_ROUTING_TESTS` | _(Optional)_ Set to `true` to skip TCP routing integration tests (TcpRoutesTest, RouterGroupsTest). Useful when the Cloud Foundry instance does not have TCP routing configured (i.e., no `routing_endpoint` in the info payload). Defaults to `false`.
`TEST_QUOTAS_ROUTES_RESERVED_PORTS` | _(Optional)_ When set to a positive integer, sets reserved TCP route ports (`total_reserved_ports`) on the **default** organization quota to that value during integration test bootstrap. When set to -1, sets the reserved ports to _unlimited_. Use this when the platform leaves that limit at `0` on the default quota but you still run TCP routing tests (`SKIP_TCP_ROUTING_TESTS` unset or `false`). If unset, no quota change is applied. Maps to the Spring property `test.quotas.routes.reserved-ports`.
`SKIP_V2_TESTS` | _(Optional)_ Set to `true` to skip all V2 API integration tests. Useful when the Cloud Foundry V2 API is rate-limited or unavailable. When enabled, tests annotated with `@RequiresV2Api` will be skipped, including V3 tests that depend on V2 API calls (e.g., service broker creation). Defaults to `false`.
`UAA_API_REQUEST_LIMIT` | _(Optional)_ If your UAA server does rate limiting and returns 429 errors, set this variable to the smallest limit configured there. Whether your server limits UAA calls is shown in the log, together with the location of the configuration file on the server. Defaults to `0` (no limit).

If you do not have access to a CloudFoundry instance with admin access, you can run one locally using [bosh-deployment](https://github.com/cloudfoundry/bosh-deployment) & [cf-deployment](https://github.com/cloudfoundry/cf-deployment/) and Virtualbox.

Expand Down
2 changes: 1 addition & 1 deletion cloudfoundry-client-reactor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.cloudfoundry</groupId>
<artifactId>cloudfoundry-java-client</artifactId>
<version>5.18.0.BUILD-SNAPSHOT</version>
<version>6.0.0-SNAPSHOT</version>
</parent>

<artifactId>cloudfoundry-client-reactor</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import org.cloudfoundry.client.v3.spaces.SpacesV3;
import org.cloudfoundry.client.v3.stacks.StacksV3;
import org.cloudfoundry.client.v3.tasks.Tasks;
import org.cloudfoundry.client.v3.users.UsersV3;
import org.cloudfoundry.reactor.ConnectionContext;
import org.cloudfoundry.reactor.TokenProvider;
import org.cloudfoundry.reactor.client.v2.applications.ReactorApplicationsV2;
Expand Down Expand Up @@ -137,6 +138,7 @@
import org.cloudfoundry.reactor.client.v3.spaces.ReactorSpacesV3;
import org.cloudfoundry.reactor.client.v3.stacks.ReactorStacksV3;
import org.cloudfoundry.reactor.client.v3.tasks.ReactorTasks;
import org.cloudfoundry.reactor.client.v3.users.ReactorUsersV3;
import org.immutables.value.Value;
import reactor.core.publisher.Mono;

Expand Down Expand Up @@ -517,6 +519,12 @@ public Users users() {
return new ReactorUsers(getConnectionContext(), getRootV2(), getTokenProvider(), getRequestTags());
}

@Override
@Value.Derived
public UsersV3 usersV3() {
return new ReactorUsersV3(getConnectionContext(), getRootV3(), getTokenProvider(), getRequestTags());
}

/**
* The connection context
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,18 @@ public Mono<String> delete(DeleteOrganizationQuotaRequest request) {
"organization_quotas", request.getOrganizationQuotaId()))
.checkpoint();
}

@Override
public Mono<ApplyOrganizationQuotaResponse> apply(ApplyOrganizationQuotaRequest request) {
return post(
request,
ApplyOrganizationQuotaResponse.class,
builder ->
builder.pathSegment(
"organization_quotas",
request.getOrganizationQuotaId(),
"relationships",
"organizations"))
.checkpoint();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,33 @@ public Mono<String> delete(DeleteSpaceQuotaRequest request) {
builder -> builder.pathSegment("space_quotas", request.getSpaceQuotaId()))
.checkpoint();
}

@Override
public Mono<ApplySpaceQuotaResponse> apply(ApplySpaceQuotaRequest request) {
return post(
request,
ApplySpaceQuotaResponse.class,
builder ->
builder.pathSegment(
"space_quotas",
request.getSpaceQuotaId(),
"relationships",
"spaces"))
.checkpoint();
}

@Override
public Mono<Void> remove(RemoveSpaceQuotaRequest request) {
return delete(
request,
Void.class,
builder ->
builder.pathSegment(
"space_quotas",
request.getSpaceQuotaId(),
"relationships",
"spaces",
request.getSpaceId()))
.checkpoint();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright 2013-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.cloudfoundry.reactor.client.v3.users;

import java.util.Map;
import org.cloudfoundry.client.v3.users.*;
import org.cloudfoundry.reactor.ConnectionContext;
import org.cloudfoundry.reactor.TokenProvider;
import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations;
import reactor.core.publisher.Mono;

/**
* The Reactor-based implementation of {@link UsersV3}
*/
public class ReactorUsersV3 extends AbstractClientV3Operations implements UsersV3 {

/**
* Creates an instance
*
* @param connectionContext the {@link ConnectionContext} to use when communicating with the server
* @param root the root URI of the server. Typically, something like {@code https://api.cloudfoundry.your.company.com}.
* @param tokenProvider the {@link TokenProvider} to use when communicating with the server
* @param requestTags map with custom http headers which will be added to web request
*/
public ReactorUsersV3(
ConnectionContext connectionContext,
Mono<String> root,
TokenProvider tokenProvider,
Map<String, String> requestTags) {
super(connectionContext, root, tokenProvider, requestTags);
}

@Override
public Mono<CreateUserResponse> create(CreateUserRequest request) {
return post(request, CreateUserResponse.class, builder -> builder.pathSegment("users"))
.checkpoint();
}

@Override
public Mono<GetUserResponse> get(GetUserRequest request) {
return get(
request,
GetUserResponse.class,
builder -> builder.pathSegment("users", request.getUserId()))
.checkpoint();
}

@Override
public Mono<ListUsersResponse> list(ListUsersRequest request) {
return get(request, ListUsersResponse.class, builder -> builder.pathSegment("users"))
.checkpoint();
}

@Override
public Mono<UpdateUserResponse> update(UpdateUserRequest request) {
return patch(
request,
UpdateUserResponse.class,
builder -> builder.pathSegment("users", request.getUserId()))
.checkpoint();
}

@Override
public Mono<Void> delete(DeleteUserRequest request) {
return delete(
request,
Void.class,
builder -> builder.pathSegment("users", request.getUserId()))
.checkpoint();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2013-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.cloudfoundry.reactor.uaa;

import java.util.Map;
import org.cloudfoundry.reactor.ConnectionContext;
import org.cloudfoundry.reactor.TokenProvider;
import org.cloudfoundry.uaa.ratelimit.Ratelimit;
import org.cloudfoundry.uaa.ratelimit.RatelimitRequest;
import org.cloudfoundry.uaa.ratelimit.RatelimitResponse;
import reactor.core.publisher.Mono;

public final class ReactorRatelimit extends AbstractUaaOperations implements Ratelimit {

/**
* Creates an instance
*
* @param connectionContext the {@link ConnectionContext} to use when communicating with the server
* @param root the root URI of the server. Typically something like {@code https://uaa.run.pivotal.io}.
* @param tokenProvider the {@link TokenProvider} to use when communicating with the server
* @param requestTags map with custom http headers which will be added to web request
*/
public ReactorRatelimit(
ConnectionContext connectionContext,
Mono<String> root,
TokenProvider tokenProvider,
Map<String, String> requestTags) {
super(connectionContext, root, tokenProvider, requestTags);
}

@Override
public Mono<RatelimitResponse> getRatelimit(RatelimitRequest request) {
return get(
request,
RatelimitResponse.class,
builder -> builder.pathSegment("RateLimitingStatus"))
.checkpoint();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.cloudfoundry.uaa.groups.Groups;
import org.cloudfoundry.uaa.identityproviders.IdentityProviders;
import org.cloudfoundry.uaa.identityzones.IdentityZones;
import org.cloudfoundry.uaa.ratelimit.Ratelimit;
import org.cloudfoundry.uaa.serverinformation.ServerInformation;
import org.cloudfoundry.uaa.tokens.Tokens;
import org.cloudfoundry.uaa.users.Users;
Expand Down Expand Up @@ -104,6 +105,12 @@ public Users users() {
return new ReactorUsers(getConnectionContext(), getRoot(), getTokenProvider(), getRequestTags());
}

@Override
@Value.Derived
public Ratelimit rateLimit() {
return new ReactorRatelimit(getConnectionContext(), getRoot(), getTokenProvider(), getRequestTags());
}

/**
* The connection context
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class RequestLogger {
private long requestSentTime;

public void request(HttpClientRequest request) {
request(String.format("%-6s {}", request.method()), request.uri());
request(String.format("%-6s {}", request.method()), request.resourceUrl());
}

public void response(HttpClientResponse response) {
Expand Down
Loading