org.cloudfoundry.reactor.doppler.ReactorDopplerClient Java Examples

The following examples show how to use org.cloudfoundry.reactor.doppler.ReactorDopplerClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudFoundryTestSupport.java    From spring-cloud-deployer-cloudfoundry with Apache License 2.0 6 votes vote down vote up
@Bean
public CloudFoundryOperations cloudFoundryOperations(CloudFoundryClient cloudFoundryClient,
													 ConnectionContext connectionContext,
													 TokenProvider tokenProvider,
													 CloudFoundryConnectionProperties properties) {
	ReactorDopplerClient.builder()
		.connectionContext(connectionContext)
		.tokenProvider(tokenProvider)
		.build();

	ReactorUaaClient.builder()
		.connectionContext(connectionContext)
		.tokenProvider(tokenProvider)
		.build();

	return DefaultCloudFoundryOperations.builder()
		.cloudFoundryClient(cloudFoundryClient)
		.organization(properties.getOrg())
		.space(properties.getSpace())
		.build();
}
 
Example #2
Source File: ButlerConfig.java    From cf-butler with Apache License 2.0 5 votes vote down vote up
@Bean
public ReactorDopplerClient dopplerClient(ConnectionContext connectionContext, TokenProvider tokenProvider) {
    return ReactorDopplerClient
            .builder()
                .connectionContext(connectionContext)
                .tokenProvider(tokenProvider)
                .build();
}
 
Example #3
Source File: ButlerConfig.java    From cf-butler with Apache License 2.0 5 votes vote down vote up
@Bean
public DefaultCloudFoundryOperations opsClient(ReactorCloudFoundryClient cloudFoundryClient,
        ReactorDopplerClient dopplerClient, ReactorUaaClient uaaClient) {
    return DefaultCloudFoundryOperations
            .builder()
                .cloudFoundryClient(cloudFoundryClient)
                .dopplerClient(dopplerClient)
                .uaaClient(uaaClient)
                .build();
}
 
Example #4
Source File: CloudFoundryClientConfiguration.java    From bootiful-testing-online-training with Apache License 2.0 5 votes vote down vote up
@Bean
ReactorDopplerClient dopplerClient(ConnectionContext connectionContext,
																																			TokenProvider tokenProvider) {
	return ReactorDopplerClient
		.builder()
		.connectionContext(connectionContext)
		.tokenProvider(tokenProvider)
		.build();
}
 
Example #5
Source File: CloudFoundryClientConfiguration.java    From bootiful-testing-online-training with Apache License 2.0 5 votes vote down vote up
@Bean
public DefaultCloudFoundryOperations cloudFoundryOperations(
	CloudFoundryClient cfc,
	ReactorDopplerClient dopplerClient,
	ReactorUaaClient uaaClient,
	@Value("${cf.org}") String organization,
	@Value("${cf.space}") String space) {
	return DefaultCloudFoundryOperations.builder()
		.cloudFoundryClient(cfc)
		.dopplerClient(dopplerClient)
		.uaaClient(uaaClient)
		.organization(organization)
		.space(space)
		.build();
}
 
Example #6
Source File: CloudFoundryAppDeployerAutoConfiguration.java    From spring-cloud-app-broker with Apache License 2.0 5 votes vote down vote up
/**
 * Provide a {@link ReactorDopplerClient} bean
 *
 * @param connectionContext the ConnectionContext bean
 * @param tokenProvider the TokenProvider bean
 * @return the bean
 */
@Bean
public ReactorDopplerClient dopplerClient(ConnectionContext connectionContext,
	@TokenQualifier TokenProvider tokenProvider) {
	return ReactorDopplerClient.builder()
		.connectionContext(connectionContext)
		.tokenProvider(tokenProvider)
		.build();
}
 
Example #7
Source File: CloudFoundryAppDeployerAutoConfigurationTest.java    From spring-cloud-app-broker with Apache License 2.0 5 votes vote down vote up
@Test
void clientIsCreatedWithCredentialsGrantConfiguration() {
	this.contextRunner
		.withPropertyValues(
			"spring.cloud.appbroker.deployer.cloudfoundry.api-host=api.example.local",
			"spring.cloud.appbroker.deployer.cloudfoundry.api-port=443",
			"spring.cloud.appbroker.deployer.cloudfoundry.default-org=example-org",
			"spring.cloud.appbroker.deployer.cloudfoundry.default-space=example-space",
			"spring.cloud.appbroker.deployer.cloudfoundry.client-id=oauth-client",
			"spring.cloud.appbroker.deployer.cloudfoundry.client-secret=secret"
		)
		.run((context) -> {
			assertThat(context).hasSingleBean(CloudFoundryTargetProperties.class);
			CloudFoundryTargetProperties targetProperties = context.getBean(CloudFoundryTargetProperties.class);
			assertThat(targetProperties.getApiHost()).isEqualTo("api.example.local");
			assertThat(targetProperties.getApiPort()).isEqualTo(443);
			assertThat(targetProperties.getDefaultOrg()).isEqualTo("example-org");
			assertThat(targetProperties.getDefaultSpace()).isEqualTo("example-space");
			assertThat(targetProperties.getClientId()).isEqualTo("oauth-client");
			assertThat(targetProperties.getClientSecret()).isEqualTo("secret");

			assertThat(context).hasSingleBean(AppDeployer.class);
			assertThat(context).hasSingleBean(AppManager.class);

			assertThat(context).hasSingleBean(ReactorCloudFoundryClient.class);
			assertThat(context).hasSingleBean(ReactorDopplerClient.class);
			assertThat(context).hasSingleBean(ReactorUaaClient.class);
			assertThat(context).hasSingleBean(CloudFoundryOperations.class);
			assertThat(context).hasSingleBean(CloudFoundryOperationsUtils.class);
			assertThat(context).hasSingleBean(DefaultConnectionContext.class);
			assertThat(context).hasSingleBean(ClientCredentialsGrantTokenProvider.class);
		});
}
 
Example #8
Source File: CloudFoundryAppDeployerAutoConfigurationTest.java    From spring-cloud-app-broker with Apache License 2.0 5 votes vote down vote up
@Test
void clientIsNotCreatedWithoutConfiguration() {
	this.contextRunner
		.run((context) -> {
			assertThat(context).doesNotHaveBean(CloudFoundryTargetProperties.class);
			assertThat(context).doesNotHaveBean(CloudFoundryDeploymentProperties.class);
			assertThat(context).doesNotHaveBean(ReactorCloudFoundryClient.class);
			assertThat(context).doesNotHaveBean(ReactorDopplerClient.class);
			assertThat(context).doesNotHaveBean(ReactorUaaClient.class);
			assertThat(context).doesNotHaveBean(CloudFoundryOperations.class);
			assertThat(context).doesNotHaveBean(CloudFoundryOperationsUtils.class);
			assertThat(context).doesNotHaveBean(ConnectionContext.class);
			assertThat(context).doesNotHaveBean(TokenProvider.class);
		});
}
 
Example #9
Source File: CloudFoundryClientConfiguration.java    From spring-cloud-app-broker with Apache License 2.0 5 votes vote down vote up
@Bean
protected DopplerClient dopplerClient(ConnectionContext connectionContext,
	@Qualifier("userCredentials") TokenProvider tokenProvider) {
	return ReactorDopplerClient.builder()
		.connectionContext(connectionContext)
		.tokenProvider(tokenProvider)
		.build();
}
 
Example #10
Source File: CloudFoundryTaskPlatformFactory.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
private CloudFoundryOperations cloudFoundryOperations(CloudFoundryClient cloudFoundryClient, String account) {
	return DefaultCloudFoundryOperations
			.builder().cloudFoundryClient(cloudFoundryClient)
			.organization(connectionProperties(account).getOrg())
			.dopplerClient(ReactorDopplerClient.builder()
					.connectionContext(connectionContext(account))
					.tokenProvider(tokenProvider(account)).build())
			.space(connectionProperties(account).getSpace()).build();
}
 
Example #11
Source File: CloudFoundryClientAutoConfiguration.java    From spring-cloud-cloudfoundry with Apache License 2.0 5 votes vote down vote up
@Bean
@Lazy
@ConditionalOnMissingBean
public DopplerClient dopplerClient(ConnectionContext connectionContext,
		TokenProvider tokenProvider) {
	return ReactorDopplerClient.builder().connectionContext(connectionContext)
			.tokenProvider(tokenProvider).build();
}
 
Example #12
Source File: CloudFoundryAppDeployerAutoConfigurationTest.java    From spring-cloud-app-broker with Apache License 2.0 4 votes vote down vote up
@Test
void clientIsCreatedWithPasswordGrantConfiguration() {
	this.contextRunner
		.withPropertyValues(
			"spring.cloud.appbroker.deployer.cloudfoundry.api-host=api.example.local",
			"spring.cloud.appbroker.deployer.cloudfoundry.api-port=443",
			"spring.cloud.appbroker.deployer.cloudfoundry.default-org=example-org",
			"spring.cloud.appbroker.deployer.cloudfoundry.default-space=example-space",
			"spring.cloud.appbroker.deployer.cloudfoundry.username=user",
			"spring.cloud.appbroker.deployer.cloudfoundry.password=secret",
			"spring.cloud.appbroker.deployer.cloudfoundry.properties.memory=2G",
			"spring.cloud.appbroker.deployer.cloudfoundry.properties.count=3",
			"spring.cloud.appbroker.deployer.cloudfoundry.properties.buildpack=example-buildpack",
			"spring.cloud.appbroker.deployer.cloudfoundry.properties.domain=example.local"
		)
		.run((context) -> {
			assertThat(context).hasSingleBean(CloudFoundryTargetProperties.class);
			CloudFoundryTargetProperties targetProperties = context.getBean(CloudFoundryTargetProperties.class);
			assertThat(targetProperties.getApiHost()).isEqualTo("api.example.local");
			assertThat(targetProperties.getApiPort()).isEqualTo(443);
			assertThat(targetProperties.getDefaultOrg()).isEqualTo("example-org");
			assertThat(targetProperties.getDefaultSpace()).isEqualTo("example-space");
			assertThat(targetProperties.getUsername()).isEqualTo("user");
			assertThat(targetProperties.getPassword()).isEqualTo("secret");

			assertThat(context).hasSingleBean(CloudFoundryDeploymentProperties.class);
			CloudFoundryDeploymentProperties deploymentProperties = context
				.getBean(CloudFoundryDeploymentProperties.class);
			assertThat(deploymentProperties.getMemory()).isEqualTo("2G");
			assertThat(deploymentProperties.getCount()).isEqualTo(3);
			assertThat(deploymentProperties.getBuildpack()).isEqualTo("example-buildpack");
			assertThat(deploymentProperties.getDomain()).isEqualTo("example.local");

			assertThat(context).hasSingleBean(AppDeployer.class);
			assertThat(context).hasSingleBean(AppManager.class);
			assertThat(context).hasSingleBean(OAuth2Client.class);

			assertThat(context).hasSingleBean(ReactorCloudFoundryClient.class);
			assertThat(context).hasSingleBean(ReactorDopplerClient.class);
			assertThat(context).hasSingleBean(ReactorUaaClient.class);
			assertThat(context).hasSingleBean(CloudFoundryOperations.class);
			assertThat(context).hasSingleBean(CloudFoundryOperationsUtils.class);
			assertThat(context).hasSingleBean(DefaultConnectionContext.class);
			assertThat(context).hasSingleBean(PasswordGrantTokenProvider.class);
		});
}
 
Example #13
Source File: CloudFoundryClientFactory.java    From cf-java-client-sap with Apache License 2.0 4 votes vote down vote up
public DopplerClient createDopplerClient(URL controllerUrl, OAuthClient oAuthClient) {
    return ReactorDopplerClient.builder()
                               .connectionContext(getOrCreateConnectionContext(controllerUrl.getHost()))
                               .tokenProvider(oAuthClient.getTokenProvider())
                               .build();
}
 
Example #14
Source File: CfConfiguration.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
@Bean
ReactorDopplerClient dopplerClient(ConnectionContext connectionContext,
		TokenProvider tokenProvider) {
	return ReactorDopplerClient.builder().connectionContext(connectionContext)
			.tokenProvider(tokenProvider).build();
}