GlueGen: src/junit/com/jogamp/common/util/TestVersionInfo.java Source File

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

TestVersionInfo.java
Go to the documentation of this file.
1/**
2 * Copyright 2010 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.net.URISyntaxException;
33import java.security.NoSuchAlgorithmException;
34import org.junit.Test;
35
36import com.jogamp.common.GlueGenVersion;
37import com.jogamp.junit.util.SingletonJunitCase;
38
39import org.junit.Assert;
40import org.junit.FixMethodOrder;
41import org.junit.runners.MethodSorters;
42
43@FixMethodOrder(MethodSorters.NAME_ASCENDING)
44public class TestVersionInfo extends SingletonJunitCase {
45 static boolean VERBOSE = false;
46
47 @Test
48 public void test01Info() {
49 System.err.println(VersionUtil.getPlatformInfo());
50 System.err.println("Version Info:");
51 System.err.println(GlueGenVersion.getInstance());
52 System.err.println("");
53 System.err.println("Full Manifest:");
54 System.err.println(GlueGenVersion.getInstance().getFullManifestInfo(null));
55 }
56
57 @Test
58 public void test02ValidateSHA()
59 throws IllegalArgumentException, IOException, URISyntaxException, SecurityException, NoSuchAlgorithmException
60 {
61 final GlueGenVersion info = GlueGenVersion.getInstance();
62 final String shaClassesThis = info.getImplementationSHAClassesThis();
63 System.err.println("SHA CLASSES.this (build-time): "+shaClassesThis);
64
65 final GlueGenVersion.GluGenRTJarSHASum shaSum = new GlueGenVersion.GluGenRTJarSHASum();
66 final byte[] shasum = shaSum.compute(VERBOSE);
67 final String shaClasses = SHASum.toHexString(shasum, null).toString();
68 System.err.println("SHA CLASSES.this (now): "+shaClasses);
69 Assert.assertEquals("SHA not equal", shaClassesThis, shaClasses);
70 }
71
72 public static void main(final String args[]) throws IOException {
73 // VERBOSE = true;
74 final String tstname = TestVersionInfo.class.getName();
75 org.junit.runner.JUnitCore.main(tstname);
76 }
77
78}
com.jogamp.common.GlueGenVersion.GluGenRTJarSHASum
gluegen-rt.jar definition of SHASum.TempJarSHASum's specialization of SHASum.
Definition: GlueGenVersion.java:80
com.jogamp.common.GlueGenVersion
Definition: GlueGenVersion.java:44
com.jogamp.common.GlueGenVersion.getInstance
static GlueGenVersion getInstance()
Definition: GlueGenVersion.java:52
com.jogamp.common.util.JogampVersion.getFullManifestInfo
final StringBuilder getFullManifestInfo(final StringBuilder sb)
Definition: JogampVersion.java:246
com.jogamp.common.util.JogampVersion.getImplementationSHAClassesThis
final String getImplementationSHAClassesThis()
Returns the SHA of all concatenated class files of the local (jar) package subset.
Definition: JogampVersion.java:185
com.jogamp.common.util.SHASum
Utility class to produce secure hash (SHA) sums over diverse input sources.
Definition: SHASum.java:73
com.jogamp.common.util.SHASum.compute
final byte[] compute(final boolean verbose)
Implementation gathers all files traversing through given paths via IOUtil#filesOf(List,...
Definition: SHASum.java:190
com.jogamp.common.util.SHASum.toHexString
static StringBuilder toHexString(final byte[] shasum, StringBuilder sb)
Simple helper to print the given byte-array into a string, here appended to StringBuilder.
Definition: SHASum.java:129
com.jogamp.common.util.TestVersionInfo
Definition: TestVersionInfo.java:44
com.jogamp.common.util.TestVersionInfo.test02ValidateSHA
void test02ValidateSHA()
Definition: TestVersionInfo.java:58
com.jogamp.common.util.TestVersionInfo.test01Info
void test01Info()
Definition: TestVersionInfo.java:48
com.jogamp.common.util.TestVersionInfo.main
static void main(final String args[])
Definition: TestVersionInfo.java:72
com.jogamp.common.util.VersionUtil
Definition: VersionUtil.java:45
com.jogamp.common.util.VersionUtil.getPlatformInfo
static StringBuilder getPlatformInfo(StringBuilder sb)
Appends environment information like OS, JVM and CPU architecture properties to the StringBuilder.
Definition: VersionUtil.java:52
com.jogamp.junit.util.SingletonJunitCase
Definition: SingletonJunitCase.java:39