use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiImpl method create.
@Override
public UserAssignment create(Reference<Project> projectReference, UserAssignment creationInfo) {
Call<UserAssignment> call = service.create(projectReference.getId(), creationInfo);
UserAssignment userAssignment = ExceptionHandler.callOrThrow(call);
log.debug("Created {}", userAssignment);
return userAssignment;
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiImpl method get.
@Override
public UserAssignment get(Reference<Project> projectReference, Reference<UserAssignment> userAssignmentReference) {
Call<UserAssignment> call = service.get(projectReference.getId(), userAssignmentReference.getId());
UserAssignment userAssignment = ExceptionHandler.callOrThrow(call);
log.debug("Gotten {}", userAssignment);
return userAssignment;
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiCreateTest method createDefault.
@Test
void createDefault() {
UserAssignment creationInfo = ImmutableUserAssignment.builder().user(userReference).build();
userAssignment = userAssignmentApi.create(projectReference, creationInfo);
assertThat(userAssignment).isNotNull();
assertThat(userAssignment.getUser().getId()).isEqualTo(userReference.getId());
UserAssignment gotten = userAssignmentApi.get(projectReference, this.userAssignment);
assertThat(gotten).isEqualTo(userAssignment);
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiListTest method listByActive.
@Test
void listByActive() {
UserAssignment creationInfo = ImmutableUserAssignment.builder().user(userReference).active(true).build();
userAssignment = userAssignmentApi.create(projectReference, creationInfo);
UserAssignmentFilter filter = new UserAssignmentFilter();
filter.setActive(true);
List<UserAssignment> userAssignments = userAssignmentApi.list(projectReference, filter);
assertThat(userAssignments).usingFieldByFieldElementComparator().contains(userAssignment);
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiListTest method listPaginated.
@Test
void listPaginated() {
// create a second one to check the pagination
UserAssignment creationInfo = ImmutableUserAssignment.builder().user(userReference).active(true).build();
userAssignment = userAssignmentApi.create(projectReference, creationInfo);
Pagination<UserAssignment> pagination = userAssignmentApi.list(projectReference, new UserAssignmentFilter(), 1, 1);
List<UserAssignment> result = pagination.getList();
assertThat(result).hasSize(1);
assertThat(pagination.getTotalPages()).isGreaterThanOrEqualTo(2);
assertThat(pagination.getNextPage()).isEqualTo(2);
assertThat(pagination.getPreviousPage()).isNull();
assertThat(pagination.getPerPage()).isEqualTo(1);
assertThat(pagination.getTotalPages()).isGreaterThanOrEqualTo(2);
}
Aggregations