source: branches/streams/abcl/test/src/org/armedbear/lisp/util/HttpHeadTest.java

Last change on this file was 14627, checked in by Mark Evenson, 11 years ago

(partially) restore CL:LOAD from jar files.

There is apparently a fair amount of "breakage" of cases that used to
load no longer working which seems due to the changes in the semantics
for finding the FASL init loader. The following tests are now broken
but no longer cause the JVM to crash: JAR-PATHNAME.LOAD.HTTP.1,
JAR-PATHNAME.LOAD.HTTP.2, JAR-PATHNAME.LOAD.HTTP.4,
JAR-PATHNAME.LOAD.HTTP.6, JAR-PATHNAME.LOAD.HTTP.7,
and JAR-PATHNAME.LOAD.HTTP.9. Need to follow this up in subsequent work.

Fixed the underlying HttpHead?.get() interface used to determine
whether to used a cache version. The custom HTTP HEAD code that was
working under Java 6 no longer worked on Java 7.

Added to HttpHead?.get() asynchronous java.lang.Throwable on a socket
timeout of 5000 ms.

File size: 1.3 KB
Line 
1package org.armedbear.lisp.util;
2
3import java.io.IOException;
4import java.net.MalformedURLException;
5import java.net.URL;
6import java.util.logging.Level;
7import java.util.logging.Logger;
8import org.junit.After;
9import org.junit.AfterClass;
10import org.junit.Before;
11import org.junit.BeforeClass;
12import org.junit.Test;
13import static org.junit.Assert.*;
14
15public class HttpHeadTest {
16 
17  public HttpHeadTest() {
18  }
19 
20  @BeforeClass
21  public static void setUpClass() {
22  }
23 
24  @AfterClass
25  public static void tearDownClass() {
26  }
27 
28  @Before
29  public void setUp() {
30  }
31 
32  @After
33  public void tearDown() {
34  }
35
36  @Test
37  public void testGet() {
38    URL url = null;
39    try {
40      url = new URL("http://abcl.org/fasl/42/baz-20140105a-fasl-42.jar");
41    } catch (MalformedURLException ex) {
42      Logger.getLogger(HttpHeadTest.class.getName()).log(Level.SEVERE, null, ex);
43    }
44    String key = "Last-Modified";
45    String result = null;
46    try {
47      result = HttpHead.get(url, key);
48    } catch (IOException ex) {
49      Logger.getLogger(HttpHeadTest.class.getName()).log(Level.SEVERE, null, ex);
50    }
51    assertNotNull(result);
52    System.out.println("Last-Modified result was "+ result);
53  }
54
55  @Test
56  public void testMain() {
57    System.out.println("main");
58    String[] argv = {"http://google.com/"};
59    HttpHead.main(argv);
60  }
61 
62}
Note: See TracBrowser for help on using the repository browser.