use of org.cloudfoundry.client.v2.domains.Domain in project promregator by promregator.
the class CFAccessorMock method retrieveSharedDomain.
@Override
public Mono<GetSharedDomainResponse> retrieveSharedDomain(String domainId) {
if (domainId.equals(UNITTEST_SHARED_DOMAIN_UUID)) {
SharedDomainEntity entity = SharedDomainEntity.builder().name(UNITTEST_SHARED_DOMAIN).build();
GetSharedDomainResponse resp = GetSharedDomainResponse.builder().entity(entity).build();
return Mono.just(resp);
}
Assert.fail("Invalid shared domain request");
return null;
}
use of org.cloudfoundry.client.v2.domains.Domain 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 org.cloudfoundry.client.v2.domains.Domain 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 org.cloudfoundry.client.v2.domains.Domain in project cf-java-client by cloudfoundry.
the class DefaultApplicationsTest method pushStartFailsRunning.
@Test
public void pushStartFailsRunning() 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).domain("test-shared-domain").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);
requestSharedDomains(this.cloudFoundryClient, "test-shared-domain", "test-shared-domain-id");
requestApplicationRoutes(this.cloudFoundryClient, "test-application-id", "test-route-id");
requestRoutesEmpty(this.cloudFoundryClient, "test-shared-domain-id", "test-name", null, null);
requestListMatchingResources(this.cloudFoundryClient, Arrays.asList(new ResourceMatchingUtils.ArtifactMetadata("da39a3ee5e6b4b0d3255bfef95601890afd80709", "Staticfile", "100644", 0), new ResourceMatchingUtils.ArtifactMetadata("45044a6ddbfe11415a8f8a6219de68a2c66b496b", "index.html", "100644", 178)));
requestCreateRoute(this.cloudFoundryClient, "test-shared-domain-id", "test-name", null, null, TEST_SPACE_ID, "test-route-id");
requestAssociateRoute(this.cloudFoundryClient, "test-application-id", "test-route-id");
requestUpload(this.cloudFoundryClient, "test-application-id", testApplication, "test-job-id");
requestJobSuccess(this.cloudFoundryClient, "test-job-entity-id");
requestUpdateApplicationState(this.cloudFoundryClient, "test-application-id", "STOPPED");
requestUpdateApplicationState(this.cloudFoundryClient, "test-application-id", "STARTED");
requestGetApplication(this.cloudFoundryClient, "test-application-id");
requestApplicationInstancesFailingTotal(this.cloudFoundryClient, "test-application-id");
StepVerifier.withVirtualTime(() -> this.applications.push(PushApplicationRequest.builder().path(testApplication).domain("test-shared-domain").name("test-name").build())).then(() -> VirtualTimeScheduler.get().advanceTimeBy(Duration.ofSeconds(3))).consumeErrorWith(t -> assertThat(t).isInstanceOf(IllegalStateException.class).hasMessage("Application test-name failed during start")).verify(Duration.ofSeconds(5));
}
use of org.cloudfoundry.client.v2.domains.Domain 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));
}
Aggregations