Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Request<UserAttributeProfile> get(String id) {
* @return a Request to execute
*
*/
public Request<ListUserAttributeProfile> getAll(UserAttributeProfilesFilter filter) {
public Request<UserAttributeProfilePage> getAll(UserAttributeProfilesFilter filter) {
HttpUrl.Builder builder = baseUrl.newBuilder()
.addPathSegments(ORGS_PATH);

Expand All @@ -53,7 +53,7 @@ public Request<ListUserAttributeProfile> getAll(UserAttributeProfilesFilter filt

String url = builder.build().toString();

return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<ListUserAttributeProfile>() {
return new BaseRequest<>(client, tokenProvider, url, HttpMethod.GET, new TypeReference<UserAttributeProfilePage>() {
});
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.auth0.json.mgmt.userAttributeProfiles;

import com.auth0.json.mgmt.Page;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import java.util.List;

@SuppressWarnings({"unused", "WeakerAccess"})
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonDeserialize(using = UserAttributeProfilePageDeserializer.class)
public class UserAttributeProfilePage extends Page<UserAttributeProfile> {
public UserAttributeProfilePage(List<UserAttributeProfile> items) {
super(items);
}

protected UserAttributeProfilePage(Integer start, Integer length, Integer total, Integer limit, List<UserAttributeProfile> items) {
super(start, length, total, limit, items);
}

protected UserAttributeProfilePage(Integer start, Integer length, Integer total, Integer limit, String next, List<UserAttributeProfile> items){
super(start, length, total, limit, next, items);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.auth0.json.mgmt.userAttributeProfiles;

import com.auth0.json.mgmt.PageDeserializer;

import java.util.List;


@SuppressWarnings({"unused", "WeakerAccess"})
class UserAttributeProfilePageDeserializer extends PageDeserializer<UserAttributeProfilePage, UserAttributeProfile> {
UserAttributeProfilePageDeserializer() {
super(UserAttributeProfile.class, "user_attribute_profiles");
}

@Override
protected UserAttributeProfilePage createPage(List<UserAttributeProfile> items) {
return new UserAttributeProfilePage(items);
}

@Override
protected UserAttributeProfilePage createPage(Integer start, Integer length, Integer total, Integer limit, List<UserAttributeProfile> items) {
return new UserAttributeProfilePage(start, length, total, limit, items);
}

@Override
protected UserAttributeProfilePage createPage(Integer start, Integer length, Integer total, Integer limit, String next, List<UserAttributeProfile> items) {
return new UserAttributeProfilePage(start, length, total, limit, next, items);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,41 +49,41 @@ public void shouldGetUserAttributeProfile() throws Exception {

@Test
public void shouldGetAllUserAttributeProfilesWithoutFilter() throws Exception {
Request<ListUserAttributeProfile> request = api.userAttributeProfiles().getAll(null);
Request<UserAttributeProfilePage> request = api.userAttributeProfiles().getAll(null);
assertThat(request, is(notNullValue()));

server.jsonResponse(MockServer.MGMT_USER_ATTRIBUTE_PROFILES_LIST, 200);
ListUserAttributeProfile response = request.execute().getBody();
UserAttributeProfilePage response = request.execute().getBody();
RecordedRequest recordedRequest = server.takeRequest();

assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/user-attribute-profiles"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));

assertThat(response, is(notNullValue()));
assertThat(response.getUserAttributeProfiles(), hasSize(3));
assertThat(response.getItems(), hasSize(3));
}

@Test
public void shouldGetAllUserAttributeProfilesWithFilter() throws Exception {
UserAttributeProfilesFilter filter = new UserAttributeProfilesFilter()
.withCheckpointPagination("uap_1234567890", 10);
.withCheckpointPagination("uap_1234567890", 2);

Request<ListUserAttributeProfile> request = api.userAttributeProfiles().getAll(filter);
Request<UserAttributeProfilePage> request = api.userAttributeProfiles().getAll(filter);
assertThat(request, is(notNullValue()));

server.jsonResponse(MockServer.MGMT_USER_ATTRIBUTE_PROFILES_LIST, 200);
ListUserAttributeProfile response = request.execute().getBody();
UserAttributeProfilePage response = request.execute().getBody();
RecordedRequest recordedRequest = server.takeRequest();

assertThat(recordedRequest, hasMethodAndPath(HttpMethod.GET, "/api/v2/user-attribute-profiles"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("from", "uap_1234567890"));
assertThat(recordedRequest, hasQueryParameter("take", "10"));
assertThat(recordedRequest, hasQueryParameter("take", "2"));

assertThat(response, is(notNullValue()));
assertThat(response.getUserAttributeProfiles(), hasSize(3));
assertThat(response.getItems(), hasSize(3));
}

@Test
Expand Down

This file was deleted.