use of ca.corefacility.bioinformatics.irida.model.joins.Join in project irida by phac-nml.
the class ProjectServiceImplIT method testRemoveSamplesFromProject.
@Test
@WithMockUser(username = "admin", roles = "ADMIN")
public void testRemoveSamplesFromProject() {
Sample s1 = sampleService.read(1L);
Sample s2 = sampleService.read(2L);
Project p = projectService.read(2L);
projectService.removeSamplesFromProject(p, ImmutableList.of(s1, s2));
Collection<Join<Project, Sample>> samples = sampleService.getSamplesForProject(p);
assertTrue("No samples should be assigned to project.", samples.isEmpty());
}
use of ca.corefacility.bioinformatics.irida.model.joins.Join in project irida by phac-nml.
the class ReferenceFileServiceImplIT method testGetReferenceFilesForProject.
@Test
@WithMockUser(username = "fbristow", roles = "ADMIN")
public void testGetReferenceFilesForProject() {
Project p = projectService.read(1L);
List<Join<Project, ReferenceFile>> prs = referenceFileService.getReferenceFilesForProject(p);
assertEquals("Wrong number of reference files for project.", 1, prs.size());
ReferenceFile rf = prs.iterator().next().getObject();
assertEquals("Wrong reference file attached to project.", Long.valueOf(1), rf.getId());
}
use of ca.corefacility.bioinformatics.irida.model.joins.Join in project irida by phac-nml.
the class UserServiceImplIT method testGetUsersForProject.
@Test
@WithMockUser(username = "fbristow", roles = "MANAGER")
public void testGetUsersForProject() {
Project p = projectService.read(1L);
Collection<Join<Project, User>> projectUsers = userService.getUsersForProject(p);
assertEquals("Wrong number of users.", 1, projectUsers.size());
Join<Project, User> projectUser = projectUsers.iterator().next();
assertEquals("Wrong project.", p, projectUser.getSubject());
assertEquals("Wrong user.", "fbristow", projectUser.getObject().getUsername());
}
use of ca.corefacility.bioinformatics.irida.model.joins.Join in project irida by phac-nml.
the class ProjectSamplesControllerTest method mockSidebarInfo.
/**
* Mocks the information found within the project sidebar.
*/
private void mockSidebarInfo() {
Project project = getProject();
Collection<Join<Project, User>> ownerList = new ArrayList<>();
ownerList.add(new ProjectUserJoin(project, user, ProjectRole.PROJECT_OWNER));
when(projectService.read(PROJECT_ID)).thenReturn(project);
}
use of ca.corefacility.bioinformatics.irida.model.joins.Join in project irida by phac-nml.
the class ProjectsControllerTest method testGetSpecificProjectPage.
@Test
public void testGetSpecificProjectPage() {
Model model = new ExtendedModelMap();
Long projectId = 1L;
Principal principal = () -> USER_NAME;
List<Join<Project, User>> projects = getProjectsForUser();
when(userService.getUsersForProjectByRole(getProject(), ProjectRole.PROJECT_OWNER)).thenReturn(getUsersForProjectByRole());
when(projectService.getProjectsForUser(user)).thenReturn(projects);
when(projectService.getRelatedProjects(getProject())).thenReturn(getRelatedProjectJoin(projects));
assertEquals("Returns the correct Project Page", ProjectsController.SPECIFIC_PROJECT_PAGE, controller.getProjectSpecificPage(projectId, model, principal));
}
Aggregations