use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class ClientsTest method changeSecret.
@Test
public void changeSecret() {
String clientId = this.nameFactory.getClientId();
String newClientSecret = this.nameFactory.getClientSecret();
String oldClientSecret = this.nameFactory.getClientSecret();
requestCreateClient(this.uaaClient, clientId, oldClientSecret).then(this.uaaClient.clients().changeSecret(ChangeSecretRequest.builder().clientId(clientId).oldSecret(oldClientSecret).secret(newClientSecret).build())).as(StepVerifier::create).consumeErrorWith(t -> assertThat(t).isInstanceOf(UaaException.class).hasMessage("invalid_client: Only a client can change client secret")).verify(Duration.ofMinutes(5));
}
use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class ServiceBrokersTest method create.
@Test
public void create() {
String planName = this.nameFactory.getPlanName();
String serviceBrokerName = this.nameFactory.getServiceBrokerName();
String serviceName = this.nameFactory.getServiceName();
String spaceName = this.nameFactory.getSpaceName();
Path application;
try {
application = new ClassPathResource("test-service-broker.jar").getFile().toPath();
} catch (IOException e) {
throw Exceptions.propagate(e);
}
ServiceBrokerUtils.ApplicationMetadata applicationMetadata = this.organizationId.flatMap(organizationId -> Mono.zip(createSpaceId(this.cloudFoundryClient, organizationId, spaceName), getSharedDomain(this.cloudFoundryClient))).flatMap(function((spaceId, domain) -> ServiceBrokerUtils.pushServiceBrokerApplication(this.cloudFoundryClient, application, domain, this.nameFactory, planName, serviceName, spaceId))).block(Duration.ofMinutes(5));
this.cloudFoundryClient.serviceBrokers().create(CreateServiceBrokerRequest.builder().authenticationPassword("test-authentication-password").authenticationUsername("test-authentication-username").brokerUrl(applicationMetadata.uri).name(serviceBrokerName).spaceId(applicationMetadata.spaceId).build()).flatMapMany(response -> PaginationUtils.requestClientV2Resources(page -> this.cloudFoundryClient.serviceBrokers().list(ListServiceBrokersRequest.builder().name(serviceBrokerName).page(page).build()))).as(StepVerifier::create).expectNextCount(1).expectComplete().verify(Duration.ofMinutes(5));
deleteServiceBroker(this.cloudFoundryClient, applicationMetadata.applicationId).block(Duration.ofMinutes(5));
}
use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class DefaultApplicationsTest method pushInvalidStack.
@Test
public void pushInvalidStack() throws IOException {
Path testApplication = new ClassPathResource("test-application.zip").getFile().toPath();
requestSpace(this.cloudFoundryClient, TEST_SPACE_ID, TEST_ORGANIZATION_ID);
requestPrivateDomainsEmpty(this.cloudFoundryClient, TEST_ORGANIZATION_ID);
requestSharedDomains(this.cloudFoundryClient, "test-shared-domain", "test-shared-domain-id");
requestStackIdEmpty(this.cloudFoundryClient, "invalid-stack");
this.applications.push(PushApplicationRequest.builder().path(testApplication).name("test-name").stack("invalid-stack").build()).as(StepVerifier::create).consumeErrorWith(t -> assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessage("Stack invalid-stack does not exist")).verify(Duration.ofSeconds(5));
}
use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class DefaultApplicationsTest method pushNoDomainNoneFound.
@Test
public void pushNoDomainNoneFound() throws IOException {
Path testApplication = new ClassPathResource("test-application.zip").getFile().toPath();
requestApplicationsEmpty(this.cloudFoundryClient, "test-name", TEST_SPACE_ID);
requestCreateApplication(this.cloudFoundryClient, ApplicationManifest.builder().path(testApplication).name("test-name").build(), TEST_SPACE_ID, null, "test-application-id");
requestSpace(this.cloudFoundryClient, TEST_SPACE_ID, TEST_ORGANIZATION_ID);
requestPrivateDomainsEmpty(this.cloudFoundryClient, TEST_ORGANIZATION_ID);
requestSharedDomainsEmpty(this.cloudFoundryClient);
requestListMatchingResources(this.cloudFoundryClient, Arrays.asList(new ResourceMatchingUtils.ArtifactMetadata("da39a3ee5e6b4b0d3255bfef95601890afd80709", "Staticfile", "100644", 0), new ResourceMatchingUtils.ArtifactMetadata("45044a6ddbfe11415a8f8a6219de68a2c66b496b", "index.html", "100644", 178)));
requestApplicationRoutesEmpty(this.cloudFoundryClient, "test-application-id");
this.applications.push(PushApplicationRequest.builder().path(testApplication).name("test-name").build()).as(StepVerifier::create).consumeErrorWith(t -> assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessage("No default domain found")).verify(Duration.ofSeconds(5));
}
use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class DefaultApplicationsTest method pushDomainNotFound.
@Test
public void pushDomainNotFound() throws IOException {
Path testApplication = new ClassPathResource("test-application.zip").getFile().toPath();
requestApplicationsEmpty(this.cloudFoundryClient, "test-application-name", TEST_SPACE_ID);
requestCreateApplication(this.cloudFoundryClient, ApplicationManifest.builder().path(testApplication).domain("test-shared-domain").name("test-application-name").build(), TEST_SPACE_ID, null, "test-application-id");
requestSpace(this.cloudFoundryClient, TEST_SPACE_ID, TEST_ORGANIZATION_ID);
requestPrivateDomainsEmpty(this.cloudFoundryClient, TEST_ORGANIZATION_ID);
requestSharedDomainsEmpty(this.cloudFoundryClient);
requestApplicationRoutes(this.cloudFoundryClient, "test-application-id", "test-route-id");
requestListMatchingResources(this.cloudFoundryClient, Arrays.asList(new ResourceMatchingUtils.ArtifactMetadata("da39a3ee5e6b4b0d3255bfef95601890afd80709", "Staticfile", "100644", 0), new ResourceMatchingUtils.ArtifactMetadata("45044a6ddbfe11415a8f8a6219de68a2c66b496b", "index.html", "100644", 178)));
this.applications.push(PushApplicationRequest.builder().path(testApplication).domain("test-shared-domain").name("test-application-name").build()).as(StepVerifier::create).consumeErrorWith(t -> assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessage("Domain test-shared-domain not found")).verify(Duration.ofSeconds(5));
}
Aggregations