use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiCreateTest method createAllOptions.
@Test
void createAllOptions() {
UserAssignment creationInfo = ImmutableUserAssignment.builder().user(userReference).active(false).hourlyRate(220.).budget(1111.).projectManager(true).build();
userAssignment = userAssignmentApi.create(projectReference, creationInfo);
assertThat(userAssignment).isNotNull();
assertThat(userAssignment).usingComparatorForType((x, y) -> (int) (y.getId() - x.getId()), Reference.class).isEqualToIgnoringNullFields(creationInfo);
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiListTest method listByUpdatedSince.
@Test
void listByUpdatedSince() {
Instant creationTime = Instant.now().minusSeconds(1);
UserAssignment creationInfo = ImmutableUserAssignment.builder().user(userReference).build();
userAssignment = userAssignmentApi.create(projectReference, creationInfo);
log.debug("time now: {}", Instant.now());
log.debug("Creation time for userAssignment: {}", userAssignment.getCreatedAt());
log.debug("Update time for userAssignment: {}", userAssignment.getUpdatedAt());
UserAssignmentFilter filter = new UserAssignmentFilter();
filter.setUpdatedSince(creationTime);
List<UserAssignment> userAssignments = userAssignmentApi.list(projectReference, filter);
assertThat(userAssignments).usingFieldByFieldElementComparator().containsExactly(userAssignment);
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiListTest method list.
@Test
void list() {
UserAssignmentFilter filter = new UserAssignmentFilter();
List<UserAssignment> userAssignments = userAssignmentApi.list(projectReference, filter);
assertThat(userAssignments).isNotEmpty();
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiUpdateTest method changeActive.
@Test
void changeActive() {
userAssignment = userAssignmentApi.create(projectReference, ImmutableUserAssignment.builder().user(userReference).build());
UserAssignmentUpdateInfo updateInfo = ImmutableUserAssignmentUpdateInfo.builder().active(false).build();
UserAssignment updatedUserAssignment = userAssignmentApi.update(projectReference, userAssignment, updateInfo);
assertThat(updatedUserAssignment.getActive()).isEqualTo(updateInfo.getActive());
}
use of ch.aaap.harvestclient.domain.UserAssignment in project harvest-client by 3AP-AG.
the class UserAssignmentsApiImpl method update.
@Override
public UserAssignment update(Reference<Project> projectReference, Reference<UserAssignment> userAssignmentReference, UserAssignmentUpdateInfo updateInfo) {
Call<UserAssignment> call = service.update(projectReference.getId(), userAssignmentReference.getId(), updateInfo);
UserAssignment userAssignment = ExceptionHandler.callOrThrow(call);
log.debug("Updated {}", userAssignment);
return userAssignment;
}
Aggregations