use of com.artezio.arttime.datamodel.TeamFilter 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);
}
use of com.artezio.arttime.datamodel.TeamFilter 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);
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class ProjectRepositoryIntegrationTest method createTestProject.
private Project createTestProject(String code, boolean isSubproject, Project master) {
Project project = new Project();
project.setCode(code);
project.setStatus(ACTIVE);
project.setAccountableHours(Arrays.asList(testHourType));
project.setManagers(Arrays.asList(testEmployee));
project.setAllowEmployeeReportTime(true);
TeamFilter teamFilter;
if (isSubproject) {
project.setMaster(master);
teamFilter = new TeamFilter(TeamFilter.Type.BASED_ON_MASTER);
} else {
teamFilter = new TeamFilter(TeamFilter.Type.DISABLED);
}
project.setTeamFilter(teamFilter);
return project;
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class LdapAdapterIntegrationTest method testGetDepartments.
@Test
public void testGetDepartments() {
Project project = new Project();
TeamFilter teamFilter = new TeamFilter(TeamFilter.Type.DISABLED, "");
project.setTeamFilter(teamFilter);
Set<String> expected = Sets.newHashSet("Department1", "Department2");
Set<String> actual = ldapAdapter.getDepartments();
assertEquals(expected, actual);
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testGetEmployeesFromProjectTree_expectNoEmployeesFromClosedSubprojects.
@Test
public void testGetEmployeesFromProjectTree_expectNoEmployeesFromClosedSubprojects() {
Employee employee1 = new Employee("emp1");
Employee employee2 = new Employee("emp2");
Employee employee3 = new Employee("emp3");
Employee employee4 = new Employee("emp4");
Project master = new Project();
master.setCode("master");
master.setTeamFilter(new TeamFilter(Type.PROJECT_CODES, "abc"));
master.addTeamMember(employee1);
Project activeSubproject = new Project(master);
activeSubproject.setStatus(ACTIVE);
activeSubproject.setCode("activeSubBased");
activeSubproject.setTeamFilter(new TeamFilter(BASED_ON_MASTER));
activeSubproject.addTeamMember(employee2);
activeSubproject.addTeamMember(employee3);
Project closedSubproject = new Project(master);
closedSubproject.setStatus(Project.Status.CLOSED);
closedSubproject.setCode("subBased2");
closedSubproject.setTeamFilter(new TeamFilter(BASED_ON_MASTER));
closedSubproject.addTeamMember(employee3);
closedSubproject.addTeamMember(employee4);
ProjectRepository.ProjectQuery query = mock(ProjectRepository.ProjectQuery.class);
ProjectRepository.ProjectQuery query1 = mock(ProjectRepository.ProjectQuery.class);
ProjectRepository.ProjectQuery query2 = mock(ProjectRepository.ProjectQuery.class);
expect(projectRepository.query()).andReturn(query).times(2);
expect(query.masters(asList(master))).andReturn(query1);
expect(query.masters(asList(activeSubproject))).andReturn(query2);
expect(query1.status(ACTIVE)).andReturn(query1);
expect(query1.list()).andReturn(asList(activeSubproject));
expect(query2.status(ACTIVE)).andReturn(query2);
expect(query2.list()).andReturn(emptyList());
replay(projectRepository, query, query1, query2);
List<Employee> teamFromSubproject = teamSynchronizer.getEmployeesFromProjectTree(activeSubproject);
verify(projectRepository, query);
assertTrue(teamFromSubproject.contains(employee1));
assertTrue(teamFromSubproject.contains(employee2));
assertTrue(teamFromSubproject.contains(employee3));
assertFalse(teamFromSubproject.contains(employee4));
}
Aggregations