Search in sources :

Example 1 with Project

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;
}
Also used : Project(ch.aaap.harvestclient.domain.Project)

Example 2 with 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;
}
Also used : Project(ch.aaap.harvestclient.domain.Project)

Example 3 with 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());
}
Also used : Project(ch.aaap.harvestclient.domain.Project) ImmutableProject(ch.aaap.harvestclient.domain.ImmutableProject) Client(ch.aaap.harvestclient.domain.Client) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with Project

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();
}
Also used : Project(ch.aaap.harvestclient.domain.Project) ImmutableProject(ch.aaap.harvestclient.domain.ImmutableProject) ProjectFilter(ch.aaap.harvestclient.api.filter.ProjectFilter) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Example 5 with Project

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);
}
Also used : Project(ch.aaap.harvestclient.domain.Project) ImmutableProject(ch.aaap.harvestclient.domain.ImmutableProject) ProjectFilter(ch.aaap.harvestclient.api.filter.ProjectFilter) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Aggregations

Project (ch.aaap.harvestclient.domain.Project)12 ImmutableProject (ch.aaap.harvestclient.domain.ImmutableProject)10 HarvestTest (ch.aaap.harvestclient.HarvestTest)7 Test (org.junit.jupiter.api.Test)7 Client (ch.aaap.harvestclient.domain.Client)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 ProjectFilter (ch.aaap.harvestclient.api.filter.ProjectFilter)3 LocalDate (java.time.LocalDate)3 EnumSource (org.junit.jupiter.params.provider.EnumSource)2 ProjectAssignmentsApi (ch.aaap.harvestclient.api.ProjectAssignmentsApi)1 UserAssignmentFilter (ch.aaap.harvestclient.api.filter.UserAssignmentFilter)1 Harvest (ch.aaap.harvestclient.core.Harvest)1 ProjectAssignment (ch.aaap.harvestclient.domain.ProjectAssignment)1 User (ch.aaap.harvestclient.domain.User)1 Reference (ch.aaap.harvestclient.domain.reference.Reference)1 Instant (java.time.Instant)1 List (java.util.List)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 TestInfo (org.junit.jupiter.api.TestInfo)1