Search in sources :

Example 6 with MiseqRun

use of ca.corefacility.bioinformatics.irida.model.run.MiseqRun in project irida by phac-nml.

the class SequencingRunControllerTest method testGetFilesPage.

@SuppressWarnings("rawtypes")
@Test
public void testGetFilesPage() throws IOException {
    Long runId = 1L;
    ExtendedModelMap model = new ExtendedModelMap();
    SequencingRun sequencingRunEntity = new MiseqRun(SequencingRun.LayoutType.PAIRED_END, "");
    ImmutableSet<SequencingObject> files = ImmutableSet.of(new SingleEndSequenceFile(new SequenceFile()));
    when(sequencingRunService.read(runId)).thenReturn(sequencingRunEntity);
    when(objectService.getSequencingObjectsForSequencingRun(sequencingRunEntity)).thenReturn(files);
    String filesPage = controller.getFilesPage(runId, model);
    assertEquals(SequencingRunController.FILES_VIEW, filesPage);
    assertFalse(((Collection) model.get("sequencingObjects")).isEmpty());
    assertEquals(sequencingRunEntity, model.get("run"));
    assertTrue(model.containsKey("fileCount"));
    verify(sequencingRunService).read(runId);
    verify(objectService).getSequencingObjectsForSequencingRun(sequencingRunEntity);
}
Also used : MiseqRun(ca.corefacility.bioinformatics.irida.model.run.MiseqRun) SequencingObject(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject) ExtendedModelMap(org.springframework.ui.ExtendedModelMap) SequencingRun(ca.corefacility.bioinformatics.irida.model.run.SequencingRun) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) Test(org.junit.Test)

Example 7 with MiseqRun

use of ca.corefacility.bioinformatics.irida.model.run.MiseqRun in project irida by phac-nml.

the class SequencingRunServiceImplIT method testCreateMiseqRunAsUser.

@Test
@WithMockUser(username = "user", password = "password1", roles = "USER")
public void testCreateMiseqRunAsUser() {
    MiseqRun mr = new MiseqRun(LayoutType.PAIRED_END, "workflow");
    SequencingRun create = miseqRunService.create(mr);
    assertEquals("user", create.getUser().getUsername());
}
Also used : MiseqRun(ca.corefacility.bioinformatics.irida.model.run.MiseqRun) SequencingRun(ca.corefacility.bioinformatics.irida.model.run.SequencingRun) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 8 with MiseqRun

use of ca.corefacility.bioinformatics.irida.model.run.MiseqRun in project irida by phac-nml.

the class SequencingObjectServiceTest method testCreateSequenceFileInSampleWrongType.

@Test(expected = IllegalArgumentException.class)
public void testCreateSequenceFileInSampleWrongType() throws IOException {
    Sample s = new Sample();
    SingleEndSequenceFile so = TestDataFactory.constructSingleEndSequenceFile();
    SequencingRun run = new MiseqRun(LayoutType.PAIRED_END, "workflow");
    so.setSequencingRun(run);
    when(repository.save(so)).thenReturn(so);
    service.createSequencingObjectInSample(so, s);
}
Also used : MiseqRun(ca.corefacility.bioinformatics.irida.model.run.MiseqRun) SequencingRun(ca.corefacility.bioinformatics.irida.model.run.SequencingRun) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) Test(org.junit.Test)

Example 9 with MiseqRun

use of ca.corefacility.bioinformatics.irida.model.run.MiseqRun in project irida by phac-nml.

the class SequencingObjectServiceTest method testCreateSequenceFilePairInSampleWrongType.

@Test(expected = IllegalArgumentException.class)
public void testCreateSequenceFilePairInSampleWrongType() throws IOException {
    Sample s = new Sample();
    SequencingRun run = new MiseqRun(LayoutType.SINGLE_END, "workflow");
    SequenceFilePair so = TestDataFactory.constructSequenceFilePair();
    so.setSequencingRun(run);
    when(repository.save(so)).thenReturn(so);
    service.createSequencingObjectInSample(so, s);
}
Also used : SequenceFilePair(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair) MiseqRun(ca.corefacility.bioinformatics.irida.model.run.MiseqRun) SequencingRun(ca.corefacility.bioinformatics.irida.model.run.SequencingRun) Sample(ca.corefacility.bioinformatics.irida.model.sample.Sample) Test(org.junit.Test)

Aggregations

MiseqRun (ca.corefacility.bioinformatics.irida.model.run.MiseqRun)9 Test (org.junit.Test)8 SequencingRun (ca.corefacility.bioinformatics.irida.model.run.SequencingRun)7 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)3 WithMockUser (org.springframework.security.test.context.support.WithMockUser)3 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)2 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)2 ExtendedModelMap (org.springframework.ui.ExtendedModelMap)2 ModelMap (org.springframework.ui.ModelMap)2 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)1 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)1 RESTSequencingRunController (ca.corefacility.bioinformatics.irida.web.controller.api.sequencingrun.RESTSequencingRunController)1 HashMap (java.util.HashMap)1 Link (org.springframework.hateoas.Link)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1