Search in sources :

Example 1 with SampleDataRepository

use of com.artezio.arttime.report.repositories.SampleDataRepository in project ART-TIME by Artezio.

the class HourTypeDataSetTest method testOpen.

@Test
public void testOpen() throws IllegalAccessException {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put(REPORT_PARAM_NAME_HOUR_TYPE_IDS, new Long[] { 1L, 3L });
    dataSet.open(null, parameters);
    Iterator<HourType> actual = (Iterator) FieldUtils.readField(dataSet, "dataIterator", true);
    List<HourType> hourTypes = new SampleDataRepository().getHourTypes();
    List<HourType> expected = Arrays.asList(hourTypes.get(0), hourTypes.get(2));
    ListAssert.assertEquals(expected, IteratorUtils.toList(actual));
}
Also used : SampleDataRepository(com.artezio.arttime.report.repositories.SampleDataRepository) HourType(com.artezio.arttime.datamodel.HourType) HashMap(java.util.HashMap) Iterator(java.util.Iterator) Test(org.junit.Test)

Example 2 with SampleDataRepository

use of com.artezio.arttime.report.repositories.SampleDataRepository in project ART-TIME by Artezio.

the class ProjectDataSetTest method testOpen.

@Test
public void testOpen() throws IllegalAccessException {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put(REPORT_PARAM_NAME_PROJECT_IDS, new Long[] { 2L, 3L });
    dataSet.open(null, parameters);
    Iterator<Project> actual = (Iterator) FieldUtils.readField(dataSet, "dataIterator", true);
    List<Project> projecs = new SampleDataRepository().getProjects();
    List<Project> expected = projecs.subList(1, 3);
    ListAssert.assertEquals(expected, IteratorUtils.toList(actual));
}
Also used : SampleDataRepository(com.artezio.arttime.report.repositories.SampleDataRepository) Project(com.artezio.arttime.datamodel.Project) HashMap(java.util.HashMap) Iterator(java.util.Iterator) Test(org.junit.Test)

Example 3 with SampleDataRepository

use of com.artezio.arttime.report.repositories.SampleDataRepository in project ART-TIME by Artezio.

the class HoursDataSetTest method testOpen.

@Test
public void testOpen() throws IllegalAccessException {
    Map<String, Object> parameters = new HashMap<>();
    parameters.put(REPORT_PARAM_NAME_START_DATE, new GregorianCalendar(2018, 2, 4).getTime());
    parameters.put(REPORT_PARAM_NAME_END_DATE, new GregorianCalendar(2018, 2, 5).getTime());
    parameters.put(REPORT_PARAM_NAME_PROJECT_IDS, new Long[] { 2L, 3L });
    parameters.put(REPORT_PARAM_NAME_DEPARTMENTS, new String[] { "Minsk", "Moscow" });
    parameters.put(REPORT_PARAM_NAME_EMPLOYEE_USERNAMES, new String[] { "user2", "user3" });
    parameters.put(REPORT_PARAM_NAME_HOUR_TYPE_IDS, new Long[] { 1L, 2L, 3L });
    dataSet.open(null, parameters);
    Iterator<Hours> actual = (Iterator) FieldUtils.readField(dataSet, "dataIterator", true);
    List<Hours> hours = new SampleDataRepository().getHours();
    List<Hours> expected = hours.subList(1, 3);
    ListAssert.assertEquals(expected, IteratorUtils.toList(actual));
}
Also used : SampleDataRepository(com.artezio.arttime.report.repositories.SampleDataRepository) HashMap(java.util.HashMap) Hours(com.artezio.arttime.datamodel.Hours) GregorianCalendar(java.util.GregorianCalendar) Iterator(java.util.Iterator) Test(org.junit.Test)

Aggregations

SampleDataRepository (com.artezio.arttime.report.repositories.SampleDataRepository)3 HashMap (java.util.HashMap)3 Iterator (java.util.Iterator)3 Test (org.junit.Test)3 HourType (com.artezio.arttime.datamodel.HourType)1 Hours (com.artezio.arttime.datamodel.Hours)1 Project (com.artezio.arttime.datamodel.Project)1 GregorianCalendar (java.util.GregorianCalendar)1