Search in sources :

Example 71 with Employee

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

the class LdapAdapterTest method testGetTeam.

@Test
public void testGetTeam() throws Exception {
    Logger log = createMock(Logger.class);
    setField(ldapImpl, "log", log);
    Project project = new Project();
    TeamFilter teamFilter = new TeamFilter(FilterType.PROJECT_CODES, "_ART-PRJ-ART-TIME-PG");
    project.setTeamFilter(teamFilter);
    setField(ldapImpl, "workdaysCalendarRepository", workdaysCalendarRepository);
    expect(workdaysCalendarRepository.findDefaultCalendar(anyObject(Employee.class))).andReturn(null).anyTimes();
    replay(workdaysCalendarRepository);
    List<Employee> team = ldapImpl.getTeam(project);
    verify(workdaysCalendarRepository);
    assertTrue(team.size() > 0);
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter) Logger(java.util.logging.Logger) Test(org.junit.Test)

Example 72 with Employee

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

the class LdapAdapterTest method testListEmployeesByTeamCodes.

@Test
public void testListEmployeesByTeamCodes() throws Exception {
    Logger log = createMock(Logger.class);
    setField(ldapImpl, "log", log);
    Project project = new Project();
    TeamFilter teamFilter = new TeamFilter(FilterType.PROJECT_CODES, "_ART-PRJ-ART-TIME-PG");
    project.setTeamFilter(teamFilter);
    setField(ldapImpl, "workdaysCalendarRepository", workdaysCalendarRepository);
    expect(workdaysCalendarRepository.findDefaultCalendar(anyObject(Employee.class))).andReturn(null).anyTimes();
    replay(workdaysCalendarRepository);
    List<Employee> team = ldapImpl.getTeam(project);
    verify(workdaysCalendarRepository);
    assertTrue(team.size() > 0);
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter) Logger(java.util.logging.Logger) Test(org.junit.Test)

Example 73 with Employee

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

the class DepartmentRepositoryTest method testGetDepartments.

@Test
public void testGetDepartments() {
    Employee employee1 = new Employee("emp1");
    Employee employee2 = new Employee("emp2");
    Employee employee3 = new Employee("emp3");
    employee1.setDepartment("dep1");
    employee2.setDepartment("dep2");
    employee3.setDepartment("dep1");
    entityManager.persist(employee1);
    entityManager.persist(employee2);
    entityManager.persist(employee3);
    List<String> actual = departmentRepository.getDepartments();
    assertEquals(2, actual.size());
    assertTrue(actual.contains(employee1.getDepartment()));
    assertTrue(actual.contains(employee2.getDepartment()));
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) Test(org.junit.Test)

Example 74 with Employee

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

the class EmployeeRepositoryTest method testFind_ByUsername.

@Test
public void testFind_ByUsername() {
    Employee expectedEmployee = new Employee("expected employee");
    Employee unexpectedEmployee = new Employee("unexpected employee");
    entityManager.persist(expectedEmployee);
    entityManager.persist(unexpectedEmployee);
    Employee actual = employeeRepository.find("expected employee");
    assertNotNull(actual);
    assertEquals(expectedEmployee, actual);
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) Test(org.junit.Test)

Example 75 with Employee

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

the class EmployeeRepositoryTest method testCreateEmployee.

@Test
public void testCreateEmployee() {
    Employee employee = new Employee("employee");
    employeeRepository.create(employee);
    Employee actual = entityManager.find(Employee.class, employee.getUserName());
    assertNotNull(actual);
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) Test(org.junit.Test)

Aggregations

Employee (com.artezio.arttime.datamodel.Employee)201 Test (org.junit.Test)173 Project (com.artezio.arttime.datamodel.Project)121 HourType (com.artezio.arttime.datamodel.HourType)74 Hours (com.artezio.arttime.datamodel.Hours)65 Date (java.util.Date)39 BigDecimal (java.math.BigDecimal)33 Period (com.artezio.arttime.datamodel.Period)28 Filter (com.artezio.arttime.filter.Filter)23 ArrayList (java.util.ArrayList)20 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)19 CalendarUtils.getOffsetDate (com.artezio.arttime.test.utils.CalendarUtils.getOffsetDate)18 CalendarUtils.createPeriod (com.artezio.arttime.test.utils.CalendarUtils.createPeriod)15 TeamFilter (com.artezio.arttime.datamodel.TeamFilter)13 HashMap (java.util.HashMap)12 WorkdaysCalendar (com.artezio.arttime.datamodel.WorkdaysCalendar)7 Mail (com.artezio.arttime.services.mailing.Mail)7 ProjectRepository (com.artezio.arttime.services.repositories.ProjectRepository)7 List (java.util.List)7 Map (java.util.Map)7