diff options
Diffstat (limited to 'src/junit/com/jogamp/common/net')
6 files changed, 61 insertions, 61 deletions
diff --git a/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java b/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java index cb3fe14..e16003f 100644 --- a/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java +++ b/src/junit/com/jogamp/common/net/AssetURLConnectionBase.java @@ -17,9 +17,9 @@ public abstract class AssetURLConnectionBase extends JunitTracer { /** In gluegen-rt.jar */ protected static final String test_asset_rt_url = "asset:gluegen/info.txt"; protected static final String test_asset_rt_entry = "gluegen/info.txt"; - + protected static final String test_asset_rt2_url = "asset:/gluegen/info.txt"; - + /** In gluegen.test.jar */ protected static final String test_asset_test1_url = "asset:gluegen-test/info.txt"; protected static final String test_asset_test1_entry = "gluegen-test/info.txt"; @@ -36,7 +36,7 @@ public abstract class AssetURLConnectionBase extends JunitTracer { protected static final String test_asset_test4b_url = "asset:/com/jogamp/common/net/data2/RelativeData2.txt"; protected static final String test_asset_test4_entry = "com/jogamp/common/net/data2/RelativeData2.txt"; - protected static void testAssetConnection(URLConnection c, String entry_name) throws IOException { + protected static void testAssetConnection(final URLConnection c, final String entry_name) throws IOException { Assert.assertNotNull(c); if(c instanceof AssetURLConnection) { final AssetURLConnection ac = (AssetURLConnection) c; @@ -49,7 +49,7 @@ public abstract class AssetURLConnectionBase extends JunitTracer { Assert.assertEquals(entry_name, jc.getEntryName()); } } - + final BufferedReader reader = new BufferedReader(new InputStreamReader(c.getInputStream())); try { String line = null; @@ -61,5 +61,5 @@ public abstract class AssetURLConnectionBase extends JunitTracer { } finally { IOUtil.close(reader, false); } - } + } }
\ No newline at end of file diff --git a/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java b/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java index 2a3df41..7648990 100644 --- a/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java +++ b/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java @@ -17,7 +17,7 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class AssetURLConnectionRegisteredTest extends AssetURLConnectionBase { - + @BeforeClass public static void assetRegistration() throws Exception { try { @@ -25,68 +25,68 @@ public class AssetURLConnectionRegisteredTest extends AssetURLConnectionBase { Assert.assertTrue("GenericURLStreamHandlerFactory.register() failed", AssetURLContext.registerHandler(AssetURLConnectionRegisteredTest.class.getClassLoader())); Assert.assertNotNull(AssetURLContext.getRegisteredHandler()); System.err.println("******* Asset URL Stream Handler Registration: POST"); - } catch (Exception e) { + } catch (final Exception e) { setTestSupported(false); throw e; - } + } } - + @Test public void assetRegisteredURLConnection_RT() throws IOException { testAssetConnection(createAssetURLConnection(test_asset_rt_url), test_asset_rt_entry); } - + @Test public void assetRegisteredURLConnection_Test() throws IOException { testAssetConnection(createAssetURLConnection(test_asset_test1_url), test_asset_test1_entry); } - + @Test public void assetRegisteredIOUtilGetResourceRel1_RT() throws IOException, URISyntaxException { final URLConnection urlConn0 = IOUtil.getResource(test_asset_test2a_url, this.getClass().getClassLoader()); Assert.assertNotNull(urlConn0); Assert.assertEquals(test_asset_test2a_url, urlConn0.getURL().toExternalForm()); testAssetConnection(urlConn0, test_asset_test2_entry); - + final URI uri1 = IOUtil.getRelativeOf(urlConn0.getURL().toURI(), test_asset_test3_rel); Assert.assertNotNull(uri1); Assert.assertEquals(test_asset_test3a_url, uri1.toString()); testAssetConnection(uri1.toURL().openConnection(), test_asset_test3_entry); - + final URI uri2 = IOUtil.getRelativeOf(urlConn0.getURL().toURI(), test_asset_test4_rel); Assert.assertNotNull(uri2); Assert.assertEquals(test_asset_test4a_url, uri2.toString()); testAssetConnection(uri2.toURL().openConnection(), test_asset_test4_entry); } - + @Test public void assetRegisteredIOUtilGetResourceRel2_RT() throws IOException, URISyntaxException { final URLConnection urlConn0 = IOUtil.getResource(test_asset_test2b_url, this.getClass().getClassLoader()); Assert.assertNotNull(urlConn0); Assert.assertEquals(test_asset_test2b_url, urlConn0.getURL().toExternalForm()); testAssetConnection(urlConn0, test_asset_test2_entry); - + final URI uri1 = IOUtil.getRelativeOf(urlConn0.getURL().toURI(), test_asset_test3_rel); Assert.assertNotNull(uri1); Assert.assertEquals(test_asset_test3b_url, uri1.toString()); testAssetConnection(uri1.toURL().openConnection(), test_asset_test3_entry); - + final URI uri2 = IOUtil.getRelativeOf(urlConn0.getURL().toURI(), test_asset_test4_rel); Assert.assertNotNull(uri2); Assert.assertEquals(test_asset_test4b_url, uri2.toString()); - testAssetConnection(uri2.toURL().openConnection(), test_asset_test4_entry); + testAssetConnection(uri2.toURL().openConnection(), test_asset_test4_entry); } - - URLConnection createAssetURLConnection(String path) throws IOException { - URL url = AssetURLContext.createURL(path); - URLConnection c = url.openConnection(); + + URLConnection createAssetURLConnection(final String path) throws IOException { + final URL url = AssetURLContext.createURL(path); + final URLConnection c = url.openConnection(); System.err.println("createAssetURL: "+path+" -> url: "+url+" -> conn: "+c+" / connURL "+(null!=c?c.getURL():null)); - return c; - + return c; + } - - public static void main(String args[]) throws IOException { - String tstname = AssetURLConnectionRegisteredTest.class.getName(); + + public static void main(final String args[]) throws IOException { + final String tstname = AssetURLConnectionRegisteredTest.class.getName(); org.junit.runner.JUnitCore.main(tstname); - } + } } diff --git a/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java b/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java index 29b698e..5fbde49 100644 --- a/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java +++ b/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java @@ -20,46 +20,46 @@ public class AssetURLConnectionUnregisteredTest extends AssetURLConnectionBase { public void assetUnregisteredURLConnection_RT2() throws IOException { testAssetConnection(createAssetURLConnection(test_asset_rt2_url, this.getClass().getClassLoader()), test_asset_rt_entry); } - + @Test public void assetUnregisteredURLConnection_RT() throws IOException { testAssetConnection(createAssetURLConnection(test_asset_rt_url, this.getClass().getClassLoader()), test_asset_rt_entry); } - + @Test public void assetUnregisteredURLConnection_Test() throws IOException { testAssetConnection(createAssetURLConnection(test_asset_test1_url, this.getClass().getClassLoader()), test_asset_test1_entry); } - + @Test public void assetUnregisteredIOUtilGetResourceAbs_RT() throws IOException { - URLConnection c = IOUtil.getResource(test_asset_rt_entry, this.getClass().getClassLoader()); + final URLConnection c = IOUtil.getResource(test_asset_rt_entry, this.getClass().getClassLoader()); testAssetConnection(c, test_asset_rt_entry); } - + @Test public void assetUnregisteredIOUtilGetResourceRel0_RT() throws IOException, URISyntaxException { final URLConnection urlConn0 = IOUtil.getResource(this.getClass(), test_asset_test2_rel); testAssetConnection(urlConn0, test_asset_test2_entry); - + final URI uri1 = IOUtil.getRelativeOf(urlConn0.getURL().toURI(), test_asset_test3_rel); Assert.assertNotNull(uri1); // JARFile URL .. testAssetConnection(uri1.toURL().openConnection(), test_asset_test3_entry); - + final URI uri2 = IOUtil.getRelativeOf(urlConn0.getURL().toURI(), test_asset_test4_rel); Assert.assertNotNull(uri2); - testAssetConnection(uri2.toURL().openConnection(), test_asset_test4_entry); + testAssetConnection(uri2.toURL().openConnection(), test_asset_test4_entry); } - - protected static URLConnection createAssetURLConnection(String path, ClassLoader cl) throws IOException { - URL url = AssetURLContext.createURL(path, cl); - URLConnection c = url.openConnection(); + + protected static URLConnection createAssetURLConnection(final String path, final ClassLoader cl) throws IOException { + final URL url = AssetURLContext.createURL(path, cl); + final URLConnection c = url.openConnection(); System.err.println("createAssetURL: "+path+" -> url: "+url+" -> conn: "+c+" / connURL "+(null!=c?c.getURL():null)); - return c; + return c; } - - public static void main(String args[]) throws IOException { - String tstname = AssetURLConnectionUnregisteredTest.class.getName(); + + public static void main(final String args[]) throws IOException { + final String tstname = AssetURLConnectionUnregisteredTest.class.getName(); org.junit.runner.JUnitCore.main(tstname); - } + } } diff --git a/src/junit/com/jogamp/common/net/TestURIQueryProps.java b/src/junit/com/jogamp/common/net/TestURIQueryProps.java index 09cef61..4f4435a 100644 --- a/src/junit/com/jogamp/common/net/TestURIQueryProps.java +++ b/src/junit/com/jogamp/common/net/TestURIQueryProps.java @@ -16,35 +16,35 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestURIQueryProps extends JunitTracer { - + @Test public void test() throws IOException, URISyntaxException { final String SCHEME = "camera"; final String HOST = "somewhere"; final String PATH = "0"; - String[] args = new String[] { + final String[] args = new String[] { SCHEME+"://"+HOST+"/"+PATH, SCHEME+"://"+HOST+"/"+PATH+"?p1=1", }; for(int i=0; i<args.length-1; i+=2) { - String uri_s0 = args[i]; - String uri_s1 = args[i+1]; - URI uri0 = new URI(uri_s0); - URI uri1 = new URI(uri_s1); + final String uri_s0 = args[i]; + final String uri_s1 = args[i+1]; + final URI uri0 = new URI(uri_s0); + final URI uri1 = new URI(uri_s1); showURI(uri0); showURI(uri1); - URIQueryProps data = URIQueryProps.create(uri1, ';'); + final URIQueryProps data = URIQueryProps.create(uri1, ';'); if(null == data) { System.err.println("Error: NULL: <"+uri_s1+"> -> "+uri1+" -> NULL"); } else { - URI uri1T = data.appendQuery(uri0); + final URI uri1T = data.appendQuery(uri0); showURI(uri1T); Assert.assertEquals(uri1, uri1T); } } } - public static void main(String args[]) throws IOException { - String tstname = TestURIQueryProps.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestURIQueryProps.class.getName(); org.junit.runner.JUnitCore.main(tstname); - } + } } diff --git a/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java b/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java index 6e244eb..d2bfaf7 100644 --- a/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java +++ b/src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java @@ -23,7 +23,7 @@ public class TestUrisWithAssetHandler extends JunitTracer { Assert.assertTrue("GenericURLStreamHandlerFactory.register() failed", AssetURLContext.registerHandler(TestUrisWithAssetHandler.class.getClassLoader())); Assert.assertNotNull(AssetURLContext.getRegisteredHandler()); System.err.println("******* Asset URL Stream Handler Registration: POST"); - } catch (Exception e) { + } catch (final Exception e) { setTestSupported(false); throw e; } @@ -43,8 +43,8 @@ public class TestUrisWithAssetHandler extends JunitTracer { showURX("asset:jar:file:/web1/file1.jar!/rootDir/dummyParent/../file1.txt"); } - public static void main(String args[]) throws IOException { - String tstname = TestUrisWithAssetHandler.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestUrisWithAssetHandler.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/junit/com/jogamp/common/net/URIDumpUtil.java b/src/junit/com/jogamp/common/net/URIDumpUtil.java index 132a19c..8d94b6d 100644 --- a/src/junit/com/jogamp/common/net/URIDumpUtil.java +++ b/src/junit/com/jogamp/common/net/URIDumpUtil.java @@ -6,14 +6,14 @@ import java.net.URISyntaxException; import java.net.URL; public class URIDumpUtil { - public static void showURX(String urx) throws MalformedURLException, URISyntaxException { + public static void showURX(final String urx) throws MalformedURLException, URISyntaxException { System.err.println("XXXXXX "+urx); showURL(new URL(urx)); showURI(new URI(urx)); System.err.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } - public static void showURL(URL url) { + public static void showURL(final URL url) { System.err.println("YYYYYY URL "+url); System.err.println("protocol: "+url.getProtocol()); System.err.println("auth: "+url.getAuthority()); @@ -22,7 +22,7 @@ public class URIDumpUtil { System.err.println("file: "+url.getFile() + " ( path " + url.getPath() + ", query " + url.getQuery() + " ) " ); System.err.println("ref: "+url.getRef()); } - public static void showURI(URI uri) { + public static void showURI(final URI uri) { System.err.println("ZZZZZZ URI "+uri); // 1 [scheme:]scheme-specific-part[#fragment] System.err.println("1 scheme: "+uri.getScheme()); |