Search in sources :

Example 11 with Archiver

use of org.eclipse.che.api.vfs.Archiver in project che by eclipse.

the class MemoryVirtualFileTest 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));
}
Also used : VirtualFile(org.eclipse.che.api.vfs.VirtualFile) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Archiver(org.eclipse.che.api.vfs.Archiver) Test(org.junit.Test)

Example 12 with Archiver

use of org.eclipse.che.api.vfs.Archiver in project che by eclipse.

the class MemoryVirtualFileTest method compressesFolderToZipArchive.

@Test
public void compressesFolderToZipArchive() throws Exception {
    VirtualFile folder = getRoot().createFolder(generateFolderName());
    Archiver archiver = mock(Archiver.class);
    when(archiverFactory.createArchiver(eq(folder), eq("zip"))).thenReturn(archiver);
    folder.zip();
    verify(archiver).compress(any(OutputStream.class));
}
Also used : VirtualFile(org.eclipse.che.api.vfs.VirtualFile) OutputStream(java.io.OutputStream) Archiver(org.eclipse.che.api.vfs.Archiver) Test(org.junit.Test)

Aggregations

Archiver (org.eclipse.che.api.vfs.Archiver)12 VirtualFile (org.eclipse.che.api.vfs.VirtualFile)12 Test (org.junit.Test)12 ByteArrayInputStream (java.io.ByteArrayInputStream)8 InputStream (java.io.InputStream)4 OutputStream (java.io.OutputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 DataOutputStream (java.io.DataOutputStream)2 VirtualFileFilter (org.eclipse.che.api.vfs.VirtualFileFilter)2