Search in sources :

Example 56 with StepVerifier

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));
}
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) AsciiString(io.netty.util.AsciiString) StepVerifier(reactor.test.StepVerifier) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Example 57 with StepVerifier

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));
}
Also used : Path(java.nio.file.Path) StepVerifier(reactor.test.StepVerifier) ServiceBrokerUtils.createServiceBroker(org.cloudfoundry.ServiceBrokerUtils.createServiceBroker) UpdateServiceBrokerRequest(org.cloudfoundry.client.v2.servicebrokers.UpdateServiceBrokerRequest) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ClassPathResource(org.springframework.core.io.ClassPathResource) CreateSpaceRequest(org.cloudfoundry.client.v2.spaces.CreateSpaceRequest) Autowired(org.springframework.beans.factory.annotation.Autowired) ServiceBrokerUtils.deleteServiceBroker(org.cloudfoundry.ServiceBrokerUtils.deleteServiceBroker) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) ResourceUtils(org.cloudfoundry.util.ResourceUtils) GetServiceBrokerRequest(org.cloudfoundry.client.v2.servicebrokers.GetServiceBrokerRequest) DeleteServiceBrokerRequest(org.cloudfoundry.client.v2.servicebrokers.DeleteServiceBrokerRequest) Duration(java.time.Duration) ServiceBrokerUtils(org.cloudfoundry.ServiceBrokerUtils) PaginationUtils(org.cloudfoundry.util.PaginationUtils) Path(java.nio.file.Path) ListServiceBrokersRequest(org.cloudfoundry.client.v2.servicebrokers.ListServiceBrokersRequest) CreateServiceBrokerRequest(org.cloudfoundry.client.v2.servicebrokers.CreateServiceBrokerRequest) SharedDomainResource(org.cloudfoundry.client.v2.shareddomains.SharedDomainResource) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) ListSharedDomainsRequest(org.cloudfoundry.client.v2.shareddomains.ListSharedDomainsRequest) CreateSpaceResponse(org.cloudfoundry.client.v2.spaces.CreateSpaceResponse) Flux(reactor.core.publisher.Flux) CloudFoundryClient(org.cloudfoundry.client.CloudFoundryClient) Exceptions(reactor.core.Exceptions) TupleUtils.function(org.cloudfoundry.util.tuple.TupleUtils.function) IOException(java.io.IOException) ServiceBrokerUtils(org.cloudfoundry.ServiceBrokerUtils) ClassPathResource(org.springframework.core.io.ClassPathResource) AbstractIntegrationTest(org.cloudfoundry.AbstractIntegrationTest) Test(org.junit.Test)

Example 58 with StepVerifier

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));
}
Also used : Path(java.nio.file.Path) LogMessage(org.cloudfoundry.doppler.LogMessage) Arrays(java.util.Arrays) GetApplicationResponse(org.cloudfoundry.client.v2.applications.GetApplicationResponse) StepVerifier(reactor.test.StepVerifier) GetJobRequest(org.cloudfoundry.client.v2.jobs.GetJobRequest) SharedDomainEntity(org.cloudfoundry.client.v2.shareddomains.SharedDomainEntity) CancelTaskResponse(org.cloudfoundry.client.v3.tasks.CancelTaskResponse) OrderDirection(org.cloudfoundry.client.v2.OrderDirection) SpaceResource(org.cloudfoundry.client.v2.spaces.SpaceResource) LifecycleType(org.cloudfoundry.client.v3.LifecycleType) ApplicationEntity(org.cloudfoundry.client.v2.applications.ApplicationEntity) ListRoutesResponse(org.cloudfoundry.client.v2.routes.ListRoutesResponse) TestObjects.fill(org.cloudfoundry.operations.TestObjects.fill) Duration(java.time.Duration) Map(java.util.Map) ListApplicationsResponse(org.cloudfoundry.client.v3.applications.ListApplicationsResponse) GetSpaceSummaryResponse(org.cloudfoundry.client.v2.spaces.GetSpaceSummaryResponse) Path(java.nio.file.Path) GetStackRequest(org.cloudfoundry.client.v2.stacks.GetStackRequest) PrivateDomainEntity(org.cloudfoundry.client.v2.privatedomains.PrivateDomainEntity) SharedDomainResource(org.cloudfoundry.client.v2.shareddomains.SharedDomainResource) SpaceApplicationSummary(org.cloudfoundry.client.v2.spaces.SpaceApplicationSummary) Envelope(org.cloudfoundry.doppler.Envelope) UpdateApplicationRequest(org.cloudfoundry.client.v2.applications.UpdateApplicationRequest) PrivateDomainResource(org.cloudfoundry.client.v2.privatedomains.PrivateDomainResource) ListEventsResponse(org.cloudfoundry.client.v2.events.ListEventsResponse) CloudFoundryClient(org.cloudfoundry.client.CloudFoundryClient) RETURNS_SMART_NULLS(org.mockito.Mockito.RETURNS_SMART_NULLS) CancelTaskRequest(org.cloudfoundry.client.v3.tasks.CancelTaskRequest) DopplerClient(org.cloudfoundry.doppler.DopplerClient) Mockito.mock(org.mockito.Mockito.mock) RouteEntity(org.cloudfoundry.client.v2.routes.RouteEntity) RecentLogsRequest(org.cloudfoundry.doppler.RecentLogsRequest) CreateRouteResponse(org.cloudfoundry.client.v2.routes.CreateRouteResponse) ListApplicationsRequest(org.cloudfoundry.client.v3.applications.ListApplicationsRequest) TaskResource(org.cloudfoundry.client.v3.tasks.TaskResource) GetSpaceRequest(org.cloudfoundry.client.v2.spaces.GetSpaceRequest) Supplier(java.util.function.Supplier) AssociateApplicationRouteRequest(org.cloudfoundry.client.v2.applications.AssociateApplicationRouteRequest) ListOrganizationSpacesRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationSpacesRequest) Lifecycle(org.cloudfoundry.client.v3.Lifecycle) Resource(org.cloudfoundry.client.v2.resourcematch.Resource) ListOrganizationPrivateDomainsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationPrivateDomainsResponse) Statistics(org.cloudfoundry.client.v2.applications.Statistics) ApplicationInstanceInfo(org.cloudfoundry.client.v2.applications.ApplicationInstanceInfo) RemoveApplicationRouteRequest(org.cloudfoundry.client.v2.applications.RemoveApplicationRouteRequest) ErrorDetails(org.cloudfoundry.client.v2.jobs.ErrorDetails) VirtualTimeScheduler(reactor.test.scheduler.VirtualTimeScheduler) ApplicationStatisticsResponse(org.cloudfoundry.client.v2.applications.ApplicationStatisticsResponse) ListApplicationServiceBindingsRequest(org.cloudfoundry.client.v2.applications.ListApplicationServiceBindingsRequest) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) ApplicationStatisticsRequest(org.cloudfoundry.client.v2.applications.ApplicationStatisticsRequest) ListApplicationRoutesResponse(org.cloudfoundry.client.v2.applications.ListApplicationRoutesResponse) UpdateApplicationResponse(org.cloudfoundry.client.v2.applications.UpdateApplicationResponse) Flux(reactor.core.publisher.Flux) InstanceStatistics(org.cloudfoundry.client.v2.applications.InstanceStatistics) EventEntity(org.cloudfoundry.client.v2.events.EventEntity) FluentMap(org.cloudfoundry.util.FluentMap) OrganizationResource(org.cloudfoundry.client.v2.organizations.OrganizationResource) ListEventsRequest(org.cloudfoundry.client.v2.events.ListEventsRequest) OrganizationEntity(org.cloudfoundry.client.v2.organizations.OrganizationEntity) GetSharedDomainRequest(org.cloudfoundry.client.v2.shareddomains.GetSharedDomainRequest) BuildpackData(org.cloudfoundry.client.v3.BuildpackData) StreamRequest(org.cloudfoundry.doppler.StreamRequest) ListSharedDomainsResponse(org.cloudfoundry.client.v2.shareddomains.ListSharedDomainsResponse) Date(java.util.Date) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ListSpaceApplicationsResponse(org.cloudfoundry.client.v2.spaces.ListSpaceApplicationsResponse) SpaceEntity(org.cloudfoundry.client.v2.spaces.SpaceEntity) EventResource(org.cloudfoundry.client.v2.events.EventResource) AbstractOperationsTest(org.cloudfoundry.operations.AbstractOperationsTest) ApplicationEnvironmentResponse(org.cloudfoundry.client.v2.applications.ApplicationEnvironmentResponse) UploadApplicationRequest(org.cloudfoundry.client.v2.applications.UploadApplicationRequest) GetSpaceSummaryRequest(org.cloudfoundry.client.v2.spaces.GetSpaceSummaryRequest) GetSharedDomainResponse(org.cloudfoundry.client.v2.shareddomains.GetSharedDomainResponse) TerminateApplicationInstanceRequest(org.cloudfoundry.client.v2.applications.TerminateApplicationInstanceRequest) ListApplicationRoutesRequest(org.cloudfoundry.client.v2.applications.ListApplicationRoutesRequest) ListSpaceApplicationsRequest(org.cloudfoundry.client.v2.spaces.ListSpaceApplicationsRequest) Collection(java.util.Collection) UploadApplicationResponse(org.cloudfoundry.client.v2.applications.UploadApplicationResponse) ListOrganizationsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse) ResourceMatchingUtils(org.cloudfoundry.util.ResourceMatchingUtils) JobEntity(org.cloudfoundry.client.v2.jobs.JobEntity) CreateApplicationResponse(org.cloudfoundry.client.v2.applications.CreateApplicationResponse) SummaryApplicationRequest(org.cloudfoundry.client.v2.applications.SummaryApplicationRequest) ServiceBindingResource(org.cloudfoundry.client.v2.servicebindings.ServiceBindingResource) CreateRouteRequest(org.cloudfoundry.client.v2.routes.CreateRouteRequest) Optional(java.util.Optional) ListOrganizationPrivateDomainsRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationPrivateDomainsRequest) RouteResource(org.cloudfoundry.client.v2.routes.RouteResource) Queue(java.util.Queue) EventType(org.cloudfoundry.doppler.EventType) ListStacksRequest(org.cloudfoundry.client.v2.stacks.ListStacksRequest) GetJobResponse(org.cloudfoundry.client.v2.jobs.GetJobResponse) Usage(org.cloudfoundry.client.v2.applications.Usage) ClassPathResource(org.springframework.core.io.ClassPathResource) RestageApplicationResponse(org.cloudfoundry.client.v2.applications.RestageApplicationResponse) DeleteRouteResponse(org.cloudfoundry.client.v2.routes.DeleteRouteResponse) CreateTaskResponse(org.cloudfoundry.client.v3.tasks.CreateTaskResponse) CopyApplicationResponse(org.cloudfoundry.client.v2.applications.CopyApplicationResponse) ListStacksResponse(org.cloudfoundry.client.v2.stacks.ListStacksResponse) ListOrganizationsRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationsRequest) ApplicationResource(org.cloudfoundry.client.v2.applications.ApplicationResource) CopyApplicationRequest(org.cloudfoundry.client.v2.applications.CopyApplicationRequest) ListRoutesRequest(org.cloudfoundry.client.v2.routes.ListRoutesRequest) ListOrganizationSpacesResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationSpacesResponse) LinkedList(java.util.LinkedList) ListMatchingResourcesResponse(org.cloudfoundry.client.v2.resourcematch.ListMatchingResourcesResponse) GetStackResponse(org.cloudfoundry.client.v2.stacks.GetStackResponse) ApplicationEnvironmentRequest(org.cloudfoundry.client.v2.applications.ApplicationEnvironmentRequest) ListMatchingResourcesRequest(org.cloudfoundry.client.v2.resourcematch.ListMatchingResourcesRequest) CreateTaskRequest(org.cloudfoundry.client.v3.tasks.CreateTaskRequest) Mockito.when(org.mockito.Mockito.when) ListApplicationServiceBindingsResponse(org.cloudfoundry.client.v2.applications.ListApplicationServiceBindingsResponse) ServiceInstance(org.cloudfoundry.client.v2.serviceinstances.ServiceInstance) GetSpaceResponse(org.cloudfoundry.client.v2.spaces.GetSpaceResponse) ListSharedDomainsRequest(org.cloudfoundry.client.v2.shareddomains.ListSharedDomainsRequest) DateUtils(org.cloudfoundry.util.DateUtils) ApplicationInstancesResponse(org.cloudfoundry.client.v2.applications.ApplicationInstancesResponse) ApplicationState(org.cloudfoundry.client.v3.applications.ApplicationState) ClientV2Exception(org.cloudfoundry.client.v2.ClientV2Exception) StackEntity(org.cloudfoundry.client.v2.stacks.StackEntity) CreateApplicationRequest(org.cloudfoundry.client.v2.applications.CreateApplicationRequest) Metadata(org.cloudfoundry.client.v2.Metadata) RemoveApplicationServiceBindingRequest(org.cloudfoundry.client.v2.applications.RemoveApplicationServiceBindingRequest) Collections(java.util.Collections) ApplicationInstancesRequest(org.cloudfoundry.client.v2.applications.ApplicationInstancesRequest) SummaryApplicationResponse(org.cloudfoundry.client.v2.applications.SummaryApplicationResponse) StepVerifier(reactor.test.StepVerifier) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test) AbstractOperationsTest(org.cloudfoundry.operations.AbstractOperationsTest)

Example 59 with StepVerifier

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));
}
Also used : Path(java.nio.file.Path) LogMessage(org.cloudfoundry.doppler.LogMessage) Arrays(java.util.Arrays) GetApplicationResponse(org.cloudfoundry.client.v2.applications.GetApplicationResponse) StepVerifier(reactor.test.StepVerifier) GetJobRequest(org.cloudfoundry.client.v2.jobs.GetJobRequest) SharedDomainEntity(org.cloudfoundry.client.v2.shareddomains.SharedDomainEntity) CancelTaskResponse(org.cloudfoundry.client.v3.tasks.CancelTaskResponse) OrderDirection(org.cloudfoundry.client.v2.OrderDirection) SpaceResource(org.cloudfoundry.client.v2.spaces.SpaceResource) LifecycleType(org.cloudfoundry.client.v3.LifecycleType) ApplicationEntity(org.cloudfoundry.client.v2.applications.ApplicationEntity) ListRoutesResponse(org.cloudfoundry.client.v2.routes.ListRoutesResponse) TestObjects.fill(org.cloudfoundry.operations.TestObjects.fill) Duration(java.time.Duration) Map(java.util.Map) ListApplicationsResponse(org.cloudfoundry.client.v3.applications.ListApplicationsResponse) GetSpaceSummaryResponse(org.cloudfoundry.client.v2.spaces.GetSpaceSummaryResponse) Path(java.nio.file.Path) GetStackRequest(org.cloudfoundry.client.v2.stacks.GetStackRequest) PrivateDomainEntity(org.cloudfoundry.client.v2.privatedomains.PrivateDomainEntity) SharedDomainResource(org.cloudfoundry.client.v2.shareddomains.SharedDomainResource) SpaceApplicationSummary(org.cloudfoundry.client.v2.spaces.SpaceApplicationSummary) Envelope(org.cloudfoundry.doppler.Envelope) UpdateApplicationRequest(org.cloudfoundry.client.v2.applications.UpdateApplicationRequest) PrivateDomainResource(org.cloudfoundry.client.v2.privatedomains.PrivateDomainResource) ListEventsResponse(org.cloudfoundry.client.v2.events.ListEventsResponse) CloudFoundryClient(org.cloudfoundry.client.CloudFoundryClient) RETURNS_SMART_NULLS(org.mockito.Mockito.RETURNS_SMART_NULLS) CancelTaskRequest(org.cloudfoundry.client.v3.tasks.CancelTaskRequest) DopplerClient(org.cloudfoundry.doppler.DopplerClient) Mockito.mock(org.mockito.Mockito.mock) RouteEntity(org.cloudfoundry.client.v2.routes.RouteEntity) RecentLogsRequest(org.cloudfoundry.doppler.RecentLogsRequest) CreateRouteResponse(org.cloudfoundry.client.v2.routes.CreateRouteResponse) ListApplicationsRequest(org.cloudfoundry.client.v3.applications.ListApplicationsRequest) TaskResource(org.cloudfoundry.client.v3.tasks.TaskResource) GetSpaceRequest(org.cloudfoundry.client.v2.spaces.GetSpaceRequest) Supplier(java.util.function.Supplier) AssociateApplicationRouteRequest(org.cloudfoundry.client.v2.applications.AssociateApplicationRouteRequest) ListOrganizationSpacesRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationSpacesRequest) Lifecycle(org.cloudfoundry.client.v3.Lifecycle) Resource(org.cloudfoundry.client.v2.resourcematch.Resource) ListOrganizationPrivateDomainsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationPrivateDomainsResponse) Statistics(org.cloudfoundry.client.v2.applications.Statistics) ApplicationInstanceInfo(org.cloudfoundry.client.v2.applications.ApplicationInstanceInfo) RemoveApplicationRouteRequest(org.cloudfoundry.client.v2.applications.RemoveApplicationRouteRequest) ErrorDetails(org.cloudfoundry.client.v2.jobs.ErrorDetails) VirtualTimeScheduler(reactor.test.scheduler.VirtualTimeScheduler) ApplicationStatisticsResponse(org.cloudfoundry.client.v2.applications.ApplicationStatisticsResponse) ListApplicationServiceBindingsRequest(org.cloudfoundry.client.v2.applications.ListApplicationServiceBindingsRequest) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) ApplicationStatisticsRequest(org.cloudfoundry.client.v2.applications.ApplicationStatisticsRequest) ListApplicationRoutesResponse(org.cloudfoundry.client.v2.applications.ListApplicationRoutesResponse) UpdateApplicationResponse(org.cloudfoundry.client.v2.applications.UpdateApplicationResponse) Flux(reactor.core.publisher.Flux) InstanceStatistics(org.cloudfoundry.client.v2.applications.InstanceStatistics) EventEntity(org.cloudfoundry.client.v2.events.EventEntity) FluentMap(org.cloudfoundry.util.FluentMap) OrganizationResource(org.cloudfoundry.client.v2.organizations.OrganizationResource) ListEventsRequest(org.cloudfoundry.client.v2.events.ListEventsRequest) OrganizationEntity(org.cloudfoundry.client.v2.organizations.OrganizationEntity) GetSharedDomainRequest(org.cloudfoundry.client.v2.shareddomains.GetSharedDomainRequest) BuildpackData(org.cloudfoundry.client.v3.BuildpackData) StreamRequest(org.cloudfoundry.doppler.StreamRequest) ListSharedDomainsResponse(org.cloudfoundry.client.v2.shareddomains.ListSharedDomainsResponse) Date(java.util.Date) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ListSpaceApplicationsResponse(org.cloudfoundry.client.v2.spaces.ListSpaceApplicationsResponse) SpaceEntity(org.cloudfoundry.client.v2.spaces.SpaceEntity) EventResource(org.cloudfoundry.client.v2.events.EventResource) AbstractOperationsTest(org.cloudfoundry.operations.AbstractOperationsTest) ApplicationEnvironmentResponse(org.cloudfoundry.client.v2.applications.ApplicationEnvironmentResponse) UploadApplicationRequest(org.cloudfoundry.client.v2.applications.UploadApplicationRequest) GetSpaceSummaryRequest(org.cloudfoundry.client.v2.spaces.GetSpaceSummaryRequest) GetSharedDomainResponse(org.cloudfoundry.client.v2.shareddomains.GetSharedDomainResponse) TerminateApplicationInstanceRequest(org.cloudfoundry.client.v2.applications.TerminateApplicationInstanceRequest) ListApplicationRoutesRequest(org.cloudfoundry.client.v2.applications.ListApplicationRoutesRequest) ListSpaceApplicationsRequest(org.cloudfoundry.client.v2.spaces.ListSpaceApplicationsRequest) Collection(java.util.Collection) UploadApplicationResponse(org.cloudfoundry.client.v2.applications.UploadApplicationResponse) ListOrganizationsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse) ResourceMatchingUtils(org.cloudfoundry.util.ResourceMatchingUtils) JobEntity(org.cloudfoundry.client.v2.jobs.JobEntity) CreateApplicationResponse(org.cloudfoundry.client.v2.applications.CreateApplicationResponse) SummaryApplicationRequest(org.cloudfoundry.client.v2.applications.SummaryApplicationRequest) ServiceBindingResource(org.cloudfoundry.client.v2.servicebindings.ServiceBindingResource) CreateRouteRequest(org.cloudfoundry.client.v2.routes.CreateRouteRequest) Optional(java.util.Optional) ListOrganizationPrivateDomainsRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationPrivateDomainsRequest) RouteResource(org.cloudfoundry.client.v2.routes.RouteResource) Queue(java.util.Queue) EventType(org.cloudfoundry.doppler.EventType) ListStacksRequest(org.cloudfoundry.client.v2.stacks.ListStacksRequest) GetJobResponse(org.cloudfoundry.client.v2.jobs.GetJobResponse) Usage(org.cloudfoundry.client.v2.applications.Usage) ClassPathResource(org.springframework.core.io.ClassPathResource) RestageApplicationResponse(org.cloudfoundry.client.v2.applications.RestageApplicationResponse) DeleteRouteResponse(org.cloudfoundry.client.v2.routes.DeleteRouteResponse) CreateTaskResponse(org.cloudfoundry.client.v3.tasks.CreateTaskResponse) CopyApplicationResponse(org.cloudfoundry.client.v2.applications.CopyApplicationResponse) ListStacksResponse(org.cloudfoundry.client.v2.stacks.ListStacksResponse) ListOrganizationsRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationsRequest) ApplicationResource(org.cloudfoundry.client.v2.applications.ApplicationResource) CopyApplicationRequest(org.cloudfoundry.client.v2.applications.CopyApplicationRequest) ListRoutesRequest(org.cloudfoundry.client.v2.routes.ListRoutesRequest) ListOrganizationSpacesResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationSpacesResponse) LinkedList(java.util.LinkedList) ListMatchingResourcesResponse(org.cloudfoundry.client.v2.resourcematch.ListMatchingResourcesResponse) GetStackResponse(org.cloudfoundry.client.v2.stacks.GetStackResponse) ApplicationEnvironmentRequest(org.cloudfoundry.client.v2.applications.ApplicationEnvironmentRequest) ListMatchingResourcesRequest(org.cloudfoundry.client.v2.resourcematch.ListMatchingResourcesRequest) CreateTaskRequest(org.cloudfoundry.client.v3.tasks.CreateTaskRequest) Mockito.when(org.mockito.Mockito.when) ListApplicationServiceBindingsResponse(org.cloudfoundry.client.v2.applications.ListApplicationServiceBindingsResponse) ServiceInstance(org.cloudfoundry.client.v2.serviceinstances.ServiceInstance) GetSpaceResponse(org.cloudfoundry.client.v2.spaces.GetSpaceResponse) ListSharedDomainsRequest(org.cloudfoundry.client.v2.shareddomains.ListSharedDomainsRequest) DateUtils(org.cloudfoundry.util.DateUtils) ApplicationInstancesResponse(org.cloudfoundry.client.v2.applications.ApplicationInstancesResponse) ApplicationState(org.cloudfoundry.client.v3.applications.ApplicationState) ClientV2Exception(org.cloudfoundry.client.v2.ClientV2Exception) StackEntity(org.cloudfoundry.client.v2.stacks.StackEntity) CreateApplicationRequest(org.cloudfoundry.client.v2.applications.CreateApplicationRequest) Metadata(org.cloudfoundry.client.v2.Metadata) RemoveApplicationServiceBindingRequest(org.cloudfoundry.client.v2.applications.RemoveApplicationServiceBindingRequest) Collections(java.util.Collections) ApplicationInstancesRequest(org.cloudfoundry.client.v2.applications.ApplicationInstancesRequest) SummaryApplicationResponse(org.cloudfoundry.client.v2.applications.SummaryApplicationResponse) StepVerifier(reactor.test.StepVerifier) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test) AbstractOperationsTest(org.cloudfoundry.operations.AbstractOperationsTest)

Example 60 with StepVerifier

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));
}
Also used : Path(java.nio.file.Path) LogMessage(org.cloudfoundry.doppler.LogMessage) Arrays(java.util.Arrays) GetApplicationResponse(org.cloudfoundry.client.v2.applications.GetApplicationResponse) StepVerifier(reactor.test.StepVerifier) GetJobRequest(org.cloudfoundry.client.v2.jobs.GetJobRequest) SharedDomainEntity(org.cloudfoundry.client.v2.shareddomains.SharedDomainEntity) CancelTaskResponse(org.cloudfoundry.client.v3.tasks.CancelTaskResponse) OrderDirection(org.cloudfoundry.client.v2.OrderDirection) SpaceResource(org.cloudfoundry.client.v2.spaces.SpaceResource) LifecycleType(org.cloudfoundry.client.v3.LifecycleType) ApplicationEntity(org.cloudfoundry.client.v2.applications.ApplicationEntity) ListRoutesResponse(org.cloudfoundry.client.v2.routes.ListRoutesResponse) TestObjects.fill(org.cloudfoundry.operations.TestObjects.fill) Duration(java.time.Duration) Map(java.util.Map) ListApplicationsResponse(org.cloudfoundry.client.v3.applications.ListApplicationsResponse) GetSpaceSummaryResponse(org.cloudfoundry.client.v2.spaces.GetSpaceSummaryResponse) Path(java.nio.file.Path) GetStackRequest(org.cloudfoundry.client.v2.stacks.GetStackRequest) PrivateDomainEntity(org.cloudfoundry.client.v2.privatedomains.PrivateDomainEntity) SharedDomainResource(org.cloudfoundry.client.v2.shareddomains.SharedDomainResource) SpaceApplicationSummary(org.cloudfoundry.client.v2.spaces.SpaceApplicationSummary) Envelope(org.cloudfoundry.doppler.Envelope) UpdateApplicationRequest(org.cloudfoundry.client.v2.applications.UpdateApplicationRequest) PrivateDomainResource(org.cloudfoundry.client.v2.privatedomains.PrivateDomainResource) ListEventsResponse(org.cloudfoundry.client.v2.events.ListEventsResponse) CloudFoundryClient(org.cloudfoundry.client.CloudFoundryClient) RETURNS_SMART_NULLS(org.mockito.Mockito.RETURNS_SMART_NULLS) CancelTaskRequest(org.cloudfoundry.client.v3.tasks.CancelTaskRequest) DopplerClient(org.cloudfoundry.doppler.DopplerClient) Mockito.mock(org.mockito.Mockito.mock) RouteEntity(org.cloudfoundry.client.v2.routes.RouteEntity) RecentLogsRequest(org.cloudfoundry.doppler.RecentLogsRequest) CreateRouteResponse(org.cloudfoundry.client.v2.routes.CreateRouteResponse) ListApplicationsRequest(org.cloudfoundry.client.v3.applications.ListApplicationsRequest) TaskResource(org.cloudfoundry.client.v3.tasks.TaskResource) GetSpaceRequest(org.cloudfoundry.client.v2.spaces.GetSpaceRequest) Supplier(java.util.function.Supplier) AssociateApplicationRouteRequest(org.cloudfoundry.client.v2.applications.AssociateApplicationRouteRequest) ListOrganizationSpacesRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationSpacesRequest) Lifecycle(org.cloudfoundry.client.v3.Lifecycle) Resource(org.cloudfoundry.client.v2.resourcematch.Resource) ListOrganizationPrivateDomainsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationPrivateDomainsResponse) Statistics(org.cloudfoundry.client.v2.applications.Statistics) ApplicationInstanceInfo(org.cloudfoundry.client.v2.applications.ApplicationInstanceInfo) RemoveApplicationRouteRequest(org.cloudfoundry.client.v2.applications.RemoveApplicationRouteRequest) ErrorDetails(org.cloudfoundry.client.v2.jobs.ErrorDetails) VirtualTimeScheduler(reactor.test.scheduler.VirtualTimeScheduler) ApplicationStatisticsResponse(org.cloudfoundry.client.v2.applications.ApplicationStatisticsResponse) ListApplicationServiceBindingsRequest(org.cloudfoundry.client.v2.applications.ListApplicationServiceBindingsRequest) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) IOException(java.io.IOException) ApplicationStatisticsRequest(org.cloudfoundry.client.v2.applications.ApplicationStatisticsRequest) ListApplicationRoutesResponse(org.cloudfoundry.client.v2.applications.ListApplicationRoutesResponse) UpdateApplicationResponse(org.cloudfoundry.client.v2.applications.UpdateApplicationResponse) Flux(reactor.core.publisher.Flux) InstanceStatistics(org.cloudfoundry.client.v2.applications.InstanceStatistics) EventEntity(org.cloudfoundry.client.v2.events.EventEntity) FluentMap(org.cloudfoundry.util.FluentMap) OrganizationResource(org.cloudfoundry.client.v2.organizations.OrganizationResource) ListEventsRequest(org.cloudfoundry.client.v2.events.ListEventsRequest) OrganizationEntity(org.cloudfoundry.client.v2.organizations.OrganizationEntity) GetSharedDomainRequest(org.cloudfoundry.client.v2.shareddomains.GetSharedDomainRequest) BuildpackData(org.cloudfoundry.client.v3.BuildpackData) StreamRequest(org.cloudfoundry.doppler.StreamRequest) ListSharedDomainsResponse(org.cloudfoundry.client.v2.shareddomains.ListSharedDomainsResponse) Date(java.util.Date) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ListSpaceApplicationsResponse(org.cloudfoundry.client.v2.spaces.ListSpaceApplicationsResponse) SpaceEntity(org.cloudfoundry.client.v2.spaces.SpaceEntity) EventResource(org.cloudfoundry.client.v2.events.EventResource) AbstractOperationsTest(org.cloudfoundry.operations.AbstractOperationsTest) ApplicationEnvironmentResponse(org.cloudfoundry.client.v2.applications.ApplicationEnvironmentResponse) UploadApplicationRequest(org.cloudfoundry.client.v2.applications.UploadApplicationRequest) GetSpaceSummaryRequest(org.cloudfoundry.client.v2.spaces.GetSpaceSummaryRequest) GetSharedDomainResponse(org.cloudfoundry.client.v2.shareddomains.GetSharedDomainResponse) TerminateApplicationInstanceRequest(org.cloudfoundry.client.v2.applications.TerminateApplicationInstanceRequest) ListApplicationRoutesRequest(org.cloudfoundry.client.v2.applications.ListApplicationRoutesRequest) ListSpaceApplicationsRequest(org.cloudfoundry.client.v2.spaces.ListSpaceApplicationsRequest) Collection(java.util.Collection) UploadApplicationResponse(org.cloudfoundry.client.v2.applications.UploadApplicationResponse) ListOrganizationsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse) ResourceMatchingUtils(org.cloudfoundry.util.ResourceMatchingUtils) JobEntity(org.cloudfoundry.client.v2.jobs.JobEntity) CreateApplicationResponse(org.cloudfoundry.client.v2.applications.CreateApplicationResponse) SummaryApplicationRequest(org.cloudfoundry.client.v2.applications.SummaryApplicationRequest) ServiceBindingResource(org.cloudfoundry.client.v2.servicebindings.ServiceBindingResource) CreateRouteRequest(org.cloudfoundry.client.v2.routes.CreateRouteRequest) Optional(java.util.Optional) ListOrganizationPrivateDomainsRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationPrivateDomainsRequest) RouteResource(org.cloudfoundry.client.v2.routes.RouteResource) Queue(java.util.Queue) EventType(org.cloudfoundry.doppler.EventType) ListStacksRequest(org.cloudfoundry.client.v2.stacks.ListStacksRequest) GetJobResponse(org.cloudfoundry.client.v2.jobs.GetJobResponse) Usage(org.cloudfoundry.client.v2.applications.Usage) ClassPathResource(org.springframework.core.io.ClassPathResource) RestageApplicationResponse(org.cloudfoundry.client.v2.applications.RestageApplicationResponse) DeleteRouteResponse(org.cloudfoundry.client.v2.routes.DeleteRouteResponse) CreateTaskResponse(org.cloudfoundry.client.v3.tasks.CreateTaskResponse) CopyApplicationResponse(org.cloudfoundry.client.v2.applications.CopyApplicationResponse) ListStacksResponse(org.cloudfoundry.client.v2.stacks.ListStacksResponse) ListOrganizationsRequest(org.cloudfoundry.client.v2.organizations.ListOrganizationsRequest) ApplicationResource(org.cloudfoundry.client.v2.applications.ApplicationResource) CopyApplicationRequest(org.cloudfoundry.client.v2.applications.CopyApplicationRequest) ListRoutesRequest(org.cloudfoundry.client.v2.routes.ListRoutesRequest) ListOrganizationSpacesResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationSpacesResponse) LinkedList(java.util.LinkedList) ListMatchingResourcesResponse(org.cloudfoundry.client.v2.resourcematch.ListMatchingResourcesResponse) GetStackResponse(org.cloudfoundry.client.v2.stacks.GetStackResponse) ApplicationEnvironmentRequest(org.cloudfoundry.client.v2.applications.ApplicationEnvironmentRequest) ListMatchingResourcesRequest(org.cloudfoundry.client.v2.resourcematch.ListMatchingResourcesRequest) CreateTaskRequest(org.cloudfoundry.client.v3.tasks.CreateTaskRequest) Mockito.when(org.mockito.Mockito.when) ListApplicationServiceBindingsResponse(org.cloudfoundry.client.v2.applications.ListApplicationServiceBindingsResponse) ServiceInstance(org.cloudfoundry.client.v2.serviceinstances.ServiceInstance) GetSpaceResponse(org.cloudfoundry.client.v2.spaces.GetSpaceResponse) ListSharedDomainsRequest(org.cloudfoundry.client.v2.shareddomains.ListSharedDomainsRequest) DateUtils(org.cloudfoundry.util.DateUtils) ApplicationInstancesResponse(org.cloudfoundry.client.v2.applications.ApplicationInstancesResponse) ApplicationState(org.cloudfoundry.client.v3.applications.ApplicationState) ClientV2Exception(org.cloudfoundry.client.v2.ClientV2Exception) StackEntity(org.cloudfoundry.client.v2.stacks.StackEntity) CreateApplicationRequest(org.cloudfoundry.client.v2.applications.CreateApplicationRequest) Metadata(org.cloudfoundry.client.v2.Metadata) RemoveApplicationServiceBindingRequest(org.cloudfoundry.client.v2.applications.RemoveApplicationServiceBindingRequest) Collections(java.util.Collections) ApplicationInstancesRequest(org.cloudfoundry.client.v2.applications.ApplicationInstancesRequest) SummaryApplicationResponse(org.cloudfoundry.client.v2.applications.SummaryApplicationResponse) StepVerifier(reactor.test.StepVerifier) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test) AbstractOperationsTest(org.cloudfoundry.operations.AbstractOperationsTest)

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