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

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

TestAssetURLConnectionUnregistered.java
Go to the documentation of this file.
1package com.jogamp.common.net;
2
3import java.io.IOException;
4import java.net.URISyntaxException;
5import java.net.URL;
6import java.net.URLConnection;
7
8import org.junit.Assert;
9import org.junit.Test;
10
11import com.jogamp.common.util.IOUtil;
12
13import org.junit.FixMethodOrder;
14import org.junit.runners.MethodSorters;
15
16@FixMethodOrder(MethodSorters.NAME_ASCENDING)
17public class TestAssetURLConnectionUnregistered extends AssetURLConnectionBase {
18 @Test
19 public void assetUnregisteredURLConnection_RT2() throws IOException {
20 testAssetConnection(createAssetURLConnection(test_asset_rt2_url, this.getClass().getClassLoader()), test_asset_rt_entry);
21 }
22
23 @Test
24 public void assetUnregisteredURLConnection_RT() throws IOException {
25 testAssetConnection(createAssetURLConnection(test_asset_rt_url, this.getClass().getClassLoader()), test_asset_rt_entry);
26 }
27
28 @Test
29 public void assetUnregisteredURLConnection_Test() throws IOException {
30 testAssetConnection(createAssetURLConnection(test_asset_test1_url, this.getClass().getClassLoader()), test_asset_test1_entry);
31 }
32
33 @Test
34 public void assetUnregisteredIOUtilGetResourceAbs_RT() throws IOException {
35 final URLConnection c = IOUtil.getResource(test_asset_rt_entry, this.getClass().getClassLoader());
36 testAssetConnection(c, test_asset_rt_entry);
37 }
38
39 @Test
40 public void assetUnregisteredIOUtilGetResourceRel0_RT() throws IOException, URISyntaxException {
41 final URLConnection urlConn0 = IOUtil.getResource(test_asset_test2_rel.get(), this.getClass().getClassLoader(), this.getClass());
42 testAssetConnection(urlConn0, test_asset_test2_entry);
43
44 final Uri uri1 = Uri.valueOf(urlConn0.getURL()).getRelativeOf(test_asset_test3_rel);
45 Assert.assertNotNull(uri1); // JARFile URL ..
46 testAssetConnection(uri1.toURL().openConnection(), test_asset_test3_entry);
47
48 final Uri uri2 = Uri.valueOf(urlConn0.getURL()).getRelativeOf(test_asset_test4_rel);
49 Assert.assertNotNull(uri2);
50 testAssetConnection(uri2.toURL().openConnection(), test_asset_test4_entry);
51 }
52
53 protected static URLConnection createAssetURLConnection(final String path, final ClassLoader cl) throws IOException {
54 final URL url = AssetURLContext.createURL(path, cl);
55 final URLConnection c = url.openConnection();
56 System.err.println("createAssetURL: "+path+" -> url: "+url+" -> conn: "+c+" / connURL "+(null!=c?c.getURL():null));
57 return c;
58 }
59
60 public static void main(final String args[]) throws IOException {
61 final String tstname = TestAssetURLConnectionUnregistered.class.getName();
62 org.junit.runner.JUnitCore.main(tstname);
63 }
64}
com.jogamp.common.net.AssetURLConnectionBase
Definition: AssetURLConnectionBase.java:15
com.jogamp.common.net.AssetURLContext
See PiggybackURLConnection for description and examples.
Definition: AssetURLContext.java:18
com.jogamp.common.net.AssetURLContext.createURL
static URL createURL(final String path, final ClassLoader cl)
Create an asset URL, suitable even w/o the registered asset URLStreamHandler.
Definition: AssetURLContext.java:62
com.jogamp.common.net.TestAssetURLConnectionUnregistered
Definition: TestAssetURLConnectionUnregistered.java:17
com.jogamp.common.net.TestAssetURLConnectionUnregistered.assetUnregisteredURLConnection_RT2
void assetUnregisteredURLConnection_RT2()
Definition: TestAssetURLConnectionUnregistered.java:19
com.jogamp.common.net.TestAssetURLConnectionUnregistered.assetUnregisteredURLConnection_Test
void assetUnregisteredURLConnection_Test()
Definition: TestAssetURLConnectionUnregistered.java:29
com.jogamp.common.net.TestAssetURLConnectionUnregistered.assetUnregisteredIOUtilGetResourceAbs_RT
void assetUnregisteredIOUtilGetResourceAbs_RT()
Definition: TestAssetURLConnectionUnregistered.java:34
com.jogamp.common.net.TestAssetURLConnectionUnregistered.createAssetURLConnection
static URLConnection createAssetURLConnection(final String path, final ClassLoader cl)
Definition: TestAssetURLConnectionUnregistered.java:53
com.jogamp.common.net.TestAssetURLConnectionUnregistered.assetUnregisteredIOUtilGetResourceRel0_RT
void assetUnregisteredIOUtilGetResourceRel0_RT()
Definition: TestAssetURLConnectionUnregistered.java:40
com.jogamp.common.net.TestAssetURLConnectionUnregistered.main
static void main(final String args[])
Definition: TestAssetURLConnectionUnregistered.java:60
com.jogamp.common.net.TestAssetURLConnectionUnregistered.assetUnregisteredURLConnection_RT
void assetUnregisteredURLConnection_RT()
Definition: TestAssetURLConnectionUnregistered.java:24
com.jogamp.common.net.Uri
This class implements an immutable Uri as defined by RFC 2396.
Definition: Uri.java:160
com.jogamp.common.net.Uri.valueOf
static Uri valueOf(final File file)
Creates a new Uri instance using the given File instance.
Definition: Uri.java:1121
com.jogamp.common.net.Uri.getRelativeOf
Uri getRelativeOf(final Encoded appendPath)
Returns a new Uri appending the given appendPath to this instance's directory.
Definition: Uri.java:1709
com.jogamp.common.net.Uri.toURL
final java.net.URL toURL()
Returns a new URL instance using the encoded input string, new URL(uri.input), i.e.
Definition: Uri.java:1369
com.jogamp.common.util.IOUtil
Definition: IOUtil.java:69
com.jogamp.common.util.IOUtil.getResource
static URLConnection getResource(final String resourcePath, final ClassLoader classLoader, final Class<?> relContext)
Locating a resource using getResource(String, ClassLoader):
Definition: IOUtil.java:578