GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
TestUriQueryProps.java
Go to the documentation of this file.
1package com.jogamp.common.net;
2
3import static com.jogamp.common.net.URIDumpUtil.showUri;
4
5import java.io.IOException;
6import java.net.URISyntaxException;
7
8import org.junit.Assert;
9import org.junit.Test;
10
11import com.jogamp.junit.util.SingletonJunitCase;
12
13import org.junit.FixMethodOrder;
14import org.junit.runners.MethodSorters;
15
16@FixMethodOrder(MethodSorters.NAME_ASCENDING)
18
19 @Test
20 public void test() throws IOException, URISyntaxException {
21 final String SCHEME = "camera";
22 final String HOST = "somewhere";
23 final String PATH = "0";
24 final String[] args = new String[] {
25 SCHEME+"://"+HOST+"/"+PATH,
26 SCHEME+"://"+HOST+"/"+PATH+"?p1=1",
27 };
28 for(int i=0; i<args.length-1; i+=2) {
29 final String uri_s0 = args[i];
30 final String uri_s1 = args[i+1];
31 final Uri uri0 = Uri.cast(uri_s0);
32 final Uri uri1 = Uri.cast(uri_s1);
33 showUri(uri0);
34 showUri(uri1);
35 final UriQueryProps data = UriQueryProps.create(uri1, ';');
36 if(null == data) {
37 System.err.println("Error: NULL: <"+uri_s1+"> -> "+uri1+" -> NULL");
38 } else {
39 final Uri uri1T = data.appendQuery(uri0);
40 showUri(uri1T);
41 Assert.assertEquals(uri1, uri1T);
42 }
43 }
44 }
45 public static void main(final String args[]) throws IOException {
46 final String tstname = TestUriQueryProps.class.getName();
47 org.junit.runner.JUnitCore.main(tstname);
48 }
49}
static void main(final String args[])
Helper class to process URI's query, handled as properties.
final Uri.Encoded appendQuery(Uri.Encoded baseQuery)
static final UriQueryProps create(final Uri uri, final char querySeparator)
This class implements an immutable Uri as defined by RFC 2396.
Definition: Uri.java:160
static Uri cast(final String encodedUri)
Casts the given encoded String to a new Encoded instance used to create the resulting Uri instance vi...
Definition: Uri.java:1068