diff options
author | Benoit Lamarche <benoitlamarche@google.com> | 2015-01-26 15:25:03 +0100 |
---|---|---|
committer | Benoit Lamarche <benoitlamarche@google.com> | 2015-01-27 11:32:25 +0100 |
commit | 982bb6343e6ae66724b8a8f2a38dd4e81fdfce68 (patch) | |
tree | 2f6f2865394596c59b38eb1a64d9a3a1ba614937 /sched/tests/com | |
parent | 66a23cf47993e9409acb06f802afaaa1233cd333 (diff) | |
download | toolchain_jack-982bb6343e6ae66724b8a8f2a38dd4e81fdfce68.zip toolchain_jack-982bb6343e6ae66724b8a8f2a38dd4e81fdfce68.tar.gz toolchain_jack-982bb6343e6ae66724b8a8f2a38dd4e81fdfce68.tar.bz2 |
Add new ReadZipVFS
Change-Id: Id9dbfd2145563a6f1c7c5a677c70dd250b3f0184
Diffstat (limited to 'sched/tests/com')
-rw-r--r-- | sched/tests/com/android/sched/vfs/VFSTest.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sched/tests/com/android/sched/vfs/VFSTest.java b/sched/tests/com/android/sched/vfs/VFSTest.java index 9b8c9e9..307d3da 100644 --- a/sched/tests/com/android/sched/vfs/VFSTest.java +++ b/sched/tests/com/android/sched/vfs/VFSTest.java @@ -370,6 +370,41 @@ public class VFSTest { } } + @Test + public void testReadZipVFS() + throws NotDirectoryException, + CannotCreateFileException, + WrongPermissionException, + CannotSetPermissionException, + NoSuchFileException, + FileAlreadyExistsException, + IOException { + File file = null; + InputOutputVFS outputZipVFS = null; + InputVFS inputZipVFS = null; + try { + file = File.createTempFile("vfs", ".zip"); + String path = file.getAbsolutePath(); + outputZipVFS = new InputOutputZipVFS( + new OutputZipFile(path, null, Existence.MAY_EXIST, ChangePermission.NOCHANGE)); + testOutputVFS(outputZipVFS); + outputZipVFS.close(); + inputZipVFS = new GenericInputVFS(new ReadZipFS( + new InputZipFile(path, null, Existence.MUST_EXIST, ChangePermission.NOCHANGE))); + testInputVFS(inputZipVFS); + } finally { + if (outputZipVFS != null) { + outputZipVFS.close(); + } + if (inputZipVFS != null) { + inputZipVFS.close(); + } + if (file != null) { + Assert.assertTrue(file.delete()); + } + } + } + private void testOutputVFS(@Nonnull InputOutputVFS outputVFS) throws NotDirectoryException, CannotCreateFileException, IOException { |