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);
}
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));
}
Aggregations