Search in sources :

Example 1 with GzipFileProcessor

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

the class GzipFileProcessorTest method setUp.

@Before
public void setUp() {
    sequenceFileRepository = mock(SequenceFileRepository.class);
    fileProcessor = new GzipFileProcessor(sequenceFileRepository, Boolean.FALSE);
}
Also used : GzipFileProcessor(ca.corefacility.bioinformatics.irida.processing.impl.GzipFileProcessor) SequenceFileRepository(ca.corefacility.bioinformatics.irida.repositories.sequencefile.SequenceFileRepository) Before(org.junit.Before)

Example 2 with GzipFileProcessor

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

the class GzipFileProcessorTest method testDeleteOriginalFile.

@Test
public void testDeleteOriginalFile() throws IOException {
    fileProcessor = new GzipFileProcessor(sequenceFileRepository, Boolean.TRUE);
    final SequenceFile sf = constructSequenceFile();
    // compress the file, update the sequence file reference
    Path uncompressed = sf.getFile();
    Path compressed = Files.createTempFile(null, ".gz");
    GZIPOutputStream out = new GZIPOutputStream(Files.newOutputStream(compressed));
    Files.copy(uncompressed, out);
    out.close();
    sf.setFile(compressed);
    SingleEndSequenceFile so = new SingleEndSequenceFile(sf);
    fileProcessor.process(so);
    verify(sequenceFileRepository, times(1)).save(any(SequenceFile.class));
    assertFalse("The original file should have been deleted.", Files.exists(compressed));
}
Also used : Path(java.nio.file.Path) GzipFileProcessor(ca.corefacility.bioinformatics.irida.processing.impl.GzipFileProcessor) SequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) GZIPOutputStream(java.util.zip.GZIPOutputStream) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile) Test(org.junit.Test)

Aggregations

GzipFileProcessor (ca.corefacility.bioinformatics.irida.processing.impl.GzipFileProcessor)2 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)1 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)1 SequenceFileRepository (ca.corefacility.bioinformatics.irida.repositories.sequencefile.SequenceFileRepository)1 Path (java.nio.file.Path)1 GZIPOutputStream (java.util.zip.GZIPOutputStream)1 Before (org.junit.Before)1 Test (org.junit.Test)1