use of com.artezio.arttime.datamodel.Project in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testGetCommonImportSettingsProjects.
@Test
public void testGetCommonImportSettingsProjects() throws NoSuchFieldException {
Project master = createProject(1L, null, FilterType.PROJECT_CODES);
Project project01 = createProject(2L, master, FilterType.BASED_ON_MASTER);
Project project02 = createProject(3L, master, FilterType.DISABLED);
Project project11 = createProject(4L, project01, FilterType.BASED_ON_MASTER);
Project project21 = createProject(5L, project02, FilterType.BASED_ON_MASTER);
List<Project> projects = Arrays.asList(master, project01, project02, project11, project21);
expect(projectService.getSubprojectsByProject(master)).andReturn(projects);
List<Project> expected = Arrays.asList(master, project01, project11);
replay(projectService);
List<Project> actual = teamSynchronizer.getCommonImportSettingsProjects(master);
verify(projectService);
ListAssert.assertEquals(expected, actual);
}
use of com.artezio.arttime.datamodel.Project 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.Project in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testGetTeamMembers.
@Test
public void testGetTeamMembers() {
Employee employee1 = new Employee("employee1");
Employee employee2 = new Employee("employee2");
Employee employee3 = new Employee("employee3");
Project project1 = new Project();
project1.addTeamMember(employee1);
Project project2 = new Project();
project2.addTeamMember(employee2);
project2.addTeamMember(employee3);
List<Project> projects = Arrays.asList(project1, project2);
List<Employee> expected = Arrays.asList(employee1, employee2, employee3);
Set<Employee> actual = teamSynchronizer.getTeamMembers(projects);
ListAssert.assertEquals(expected, new ArrayList<>(actual));
}
use of com.artezio.arttime.datamodel.Project in project ART-TIME by Artezio.
the class TeamSynchronizerTest method testGetFullTeam.
@Test
public void testGetFullTeam() throws Exception {
Employee employee1 = new Employee("employee1");
Employee employee2 = new Employee("employee2");
Employee employee3 = new Employee("employee3");
Employee employee4 = new Employee("employee4");
Employee employee5 = new Employee("employee5");
Project master = createProject(1L, null, FilterType.PROJECT_CODES);
Project project01 = createProject(2L, master, FilterType.BASED_ON_MASTER);
Project project02 = createProject(3L, master, FilterType.DISABLED);
Project project11 = createProject(4L, project01, FilterType.BASED_ON_MASTER);
Project project21 = createProject(5L, project02, FilterType.BASED_ON_MASTER);
List<Project> projects = Arrays.asList(master, project01, project02, project11, project21);
expect(projectService.getSubprojectsByProject(master)).andReturn(projects);
master.addTeamMember(employee1);
project01.addTeamMember(employee2);
project11.addTeamMember(employee3);
project02.addTeamMember(employee4);
project21.addTeamMember(employee5);
List<Employee> expected = Arrays.asList(employee1, employee2, employee3);
replay(projectService);
Set<Employee> actual = teamSynchronizer.getFullTeam(master);
verify(projectService);
ListAssert.assertEquals(expected, new ArrayList<>(actual));
}
use of com.artezio.arttime.datamodel.Project 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);
}
Aggregations