source: branches/1.3.3/abcl/test/src/org/armedbear/lisp/UtilitiesTest.java

Last change on this file was 12424, checked in by Mark Evenson, 15 years ago

Further tests for jar pathnames.

jar-file.lisp now has network based FASL loads.

Additional associated Java unit tests.

File size: 1.5 KB
Line 
1package org.armedbear.lisp;
2
3import java.io.FileNotFoundException;
4import static org.junit.Assert.*;
5
6import java.io.File;
7import java.io.FileInputStream;
8import java.io.FileWriter;
9import org.junit.Test;
10import java.io.IOException;
11import java.io.InputStream;
12import java.util.jar.JarFile;
13import java.util.jar.JarInputStream;
14import java.util.zip.ZipEntry;
15import java.util.zip.ZipInputStream;
16import org.junit.Before;
17
18public class UtilitiesTest
19{
20   File zipFile;
21
22
23   @Before
24   public void setup() {
25       // XXX currently created by the ABCL Lisp based tests
26       zipFile = new File("test/lisp/abcl/baz.jar");
27       assertTrue(zipFile.canRead());
28   }
29
30
31  @Test
32  public void getZipEntry() throws FileNotFoundException, IOException {
33      FileInputStream inputFile = new FileInputStream(zipFile);
34      ZipInputStream input = new ZipInputStream(inputFile);
35      ZipEntry entry = Utilities.getEntry(input, "a/b/bar.abcl");
36      assertNotNull(entry);
37      input.close();
38      inputFile.close();
39  }
40
41  @Test
42  public void getZipInputStreamZipEntry() throws FileNotFoundException, IOException {
43      JarFile jar = new JarFile(zipFile);
44      Pathname pathname = new Pathname("a/b/bar.abcl");
45      InputStream entryInputStream = Utilities.getInputStream(jar, pathname);
46      assertNotNull(entryInputStream);
47      ZipInputStream zip = new ZipInputStream(entryInputStream);
48      assertNotNull(zip);
49      ZipEntry entry = Utilities.getEntry(zip, "bar._");
50      assertNotNull(entry);
51  }
52   
53}   
Note: See TracBrowser for help on using the repository browser.