Search in sources :

Example 51 with StepVerifier

use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.

the class ApplicationsTest method pushNoHostName.

@Test
public void pushNoHostName() throws IOException {
    String applicationName = this.nameFactory.getApplicationName();
    String domainName = this.nameFactory.getDomainName();
    requestCreateDomain(this.cloudFoundryOperations, domainName, this.organizationName).then(this.cloudFoundryOperations.applications().push(PushApplicationRequest.builder().path(new ClassPathResource("test-application.zip").getFile().toPath()).buildpack("staticfile_buildpack").diskQuota(512).domain(domainName).healthCheckType(ApplicationHealthCheck.PORT).memory(64).name(applicationName).noHostname(true).noStart(false).build())).thenMany(this.cloudFoundryOperations.routes().list(ListRoutesRequest.builder().build())).filter(response -> domainName.equals(response.getDomain())).map(org.cloudfoundry.operations.routes.Route::getHost).as(StepVerifier::create).expectNext("").expectComplete().verify(Duration.ofMinutes(5));
}
Also used : StepVerifier(reactor.test.StepVerifier) GetApplicationManifestRequest(org.cloudfoundry.operations.applications.GetApplicationManifestRequest) PushApplicationRequest(org.cloudfoundry.operations.applications.PushApplicationRequest) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Task(org.cloudfoundry.operations.applications.Task) ClassPathResource(org.springframework.core.io.ClassPathResource) Route(org.cloudfoundry.operations.applications.Route) Autowired(org.springframework.beans.factory.annotation.Autowired) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) ApplicationHealthCheck(org.cloudfoundry.operations.applications.ApplicationHealthCheck) TaskState(org.cloudfoundry.operations.applications.TaskState) CreateDomainRequest(org.cloudfoundry.operations.domains.CreateDomainRequest) RestartApplicationRequest(org.cloudfoundry.operations.applications.RestartApplicationRequest) DeleteApplicationRequest(org.cloudfoundry.operations.applications.DeleteApplicationRequest) ApplicationDetail(org.cloudfoundry.operations.applications.ApplicationDetail) ApplicationEnvironments(org.cloudfoundry.operations.applications.ApplicationEnvironments) ApplicationSummary(org.cloudfoundry.operations.applications.ApplicationSummary) IfCloudFoundryVersion(org.cloudfoundry.IfCloudFoundryVersion) Duration(java.time.Duration) Map(java.util.Map) GetApplicationEventsRequest(org.cloudfoundry.operations.applications.GetApplicationEventsRequest) RunApplicationTaskRequest(org.cloudfoundry.operations.applications.RunApplicationTaskRequest) CloudFoundryVersion(org.cloudfoundry.CloudFoundryVersion) GetApplicationEnvironmentsRequest(org.cloudfoundry.operations.applications.GetApplicationEnvironmentsRequest) ListApplicationTasksRequest(org.cloudfoundry.operations.applications.ListApplicationTasksRequest) CreateSharedDomainRequest(org.cloudfoundry.operations.domains.CreateSharedDomainRequest) CreateUserProvidedServiceInstanceRequest(org.cloudfoundry.operations.services.CreateUserProvidedServiceInstanceRequest) GetApplicationRequest(org.cloudfoundry.operations.applications.GetApplicationRequest) Path(java.nio.file.Path) ApplicationEvent(org.cloudfoundry.operations.applications.ApplicationEvent) GetServiceInstanceRequest(org.cloudfoundry.operations.services.GetServiceInstanceRequest) UnsetEnvironmentVariableApplicationRequest(org.cloudfoundry.operations.applications.UnsetEnvironmentVariableApplicationRequest) ServiceInstance(org.cloudfoundry.operations.services.ServiceInstance) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) ApplicationManifest(org.cloudfoundry.operations.applications.ApplicationManifest) GetApplicationHealthCheckRequest(org.cloudfoundry.operations.applications.GetApplicationHealthCheckRequest) CreateServiceInstanceRequest(org.cloudfoundry.operations.services.CreateServiceInstanceRequest) Flux(reactor.core.publisher.Flux) BindServiceInstanceRequest(org.cloudfoundry.operations.services.BindServiceInstanceRequest) StartApplicationRequest(org.cloudfoundry.operations.applications.StartApplicationRequest) ListRoutesRequest(org.cloudfoundry.operations.routes.ListRoutesRequest) FluentMap(org.cloudfoundry.util.FluentMap) TerminateApplicationTaskRequest(org.cloudfoundry.operations.applications.TerminateApplicationTaskRequest) SetEnvironmentVariableApplicationRequest(org.cloudfoundry.operations.applications.SetEnvironmentVariableApplicationRequest) Collections(java.util.Collections) PushApplicationManifestRequest(org.cloudfoundry.operations.applications.PushApplicationManifestRequest) ClassPathResource(org.springframework.core.io.ClassPathResource) Route(org.cloudfoundry.operations.applications.Route) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Example 52 with StepVerifier

use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.

the class ApplicationsTest method restartStarted.

@Test
public void restartStarted() throws IOException {
    String applicationName = this.nameFactory.getApplicationName();
    createApplication(this.cloudFoundryOperations, new ClassPathResource("test-application.zip").getFile().toPath(), applicationName, false).then(this.cloudFoundryOperations.applications().restart(RestartApplicationRequest.builder().name(applicationName).build())).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
Also used : StepVerifier(reactor.test.StepVerifier) ClassPathResource(org.springframework.core.io.ClassPathResource) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Example 53 with StepVerifier

use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.

the class RoutesTest method unmapNoPath.

@Test
public void unmapNoPath() throws IOException {
    String applicationName = this.nameFactory.getApplicationName();
    String domainName = this.nameFactory.getDomainName();
    String hostName = this.nameFactory.getHostName();
    String path = null;
    Mono.when(createDomainAndRoute(this.cloudFoundryOperations, this.organizationName, this.spaceName, domainName, hostName, path), requestCreateApplication(this.cloudFoundryOperations, new ClassPathResource("test-application.zip").getFile().toPath(), applicationName, true)).then(requestMapRoute(this.cloudFoundryOperations, applicationName, domainName, hostName, path)).then(this.cloudFoundryOperations.routes().unmap(UnmapRouteRequest.builder().applicationName(applicationName).domain(domainName).host(hostName).path(path).build())).thenMany(requestListRoutes(this.cloudFoundryOperations)).filter(filterRoutes(domainName, hostName, path, applicationName)).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
Also used : StepVerifier(reactor.test.StepVerifier) ClassPathResource(org.springframework.core.io.ClassPathResource) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Example 54 with StepVerifier

use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.

the class RoutesTest method unmapTcpRoute.

@Test
public void unmapTcpRoute() throws IOException {
    String applicationName = this.nameFactory.getApplicationName();
    String domainName = this.nameFactory.getDomainName();
    requestCreateApplication(this.cloudFoundryOperations, new ClassPathResource("test-application.zip").getFile().toPath(), applicationName, true).then(createSharedDomainAndTcpRoute(this.cloudFoundryOperations, domainName, this.spaceName)).flatMap(port -> requestMapRoute(this.cloudFoundryOperations, applicationName, domainName, port)).flatMap(port -> this.cloudFoundryOperations.routes().unmap(UnmapRouteRequest.builder().applicationName(applicationName).domain(domainName).port(port).build())).thenMany(requestListRoutes(this.cloudFoundryOperations)).filter(response -> domainName.equals(response.getDomain())).map(route -> route.getApplications().size()).as(StepVerifier::create).expectNext(0).expectComplete().verify(Duration.ofMinutes(5));
}
Also used : UnmapRouteRequest(org.cloudfoundry.operations.routes.UnmapRouteRequest) StepVerifier(reactor.test.StepVerifier) DeleteOrphanedRoutesRequest(org.cloudfoundry.operations.routes.DeleteOrphanedRoutesRequest) SPACE(org.cloudfoundry.operations.routes.Level.SPACE) PushApplicationRequest(org.cloudfoundry.operations.applications.PushApplicationRequest) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ClassPathResource(org.springframework.core.io.ClassPathResource) Autowired(org.springframework.beans.factory.annotation.Autowired) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) ORGANIZATION(org.cloudfoundry.operations.routes.Level.ORGANIZATION) ApplicationHealthCheck(org.cloudfoundry.operations.applications.ApplicationHealthCheck) MapRouteRequest(org.cloudfoundry.operations.routes.MapRouteRequest) CreateRouteRequest(org.cloudfoundry.operations.routes.CreateRouteRequest) CreateDomainRequest(org.cloudfoundry.operations.domains.CreateDomainRequest) BindRouteServiceInstanceRequest(org.cloudfoundry.operations.services.BindRouteServiceInstanceRequest) Duration(java.time.Duration) CreateSharedDomainRequest(org.cloudfoundry.operations.domains.CreateSharedDomainRequest) CreateUserProvidedServiceInstanceRequest(org.cloudfoundry.operations.services.CreateUserProvidedServiceInstanceRequest) Path(java.nio.file.Path) Route(org.cloudfoundry.operations.routes.Route) Predicate(java.util.function.Predicate) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) Flux(reactor.core.publisher.Flux) CheckRouteRequest(org.cloudfoundry.operations.routes.CheckRouteRequest) DeleteRouteRequest(org.cloudfoundry.operations.routes.DeleteRouteRequest) ListRoutesRequest(org.cloudfoundry.operations.routes.ListRoutesRequest) Optional(java.util.Optional) Collections(java.util.Collections) ClassPathResource(org.springframework.core.io.ClassPathResource) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Example 55 with StepVerifier

use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.

the class ClientsTest method batchDelete.

@Test
public void batchDelete() {
    String clientId1 = this.nameFactory.getClientId();
    String clientId2 = this.nameFactory.getClientId();
    String clientSecret = this.nameFactory.getClientSecret();
    batchCreateClients(this.uaaClient, clientId1, clientId2, clientSecret).flatMapIterable(BatchCreateClientsResponse::getClients).map(Client::getClientId).collectList().flatMap(clientIds -> this.uaaClient.clients().batchDelete(BatchDeleteClientsRequest.builder().clientIds(clientIds).build())).thenMany(requestListClients(this.uaaClient)).filter(client -> clientId1.equals(client.getClientId()) || clientId2.equals(client.getClientId())).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
Also used : UpdateMetadataResponse(org.cloudfoundry.uaa.clients.UpdateMetadataResponse) UpdateSecretAction(org.cloudfoundry.uaa.clients.UpdateSecretAction) StepVerifier(reactor.test.StepVerifier) UpdateClient(org.cloudfoundry.uaa.clients.UpdateClient) Client(org.cloudfoundry.uaa.clients.Client) DeleteClientRequest(org.cloudfoundry.uaa.clients.DeleteClientRequest) BatchUpdateClientsRequest(org.cloudfoundry.uaa.clients.BatchUpdateClientsRequest) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) IMPLICIT(org.cloudfoundry.uaa.tokens.GrantType.IMPLICIT) GetClientRequest(org.cloudfoundry.uaa.clients.GetClientRequest) CLIENT_CREDENTIALS(org.cloudfoundry.uaa.tokens.GrantType.CLIENT_CREDENTIALS) AsciiString(io.netty.util.AsciiString) Autowired(org.springframework.beans.factory.annotation.Autowired) TimeoutException(java.util.concurrent.TimeoutException) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) UpdateMetadataRequest(org.cloudfoundry.uaa.clients.UpdateMetadataRequest) PASSWORD(org.cloudfoundry.uaa.tokens.GrantType.PASSWORD) MixedActionsRequest(org.cloudfoundry.uaa.clients.MixedActionsRequest) UpdateClientAction(org.cloudfoundry.uaa.clients.UpdateClientAction) Duration(java.time.Duration) PaginationUtils(org.cloudfoundry.util.PaginationUtils) UpdateSecretClientAction(org.cloudfoundry.uaa.clients.UpdateSecretClientAction) BatchChangeSecretResponse(org.cloudfoundry.uaa.clients.BatchChangeSecretResponse) CreateClientResponse(org.cloudfoundry.uaa.clients.CreateClientResponse) ListMetadatasResponse(org.cloudfoundry.uaa.clients.ListMetadatasResponse) BatchCreateClientsResponse(org.cloudfoundry.uaa.clients.BatchCreateClientsResponse) ListClientsRequest(org.cloudfoundry.uaa.clients.ListClientsRequest) UpdateClientRequest(org.cloudfoundry.uaa.clients.UpdateClientRequest) BatchUpdateClientsResponse(org.cloudfoundry.uaa.clients.BatchUpdateClientsResponse) GetMetadataResponse(org.cloudfoundry.uaa.clients.GetMetadataResponse) CreateClient(org.cloudfoundry.uaa.clients.CreateClient) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) BatchCreateClientsRequest(org.cloudfoundry.uaa.clients.BatchCreateClientsRequest) Flux(reactor.core.publisher.Flux) BatchChangeSecretRequest(org.cloudfoundry.uaa.clients.BatchChangeSecretRequest) Base64(java.util.Base64) DeleteClientAction(org.cloudfoundry.uaa.clients.DeleteClientAction) ChangeSecret(org.cloudfoundry.uaa.clients.ChangeSecret) ChangeSecretRequest(org.cloudfoundry.uaa.clients.ChangeSecretRequest) CreateClientRequest(org.cloudfoundry.uaa.clients.CreateClientRequest) ListMetadatasRequest(org.cloudfoundry.uaa.clients.ListMetadatasRequest) BatchDeleteClientsRequest(org.cloudfoundry.uaa.clients.BatchDeleteClientsRequest) ListClientsResponse(org.cloudfoundry.uaa.clients.ListClientsResponse) GetMetadataRequest(org.cloudfoundry.uaa.clients.GetMetadataRequest) REFRESH_TOKEN(org.cloudfoundry.uaa.tokens.GrantType.REFRESH_TOKEN) CreateClientAction(org.cloudfoundry.uaa.clients.CreateClientAction) BatchCreateClientsResponse(org.cloudfoundry.uaa.clients.BatchCreateClientsResponse) AsciiString(io.netty.util.AsciiString) StepVerifier(reactor.test.StepVerifier) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

StepVerifier (reactor.test.StepVerifier)82 Mono (reactor.core.publisher.Mono)56 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)48 Test (org.junit.jupiter.api.Test)45 Flux (reactor.core.publisher.Flux)41 Test (org.junit.Test)37 Duration (java.time.Duration)31 ClassPathResource (org.springframework.core.io.ClassPathResource)28 AbstractIntegrationTest (org.cloudfoundry.AbstractIntegrationTest)24 Collections (java.util.Collections)20 Mockito.mock (org.mockito.Mockito.mock)20 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)20 ConnectionFactory (io.r2dbc.spi.ConnectionFactory)19 Connection (io.r2dbc.spi.Connection)17 IOException (java.io.IOException)17 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)17 BeforeEach (org.junit.jupiter.api.BeforeEach)16 Autowired (org.springframework.beans.factory.annotation.Autowired)16 Result (io.r2dbc.spi.Result)14 Path (java.nio.file.Path)14