use of org.eclipse.che.api.vfs.Archiver in project che by eclipse.
the class LocalVirtualFileTest method addFolderInSearcherAfterExtractTarArchive.
@Test
public void addFolderInSearcherAfterExtractTarArchive() throws Exception {
VirtualFile folder = getRoot().createFolder(generateFolderName());
Mockito.reset(searcher);
Archiver archiver = mock(Archiver.class);
when(archiverFactory.createArchiver(eq(folder), eq("tar"))).thenReturn(archiver);
folder.untar(new ByteArrayInputStream(new byte[0]), false, 0);
verify(searcher).add(folder);
}
use of org.eclipse.che.api.vfs.Archiver in project che by eclipse.
the class LocalVirtualFileTest method addFolderInSearcherAfterExtractZipArchive.
@Test
public void addFolderInSearcherAfterExtractZipArchive() throws Exception {
VirtualFile folder = getRoot().createFolder(generateFolderName());
Mockito.reset(searcher);
Archiver archiver = mock(Archiver.class);
when(archiverFactory.createArchiver(eq(folder), eq("zip"))).thenReturn(archiver);
folder.unzip(new ByteArrayInputStream(new byte[0]), false, 0);
verify(searcher).add(folder);
}
use of org.eclipse.che.api.vfs.Archiver in project che by eclipse.
the class LocalVirtualFileTest method unzipsInFolder.
@Test
public void unzipsInFolder() throws Exception {
VirtualFile folder = getRoot().createFolder(generateFolderName());
Archiver archiver = mock(Archiver.class);
when(archiverFactory.createArchiver(eq(folder), eq("zip"))).thenReturn(archiver);
folder.unzip(new ByteArrayInputStream(new byte[0]), false, 0);
verify(archiver).extract(any(InputStream.class), eq(false), eq(0));
}
use of org.eclipse.che.api.vfs.Archiver in project che by eclipse.
the class LocalVirtualFileTest method compressFolderToTarArchive.
@Test
public void compressFolderToTarArchive() throws Exception {
VirtualFile folder = getRoot().createFolder(generateFolderName());
Archiver archiver = mock(Archiver.class);
when(archiverFactory.createArchiver(eq(folder), eq("tar"))).thenReturn(archiver);
folder.tar();
verify(archiver).compress(any(OutputStream.class), any(VirtualFileFilter.class));
}
use of org.eclipse.che.api.vfs.Archiver in project che by eclipse.
the class MemoryVirtualFileTest method addFolderInSearcherAfterExtractZipArchive.
@Test
public void addFolderInSearcherAfterExtractZipArchive() throws Exception {
VirtualFile folder = getRoot().createFolder(generateFolderName());
Mockito.reset(searcher);
Archiver archiver = mock(Archiver.class);
when(archiverFactory.createArchiver(eq(folder), eq("zip"))).thenReturn(archiver);
folder.unzip(new ByteArrayInputStream(new byte[0]), false, 0);
verify(searcher).add(folder);
}
Aggregations