use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class ProjectServiceImplIT method testMoveSamplesWithoutOwnerRemoteFail.
@Test(expected = AccessDeniedException.class)
@WithMockUser(username = "user1", roles = "USER")
public void testMoveSamplesWithoutOwnerRemoteFail() {
Project source = projectService.read(11L);
Project destination = projectService.read(10L);
assertTrue("Source project should be a remote project for the test", source.isRemote());
assertFalse("Destination project should not be a remote project for the test", destination.isRemote());
Sample sample = sampleService.read(3L);
Set<Sample> samples = Sets.newHashSet(sample);
projectService.moveSamples(source, destination, samples, false);
}
use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class ProjectServiceImplIT method testAddSampleToProjectWithSameSequencerId.
@Test(expected = EntityExistsException.class)
@WithMockUser(username = "admin", roles = "ADMIN")
public void testAddSampleToProjectWithSameSequencerId() {
Sample s = sampleService.read(1L);
Project p = projectService.read(1L);
projectService.addSampleToProject(p, s, true);
Sample otherSample = new Sample(s.getSampleName());
projectService.addSampleToProject(p, otherSample, true);
// if 2 exist with the same id, this call will fail
Sample sampleBySequencerSampleId = sampleService.getSampleBySampleName(p, otherSample.getSampleName());
assertNotNull(sampleBySequencerSampleId);
}
use of ca.corefacility.bioinformatics.irida.model.sample.Sample 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.sample.Sample in project irida by phac-nml.
the class SequencingObjectServiceImplIT method testGetSequenceFilePairForSample.
@Test
@WithMockUser(username = "admin", roles = "ADMIN")
public void testGetSequenceFilePairForSample() {
Sample s = sampleService.read(2L);
Set<Long> fileIds = Sets.newHashSet(3L, 4L);
Collection<SampleSequencingObjectJoin> sequenceFilePairsForSample = objectService.getSequencesForSampleOfType(s, SequenceFilePair.class);
assertEquals(1, sequenceFilePairsForSample.size());
SequencingObject pair = sequenceFilePairsForSample.iterator().next().getObject();
for (SequenceFile file : pair.getFiles()) {
assertTrue("file id should be in set", fileIds.contains(file.getId()));
fileIds.remove(file.getId());
}
assertTrue("all file ids should have been found", fileIds.isEmpty());
}
use of ca.corefacility.bioinformatics.irida.model.sample.Sample in project irida by phac-nml.
the class SequencingObjectServiceImplIT method testGetUniqueSamplesForSequencingObjectsSuccess.
/**
* Tests to make sure we get a properly constructed map of samples to sequencing objects.
*/
@Test
@WithMockUser(username = "admin", roles = "ADMIN")
public void testGetUniqueSamplesForSequencingObjectsSuccess() {
SequencingObject s1 = objectService.read(1L);
SequencingObject s2 = objectService.read(2L);
Sample sa1 = sampleService.read(1L);
Sample sa2 = sampleService.read(2L);
Map<Sample, SequencingObject> sampleMap = objectService.getUniqueSamplesForSequencingObjects(Sets.newHashSet(s1, s2));
assertEquals("Incorrect number of results returned in sample map", 2, sampleMap.size());
assertEquals("Incorrect sequencing object mapped to sample", s2.getId(), sampleMap.get(sa1).getId());
assertEquals("Incorrect sequencing object mapped to sample", s1.getId(), sampleMap.get(sa2).getId());
}
Aggregations