use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class LdapAdapterIntegrationTest method testGetTeamByGroupCode.
@Test
public void testGetTeamByGroupCode() {
Project project = new Project();
TeamFilter teamFilter = new TeamFilter(TeamFilter.Type.PROJECT_CODES, "projectGroup1");
project.setTeamFilter(teamFilter);
when(workdaysCalendarRepository.findDefaultCalendar(any())).thenReturn(null);
List<Employee> team = ldapAdapter.getTeamByGroupCode(teamFilter.getValue());
assertEquals(1, team.size());
Employee employee = team.get(0);
assertEquals(employee.getUserName(), "testuser1");
}
use of com.artezio.arttime.datamodel.TeamFilter in project ART-TIME by Artezio.
the class ProjectRepositoryTest method testUpdateProject_masterIsChanged.
@Test
public void testUpdateProject_masterIsChanged() throws NoSuchFieldException {
projectRepository = new ProjectRepository();
Map<String, String> properties = new HashMap<String, String>();
properties.put("javax.persistence.validation.mode", "none");
entityManagerFactory = Persistence.createEntityManagerFactory("test-pu", properties);
entityManager = entityManagerFactory.createEntityManager();
setField(projectRepository, "entityManager", entityManager);
setField(projectRepository, "employeeRepository", employeeRepository);
entityManager.getTransaction().begin();
Employee manager = new Employee("userName", "firstName", "lastName", "e@mail.com");
manager.setDepartment("department");
HourType hourType = new HourType("type");
TeamFilter teamFilter = new TeamFilter(TeamFilter.Type.DISABLED, "");
Project master = createProject("master", manager, hourType, teamFilter);
Project newMaster = createProject("newMaster", manager, hourType, teamFilter);
Project subProject = createProject("subProject", master, manager, hourType, teamFilter);
entityManager.persist(hourType);
entityManager.persist(manager);
entityManager.persist(master);
entityManager.persist(newMaster);
entityManager.persist(subProject);
entityManager.flush();
entityManager.clear();
setField(subProject, "master", newMaster);
Project actual = projectRepository.update(subProject);
entityManager.clear();
actual = entityManager.find(Project.class, actual.getId());
assertEquals(master.getCode(), actual.getMaster().getCode());
}
Aggregations