use of org.cloudfoundry.client.v2.domains.Domain in project promregator by promregator.
the class CFAccessorSimulator method retrieveAllDomains.
@Override
public Mono<ListOrganizationDomainsResponse> retrieveAllDomains(String orgId) {
List<DomainResource> domains = new ArrayList<DomainResource>();
for (int i = 1; i <= 100; i++) {
DomainResource domain = DomainResource.builder().entity(DomainEntity.builder().name(SHARED_DOMAIN).internal(false).build()).metadata(Metadata.builder().id(SHARED_DOMAIN_UUID + i).createdAt(CREATED_AT_TIMESTAMP).build()).build();
domains.add(domain);
}
DomainResource domain = DomainResource.builder().entity(DomainEntity.builder().name(INTERNAL_DOMAIN).internal(true).build()).metadata(Metadata.builder().id(INTERNAL_DOMAIN_UUID).createdAt(CREATED_AT_TIMESTAMP).build()).build();
domains.add(domain);
ListOrganizationDomainsResponse response = ListOrganizationDomainsResponse.builder().addAllResources(domains).build();
return Mono.just(response);
}
use of org.cloudfoundry.client.v2.domains.Domain 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.domains.Domain in project promregator by promregator.
the class CFAccessorSimulatorTest method testRetrieveAllDomains.
@Test
void testRetrieveAllDomains() {
CFAccessorSimulator subject = new CFAccessorSimulator(2);
Mono<ListOrganizationDomainsResponse> mono = subject.retrieveAllDomains(CFAccessorSimulator.ORG_UUID);
ListOrganizationDomainsResponse result = mono.block();
Assertions.assertNotNull(result);
Assertions.assertNotNull(result.getResources());
Assertions.assertEquals(101, result.getResources().size());
for (int i = 0; i <= 99; i++) {
int domainSequenceId = i + 1;
DomainResource item = result.getResources().get(i);
Assertions.assertEquals(CFAccessorSimulator.SHARED_DOMAIN, item.getEntity().getName());
Assertions.assertFalse(item.getEntity().getInternal());
Assertions.assertTrue(item.getMetadata().getId().contains(CFAccessorSimulator.SHARED_DOMAIN_UUID + domainSequenceId));
}
// get the shared domain
DomainResource sharedDomain = result.getResources().get(100);
Assertions.assertTrue(sharedDomain.getEntity().getInternal());
Assertions.assertEquals(CFAccessorSimulator.INTERNAL_DOMAIN, sharedDomain.getEntity().getName());
}
use of org.cloudfoundry.client.v2.domains.Domain in project promregator by promregator.
the class CFAccessorMock method retrieveAllDomains.
@Override
public Mono<ListOrganizationDomainsResponse> retrieveAllDomains(String orgId) {
List<DomainResource> domains = new ArrayList<DomainResource>();
DomainResource domain = DomainResource.builder().entity(DomainEntity.builder().name(UNITTEST_INTERNAL_DOMAIN).internal(true).build()).metadata(Metadata.builder().id(UNITTEST_INTERNAL_DOMAIN_UUID).createdAt(CREATED_AT_TIMESTAMP).build()).build();
domains.add(domain);
domain = DomainResource.builder().entity(DomainEntity.builder().name(UNITTEST_SHARED_DOMAIN).internal(false).build()).metadata(Metadata.builder().id(UNITTEST_SHARED_DOMAIN_UUID).createdAt(CREATED_AT_TIMESTAMP).build()).build();
domains.add(domain);
domain = DomainResource.builder().entity(DomainEntity.builder().name(UNITTEST_ADDITIONAL_SHARED_DOMAIN).internal(false).build()).metadata(Metadata.builder().id(UNITTEST_ADDITIONAL_SHARED_DOMAIN_UUID).createdAt(CREATED_AT_TIMESTAMP).build()).build();
domains.add(domain);
ListOrganizationDomainsResponse response = ListOrganizationDomainsResponse.builder().addAllResources(domains).build();
return Mono.just(response);
}
use of org.cloudfoundry.client.v2.domains.Domain 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;
}
Aggregations