Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
TestUrisWithAssetHandler.java
Go to the documentation of this file.
1package jau.test.net;
2
3import static jau.test.net.URIDumpUtil.showURX;
4
5import java.io.IOException;
6import java.net.URISyntaxException;
7
8import org.jau.net.AssetURLContext;
9import org.junit.Assert;
10import org.junit.BeforeClass;
11import org.junit.FixMethodOrder;
12import org.junit.Test;
13import org.junit.runners.MethodSorters;
14
15import jau.test.junit.util.JunitTracer;
16
17@FixMethodOrder(MethodSorters.NAME_ASCENDING)
19
20 @BeforeClass
21 public static void assetRegistration() throws Exception {
22 try {
23 System.err.println("******* Asset URL Stream Handler Registration: PRE");
24 Assert.assertTrue("GenericURLStreamHandlerFactory.register() failed", AssetURLContext.registerHandler(TestUrisWithAssetHandler.class.getClassLoader()));
25 Assert.assertNotNull(AssetURLContext.getRegisteredHandler());
26 System.err.println("******* Asset URL Stream Handler Registration: POST");
27 } catch (final Exception e) {
28 setTestSupported(false);
29 throw e;
30 }
31 }
32
33 @Test
34 public void showURLComponents0() throws IOException, URISyntaxException {
35 showURX("file:///rootDir/file1.txt");
36 showURX("file://host/rootDir/file1.txt");
37 showURX("jar:file:/web1/file1.jar!/rootDir/file1.txt");
38 showURX("asset:gluegen-test/info.txt");
39 showURX("asset:/gluegen-test/info.txt");
40 showURX("http://domain.com/web1/index.html?lala=23&lili=24#anchor");
41 showURX("http://domain.com:1234/web1/index.html?lala=23&lili=24#anchor");
42 showURX("asset:jar:file:/web1/file1.jar!/rootDir/file1.txt");
43 showURX("asset:jar:file:/web1/file1.jar!/rootDir/./file1.txt");
44 showURX("asset:jar:file:/web1/file1.jar!/rootDir/dummyParent/../file1.txt");
45 }
46
47 public static void main(final String args[]) throws IOException {
48 final String tstname = TestUrisWithAssetHandler.class.getName();
49 org.junit.runner.JUnitCore.main(tstname);
50 }
51}