diff options
author | Benoit Lamarche <benoitlamarche@google.com> | 2015-01-26 18:09:38 +0100 |
---|---|---|
committer | Benoit Lamarche <benoitlamarche@google.com> | 2015-01-27 14:37:48 +0100 |
commit | a67dc42085d6f9fa9d4dfcccd908a6a7645af70a (patch) | |
tree | 529452cb954e4810172ea9e0ea14910c8b6b2792 /sched/tests | |
parent | 4d7a9d313dfa7251c9ca5cd3cf6d47cc0723fb53 (diff) | |
download | toolchain_jack-a67dc42085d6f9fa9d4dfcccd908a6a7645af70a.zip toolchain_jack-a67dc42085d6f9fa9d4dfcccd908a6a7645af70a.tar.gz toolchain_jack-a67dc42085d6f9fa9d4dfcccd908a6a7645af70a.tar.bz2 |
Add VFSToVFSWrapper and ReadWriteZipFS
Change-Id: I447734418fb04e2e0e3186dcbb1c37c5b769e2d4
Diffstat (limited to 'sched/tests')
-rw-r--r-- | sched/tests/com/android/sched/vfs/VFSTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sched/tests/com/android/sched/vfs/VFSTest.java b/sched/tests/com/android/sched/vfs/VFSTest.java index c9b1981..401e3d1 100644 --- a/sched/tests/com/android/sched/vfs/VFSTest.java +++ b/sched/tests/com/android/sched/vfs/VFSTest.java @@ -504,6 +504,42 @@ public class VFSTest { Assert.assertEquals("dirB/dirBB/fileBB1", readFromFile(fileBB1)); } + @Test + public void testReadWriteZipFS() + throws NotDirectoryException, + CannotCreateFileException, + WrongPermissionException, + CannotSetPermissionException, + NoSuchFileException, + FileAlreadyExistsException, + IOException { + File file = null; + InputOutputVFS zipVFS = null; + InputZipVFS inputZipVFS = null; + try { + file = File.createTempFile("vfs", ".zip"); + String path = file.getAbsolutePath(); + zipVFS = new GenericInputOutputVFS(new ReadWriteZipFS( + new OutputZipFile(path, null, Existence.MAY_EXIST, ChangePermission.NOCHANGE))); + testOutputVFS(zipVFS); + testInputVFS(zipVFS); + zipVFS.close(); + inputZipVFS = new InputZipVFS( + new InputZipFile(path, null, Existence.MUST_EXIST, ChangePermission.NOCHANGE)); + testInputVFS(inputZipVFS); + } finally { + if (zipVFS != null) { + zipVFS.close(); + } + if (inputZipVFS != null) { + inputZipVFS.close(); + } + if (file != null) { + Assert.assertTrue(file.delete()); + } + } + } + private boolean containsFile(@Nonnull Collection<? extends InputVElement> elements, @Nonnull String fileSimpleName, @Nonnull String fileContent) throws IOException { for (VElement element : elements) { |