use of com.artezio.arttime.datamodel.Project 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.Project 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.Project in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testImportTeam_ShouldNotSendEmptyNotification.
@Test
public void testImportTeam_ShouldNotSendEmptyNotification() throws MessagingException {
Project project = new Project();
List<Employee> newMembers = Collections.emptyList();
List<Employee> newTeamMembers = Collections.emptyList();
expect(projectRepository.fetchComplete(project)).andReturn(project);
expect(projectService.getSubprojectsByProject(project)).andReturn(new ArrayList<>());
expect(teamTrackingSystem.getTeam(project)).andReturn(newMembers);
expect(projectService.addTeamMembers(project, newMembers)).andReturn(newTeamMembers);
replay(projectRepository, projectService, teamTrackingSystem, mailingEngine, mailTemplateManager);
teamSynchronizer.importTeam(project);
verify(projectRepository, projectService, teamTrackingSystem, mailingEngine, mailTemplateManager);
}
use of com.artezio.arttime.datamodel.Project 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);
}
use of com.artezio.arttime.datamodel.Project 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);
}
Aggregations