From: jprocter Date: Tue, 18 Sep 2007 10:01:18 +0000 (+0000) Subject: added two tests to ensure a vamsasArchive is readable and accessible as a Jar File. X-Git-Tag: Release_0.2~51 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=32c290a75cd867b683595d449297c36835b1d21c;p=vamsas.git added two tests to ensure a vamsasArchive is readable and accessible as a Jar File. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@469 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/uk/ac/vamsas/test/simpleclient/VamsasArchive.java b/src/uk/ac/vamsas/test/simpleclient/VamsasArchive.java index 7154361..52dec7e 100644 --- a/src/uk/ac/vamsas/test/simpleclient/VamsasArchive.java +++ b/src/uk/ac/vamsas/test/simpleclient/VamsasArchive.java @@ -2,6 +2,8 @@ package uk.ac.vamsas.test.simpleclient; import java.io.File; import java.io.ObjectOutputStream; +import java.io.RandomAccessFile; +import java.util.jar.JarFile; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -98,6 +100,25 @@ public class VamsasArchive { av = new File(args[0]); else av = new File("test/vamsas.zip"); + try { + RandomAccessFile raf = new RandomAccessFile(av, "r"); + raf.readByte(); + raf.close(); + } catch (Exception f) + { + log.info("Couldn't random access file archive "+av, f); + } + try { + JarFile jf = new JarFile(av, true, JarFile.OPEN_READ); + if (jf.getEntry("vamsasDocument.xml")!=null) + { + log.info("Valid archive "+av); + } + jf.close(); + } catch (Exception f) + { + log.info("Couldn't access jar archive "+av, f); + } log.info("Opening archive "+av); uk.ac.vamsas.client.simpleclient.VamsasArchive varchive = new uk.ac.vamsas.client.simpleclient.VamsasArchive(av, true);