Search in sources :

Example 1 with Spaces

use of org.cloudfoundry.client.v2.spaces.Spaces in project cf-java-client by cloudfoundry.

the class PaginationUtilsTest method requestClientV2Resources.

@Test
public void requestClientV2Resources() {
    Spaces spaces = mock(Spaces.class, RETURNS_SMART_NULLS);
    requestListSpaces(spaces, 1, 3);
    requestListSpaces(spaces, 2, 3);
    requestListSpaces(spaces, 3, 3);
    PaginationUtils.requestClientV2Resources(page -> spaces.list(ListSpacesRequest.builder().page(page).build())).as(StepVerifier::create).expectNextCount(3).expectComplete().verify(Duration.ofSeconds(1));
}
Also used : Spaces(org.cloudfoundry.client.v2.spaces.Spaces) Test(org.junit.Test)

Example 2 with Spaces

use of org.cloudfoundry.client.v2.spaces.Spaces in project cf-java-client by cloudfoundry.

the class PaginationUtilsTest method requestClientV2ResourcesEmpty.

@Test
public void requestClientV2ResourcesEmpty() {
    Spaces spaces = mock(Spaces.class, RETURNS_SMART_NULLS);
    requestListSpacesEmpty(spaces);
    PaginationUtils.requestClientV2Resources(page -> spaces.list(ListSpacesRequest.builder().page(page).build())).as(StepVerifier::create).expectComplete().verify(Duration.ofSeconds(1));
}
Also used : ListPackagesResponse(org.cloudfoundry.client.v3.packages.ListPackagesResponse) StepVerifier(reactor.test.StepVerifier) ListSpacesRequest(org.cloudfoundry.client.v2.spaces.ListSpacesRequest) TimeoutException(java.util.concurrent.TimeoutException) SpaceEntity(org.cloudfoundry.client.v2.spaces.SpaceEntity) BitsData(org.cloudfoundry.client.v3.packages.BitsData) ListUsersRequest(org.cloudfoundry.uaa.users.ListUsersRequest) Spaces(org.cloudfoundry.client.v2.spaces.Spaces) ListPackagesRequest(org.cloudfoundry.client.v3.packages.ListPackagesRequest) SpaceResource(org.cloudfoundry.client.v2.spaces.SpaceResource) PackageResource(org.cloudfoundry.client.v3.packages.PackageResource) Duration(java.time.Duration) User(org.cloudfoundry.uaa.users.User) Name(org.cloudfoundry.uaa.users.Name) Packages(org.cloudfoundry.client.v3.packages.Packages) ListUsersResponse(org.cloudfoundry.uaa.users.ListUsersResponse) Test(org.junit.Test) Mono(reactor.core.publisher.Mono) Meta(org.cloudfoundry.uaa.users.Meta) Mockito.when(org.mockito.Mockito.when) ListSpacesResponse(org.cloudfoundry.client.v2.spaces.ListSpacesResponse) Users(org.cloudfoundry.uaa.users.Users) RETURNS_SMART_NULLS(org.mockito.Mockito.RETURNS_SMART_NULLS) PackageType(org.cloudfoundry.client.v3.packages.PackageType) Pagination(org.cloudfoundry.client.v3.Pagination) PackageState(org.cloudfoundry.client.v3.packages.PackageState) Collections(java.util.Collections) Mockito.mock(org.mockito.Mockito.mock) Spaces(org.cloudfoundry.client.v2.spaces.Spaces) StepVerifier(reactor.test.StepVerifier) Test(org.junit.Test)

Aggregations

Spaces (org.cloudfoundry.client.v2.spaces.Spaces)2 Test (org.junit.Test)2 Duration (java.time.Duration)1 Collections (java.util.Collections)1 TimeoutException (java.util.concurrent.TimeoutException)1 ListSpacesRequest (org.cloudfoundry.client.v2.spaces.ListSpacesRequest)1 ListSpacesResponse (org.cloudfoundry.client.v2.spaces.ListSpacesResponse)1 SpaceEntity (org.cloudfoundry.client.v2.spaces.SpaceEntity)1 SpaceResource (org.cloudfoundry.client.v2.spaces.SpaceResource)1 Pagination (org.cloudfoundry.client.v3.Pagination)1 BitsData (org.cloudfoundry.client.v3.packages.BitsData)1 ListPackagesRequest (org.cloudfoundry.client.v3.packages.ListPackagesRequest)1 ListPackagesResponse (org.cloudfoundry.client.v3.packages.ListPackagesResponse)1 PackageResource (org.cloudfoundry.client.v3.packages.PackageResource)1 PackageState (org.cloudfoundry.client.v3.packages.PackageState)1 PackageType (org.cloudfoundry.client.v3.packages.PackageType)1 Packages (org.cloudfoundry.client.v3.packages.Packages)1 ListUsersRequest (org.cloudfoundry.uaa.users.ListUsersRequest)1 ListUsersResponse (org.cloudfoundry.uaa.users.ListUsersResponse)1 Meta (org.cloudfoundry.uaa.users.Meta)1