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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.util.Date;

import org.cloudfoundry.Nullable;
import org.immutables.value.Value;

/**
Expand All @@ -35,6 +36,7 @@ abstract class _Current {
* The number of configured limiter mappings
*/
@JsonProperty("limiterMappings")
@Nullable
abstract Integer getLimiterMappings();

/**
Expand All @@ -53,11 +55,13 @@ abstract class _Current {
* The credentialIdExtractor
*/
@JsonProperty("credentialIdExtractor")
@Nullable
abstract String getCredentialIdExtractor();

/**
* The loggingLevel. Valid values include: "OnlyLimited", "AllCalls" and "AllCallsWithDetails"
*/
@JsonProperty("loggingLevel")
@Nullable
abstract String getLoggingLevel();
}
346 changes: 235 additions & 111 deletions integration-test/src/test/java/org/cloudfoundry/ApplicationUtils.java

Large diffs are not rendered by default.

228 changes: 94 additions & 134 deletions integration-test/src/test/java/org/cloudfoundry/CloudFoundryCleaner.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import java.util.List;
import org.cloudfoundry.client.CloudFoundryClient;
import org.cloudfoundry.client.GetRootRequest;
import org.cloudfoundry.client.v2.info.GetInfoRequest;
import org.cloudfoundry.client.v2.userprovidedserviceinstances.CreateUserProvidedServiceInstanceRequest;
import org.cloudfoundry.client.v3.Relationship;
import org.cloudfoundry.client.v3.ToOneRelationship;
import org.cloudfoundry.client.v3.organizations.CreateOrganizationRequest;
Expand All @@ -53,6 +51,9 @@
import org.cloudfoundry.client.v3.roles.CreateRoleRequest;
import org.cloudfoundry.client.v3.roles.RoleRelationships;
import org.cloudfoundry.client.v3.roles.RoleType;
import org.cloudfoundry.client.v3.serviceinstances.CreateServiceInstanceRequest;
import org.cloudfoundry.client.v3.serviceinstances.ServiceInstanceRelationships;
import org.cloudfoundry.client.v3.serviceinstances.ServiceInstanceType;
import org.cloudfoundry.client.v3.spaces.CreateSpaceRequest;
import org.cloudfoundry.client.v3.spaces.CreateSpaceResponse;
import org.cloudfoundry.client.v3.spaces.SpaceRelationships;
Expand Down Expand Up @@ -92,7 +93,6 @@
import org.cloudfoundry.uaa.users.Email;
import org.cloudfoundry.uaa.users.Name;
import org.cloudfoundry.util.PaginationUtils;
import org.cloudfoundry.util.ResourceUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.SmartInitializingSingleton;
Expand Down Expand Up @@ -370,23 +370,33 @@ RandomNameFactory nameFactory() {

@Bean(initMethod = "block")
@DependsOn("cloudFoundryCleaner")
@ConditionalOnProperty(
name = RequiresV2Api.SKIP_V2_TESTS_ENV,
havingValue = "false",
matchIfMissing = true)
Mono<String> metricRegistrarServiceInstance(
CloudFoundryClient cloudFoundryClient, Mono<String> spaceId, NameFactory nameFactory) {
return spaceId.flatMap(
spaceIdValue ->
cloudFoundryClient
.userProvidedServiceInstances()
.serviceInstancesV3()
.create(
CreateUserProvidedServiceInstanceRequest.builder()
CreateServiceInstanceRequest.builder()
.type(ServiceInstanceType.USER_PROVIDED)
.name(nameFactory.getServiceInstanceName())
.spaceId(spaceIdValue)
.relationships(
ServiceInstanceRelationships
.builder()
.space(
ToOneRelationship
.builder()
.data(
Relationship
.builder()
.id(
spaceIdValue)
.build())
.build())
.build())
.syslogDrainUrl("structured-format://json")
.build()))
.map(ResourceUtils::getId)
.map(r -> r.getServiceInstance().get().getId())
.cache();
}

Expand Down Expand Up @@ -511,27 +521,12 @@ RoutingClient routingClient(ConnectionContext connectionContext, TokenProvider t

@Bean
Version serverVersion(@Qualifier("admin") CloudFoundryClient cloudFoundryClient) {
return serverVersionV2(cloudFoundryClient)
.switchIfEmpty(serverVersionV3(cloudFoundryClient))
return serverVersionV3(cloudFoundryClient)
.doOnSubscribe(s -> this.logger.debug(">> CLOUD FOUNDRY VERSION <<"))
.doOnSuccess(r -> this.logger.debug("<< CLOUD FOUNDRY VERSION >>"))
.block();
}

private static Mono<Version> serverVersionV2(CloudFoundryClient cloudFoundryClient) {
return cloudFoundryClient
.info()
.get(GetInfoRequest.builder().build())
.flatMap(
response -> {
String version = response.getApiVersion();
if (version == null || version.isEmpty()) {
return Mono.empty();
}
return Mono.just(Version.valueOf(version));
});
}

private static Mono<Version> serverVersionV3(CloudFoundryClient cloudFoundryClient) {
return cloudFoundryClient
.rootEndpoint()
Expand All @@ -542,10 +537,6 @@ private static Mono<Version> serverVersionV3(CloudFoundryClient cloudFoundryClie
@Lazy
@Bean(initMethod = "block")
@DependsOn("cloudFoundryCleaner")
@ConditionalOnProperty(
name = RequiresV2Api.SKIP_V2_TESTS_ENV,
havingValue = "false",
matchIfMissing = true)
Mono<String> serviceBrokerId(
CloudFoundryClient cloudFoundryClient,
NameFactory nameFactory,
Expand Down
Loading
Loading