use of ch.aaap.harvestclient.domain.Project in project harvest-client by 3AP-AG.
the class ProjectsApiImpl method get.
@Override
public Project get(Reference<Project> projectReference) {
Call<Project> call = service.get(projectReference.getId());
Project project = ExceptionHandler.callOrThrow(call);
log.debug("Got Project {}", project);
return project;
}
use of ch.aaap.harvestclient.domain.Project in project harvest-client by 3AP-AG.
the class ProjectsApiImpl method create.
@Override
public Project create(Project projectCreationInfo) {
Call<Project> call = service.create(projectCreationInfo);
Project project = ExceptionHandler.callOrThrow(call);
log.debug("Created Project {}", project);
return project;
}
use of ch.aaap.harvestclient.domain.Project in project harvest-client by 3AP-AG.
the class ProjectsApiCreateTest method createDefaultBudget.
@ParameterizedTest
@EnumSource(Project.BudgetMethod.class)
void createDefaultBudget(Project.BudgetMethod budgetMethod, TestInfo testInfo) {
Reference<Client> clientReference = ExistingData.getInstance().getClientReference();
String name = "Project for test " + testInfo.getDisplayName();
boolean billable = true;
Project.BillingMethod billBy = Project.BillingMethod.PROJECT;
Project creationInfo = ImmutableProject.builder().client(clientReference).name(name).billable(billable).billBy(billBy).budgetBy(budgetMethod).build();
project = projectsApi.create(creationInfo);
assertThat(project.getBillable()).isEqualTo(billable);
assertThat(project.getBillBy()).isEqualTo(billBy);
assertThat(project.getBudgetBy()).isEqualTo(budgetMethod);
assertThat(project.getName()).isEqualTo(name);
assertThat(project.getClient().getId()).isEqualTo(clientReference.getId());
}
use of ch.aaap.harvestclient.domain.Project in project harvest-client by 3AP-AG.
the class ProjectsApiListTest method listByUpdated.
@Test
void listByUpdated() {
ProjectFilter filter = new ProjectFilter();
filter.setUpdatedSince(Instant.now());
List<Project> projects = projectsApi.list(filter);
assertThat(projects).isEmpty();
}
use of ch.aaap.harvestclient.domain.Project in project harvest-client by 3AP-AG.
the class ProjectsApiListTest method listByClient.
@Test
void listByClient(TestInfo testInfo) {
project = projectsApi.create(ImmutableProject.builder().name("Project for " + testInfo.getDisplayName()).billable(true).billBy(Project.BillingMethod.PROJECT).budgetBy(Project.BudgetMethod.HOURS_PER_PROJECT).client(anotherClient).build());
ProjectFilter filter = new ProjectFilter();
filter.setClientReference(client);
List<Project> projects = projectsApi.list(filter);
assertThat(projects).doesNotContain(project);
}
Aggregations