use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method testRemove.
@Test
public void testRemove() {
Filter filter = new Filter();
entityManager.persist(filter);
filterRepository.remove(filter);
Filter actual = entityManager.find(Filter.class, filter.getId());
assertNull(actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterRepositoryTest method testCreate.
@Test
public void testCreate() {
Filter filter = new Filter();
Filter actual = filterRepository.create(filter);
assertSame(filter, actual);
assertNotNull(actual.getId());
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class HoursRepositoryTest method testGetHours_FilterHasNoProjectsAndHasHourTypes.
@Test
public void testGetHours_FilterHasNoProjectsAndHasHourTypes() {
HourType hourType = new HourType("1");
List<HourType> hourTypes = Collections.singletonList(hourType);
Project project = new Project();
project.setAccountableHours(hourTypes);
Hours hour = new Hours(project, new Date(), null, hourType);
entityManager.persist(hourType);
entityManager.persist(project);
entityManager.persist(hour);
RangePeriodSelector rangePeriodSelector = new RangePeriodSelector(createPeriod(-1, 1));
Filter filter = new Filter();
filter.setRangePeriodSelector(rangePeriodSelector);
filter.setHourTypes(hourTypes);
filter.setProjects(Collections.emptyList());
List<Hours> actual = hoursRepository.getHours(filter);
List<Hours> expected = Collections.singletonList(hour);
assertEquals(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class EmployeeRepositoryTest method testGetEmployeesByDepartments_ifEmployeesAreEmpty_FilterHasNotAllDepartments.
@Test
public void testGetEmployeesByDepartments_ifEmployeesAreEmpty_FilterHasNotAllDepartments() {
Employee employee1 = new Employee("employee1");
employee1.setDepartment("dep1");
Employee employee2 = new Employee("employee2");
employee2.setDepartment("dep2");
Employee employee3 = new Employee("employee3");
employee3.setDepartment("dep3");
Filter filter = new Filter();
filter.setEmployees(Arrays.asList(employee1, employee2));
filter.setDepartments(Arrays.asList("dep1", "dep2"));
entityManager.persist(employee1);
entityManager.persist(employee2);
entityManager.persist(employee3);
List<Employee> expected = new ArrayList<>(filter.getEmployees());
List<Employee> actual = employeeRepository.getEmployeesByDepartments(filter);
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class TimesheetBean method initSpreadSheet.
protected SpreadSheet initSpreadSheet() {
Filter filter = filterService.getTimesheetFilter();
filter.setRangePeriodSelector(filterBean.getCurrentFilter().getRangePeriodSelector());
return new PersonalEffortsSpreadSheet(hoursService, projectService, employeeService, filter);
}
Aggregations