Permalink
Browse files

- Added Java unitsync test program

- Added 2 JNA tests to the existing 4 JNI tests (you'll need to download jna.jar from the JNA website, which is around 286kb)

git-svn-id: https://spring.clan-sy.com/svn/spring/trunk@4410 37977431-3df6-0310-b722-df95706aa16b
  • Loading branch information...
1 parent 24a209f commit 9c6ee1f363c57338fe5f6b52e8947cc56742aba3 tnowell committed Sep 17, 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="UnitsyncTest" default="default" basedir=".">
+ <description>Builds, tests, and runs the project UnitsyncTest.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project properties
+ -post-init: called after initialization of project properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single file
+ -post-compile-single: called after javac compilation of single file
+ -pre-compile-test: called before javac compilation of JUnit tests
+ -post-compile-test: called after javac compilation of JUnit tests
+ -pre-compile-test-single: called before javac compilation of single JUnit test
+ -post-compile-test-single: called after javac compilation of single JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their own.)
+
+ Example of inserting an obfuscator after compilation could look like this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar-with-manifest: JAR building (if you are using a manifest)
+ -do-jar-without-manifest: JAR building (if you are not using a manifest)
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look like this:
+
+ <target name="run" depends="UnitsyncTest-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not only on
+ the compile target as the regular run target does. Again, for a list of available
+ properties which you can use, check the target you are overriding in the
+ nbproject/build-impl.xml file.
+
+ -->
+</project>
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=b8f0c183
+build.xml.script.CRC32=c545d1fa
+build.xml.stylesheet.CRC32=a12b3d02
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=b8f0c183
+nbproject/build-impl.xml.script.CRC32=f36f88b6
+nbproject/build-impl.xml.stylesheet.CRC32=295adcf5
@@ -0,0 +1,6 @@
+file.reference.jna.jar=C:\\Users\\AF-StandardUsr\\Documents\\NetBeansProjects\\UnitsyncTest\\jna.jar
+javac.debug=true
+javadoc.preview=true
+jaxws.endorsed.dir=C:\\Program Files (x86)\\NetBeans 6.0 200709120000\\java1\\modules\\ext\\jaxws21\\api
+user.properties.file=C:\\Users\\AF-StandardUsr\\.netbeans\\dev\\build.properties
+work.dir=D:\\Program Files (x86)\\Spring
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+ <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
@@ -0,0 +1,63 @@
+application.title=UnitsyncTest
+application.vendor=AF-StandardUsr
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/UnitsyncTest.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+excludes=
+file.reference.jna.jar=jna.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${file.reference.jna.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit.classpath}:\
+ ${libs.junit_4.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=unitsynctest.Main
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.java.j2seproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+ <name>UnitsyncTest</name>
+ <minimum-ant-version>1.6.5</minimum-ant-version>
+ <source-roots>
+ <root id="src.dir"/>
+ </source-roots>
+ <test-roots>
+ <root id="test.src.dir"/>
+ </test-roots>
+ </data>
+ </configuration>
+</project>
@@ -0,0 +1,28 @@
+/*
+ * CJNAUnitsync.java
+ *
+ * Created on 17-Sep-2007, 09:07:13
+ *
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package aflobby;
+
+/**
+ *
+ * @author AF-StandardUsr
+ */
+
+import com.sun.jna.*;
+import com.sun.jna.win32.StdCallLibrary;
+
+
+public interface CJNAUnitsync extends StdCallLibrary {
+
+ CJNAUnitsync INSTANCE = (CJNAUnitsync) Native.loadLibrary("unitsync", CJNAUnitsync.class);
+ CJNAUnitsync INSTANCE2 = (CJNAUnitsync) Native.loadLibrary("unitsyncVS2005", CJNAUnitsync.class);
+
+ public int Init(boolean isServer, int id);
+ String GetSpringVersion();
+}
@@ -0,0 +1,45 @@
+/*
+ * CUnitSync.java
+ *
+ * Created on 15-Sep-2007, 13:49:19
+ *
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package aflobby;
+
+/**
+ *
+ * @author AF-StandardUsr
+ */
+public class CUnitSync {
+ // load up the UnitSync.dll/UnitSync.so library
+ public static boolean loaded = false;
+
+ public static boolean LoadUnitSync(String lib) {
+ try {
+ //intendedpath = System.getProperty ("user.dir");
+ //System.out.println ("working directory : " + intendedpath);
+ //System.out.println ();
+ //System.out.println (intendedpath+"\\libjavaunitsync.so");
+ //System.out.println ();
+ System.loadLibrary(lib);
+// java.lang.Runtime.getRuntime ().load (intendedpath+System.getProperty ("file.separator")+"unitsync.dll");
+
+ loaded=true;
+ } catch (final java.lang.UnsatisfiedLinkError e) {
+ e.printStackTrace();
+ loaded=false;
+ } /*catch (Exception e){
+ // java.awt.EventQueue.invokeLater (new Runnable () {
+ // public void run () {
+ // new WarningWindow ("<font face=\"Arial\" color=\""+ColourHelper.ColourToHex (Color.WHITE)+"\"><font size=20>UnitSync Exception error</font><br><br> Make sure you have a JNI aware UnitSync library in the same folder as AFLobby, and that it is compiled correctly using the latest java bindings.<br><br> AFlobby needs the unitsync library to be able to use spring.<br><br>Linux users need libjavaunitsync.so<br><br> Windows users need javaunitsync.dll<br><br> Apple Mac users need libjavaunitsync.dylib (Mac is not entirely supported and upto date mac builds of unitsync arent included due to time restrictions)<br><br><br><br><b> path variable =</b> <i>"+ System.getProperty ("user.dir")+"</i><br> <b> library path = </b><i>"+System.getProperty("java.library.path")+"</i></font>",
+ // "UnitSync Error"
+ // ).setVisible (true);
+ // }
+ // });
+ // }*/
+ return loaded;
+ }
+}
Oops, something went wrong.

0 comments on commit 9c6ee1f

Please sign in to comment.