GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
TestSystemPropsAndEnvs.java
Go to the documentation of this file.
1/**
2 * Copyright 2012 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28
29package com.jogamp.common.util;
30
31import java.io.IOException;
32import java.util.Iterator;
33import java.util.Map;
34import java.util.Properties;
35
36import org.junit.Test;
37
38import com.jogamp.junit.util.SingletonJunitCase;
39
40import org.junit.FixMethodOrder;
41import org.junit.runners.MethodSorters;
42
43@FixMethodOrder(MethodSorters.NAME_ASCENDING)
45
46 @Test
47 public void dumpProperties() {
48 int i=0;
49 final Properties props = System.getProperties();
50 final Iterator<Map.Entry<Object,Object>> iter = props.entrySet().iterator();
51 while (iter.hasNext()) {
52 i++;
53 final Map.Entry<Object, Object> entry = iter.next();
54 System.out.format("%4d: %s = %s%n", i, entry.getKey(), entry.getValue());
55 }
56 System.out.println("Property count: "+i);
57 }
58
59 private static String[] suppress_envs = new String[] { "COOKIE", "SSH", "GPG" };
60
61 private static boolean contains(final String data, final String[] search) {
62 if(null != data && null != search) {
63 for(int i=0; i<search.length; i++) {
64 if(data.indexOf(search[i]) >= 0) {
65 return true;
66 }
67 }
68 }
69 return false;
70 }
71
72 @Test
73 public void dumpEnvironment() {
74 int i=0;
75 final Map<String, String> env = System.getenv();
76 for (final String envName : env.keySet()) {
77 if(!contains(envName, suppress_envs)) {
78 i++;
79 System.out.format("%4d: %s = %s%n",
80 i, envName,
81 env.get(envName));
82 }
83 }
84 System.out.println("Environment count: "+i);
85 }
86
87 public static void main(final String args[]) throws IOException {
88 final String tstname = TestSystemPropsAndEnvs.class.getName();
89 org.junit.runner.JUnitCore.main(tstname);
90 }
91
92}