Use imperative CredHubTemplate instead of reactive to avoid conficts with versions of reactor-netty.
This commit is contained in:
@@ -27,25 +27,25 @@ import org.springframework.cloud.appbroker.workflow.binding.CredHubPersistingCre
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.credhub.autoconfig.CredHubTemplateAutoConfiguration;
|
||||
import org.springframework.credhub.core.ReactiveCredHubOperations;
|
||||
import org.springframework.credhub.core.CredHubOperations;
|
||||
|
||||
@Configuration
|
||||
@AutoConfigureBefore(AppBrokerAutoConfiguration.class)
|
||||
@AutoConfigureAfter(CredHubTemplateAutoConfiguration.class)
|
||||
@ConditionalOnClass(ReactiveCredHubOperations.class)
|
||||
@ConditionalOnBean(ReactiveCredHubOperations.class)
|
||||
@ConditionalOnClass(CredHubOperations.class)
|
||||
@ConditionalOnBean(CredHubOperations.class)
|
||||
public class CredHubAutoConfiguration {
|
||||
|
||||
@Value("${spring.application.name}")
|
||||
private String appName;
|
||||
|
||||
@Bean
|
||||
public CreateServiceInstanceAppBindingWorkflow credhubPersistingCreateServiceInstanceAppBindingWorkflow(ReactiveCredHubOperations credHubOperations) {
|
||||
public CreateServiceInstanceAppBindingWorkflow credhubPersistingCreateServiceInstanceAppBindingWorkflow(CredHubOperations credHubOperations) {
|
||||
return new CredHubPersistingCreateServiceInstanceAppBindingWorkflow(credHubOperations, appName);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CredHubCredentialsGenerator credHubCredentialsGenerator(ReactiveCredHubOperations credHubOperations) {
|
||||
public CredHubCredentialsGenerator credHubCredentialsGenerator(CredHubOperations credHubOperations) {
|
||||
return new CredHubCredentialsGenerator(credHubOperations);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.cloud.appbroker.extensions.credentials.CredentialGene
|
||||
import org.springframework.cloud.appbroker.extensions.credentials.SimpleCredentialGenerator;
|
||||
import org.springframework.cloud.appbroker.workflow.binding.CredHubPersistingCreateServiceInstanceAppBindingWorkflow;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.credhub.core.ReactiveCredHubOperations;
|
||||
import org.springframework.credhub.core.CredHubOperations;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -49,7 +49,7 @@ class CredHubAutoConfigurationTest {
|
||||
@Test
|
||||
void servicesAreNotCreatedWithoutCredHubOnClasspath() {
|
||||
contextRunner
|
||||
.withClassLoader(new FilteredClassLoader(ReactiveCredHubOperations.class))
|
||||
.withClassLoader(new FilteredClassLoader(CredHubOperations.class))
|
||||
.run((context) -> {
|
||||
assertThat(context)
|
||||
.hasSingleBean(CredentialGenerator.class)
|
||||
@@ -78,8 +78,8 @@ class CredHubAutoConfigurationTest {
|
||||
@TestConfiguration
|
||||
public static class CredHubConfiguration {
|
||||
@Bean
|
||||
public ReactiveCredHubOperations credHubOperations() {
|
||||
return mock(ReactiveCredHubOperations.class);
|
||||
public CredHubOperations credHubOperations() {
|
||||
return mock(CredHubOperations.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.cloud.appbroker.integration;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.appbroker.integration.fixtures.CloudControllerStubFixture;
|
||||
@@ -70,18 +69,17 @@ class CreateInstanceWithCredHubCredentialsComponentTest extends WiremockComponen
|
||||
private CloudControllerStubFixture cloudControllerFixture;
|
||||
|
||||
@Autowired
|
||||
private UaaStubFixture uaaStubFixture;
|
||||
private UaaStubFixture uaaFixture;
|
||||
|
||||
@Autowired
|
||||
private CredHubStubFixture credHubFixture;
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
void pushAppWithCredentials() {
|
||||
cloudControllerFixture.stubAppDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubPushApp(APP_NAME);
|
||||
|
||||
uaaStubFixture.stubCreateClient();
|
||||
uaaFixture.stubCreateClient();
|
||||
|
||||
credHubFixture.stubGenerateUser(APP_NAME, SERVICE_INSTANCE_ID, "basic", 14);
|
||||
credHubFixture.stubGeneratePassword(APP_NAME, SERVICE_INSTANCE_ID, "oauth2", 12);
|
||||
|
||||
@@ -58,7 +58,7 @@ class CreateInstanceWithOAuth2CredentialsComponentTest extends WiremockComponent
|
||||
private CloudControllerStubFixture cloudControllerFixture;
|
||||
|
||||
@Autowired
|
||||
private UaaStubFixture uaaStubFixture;
|
||||
private UaaStubFixture uaaFixture;
|
||||
|
||||
@Test
|
||||
void pushAppWithOAuth2Credentials() {
|
||||
@@ -69,7 +69,7 @@ class CreateInstanceWithOAuth2CredentialsComponentTest extends WiremockComponent
|
||||
matchingJsonPath("$.environment_json[?(@.SPRING_APPLICATION_JSON =~ " +
|
||||
"/.*spring.*security.*oauth2.*client.*registration.*example-app-client.*client-secret.*:.*[a-zA-Z]{14}.*/)]"));
|
||||
|
||||
uaaStubFixture.stubCreateClient();
|
||||
uaaFixture.stubCreateClient();
|
||||
|
||||
// when a service instance is created
|
||||
given(brokerFixture.serviceInstanceRequest())
|
||||
@@ -96,7 +96,7 @@ class CreateInstanceWithOAuth2CredentialsComponentTest extends WiremockComponent
|
||||
cloudControllerFixture.stubServiceBindingDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubDeleteApp(APP_NAME);
|
||||
|
||||
uaaStubFixture.stubDeleteClient("test-client");
|
||||
uaaFixture.stubDeleteClient("test-client");
|
||||
|
||||
// when the service instance is deleted
|
||||
given(brokerFixture.serviceInstanceRequest())
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package org.springframework.cloud.appbroker.integration;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.appbroker.integration.fixtures.CloudControllerStubFixture;
|
||||
import org.springframework.cloud.appbroker.integration.fixtures.CredHubStubFixture;
|
||||
import org.springframework.cloud.appbroker.integration.fixtures.OpenServiceBrokerApiFixture;
|
||||
import org.springframework.cloud.appbroker.integration.fixtures.UaaStubFixture;
|
||||
import org.springframework.cloud.servicebroker.model.instance.OperationState;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
@@ -55,7 +55,7 @@ import static org.springframework.cloud.appbroker.integration.DeleteInstanceWith
|
||||
"spring.cloud.appbroker.services[0].apps[0].credential-providers[1].args.include-numeric=false",
|
||||
"spring.cloud.appbroker.services[0].apps[0].credential-providers[1].args.include-special=false",
|
||||
|
||||
"spring.credhub.url=http://localhost:8080"
|
||||
"spring.credhub.url=http://localhost:8888"
|
||||
})
|
||||
class DeleteInstanceWithCredHubCredentialsComponentTest extends WiremockComponentTest {
|
||||
|
||||
@@ -68,16 +68,20 @@ class DeleteInstanceWithCredHubCredentialsComponentTest extends WiremockComponen
|
||||
@Autowired
|
||||
private CloudControllerStubFixture cloudControllerFixture;
|
||||
|
||||
@Autowired
|
||||
private UaaStubFixture uaaFixture;
|
||||
|
||||
@Autowired
|
||||
private CredHubStubFixture credHubFixture;
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
void deleteAppWithCredentials() {
|
||||
cloudControllerFixture.stubAppExists(APP_NAME);
|
||||
cloudControllerFixture.stubServiceBindingDoesNotExist(APP_NAME);
|
||||
cloudControllerFixture.stubDeleteApp(APP_NAME);
|
||||
|
||||
uaaFixture.stubDeleteClient("test-client");
|
||||
|
||||
credHubFixture.stubDeleteCredential(APP_NAME, SERVICE_INSTANCE_ID, "basic");
|
||||
credHubFixture.stubDeleteCredential(APP_NAME, SERVICE_INSTANCE_ID, "oauth2");
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ dependencies {
|
||||
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-webflux")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testImplementation("io.projectreactor:reactor-test")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api")
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.springframework.cloud.appbroker.extensions.credentials;
|
||||
|
||||
import org.springframework.credhub.core.CredHubOperations;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.util.function.Tuple2;
|
||||
import reactor.util.function.Tuples;
|
||||
|
||||
import org.springframework.credhub.core.ReactiveCredHubOperations;
|
||||
import org.springframework.credhub.support.CredentialDetails;
|
||||
import org.springframework.credhub.support.SimpleCredentialName;
|
||||
import org.springframework.credhub.support.password.PasswordCredential;
|
||||
@@ -31,9 +31,9 @@ import org.springframework.credhub.support.user.UserParametersRequest;
|
||||
|
||||
public class CredHubCredentialsGenerator implements CredentialGenerator {
|
||||
|
||||
private final ReactiveCredHubOperations credHubOperations;
|
||||
private final CredHubOperations credHubOperations;
|
||||
|
||||
public CredHubCredentialsGenerator(ReactiveCredHubOperations credHubOperations) {
|
||||
public CredHubCredentialsGenerator(CredHubOperations credHubOperations) {
|
||||
this.credHubOperations = credHubOperations;
|
||||
}
|
||||
|
||||
@@ -41,39 +41,42 @@ public class CredHubCredentialsGenerator implements CredentialGenerator {
|
||||
public Mono<Tuple2<String, String>> generateUser(String applicationId, String serviceInstanceId, String descriptor,
|
||||
int length, boolean includeUppercaseAlpha, boolean includeLowercaseAlpha,
|
||||
boolean includeNumeric, boolean includeSpecial) {
|
||||
return this.credHubOperations.credentials().generate(UserParametersRequest
|
||||
.builder()
|
||||
.name(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor))
|
||||
.parameters(passwordParameters(length, includeUppercaseAlpha, includeLowercaseAlpha, includeNumeric, includeSpecial))
|
||||
.build(), UserCredential.class)
|
||||
.map(CredentialDetails::getValue)
|
||||
.map(userCredential -> Tuples.of(userCredential.getUsername(), userCredential.getPassword()));
|
||||
CredentialDetails<UserCredential> user = this.credHubOperations.credentials()
|
||||
.generate(UserParametersRequest.builder()
|
||||
.name(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor))
|
||||
.parameters(passwordParameters(length, includeUppercaseAlpha, includeLowercaseAlpha, includeNumeric, includeSpecial))
|
||||
.build());
|
||||
|
||||
return Mono.just(Tuples.of(user.getValue().getUsername(), user.getValue().getPassword()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<String> generateString(String applicationId, String serviceInstanceId, String descriptor, int length,
|
||||
boolean includeUppercaseAlpha, boolean includeLowercaseAlpha, boolean includeNumeric,
|
||||
boolean includeSpecial) {
|
||||
return credHubOperations.credentials().generate(PasswordParametersRequest
|
||||
.builder()
|
||||
.name(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor))
|
||||
.parameters(passwordParameters(length, includeUppercaseAlpha, includeLowercaseAlpha, includeNumeric, includeSpecial))
|
||||
.build(), PasswordCredential.class)
|
||||
.map(CredentialDetails::getValue)
|
||||
.map(PasswordCredential::getPassword);
|
||||
CredentialDetails<PasswordCredential> password = this.credHubOperations.credentials()
|
||||
.generate(PasswordParametersRequest.builder()
|
||||
.name(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor))
|
||||
.parameters(passwordParameters(length, includeUppercaseAlpha, includeLowercaseAlpha, includeNumeric, includeSpecial))
|
||||
.build());
|
||||
return Mono.just(password.getValue().getPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteUser(String applicationId, String serviceInstanceId, String descriptor) {
|
||||
return credHubOperations.credentials().deleteByName(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor));
|
||||
this.credHubOperations.credentials()
|
||||
.deleteByName(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor));
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> deleteString(String applicationId, String serviceInstanceId, String descriptor) {
|
||||
return credHubOperations.credentials().deleteByName(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor));
|
||||
this.credHubOperations.credentials().deleteByName(new SimpleCredentialName(applicationId, serviceInstanceId, descriptor));
|
||||
return Mono.empty();
|
||||
}
|
||||
|
||||
private PasswordParameters passwordParameters(int length, boolean includeUppercaseAlpha, boolean includeLowercaseAlpha,
|
||||
private PasswordParameters passwordParameters(int length, boolean includeUppercaseAlpha,
|
||||
boolean includeLowercaseAlpha,
|
||||
boolean includeNumeric, boolean includeSpecial) {
|
||||
return PasswordParameters
|
||||
.builder()
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.cloud.servicebroker.model.binding.CreateServiceInstan
|
||||
import org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceAppBindingResponse.CreateServiceInstanceAppBindingResponseBuilder;
|
||||
import org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.credhub.core.ReactiveCredHubOperations;
|
||||
import org.springframework.credhub.core.CredHubOperations;
|
||||
import org.springframework.credhub.support.ServiceInstanceCredentialName;
|
||||
import org.springframework.credhub.support.json.JsonCredentialRequest;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -41,9 +41,9 @@ public class CredHubPersistingCreateServiceInstanceAppBindingWorkflow implements
|
||||
|
||||
private final String appName;
|
||||
|
||||
private final ReactiveCredHubOperations credHubOperations;
|
||||
private final CredHubOperations credHubOperations;
|
||||
|
||||
public CredHubPersistingCreateServiceInstanceAppBindingWorkflow(ReactiveCredHubOperations credHubOperations, String appName) {
|
||||
public CredHubPersistingCreateServiceInstanceAppBindingWorkflow(CredHubOperations credHubOperations, String appName) {
|
||||
this.credHubOperations = credHubOperations;
|
||||
this.appName = appName;
|
||||
}
|
||||
@@ -65,24 +65,26 @@ public class CredHubPersistingCreateServiceInstanceAppBindingWorkflow implements
|
||||
|
||||
private Mono<CreateServiceInstanceAppBindingResponseBuilder> persistBindingCredentials(CreateServiceInstanceBindingRequest request,
|
||||
CreateServiceInstanceAppBindingResponse response) {
|
||||
return credHubOperations
|
||||
.credentials()
|
||||
ServiceInstanceCredentialName name = ServiceInstanceCredentialName
|
||||
.builder()
|
||||
.serviceBrokerName(this.appName)
|
||||
.serviceOfferingName(request.getServiceDefinitionId())
|
||||
.serviceBindingId(request.getBindingId())
|
||||
.credentialName(CREDENTIALS_NAME)
|
||||
.build();
|
||||
|
||||
credHubOperations.credentials()
|
||||
.write(JsonCredentialRequest
|
||||
.builder()
|
||||
.name(name)
|
||||
.value(response.getCredentials())
|
||||
.build())
|
||||
.thenReturn(CreateServiceInstanceAppBindingResponse
|
||||
.build());
|
||||
|
||||
return Mono.just(CreateServiceInstanceAppBindingResponse
|
||||
.builder()
|
||||
.async(response.isAsync())
|
||||
.bindingExisted(response.isBindingExisted())
|
||||
.credentials(CREDENTIALS_KEY, ServiceInstanceCredentialName
|
||||
.builder()
|
||||
.serviceBrokerName(this.appName)
|
||||
.serviceOfferingName(request.getServiceDefinitionId())
|
||||
.serviceBindingId(request.getBindingId())
|
||||
.credentialName(CREDENTIALS_NAME)
|
||||
.build()
|
||||
.getName())
|
||||
.credentials(CREDENTIALS_KEY, name.getName())
|
||||
.operation(response.getOperation())
|
||||
.syslogDrainUrl(response.getSyslogDrainUrl())
|
||||
.volumeMounts(response.getVolumeMounts()));
|
||||
|
||||
@@ -21,11 +21,10 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import reactor.core.publisher.Mono;
|
||||
import org.springframework.credhub.core.CredHubOperations;
|
||||
import org.springframework.credhub.core.credential.CredHubCredentialOperations;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import org.springframework.credhub.core.ReactiveCredHubOperations;
|
||||
import org.springframework.credhub.core.credential.ReactiveCredHubCredentialOperations;
|
||||
import org.springframework.credhub.support.CredentialDetails;
|
||||
import org.springframework.credhub.support.CredentialType;
|
||||
import org.springframework.credhub.support.SimpleCredentialName;
|
||||
@@ -36,7 +35,6 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
@@ -45,10 +43,10 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
class CredHubCredentialsGeneratorTest {
|
||||
|
||||
@Mock
|
||||
private ReactiveCredHubOperations credHubOperations;
|
||||
private CredHubOperations credHubOperations;
|
||||
|
||||
@Mock
|
||||
private ReactiveCredHubCredentialOperations credHubCredentialOperations;
|
||||
private CredHubCredentialOperations credHubCredentialOperations;
|
||||
|
||||
private CredHubCredentialsGenerator generator;
|
||||
|
||||
@@ -69,15 +67,14 @@ class CredHubCredentialsGeneratorTest {
|
||||
|
||||
@Test
|
||||
void generateUser() {
|
||||
CredentialDetails<UserCredential> credentialDetails = new CredentialDetails<UserCredential>("id",
|
||||
new SimpleCredentialName("app-service"), CredentialType.PASSWORD,
|
||||
new UserCredential("username", "password"));
|
||||
|
||||
given(this.credHubOperations.credentials())
|
||||
.willReturn(credHubCredentialOperations);
|
||||
|
||||
given(this.credHubCredentialOperations.generate(any(), eq(UserCredential.class)))
|
||||
.willReturn(Mono.just(credentialDetails));
|
||||
given(this.credHubCredentialOperations.generate(any()))
|
||||
.willReturn(new CredentialDetails<>("id",
|
||||
new SimpleCredentialName("app-service"), CredentialType.PASSWORD,
|
||||
new UserCredential("username", "password")));
|
||||
|
||||
StepVerifier.create(generator.generateUser("foo", "bar", "hello", 12, false, false, false, false))
|
||||
.assertNext(tuple2 -> {
|
||||
@@ -89,15 +86,14 @@ class CredHubCredentialsGeneratorTest {
|
||||
|
||||
@Test
|
||||
void generateString() {
|
||||
CredentialDetails<PasswordCredential> credentialDetails = new CredentialDetails<PasswordCredential>("id",
|
||||
new SimpleCredentialName("app-service"), CredentialType.PASSWORD,
|
||||
new PasswordCredential("password"));
|
||||
|
||||
given(this.credHubOperations.credentials())
|
||||
.willReturn(credHubCredentialOperations);
|
||||
|
||||
given(this.credHubCredentialOperations.generate(any(), eq(PasswordCredential.class)))
|
||||
.willReturn(Mono.just(credentialDetails));
|
||||
given(this.credHubCredentialOperations.generate(any()))
|
||||
.willReturn(new CredentialDetails<>("id",
|
||||
new SimpleCredentialName("app-service"), CredentialType.PASSWORD,
|
||||
new PasswordCredential("password")));
|
||||
|
||||
StepVerifier.create(generator.generateString("foo", "bar", "hello", 12, false, false, false, false))
|
||||
.assertNext(password -> assertThat(password).isEqualTo("password"))
|
||||
@@ -109,9 +105,6 @@ class CredHubCredentialsGeneratorTest {
|
||||
given(this.credHubOperations.credentials())
|
||||
.willReturn(credHubCredentialOperations);
|
||||
|
||||
given(this.credHubCredentialOperations.deleteByName(new SimpleCredentialName("foo", "bar", "hello")))
|
||||
.willReturn(Mono.empty());
|
||||
|
||||
StepVerifier.create(generator.deleteUser("foo", "bar", "hello"))
|
||||
.verifyComplete();
|
||||
|
||||
@@ -125,9 +118,6 @@ class CredHubCredentialsGeneratorTest {
|
||||
given(this.credHubOperations.credentials())
|
||||
.willReturn(credHubCredentialOperations);
|
||||
|
||||
given(this.credHubCredentialOperations.deleteByName(new SimpleCredentialName("foo", "bar", "hello")))
|
||||
.willReturn(Mono.empty());
|
||||
|
||||
StepVerifier.create(generator.deleteString("foo", "bar", "hello"))
|
||||
.verifyComplete();
|
||||
|
||||
|
||||
@@ -25,15 +25,15 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceAppBindingResponse;
|
||||
import org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceAppBindingResponse.CreateServiceInstanceAppBindingResponseBuilder;
|
||||
import org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest;
|
||||
import org.springframework.cloud.servicebroker.model.binding.VolumeMount;
|
||||
import org.springframework.credhub.core.ReactiveCredHubOperations;
|
||||
import org.springframework.credhub.core.credential.ReactiveCredHubCredentialOperations;
|
||||
import org.springframework.credhub.core.CredHubOperations;
|
||||
import org.springframework.credhub.core.credential.CredHubCredentialOperations;
|
||||
import org.springframework.credhub.support.CredentialDetails;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -46,10 +46,10 @@ import static org.mockito.Mockito.verifyZeroInteractions;
|
||||
class CredHubPersistingCreateServiceInstanceAppBindingWorkflowTest {
|
||||
|
||||
@Mock
|
||||
private ReactiveCredHubOperations credHubOperations;
|
||||
private CredHubOperations credHubOperations;
|
||||
|
||||
@Mock
|
||||
private ReactiveCredHubCredentialOperations credHubCredentialOperations;
|
||||
private CredHubCredentialOperations credHubCredentialOperations;
|
||||
|
||||
private CredHubPersistingCreateServiceInstanceAppBindingWorkflow workflow;
|
||||
|
||||
@@ -127,7 +127,7 @@ class CredHubPersistingCreateServiceInstanceAppBindingWorkflowTest {
|
||||
.willReturn(credHubCredentialOperations);
|
||||
|
||||
given(this.credHubCredentialOperations.write(any()))
|
||||
.willReturn(Mono.empty());
|
||||
.willReturn(new CredentialDetails<>());
|
||||
|
||||
StepVerifier
|
||||
.create(this.workflow.buildResponse(request, responseBuilder))
|
||||
|
||||
Reference in New Issue
Block a user