Search in sources :

Example 1 with ListOrganizationDomainsResponse

use of org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse 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);
}
Also used : DomainResource(org.cloudfoundry.client.v2.domains.DomainResource) ArrayList(java.util.ArrayList) ListOrganizationDomainsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse)

Example 2 with ListOrganizationDomainsResponse

use of org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse 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());
}
Also used : DomainResource(org.cloudfoundry.client.v2.domains.DomainResource) ListOrganizationDomainsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse) Test(org.junit.jupiter.api.Test)

Example 3 with ListOrganizationDomainsResponse

use of org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse 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);
}
Also used : DomainResource(org.cloudfoundry.client.v2.domains.DomainResource) ArrayList(java.util.ArrayList) ListOrganizationDomainsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse)

Example 4 with ListOrganizationDomainsResponse

use of org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse in project promregator by promregator.

the class CFAccessorMassMock method retrieveAllDomains.

@Override
public Mono<ListOrganizationDomainsResponse> retrieveAllDomains(String orgId) {
    List<DomainResource> domains = new ArrayList<DomainResource>();
    for (int i = 0; i < 100; i++) {
        DomainResource domain = DomainResource.builder().entity(DomainEntity.builder().name(UNITTEST_SHARED_DOMAIN).internal(false).build()).metadata(Metadata.builder().id(UNITTEST_SHARED_DOMAIN_UUID + i).createdAt(CREATED_AT_TIMESTAMP).build()).build();
        domains.add(domain);
    }
    ListOrganizationDomainsResponse response = ListOrganizationDomainsResponse.builder().addAllResources(domains).build();
    return Mono.just(response);
}
Also used : DomainResource(org.cloudfoundry.client.v2.domains.DomainResource) ArrayList(java.util.ArrayList) ListOrganizationDomainsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse)

Aggregations

DomainResource (org.cloudfoundry.client.v2.domains.DomainResource)4 ListOrganizationDomainsResponse (org.cloudfoundry.client.v2.organizations.ListOrganizationDomainsResponse)4 ArrayList (java.util.ArrayList)3 Test (org.junit.jupiter.api.Test)1