@Test public void list() { mockRequest( InteractionContext.builder() .request( TestRequest.builder() .method(GET) .path( "/oauth/clients?count=10&filter=client_id%2Beq%2B%22EGgNW3%22&sortBy=client_id&sortOrder=descending&startIndex=1") .build()) .response( TestResponse.builder() .status(OK) .payload("fixtures/uaa/clients/GET_response.json") .build()) .build()); this.clients .list( ListClientsRequest.builder() .count(10) .filter("client_id+eq+\"EGgNW3\"") .sortBy("client_id") .sortOrder(SortOrder.DESCENDING) .startIndex(1) .build()) .as(StepVerifier::create) .expectNext( ListClientsResponse.builder() .resource( Client.builder() .allowedProvider("uaa", "ldap", "my-saml-provider") .authority("clients.read", "clients.write") .authorizedGrantType(CLIENT_CREDENTIALS) .autoApprove("true") .clientId("EGgNW3") .lastModified(1468364445334L) .name("My Client Name") .redirectUriPattern( "http*://ant.path.wildcard/**/passback/*", "http://test1.com") .resourceId("none") .scope("clients.read", "clients.write") .tokenSalt("7uDPJX") .build()) .startIndex(1) .itemsPerPage(1) .totalResults(1) .schema("http://cloudfoundry.org/schema/scim/oauth-clients-1.0") .build()) .expectComplete() .verify(Duration.ofSeconds(5)); }
@Test public void deserialize() { mockRequest( InteractionContext.builder() .request(TestRequest.builder().method(GET).path("/oauth/clients").build()) .response( TestResponse.builder() .status(OK) .payload("fixtures/uaa/clients/GET_response_deserialize.json") .build()) .build()); this.clients .list(ListClientsRequest.builder().build()) .as(StepVerifier::create) .expectNext( ListClientsResponse.builder() .resource( Client.builder() .action("none") .authority("uaa.none") .authorizedGrantType(AUTHORIZATION_CODE, REFRESH_TOKEN) .autoApprove("true") .clientId("ssh-proxy") .lastModified(1469112324000L) .redirectUriPattern("/login") .resourceId("none") .scope("openid", "cloud_controller.read", "cloud_controller.write") .build()) .resource( Client.builder() .action("none") .authority("routing.routes.write", "routing.routes.read") .authorizedGrantType(CLIENT_CREDENTIALS, REFRESH_TOKEN) .autoApprove("routing.routes.write", "routing.routes.read") .clientId("tcp_emitter") .lastModified(1469112324000L) .resourceId("none") .scope("uaa.none") .build()) .startIndex(1) .itemsPerPage(2) .totalResults(2) .schema("http://cloudfoundry.org/schema/scim/oauth-clients-1.0") .build()) .expectComplete() .verify(Duration.ofSeconds(5)); }