use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class SequenceFileControllerTest method setUp.
@Before
public void setUp() {
sequencingRunService = mock(SequencingRunService.class);
analysisService = mock(AnalysisService.class);
objectService = mock(SequencingObjectService.class);
controller = new SequenceFileController(objectService, sequencingRunService, analysisService);
Path path = Paths.get(FILE_PATH);
SequenceFile file = new SequenceFile(path);
file.setId(FILE_ID);
SingleEndSequenceFile seqObject = new SingleEndSequenceFile(file);
when(objectService.read(anyLong())).thenReturn(seqObject);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class ReadAnalysisSubmissionPermissionTest method setUp.
/**
* Setup for tests
*/
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
readAnalysisSubmissionPermission = new ReadAnalysisSubmissionPermission(analysisSubmissionRepository, userRepository, sequencingObjectRepository, seqObjectPermission, pasRepository, readProjectPermission);
inputSingleFiles = Sets.newHashSet(new SingleEndSequenceFile(new SequenceFile()));
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class ReadSequencingObjectPermissionTest method testRejectPermission.
@Test
public void testRejectPermission() {
Project p = new Project();
Sample s = new Sample();
List<Join<Project, Sample>> projectSampleList = new ArrayList<>();
projectSampleList.add(new ProjectSampleJoin(p, s, true));
SingleEndSequenceFile sf = new SingleEndSequenceFile(null);
SampleSequencingObjectJoin join = new SampleSequencingObjectJoin(s, sf);
when(psjRepository.getProjectForSample(s)).thenReturn(projectSampleList);
when(sequencingObjectRepository.findOne(1L)).thenReturn(sf);
when(ssoRepository.getSampleForSequencingObject(sf)).thenReturn(join);
when(readProjectPermission.isAllowed(any(), eq(p))).thenReturn(false);
Authentication auth = new UsernamePasswordAuthenticationToken("fbristow", "password1");
assertFalse("permission was granted.", permission.isAllowed(auth, 1L));
verify(sequencingObjectRepository).findOne(1L);
verify(psjRepository).getProjectForSample(s);
verify(ssoRepository).getSampleForSequencingObject(sf);
verify(readProjectPermission).isAllowed(any(), eq(p));
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class ReadSequencingObjectPermissionTest method testGrantPermission.
@Test
public void testGrantPermission() {
Project p = new Project();
Sample s = new Sample();
List<Join<Project, Sample>> projectSampleList = new ArrayList<>();
projectSampleList.add(new ProjectSampleJoin(p, s, true));
SingleEndSequenceFile sf = new SingleEndSequenceFile(null);
SampleSequencingObjectJoin join = new SampleSequencingObjectJoin(s, sf);
when(psjRepository.getProjectForSample(s)).thenReturn(projectSampleList);
when(sequencingObjectRepository.findOne(1L)).thenReturn(sf);
when(ssoRepository.getSampleForSequencingObject(sf)).thenReturn(join);
when(readProjectPermission.isAllowed(any(), eq(p))).thenReturn(true);
Authentication auth = new UsernamePasswordAuthenticationToken("fbristow", "password1");
assertTrue("permission was not granted.", permission.isAllowed(auth, 1L));
verify(sequencingObjectRepository).findOne(1L);
verify(psjRepository).getProjectForSample(s);
verify(ssoRepository).getSampleForSequencingObject(sf);
verify(readProjectPermission).isAllowed(any(), eq(p));
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupSinglePairSubmissionInDatabaseDifferentSample.
/**
* Sets up an {@link AnalysisSubmission} with a list of paired sequence
* files and a single sequence file under a different sample and saves all
* dependencies in database.
*
* @param sampleIdPaired
* The id of the sample to associate with the paired sequence
* files.
* @param sampleIdSingle
* The id of the sample to associate with the single sequence
* file.
* @param sequenceFilePaths1
* A list of paths for the first part of the pair.
* @param sequenceFilePaths2
* A list of paths for the second part of the pair. The path to
* an input sequence file for this test.
* @param singleSequenceFile
* A single sequence file to add.
* @param referenceFilePath
* The path to an input reference file for this test.
* @param iridaWorkflowId
* The id of an irida workflow.
* @return An {@link AnalysisSubmission} which has been saved to the
* database.
*/
public AnalysisSubmission setupSinglePairSubmissionInDatabaseDifferentSample(long sampleIdPaired, long sampleIdSingle, List<Path> sequenceFilePaths1, List<Path> sequenceFilePaths2, Path singleSequenceFile, Path referenceFilePath, UUID iridaWorkflowId) {
SingleEndSequenceFile singleEndFile = (SingleEndSequenceFile) setupSequencingObjectInDatabase(sampleIdSingle, singleSequenceFile).get(0);
List<SequenceFilePair> sequenceFilePairs = setupSampleSequenceFileInDatabase(sampleIdPaired, sequenceFilePaths1, sequenceFilePaths2);
Set<SequencingObject> inputs = Sets.newHashSet(sequenceFilePairs);
inputs.add(singleEndFile);
ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(inputs).referenceFile(referenceFile).build();
analysisSubmissionService.create(submission);
return analysisSubmissionRepository.findOne(submission.getId());
}
Aggregations