diff options
author | Sven Gothel <[email protected]> | 2011-09-23 13:17:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-23 13:17:36 +0200 |
commit | 9da5bc1fe999caa924bd8dceafeff93ddf9d16a0 (patch) | |
tree | 54a0206d47b03d1d914bb55707b52b2cabd829b5 /src/junit/com/jogamp/common | |
parent | 675ea2c9ee6308d439b2429d0863a634ba673eff (diff) |
TempJarCache/JNILibLoaderBase: Validate the to be loader JarFile's Certificates if caller has any. Add Convenient JNILibLoaderBase.addNativeJarLibs(..) method.
Diffstat (limited to 'src/junit/com/jogamp/common')
-rw-r--r-- | src/junit/com/jogamp/common/util/TestTempJarCache.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/junit/com/jogamp/common/util/TestTempJarCache.java b/src/junit/com/jogamp/common/util/TestTempJarCache.java index fca839b..e1e47af 100644 --- a/src/junit/com/jogamp/common/util/TestTempJarCache.java +++ b/src/junit/com/jogamp/common/util/TestTempJarCache.java @@ -41,6 +41,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.GlueGenVersion; +import com.jogamp.common.jvm.JNILibLoaderBase; import com.jogamp.common.os.NativeLibrary; import com.jogamp.common.os.Platform; import com.jogamp.common.util.cache.TempCacheReg; @@ -161,7 +162,7 @@ public class TestTempJarCache { Assert.assertTrue(TempCacheReg.isTempJarCacheUsed()); Assert.assertTrue(TempJarCache.isInitialized()); - TempJarCache.addAll(JarUtil.getJarFile(GlueGenVersion.class.getName(), getClass().getClassLoader())); + TempJarCache.addAll(GlueGenVersion.class, JarUtil.getJarFile(GlueGenVersion.class.getName(), getClass().getClassLoader())); File f0 = new File(TempJarCache.getTempFileCache().getTempDir(), "META-INF/MANIFEST.MF"); Assert.assertTrue(f0.exists()); @@ -179,7 +180,7 @@ public class TestTempJarCache { } @Test - public void testTempJarCache02LoadNativeLibrary() throws IOException { + public void testTempJarCache02AddNativeLibs() throws IOException { final String nativeJarName = "gluegen-rt-natives-"+Platform.getOSAndArch()+".jar"; final String libBaseName = "gluegen-rt"; final ClassLoader cl = getClass().getClassLoader(); @@ -190,7 +191,21 @@ public class TestTempJarCache { URL nativeJarURL = JarUtil.getJarURL(jarUrlRoot, nativeJarName); JarFile nativeJar = JarUtil.getJarFile(nativeJarURL, cl); - TempJarCache.addNativeLibs(nativeJar); + TempJarCache.addNativeLibs(TempJarCache.class, nativeJar); + String libFullPath = TempJarCache.findLibrary(libBaseName); + Assert.assertNotNull(libFullPath); + Assert.assertEquals(libBaseName, NativeLibrary.isValidNativeLibraryName(libFullPath, true)); + File f = new File(libFullPath); + Assert.assertTrue(f.exists()); + } + + @Test + public void testTempJarCache03AddNativeJarLibs() throws IOException { + final String libBaseName = "gluegen-rt"; + + JNILibLoaderBase.addNativeJarLibs(TempJarCache.class, libBaseName); + Assert.assertTrue(JNILibLoaderBase.isLoaded(libBaseName)); + String libFullPath = TempJarCache.findLibrary(libBaseName); Assert.assertNotNull(libFullPath); Assert.assertEquals(libBaseName, NativeLibrary.isValidNativeLibraryName(libFullPath, true)); |