use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testImportTeam_ifTeamNotChanged.
@Test
public void testImportTeam_ifTeamNotChanged() throws Exception {
Employee employee = new Employee("employee");
Project project = new Project();
setField(project, "id", 1L);
project.addTeamMember(employee);
project.setTeamFilter(new TeamFilter(FilterType.PROJECT_CODES, "foreign code"));
List<Employee> projectTeam = Arrays.asList(employee);
expect(projectRepository.fetchComplete(project)).andReturn(project);
expect(projectService.getSubprojectsByProject(project)).andReturn(Arrays.asList(project));
expect(teamTrackingSystem.getTeam(project)).andReturn(projectTeam);
expect(projectService.addTeamMembers(project, new ArrayList<>())).andReturn(new ArrayList<>());
replay(projectRepository, projectService, teamTrackingSystem);
teamSynchronizer.importTeam(project);
verify(projectRepository, projectService, teamTrackingSystem);
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testImportTeam_ifBasedOnMaster.
@Test
public void testImportTeam_ifBasedOnMaster() throws Exception {
Employee employee = new Employee("employee");
Project project = new Project();
setField(project, "id", 1L);
project.addTeamMember(employee);
project.setTeamFilter(new TeamFilter(FilterType.BASED_ON_MASTER));
List<Employee> projectTeam = Arrays.asList(new Employee("new employee"));
expect(projectRepository.fetchComplete(project)).andReturn(project);
expect(projectService.getSubprojectsByProject(project)).andReturn(Arrays.asList(project));
expect(teamTrackingSystem.getTeam(project)).andReturn(projectTeam);
expect(projectService.addTeamMembers(project, new ArrayList<>())).andReturn(new ArrayList<>());
expect(projectRepository.update(project)).andReturn(project);
expect(mailTemplateManager.getTemplateText(anyString(), anyObject(Map.class))).andReturn("").anyTimes();
replay(projectRepository, projectService, teamTrackingSystem, mailTemplateManager);
teamSynchronizer.importTeam(project);
verify(projectRepository, projectService, teamTrackingSystem, mailTemplateManager);
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testImportTeamByProject.
@Test
public void testImportTeamByProject() throws MessagingException {
Project project = new Project();
project.setTeamFilter(new TeamFilter(FilterType.PROJECT_CODES, "foreign code"));
Employee employee = new Employee("employee");
List<Employee> projectTeam = Arrays.asList(employee);
expect(projectRepository.fetchComplete(project)).andReturn(project);
expect(projectService.getSubprojectsByProject(project)).andReturn(new ArrayList<>());
expect(teamTrackingSystem.getTeam(project)).andReturn(projectTeam);
expect(projectService.addTeamMembers(project, projectTeam)).andReturn(projectTeam);
expect(projectRepository.update(project)).andReturn(project);
expect(mailTemplateManager.getTemplateText(anyString(), anyObject(Map.class))).andReturn("").anyTimes();
replay(teamTrackingSystem, projectRepository, projectService, mailTemplateManager);
teamSynchronizer.importTeam(project);
verify(teamTrackingSystem, projectRepository, projectService, mailTemplateManager);
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class TeamSynchronizerTest method createProject.
private Project createProject(Long id, Project master, FilterType filterType) throws NoSuchFieldException {
Project project = new Project(master);
setField(project, "id", id);
TeamFilter teamFilter = new TeamFilter(filterType);
project.setTeamFilter(teamFilter);
return project;
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class LdapAdapterTest method testGetTeam_TwoTeamCodes.
@Test
public void testGetTeam_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);
}
Aggregations