diff options
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/com/jogamp/gluegen/BuildUtil.java | 38 | ||||
-rw-r--r-- | test/junit/com/jogamp/gluegen/StructAccessorTest.java | 22 | ||||
-rw-r--r-- | test/junit/com/jogamp/gluegen/StructValidator.java | 34 |
3 files changed, 47 insertions, 47 deletions
diff --git a/test/junit/com/jogamp/gluegen/BuildUtil.java b/test/junit/com/jogamp/gluegen/BuildUtil.java index ce88ba2..5f6fd8b 100644 --- a/test/junit/com/jogamp/gluegen/BuildUtil.java +++ b/test/junit/com/jogamp/gluegen/BuildUtil.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.gluegen; import com.jogamp.gluegen.JavaEmitter; @@ -44,12 +44,12 @@ import static java.lang.System.*; public final class BuildUtil { private static final Project project; - + public static final String gluegenRoot; public static final String path; public static final String testOutput; public static final String rootrel_build; - + static { out.println(" - - - System info - - - "); @@ -65,11 +65,11 @@ public final class BuildUtil { // setup paths try { - File executionRoot = new File(BuildUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI()); + final File executionRoot = new File(BuildUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI()); out.println("execution root: " + executionRoot); gluegenRoot = executionRoot.getParentFile().getParentFile().getParentFile().getParentFile().toString(); out.println("gluegen project root: " + gluegenRoot); - } catch (URISyntaxException ex) { + } catch (final URISyntaxException ex) { throw new RuntimeException("can not determine gluegen root", ex); } @@ -88,7 +88,7 @@ public final class BuildUtil { passSystemProperty(project, "gluegen-cpptasks.file"); passSystemProperty(project, "os.arch"); - DefaultLogger logger = new DefaultLogger(); + final DefaultLogger logger = new DefaultLogger(); logger.setErrorPrintStream(out); logger.setOutputPrintStream(out); logger.setMessageOutputLevel(Project.MSG_WARN); @@ -96,7 +96,7 @@ public final class BuildUtil { project.init(); - File buildFile = new File(path, "build.xml"); + final File buildFile = new File(path, "build.xml"); if(!buildFile.exists()) { throw new RuntimeException("buildfile "+buildFile+" does not exist"); } @@ -104,8 +104,8 @@ public final class BuildUtil { ProjectHelper.configureProject(project, buildFile); } - public static Project passSystemProperty(Project p, String name) { - String tmp = System.getProperty(name); + public static Project passSystemProperty(final Project p, final String name) { + final String tmp = System.getProperty(name); if(null!=tmp && tmp.length()>0) { p.setProperty(name, tmp); } @@ -138,15 +138,15 @@ public final class BuildUtil { out.println("done"); } - public static void generate(String bindingName) { + public static void generate(final String bindingName) { generate(bindingName, JavaEmitter.class.getName()); // generate(bindingName, DebugEmitter.class.getName()); } - public static void generate(String bindingName, String emitter) { + public static void generate(final String bindingName, final String emitter) { generate(bindingName, bindingName, emitter); } - public static void generate(String bindingName, String header, String emitter) { + public static void generate(final String bindingName, final String header, final String emitter) { out.println("generate binding to '" + bindingName+"' using '"+emitter+"'"); @@ -159,10 +159,10 @@ public final class BuildUtil { out.println("done"); } - public static void deleteDirectory(File path) { + public static void deleteDirectory(final File path) { if(path.exists()) { - File[] files = path.listFiles(); + final File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); @@ -170,7 +170,7 @@ public final class BuildUtil { files[i].delete(); } } - + path.delete(); } } diff --git a/test/junit/com/jogamp/gluegen/StructAccessorTest.java b/test/junit/com/jogamp/gluegen/StructAccessorTest.java index 6c8d0e8..46191f1 100644 --- a/test/junit/com/jogamp/gluegen/StructAccessorTest.java +++ b/test/junit/com/jogamp/gluegen/StructAccessorTest.java @@ -76,30 +76,30 @@ public class StructAccessorTest { public void validateGeneratedStructs() throws IOException, NoSuchMethodException, ClassNotFoundException, IllegalAccessException, InvocationTargetException { // compile testcase - String source = gluegenRoot + "/test/junit/com/jogamp/gluegen/StructValidator.java"; + final String source = gluegenRoot + "/test/junit/com/jogamp/gluegen/StructValidator.java"; compile(new File(source), testOutput + "/build/classes"); // invoke test - Class<?> test = Class.forName("com.jogamp.gluegen.StructValidator"); + final Class<?> test = Class.forName("com.jogamp.gluegen.StructValidator"); test.getDeclaredMethod("validate").invoke(null); } - private void compile(File file, String dest) throws IOException { + private void compile(final File file, final String dest) throws IOException { compile(new File[] {file}, dest); } // yeah, java 6 has even a compiler api... - private void compile(File[] files, String destination) throws IOException { + private void compile(final File[] files, final String destination) throws IOException { out.println("compiling files:\n " + Arrays.asList(files)); - JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - DiagnosticCollector<JavaFileObject> collector = new DiagnosticCollector<JavaFileObject>(); - StandardJavaFileManager fileManager = compiler.getStandardFileManager(collector, null, null); + final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + final DiagnosticCollector<JavaFileObject> collector = new DiagnosticCollector<JavaFileObject>(); + final StandardJavaFileManager fileManager = compiler.getStandardFileManager(collector, null, null); - Iterable<? extends JavaFileObject> fileObj = fileManager.getJavaFileObjects(files); + final Iterable<? extends JavaFileObject> fileObj = fileManager.getJavaFileObjects(files); - boolean success = compiler.getTask( new OutputStreamWriter(out), + final boolean success = compiler.getTask( new OutputStreamWriter(out), fileManager, collector, Arrays.asList("-d", destination/*, "-verbose"*/), @@ -108,9 +108,9 @@ public class StructAccessorTest { fileManager.close(); - List<Diagnostic<? extends JavaFileObject>> list = collector.getDiagnostics(); + final List<Diagnostic<? extends JavaFileObject>> list = collector.getDiagnostics(); if(!list.isEmpty() || !success) { - for (Diagnostic<? extends JavaFileObject> d : list) { + for (final Diagnostic<? extends JavaFileObject> d : list) { out.println("Error on line "+ d.getLineNumber()); out.println("Compiler Message:\n"+d.getMessage(Locale.ENGLISH)); } diff --git a/test/junit/com/jogamp/gluegen/StructValidator.java b/test/junit/com/jogamp/gluegen/StructValidator.java index b6eb426..6637f4d 100644 --- a/test/junit/com/jogamp/gluegen/StructValidator.java +++ b/test/junit/com/jogamp/gluegen/StructValidator.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.gluegen; import java.lang.reflect.InvocationTargetException; @@ -45,17 +45,17 @@ public class StructValidator { System.out.println("validating struct accessors..."); - float[] mu = new float[] {1, 2, 3, 4}; - float[] light = new float[] {5, 6, 7}; - int fastRendering = 1; - int shadow = 42; - int iterations = 512; - int sss = 12; - float epsilon = (float) Math.PI; - int height = 640; - int width = 480; + final float[] mu = new float[] {1, 2, 3, 4}; + final float[] light = new float[] {5, 6, 7}; + final int fastRendering = 1; + final int shadow = 42; + final int iterations = 512; + final int sss = 12; + final float epsilon = (float) Math.PI; + final int height = 640; + final int width = 480; - structtest.RenderingConfig config = structtest.RenderingConfig.create(); + final structtest.RenderingConfig config = structtest.RenderingConfig.create(); //set config.setLight(light); @@ -68,7 +68,7 @@ public class StructValidator { config.setWidth(width); config.setHeight(height); - structtest.Camera camera = config.getCamera(); + final structtest.Camera camera = config.getCamera(); camera.getOrig().setX(1001).setY(1002).setZ(1003); camera.getDir().setX(2001).setY(2002).setZ(2003); @@ -96,7 +96,7 @@ public class StructValidator { } - private static final void assertArrayEquals(float[] a, float[] b) { + private static final void assertArrayEquals(final float[] a, final float[] b) { for (int i = 0; i < b.length; i++) { assertEquals(a[i], b[i], 0.0001f); } |