Search in sources :

Example 16 with TeamFilter

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

the class LdapAdapterTest method testListEmployeesByTeamCodes_TwoTeamCodes.

@Test
public void testListEmployeesByTeamCodes_TwoTeamCodes() 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,_ART-PRJ-ART-TIME-PM");
    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 17 with TeamFilter

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

the class LdapAdapterTest method testGetTeam_ByNativeFilter.

@Test
public void testGetTeam_ByNativeFilter() throws Exception {
    Logger log = createMock(Logger.class);
    setField(ldapImpl, "log", log);
    Project project = new Project();
    TeamFilter teamFilter = new TeamFilter(FilterType.NATIVE, "(&(objectClass=user)(physicalDeliveryOfficeName=Minsk))");
    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 18 with TeamFilter

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

the class LdapAdapterTest method testGetTeam_DisabledFilter.

@Test
public void testGetTeam_DisabledFilter() throws Exception {
    Logger log = createMock(Logger.class);
    setField(ldapImpl, "log", log);
    Project project = new Project();
    TeamFilter teamFilter = new TeamFilter(FilterType.DISABLED, "");
    project.setTeamFilter(teamFilter);
    List<Employee> team = ldapImpl.getTeam(project);
    assertEquals(0, team.size());
}
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 19 with TeamFilter

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

the class TeamSynchronizerTest method testGetTeam.

@Test
public void testGetTeam() {
    Project project = new Project();
    project.setTeamFilter(new TeamFilter(TeamFilter.Type.DISABLED));
    List<Employee> actual = teamSynchronizer.getTeam(project);
    assertTrue(actual.isEmpty());
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter) Test(org.junit.Test)

Example 20 with TeamFilter

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

the class TeamSynchronizerTest method testGetTeam_basedOnMasterFilterType.

@Test
public void testGetTeam_basedOnMasterFilterType() {
    Project master = new Project();
    master.setTeamFilter(new TeamFilter(TeamFilter.Type.DISABLED));
    Project project = new Project(master);
    project.setTeamFilter(new TeamFilter(TeamFilter.Type.BASED_ON_MASTER));
    List<Employee> actual = teamSynchronizer.getTeam(project);
    assertTrue(actual.isEmpty());
}
Also used : Project(com.artezio.arttime.datamodel.Project) Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter) Test(org.junit.Test)

Aggregations

TeamFilter (com.artezio.arttime.datamodel.TeamFilter)27 Project (com.artezio.arttime.datamodel.Project)26 Employee (com.artezio.arttime.datamodel.Employee)24 Test (org.junit.Test)24 ProjectRepository (com.artezio.arttime.repositories.ProjectRepository)6 Logger (java.util.logging.Logger)6 IntegrationTest (com.artezio.arttime.markers.IntegrationTest)2 HourType (com.artezio.arttime.datamodel.HourType)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 Collections.emptyList (java.util.Collections.emptyList)1 HashMap (java.util.HashMap)1