summaryrefslogtreecommitdiffstats
path: root/sched/tests
diff options
context:
space:
mode:
authorBenoit Lamarche <benoitlamarche@google.com>2015-01-26 18:09:38 +0100
committerBenoit Lamarche <benoitlamarche@google.com>2015-01-27 14:37:48 +0100
commita67dc42085d6f9fa9d4dfcccd908a6a7645af70a (patch)
tree529452cb954e4810172ea9e0ea14910c8b6b2792 /sched/tests
parent4d7a9d313dfa7251c9ca5cd3cf6d47cc0723fb53 (diff)
downloadtoolchain_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.java36
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) {