Search in sources :

Example 1 with DefaultFileProcessingChain

use of ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain in project irida by phac-nml.

the class DefaultFileProcessingChainTest method testFastFailProcessorChain.

@Test(expected = FileProcessorException.class)
public void testFastFailProcessorChain() throws FileProcessorTimeoutException {
    FileProcessingChain fileProcessingChain = new DefaultFileProcessingChain(objectRepository, qcRepository, new FailingFileProcessor());
    when(objectRepository.exists(objectId)).thenReturn(true);
    fileProcessingChain.setFastFail(true);
    fileProcessingChain.launchChain(1L);
    fail("should not proceed when encountering exception and fastFail is enabled.");
}
Also used : DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) FileProcessingChain(ca.corefacility.bioinformatics.irida.processing.FileProcessingChain) DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) Test(org.junit.Test)

Example 2 with DefaultFileProcessingChain

use of ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain in project irida by phac-nml.

the class DefaultFileProcessingChainTest method testFailWithContinueChain.

@Test
public void testFailWithContinueChain() throws FileProcessorTimeoutException {
    FileProcessingChain fileProcessingChain = new DefaultFileProcessingChain(objectRepository, qcRepository, new FailingFileProcessor());
    when(objectRepository.exists(objectId)).thenReturn(true);
    List<Exception> exceptions = fileProcessingChain.launchChain(1L);
    // exceptions should be ignored in this test
    assertEquals("exactly one exception should have been ignored.", 1, exceptions.size());
    assertTrue("ignored exception should be of type FileProcessorException.", exceptions.iterator().next() instanceof FileProcessorException);
}
Also used : FileProcessorException(ca.corefacility.bioinformatics.irida.processing.FileProcessorException) DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) FileProcessorException(ca.corefacility.bioinformatics.irida.processing.FileProcessorException) FileProcessorTimeoutException(ca.corefacility.bioinformatics.irida.exceptions.FileProcessorTimeoutException) FileProcessingChain(ca.corefacility.bioinformatics.irida.processing.FileProcessingChain) DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) Test(org.junit.Test)

Example 3 with DefaultFileProcessingChain

use of ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain in project irida by phac-nml.

the class DefaultFileProcessingChainTest method testExceedsTimeout.

@Test(expected = FileProcessorTimeoutException.class)
public void testExceedsTimeout() throws FileProcessorTimeoutException {
    FileProcessingChain fileProcessingChain = new DefaultFileProcessingChain(objectRepository, qcRepository);
    fileProcessingChain.setTimeout(1);
    fileProcessingChain.setSleepDuration(0);
    fileProcessingChain.launchChain(objectId);
}
Also used : DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) FileProcessingChain(ca.corefacility.bioinformatics.irida.processing.FileProcessingChain) DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) Test(org.junit.Test)

Example 4 with DefaultFileProcessingChain

use of ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain in project irida by phac-nml.

the class DefaultFileProcessingChainTest method testProcessEmptyChain.

@Test
public void testProcessEmptyChain() throws FileProcessorTimeoutException {
    FileProcessingChain fileProcessingChain = new DefaultFileProcessingChain(objectRepository, qcRepository);
    when(objectRepository.exists(objectId)).thenReturn(true);
    fileProcessingChain.launchChain(objectId);
}
Also used : DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) FileProcessingChain(ca.corefacility.bioinformatics.irida.processing.FileProcessingChain) DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) Test(org.junit.Test)

Example 5 with DefaultFileProcessingChain

use of ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain in project irida by phac-nml.

the class DefaultFileProcessingChainTest method testFailWriteQCEntry.

@Test
public void testFailWriteQCEntry() throws FileProcessorTimeoutException {
    FileProcessingChain fileProcessingChain = new DefaultFileProcessingChain(objectRepository, qcRepository, new FailingFileProcessorNoContinue());
    when(objectRepository.exists(objectId)).thenReturn(true);
    boolean exceptionCaught = false;
    try {
        fileProcessingChain.launchChain(1L);
    } catch (FileProcessorException e) {
        exceptionCaught = true;
    }
    assertTrue("File process should have thrown exception", exceptionCaught);
    ArgumentCaptor<QCEntry> captor = ArgumentCaptor.forClass(QCEntry.class);
    verify(qcRepository).save(captor.capture());
    QCEntry qcEntry = captor.getValue();
    assertEquals("should have saved qc entry for sample", seqObject, qcEntry.getSequencingObject());
}
Also used : FileProcessorException(ca.corefacility.bioinformatics.irida.processing.FileProcessorException) DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) QCEntry(ca.corefacility.bioinformatics.irida.model.sample.QCEntry) FileProcessingChain(ca.corefacility.bioinformatics.irida.processing.FileProcessingChain) DefaultFileProcessingChain(ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain) Test(org.junit.Test)

Aggregations

FileProcessingChain (ca.corefacility.bioinformatics.irida.processing.FileProcessingChain)6 DefaultFileProcessingChain (ca.corefacility.bioinformatics.irida.processing.impl.DefaultFileProcessingChain)6 Test (org.junit.Test)6 FileProcessorException (ca.corefacility.bioinformatics.irida.processing.FileProcessorException)2 FileProcessorTimeoutException (ca.corefacility.bioinformatics.irida.exceptions.FileProcessorTimeoutException)1 QCEntry (ca.corefacility.bioinformatics.irida.model.sample.QCEntry)1