Search in sources :

Example 76 with HourType

use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.

the class HoursSpreadSheetRowTest method testGetFirstColValue_ifGroupingByEmployees.

@Test
public void testGetFirstColValue_ifGroupingByEmployees() {
    Project project = new Project();
    project.setCode("project");
    HourType hourType = new HourType();
    Employee employee = new Employee("iivanov", "Ivan", "Ivanov", "ivanov@email");
    row = new HoursSpreadSheetRow(project, employee, hourType, new ArrayList<>());
    String actual = row.getFirstColValue(EffortsGrouping.BY_EMPLOYEES);
    assertEquals(project.getCode(), actual);
}
Also used : Project(com.artezio.arttime.datamodel.Project) HourType(com.artezio.arttime.datamodel.HourType) Employee(com.artezio.arttime.datamodel.Employee) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 77 with HourType

use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.

the class SampleDataRepository method initHourTypes.

private static void initHourTypes() throws IllegalAccessException {
    hourTypes = new ArrayList<>();
    HourType hourType1 = new HourType("actual_type_priority_1");
    FieldUtils.writeField(hourType1, "id", 1L, true);
    hourType1.setActualTime(true);
    hourType1.setPriority(1);
    hourTypes.add(hourType1);
    HourType hourType2 = new HourType("not_actual_type_priority_2");
    FieldUtils.writeField(hourType2, "id", 2L, true);
    hourType2.setActualTime(false);
    hourType2.setPriority(2);
    hourTypes.add(hourType2);
    HourType hourType3 = new HourType("not_actual_type_priority_3");
    FieldUtils.writeField(hourType3, "id", 3L, true);
    hourType3.setActualTime(false);
    hourType3.setPriority(3);
    hourTypes.add(hourType3);
}
Also used : HourType(com.artezio.arttime.datamodel.HourType)

Example 78 with HourType

use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.

the class SpreadSheetTest method testGetFilteredHourTypes_IndexedHoursEmpty_FilterNotEmpty.

@Test
public void testGetFilteredHourTypes_IndexedHoursEmpty_FilterNotEmpty() {
    HourType hourType1 = new HourType("1");
    HourType hourType2 = new HourType("2");
    filter.setHourTypes(asList(hourType2));
    Project project = new Project();
    project.setTeam(singletonList(employee1));
    project.setAccountableHours(asList(hourType1, hourType2));
    SpreadSheet.HoursIndexedBundle indexedHours = EasyMock.mock(SpreadSheet.HoursIndexedBundle.class);
    expect(indexedHours.getHourTypes(project, employee1)).andReturn(emptyList());
    EasyMock.replay(indexedHours);
    List<HourType> expected = asList(hourType2);
    List<HourType> actual = spreadSheet.getFilteredHourTypesUnion(employee1, project, indexedHours);
    EasyMock.verify(indexedHours);
    ListAssert.assertEquals(expected, actual);
}
Also used : Project(com.artezio.arttime.datamodel.Project) HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 79 with HourType

use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.

the class SpreadSheetTest method testGetFilteredHourTypes_IndexedHourTypesNotEmpty_FilterEmpty.

@Test
public void testGetFilteredHourTypes_IndexedHourTypesNotEmpty_FilterEmpty() {
    HourType hourType1 = new HourType("1");
    HourType hourType2 = new HourType("2");
    Project project = new Project();
    project.setTeam(singletonList(employee1));
    project.setAccountableHours(asList(hourType1, hourType2));
    SpreadSheet.HoursIndexedBundle indexedHours = EasyMock.mock(SpreadSheet.HoursIndexedBundle.class);
    expect(indexedHours.getHourTypes(project, employee1)).andReturn(asList(hourType1, hourType2));
    EasyMock.replay(indexedHours);
    List<HourType> expected = asList(hourType1, hourType2);
    List<HourType> actual = spreadSheet.getFilteredHourTypesUnion(employee1, project, indexedHours);
    EasyMock.verify(indexedHours);
    ListAssert.assertEquals(expected, actual);
}
Also used : Project(com.artezio.arttime.datamodel.Project) HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Example 80 with HourType

use of com.artezio.arttime.datamodel.HourType in project ART-TIME by Artezio.

the class SpreadSheetTest method testGetFilteredHourTypes_IndexedHoursEmpty_FilterEmpty.

@Test
public void testGetFilteredHourTypes_IndexedHoursEmpty_FilterEmpty() {
    HourType hourType1 = new HourType("1");
    HourType hourType2 = new HourType("2");
    Project project = new Project();
    project.setTeam(singletonList(employee1));
    project.setAccountableHours(asList(hourType1, hourType2));
    SpreadSheet.HoursIndexedBundle indexedHours = EasyMock.mock(SpreadSheet.HoursIndexedBundle.class);
    expect(indexedHours.getHourTypes(project, employee1)).andReturn(emptyList());
    EasyMock.replay(indexedHours);
    List<HourType> expected = asList(hourType1, hourType2);
    List<HourType> actual = spreadSheet.getFilteredHourTypesUnion(employee1, project, indexedHours);
    EasyMock.verify(indexedHours);
    ListAssert.assertEquals(expected, actual);
}
Also used : Project(com.artezio.arttime.datamodel.Project) HourType(com.artezio.arttime.datamodel.HourType) Test(org.junit.Test)

Aggregations

HourType (com.artezio.arttime.datamodel.HourType)172 Test (org.junit.Test)158 Project (com.artezio.arttime.datamodel.Project)120 Employee (com.artezio.arttime.datamodel.Employee)115 Hours (com.artezio.arttime.datamodel.Hours)103 Date (java.util.Date)60 CalendarUtils.getOffsetDate (com.artezio.arttime.test.utils.CalendarUtils.getOffsetDate)54 Period (com.artezio.arttime.datamodel.Period)45 BigDecimal (java.math.BigDecimal)41 CalendarUtils.createPeriod (com.artezio.arttime.test.utils.CalendarUtils.createPeriod)21 HashMap (java.util.HashMap)16 HoursRepository (com.artezio.arttime.repositories.HoursRepository)13 Map (java.util.Map)11 Arrays.asList (java.util.Arrays.asList)10 List (java.util.List)10 Filter (com.artezio.arttime.filter.Filter)7 Mail (com.artezio.arttime.services.mailing.Mail)7 ArrayList (java.util.ArrayList)7 HourTypeRepository (com.artezio.arttime.repositories.HourTypeRepository)6 RangePeriodSelector (com.artezio.arttime.web.criteria.RangePeriodSelector)6