use of org.cloudfoundry.client.v2.routes.Route in project promregator by promregator.
the class CFAccessorSimulator method retrieveSpaceSummary.
@Override
public Mono<GetSpaceSummaryResponse> retrieveSpaceSummary(String spaceId) {
if (spaceId.equals(SPACE_UUID)) {
List<SpaceApplicationSummary> list = new LinkedList<>();
for (int i = 1; i <= 100; i++) {
Domain sharedDomain = Domain.builder().id(SHARED_DOMAIN_UUID + i).name(SHARED_DOMAIN).build();
final String[] urls = { APP_HOST_PREFIX + i + "." + SHARED_DOMAIN };
final Route[] routes = { Route.builder().domain(sharedDomain).host(APP_HOST_PREFIX + i).build() };
SpaceApplicationSummary sas = SpaceApplicationSummary.builder().id(APP_UUID_PREFIX + i).name("testapp" + i).addAllUrls(Arrays.asList(urls)).addAllRoutes(Arrays.asList(routes)).instances(this.amountInstances).state("STARTED").build();
list.add(sas);
}
GetSpaceSummaryResponse resp = GetSpaceSummaryResponse.builder().addAllApplications(list).build();
return Mono.just(resp).delayElement(this.getSleepRandomDuration());
}
log.error("Invalid retrieveSpaceSummary request");
return null;
}
use of org.cloudfoundry.client.v2.routes.Route in project promregator by promregator.
the class CFAccessorMassMock method retrieveSpaceSummary.
@Override
public Mono<GetSpaceSummaryResponse> retrieveSpaceSummary(String spaceId) {
if (spaceId.equals(UNITTEST_SPACE_UUID)) {
List<SpaceApplicationSummary> list = new LinkedList<>();
for (int i = 0; i < 100; i++) {
Domain sharedDomain = Domain.builder().id(UNITTEST_SHARED_DOMAIN_UUID + i).name(UNITTEST_SHARED_DOMAIN).build();
final String[] urls = { "hostapp" + i + "." + UNITTEST_SHARED_DOMAIN };
final Route[] routes = { Route.builder().domain(sharedDomain).host("hostapp" + i).build() };
SpaceApplicationSummary sas = SpaceApplicationSummary.builder().id(UNITTEST_APP_UUID_PREFIX + i).name("testapp" + i).addAllUrls(Arrays.asList(urls)).addAllRoutes(Arrays.asList(routes)).instances(this.amountInstances).build();
list.add(sas);
}
GetSpaceSummaryResponse resp = GetSpaceSummaryResponse.builder().addAllApplications(list).build();
return Mono.just(resp).delayElement(this.getSleepRandomDuration());
}
Assertions.fail("Invalid retrieveSpaceSummary request");
return null;
}
use of org.cloudfoundry.client.v2.routes.Route in project promregator by promregator.
the class CFAccessorMock method retrieveRouteMapping.
@Override
public Mono<ListRouteMappingsResponse> retrieveRouteMapping(String appId) {
RouteMappingEntity entity = null;
if (appId.equals(UNITTEST_APP1_UUID)) {
entity = RouteMappingEntity.builder().applicationId(appId).routeId(UNITTEST_APP1_ROUTE_UUID).build();
} else if (appId.equals(UNITTEST_APP2_UUID)) {
entity = RouteMappingEntity.builder().applicationId(appId).routeId(UNITTEST_APP2_ROUTE_UUID).build();
}
if (entity == null) {
Assert.fail("Invalid route mapping request");
return null;
}
RouteMappingResource rmr = null;
rmr = RouteMappingResource.builder().entity(entity).build();
List<RouteMappingResource> list = new LinkedList<>();
list.add(rmr);
ListRouteMappingsResponse resp = ListRouteMappingsResponse.builder().addAllResources(list).build();
return Mono.just(resp);
}
use of org.cloudfoundry.client.v2.routes.Route 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.routes.Route 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