GlueGen: src/junit/com/jogamp/common/net/TestUrisWithAssetHandler.java Source File

GlueGen v2.6.0-rc-20250722 GlueGen, Native Binding Generator for Java™ (public API).

TestUrisWithAssetHandler.java
Go to the documentation of this file.
1package com.jogamp.common.net;
2
3import static com.jogamp.common.net.URIDumpUtil.showURX;
4
5import java.io.IOException;
6import java.net.URISyntaxException;
7
8import org.junit.Assert;
9import org.junit.BeforeClass;
10import org.junit.FixMethodOrder;
11import org.junit.Test;
12import org.junit.runners.MethodSorters;
13
14import com.jogamp.junit.util.SingletonJunitCase;
15
16@FixMethodOrder(MethodSorters.NAME_ASCENDING)
17public class TestUrisWithAssetHandler extends SingletonJunitCase {
18
19 @BeforeClass
20 public static void assetRegistration() throws Exception {
21 try {
22 System.err.println("******* Asset URL Stream Handler Registration: PRE");
23 Assert.assertTrue("GenericURLStreamHandlerFactory.register() failed", AssetURLContext.registerHandler(TestUrisWithAssetHandler.class.getClassLoader()));
24 Assert.assertNotNull(AssetURLContext.getRegisteredHandler());
25 System.err.println("******* Asset URL Stream Handler Registration: POST");
26 } catch (final Exception e) {
27 setTestSupported(false);
28 throw e;
29 }
30 }
31
32 @Test
33 public void showURLComponents0() throws IOException, URISyntaxException {
34 showURX("file:///rootDir/file1.txt");
35 showURX("file://host/rootDir/file1.txt");
36 showURX("jar:file:/web1/file1.jar!/rootDir/file1.txt");
37 showURX("asset:gluegen-test/info.txt");
38 showURX("asset:/gluegen-test/info.txt");
39 showURX("http://domain.com/web1/index.html?lala=23&lili=24#anchor");
40 showURX("http://domain.com:1234/web1/index.html?lala=23&lili=24#anchor");
41 showURX("asset:jar:file:/web1/file1.jar!/rootDir/file1.txt");
42 showURX("asset:jar:file:/web1/file1.jar!/rootDir/./file1.txt");
43 showURX("asset:jar:file:/web1/file1.jar!/rootDir/dummyParent/../file1.txt");
44 }
45
46 public static void main(final String args[]) throws IOException {
47 final String tstname = TestUrisWithAssetHandler.class.getName();
48 org.junit.runner.JUnitCore.main(tstname);
49 }
50}
com.jogamp.common.net.AssetURLContext
See PiggybackURLConnection for description and examples.
Definition: AssetURLContext.java:18
com.jogamp.common.net.AssetURLContext.registerHandler
static boolean registerHandler(final ClassLoader cl)
Registers the generic URLStreamHandlerFactory via GenericURLStreamHandlerFactory#register() and if su...
Definition: AssetURLContext.java:97
com.jogamp.common.net.AssetURLContext.getRegisteredHandler
static URLStreamHandler getRegisteredHandler()
Returns the asset handler previously set via registerHandler(ClassLoader), or null if none was set.
Definition: AssetURLContext.java:86
com.jogamp.common.net.TestUrisWithAssetHandler
Definition: TestUrisWithAssetHandler.java:17
com.jogamp.common.net.TestUrisWithAssetHandler.assetRegistration
static void assetRegistration()
Definition: TestUrisWithAssetHandler.java:20
com.jogamp.common.net.TestUrisWithAssetHandler.showURLComponents0
void showURLComponents0()
Definition: TestUrisWithAssetHandler.java:33
com.jogamp.common.net.TestUrisWithAssetHandler.main
static void main(final String args[])
Definition: TestUrisWithAssetHandler.java:46
com.jogamp.junit.util.SingletonJunitCase
Definition: SingletonJunitCase.java:39