Java源码示例:org.cloudfoundry.client.v2.info.GetInfoResponse
示例1
@Bean
@Primary
public CloudFoundryPlatformClientProvider mockCloudFoundryClientProvider() {
when(cloudFoundryClient.info())
.thenReturn(getInfoRequest -> Mono.just(GetInfoResponse.builder().apiVersion("0.0.0").build()));
when(cloudFoundryClient.organizations()).thenReturn(mock(Organizations.class));
when(cloudFoundryClient.spaces()).thenReturn(mock(Spaces.class));
when(cloudFoundryClient.organizations().list(any())).thenReturn(listOrganizationsResponse());
when(cloudFoundryClient.spaces().list(any())).thenReturn(listSpacesResponse());
CloudFoundryPlatformClientProvider cloudFoundryClientProvider = mock(
CloudFoundryPlatformClientProvider.class);
when(cloudFoundryClientProvider.cloudFoundryClient(anyString())).thenAnswer(invocation -> {
System.out.println("Returning " + cloudFoundryClient);
return cloudFoundryClient;
});
return cloudFoundryClientProvider;
}
示例2
@Bean
@Primary
public CloudFoundryPlatformClientProvider mockCloudFoundryClientProvider() {
when(cloudFoundryClient.info())
.thenReturn(getInfoRequest -> Mono.just(GetInfoResponse.builder().apiVersion("0.0.0").build()));
when(cloudFoundryClient.organizations()).thenReturn(mock(Organizations.class));
when(cloudFoundryClient.spaces()).thenReturn(mock(Spaces.class));
when(cloudFoundryClient.organizations().list(any())).thenReturn(listOrganizationsResponse());
when(cloudFoundryClient.spaces().list(any())).thenReturn(listSpacesResponse());
CloudFoundryPlatformClientProvider cloudFoundryClientProvider = mock(
CloudFoundryPlatformClientProvider.class);
when(cloudFoundryClientProvider.cloudFoundryClient(anyString())).thenAnswer(invocation -> {
System.out.println("Returning " + cloudFoundryClient);
return cloudFoundryClient;
});
return cloudFoundryClientProvider;
}
示例3
@Before
public void setUp() throws Exception {
when(this.cloudFoundryClient.info())
.thenReturn(getInfoRequest -> Mono.just(GetInfoResponse.builder().apiVersion("0.0.0").build()));
when(this.cloudFoundryClient.organizations()).thenReturn(mock(Organizations.class));
when(this.cloudFoundryClient.spaces()).thenReturn(mock(Spaces.class));
when(this.cloudFoundryClient.organizations().list(any())).thenReturn(listOrganizationsResponse());
when(this.cloudFoundryClient.spaces().list(any())).thenReturn(listSpacesResponse());
when(this.cloudFoundryClientProvider.cloudFoundryClient(anyString())).thenReturn(this.cloudFoundryClient);
this.cloudFoundryPlatformProperties = new CloudFoundryPlatformProperties();
this.defaultConnectionProperties = new CloudFoundryConnectionProperties();
this.defaultConnectionProperties.setOrg("org");
this.defaultConnectionProperties.setSpace("space");
this.defaultConnectionProperties.setUrl(new URL("https://localhost:9999"));
this.deploymentProperties = new CloudFoundryDeploymentProperties();
this.deploymentProperties.setApiTimeout(1L);
}
示例4
@Override
public Mono<GetInfoResponse> getInfo() {
GetInfoResponse data = GetInfoResponse.builder()
.description("CFSimulator")
.name("CFSimulator")
.version(1)
.build();
return Mono.just(data);
}
示例5
@PostConstruct
@SuppressWarnings("unused")
private void constructCloudFoundryClient() throws ConfigurationException {
this.reset();
if (this.performPrecheckOfAPIVersion) {
GetInfoRequest request = GetInfoRequest.builder().build();
GetInfoResponse getInfo = this.cloudFoundryClient.info().get(request).block();
// NB: This also ensures that the connection has been established properly...
log.info(String.format("Target CF platform is running on API version %s", getInfo.getApiVersion()));
}
}
示例6
@Override
public Mono<GetInfoResponse> getInfo() {
GetInfoResponse data = GetInfoResponse.builder()
.description("CFAccessorMassMock")
.name("CFAccessorMassMock")
.version(1)
.build();
return Mono.just(data);
}
示例7
@Override
public Mono<GetInfoResponse> getInfo() {
GetInfoResponse data = GetInfoResponse.builder()
.description("CFAccessorMock")
.name("CFAccessorMock")
.version(1)
.build();
return Mono.just(data);
}
示例8
@Override
public CloudInfo derive() {
GetInfoResponse resource = getResource();
return ImmutableCloudInfo.builder()
.authorizationEndpoint(resource.getAuthorizationEndpoint())
.loggingEndpoint(resource.getDopplerLoggingEndpoint())
.build(resource.getBuildNumber())
.description(resource.getDescription())
.name(resource.getName())
.user(resource.getUser())
.support(resource.getSupport())
.version(parseVersion(resource.getVersion()))
.build();
}
示例9
private GetInfoResponse buildTestResource() {
return GetInfoResponse.builder()
.dopplerLoggingEndpoint(DOPPLER_LOGGING_ENDPOINT)
.authorizationEndpoint(AUTHORIZATION_ENDPOINT)
.buildNumber(BUILD)
.description(DESCRIPTION)
.name(NAME)
.user(USER)
.support(SUPPORT)
.version(VERSION)
.build();
}
示例10
@Override
public Mono<GetInfoResponse> getInfo() {
return this.parent.getInfo();
}
示例11
@Override
public Mono<GetInfoResponse> getInfo() {
return this.parent.getInfo();
}
示例12
@Override
public Mono<GetInfoResponse> getInfo() {
return this.cloudFoundryClient.info().get(DUMMY_GET_INFO_REQUEST);
}
示例13
@Override
public Mono<GetInfoResponse> getInfo() {
return Mono.just(GetInfoResponse.builder().build());
}
示例14
@Value.Parameter
public abstract GetInfoResponse getResource();
示例15
private Mono<GetInfoResponse> getInfoResource() {
return delegate.info()
.get(GetInfoRequest.builder()
.build());
}
示例16
private GetInfoResponse buildEmptyTestResource() {
return GetInfoResponse.builder()
.build();
}
示例17
Mono<GetInfoResponse> getInfo();