From 9c6ee1f363c57338fe5f6b52e8947cc56742aba3 Mon Sep 17 00:00:00 2001 From: tnowell Date: Mon, 17 Sep 2007 08:35:02 +0000 Subject: [PATCH] - 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 --- tools/unitsync/JavaUnitsyncTest/build.xml | 69 ++ tools/unitsync/JavaUnitsyncTest/manifest.mf | 3 + .../JavaUnitsyncTest/nbproject/build-impl.xml | 610 ++++++++++++++++++ .../nbproject/genfiles.properties | 8 + .../nbproject/private/config.properties | 0 .../nbproject/private/private.properties | 6 + .../nbproject/private/private.xml | 4 + .../nbproject/project.properties | 63 ++ .../JavaUnitsyncTest/nbproject/project.xml | 16 + .../src/aflobby/CJNAUnitsync.java | 28 + .../src/aflobby/CUnitSync.java | 45 ++ .../src/aflobby/CUnitSyncJNIBindings.java | 157 +++++ .../src/aflobby/CUnitSyncJNIVersion.java | 47 ++ .../src/unitsynctest/CGUI.form | 113 ++++ .../src/unitsynctest/CGUI.java | 188 ++++++ .../src/unitsynctest/Main.java | 51 ++ 16 files changed, 1408 insertions(+) create mode 100644 tools/unitsync/JavaUnitsyncTest/build.xml create mode 100644 tools/unitsync/JavaUnitsyncTest/manifest.mf create mode 100644 tools/unitsync/JavaUnitsyncTest/nbproject/build-impl.xml create mode 100644 tools/unitsync/JavaUnitsyncTest/nbproject/genfiles.properties create mode 100644 tools/unitsync/JavaUnitsyncTest/nbproject/private/config.properties create mode 100644 tools/unitsync/JavaUnitsyncTest/nbproject/private/private.properties create mode 100644 tools/unitsync/JavaUnitsyncTest/nbproject/private/private.xml create mode 100644 tools/unitsync/JavaUnitsyncTest/nbproject/project.properties create mode 100644 tools/unitsync/JavaUnitsyncTest/nbproject/project.xml create mode 100644 tools/unitsync/JavaUnitsyncTest/src/aflobby/CJNAUnitsync.java create mode 100644 tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSync.java create mode 100644 tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIBindings.java create mode 100644 tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIVersion.java create mode 100644 tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.form create mode 100644 tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.java create mode 100644 tools/unitsync/JavaUnitsyncTest/src/unitsynctest/Main.java diff --git a/tools/unitsync/JavaUnitsyncTest/build.xml b/tools/unitsync/JavaUnitsyncTest/build.xml new file mode 100644 index 00000000000..b00b4a3932d --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/build.xml @@ -0,0 +1,69 @@ + + + + + + Builds, tests, and runs the project UnitsyncTest. + + + diff --git a/tools/unitsync/JavaUnitsyncTest/manifest.mf b/tools/unitsync/JavaUnitsyncTest/manifest.mf new file mode 100644 index 00000000000..1574df4a2de --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/tools/unitsync/JavaUnitsyncTest/nbproject/build-impl.xml b/tools/unitsync/JavaUnitsyncTest/nbproject/build-impl.xml new file mode 100644 index 00000000000..b7b777401d5 --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/nbproject/build-impl.xml @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + diff --git a/tools/unitsync/JavaUnitsyncTest/nbproject/genfiles.properties b/tools/unitsync/JavaUnitsyncTest/nbproject/genfiles.properties new file mode 100644 index 00000000000..8ee3c458c80 --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/nbproject/genfiles.properties @@ -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 diff --git a/tools/unitsync/JavaUnitsyncTest/nbproject/private/config.properties b/tools/unitsync/JavaUnitsyncTest/nbproject/private/config.properties new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/unitsync/JavaUnitsyncTest/nbproject/private/private.properties b/tools/unitsync/JavaUnitsyncTest/nbproject/private/private.properties new file mode 100644 index 00000000000..e0afc621e5f --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/nbproject/private/private.properties @@ -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 diff --git a/tools/unitsync/JavaUnitsyncTest/nbproject/private/private.xml b/tools/unitsync/JavaUnitsyncTest/nbproject/private/private.xml new file mode 100644 index 00000000000..cc2c0e57c4f --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/nbproject/private/private.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tools/unitsync/JavaUnitsyncTest/nbproject/project.properties b/tools/unitsync/JavaUnitsyncTest/nbproject/project.properties new file mode 100644 index 00000000000..7c04dcbdc7e --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/nbproject/project.properties @@ -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 diff --git a/tools/unitsync/JavaUnitsyncTest/nbproject/project.xml b/tools/unitsync/JavaUnitsyncTest/nbproject/project.xml new file mode 100644 index 00000000000..e66962140fe --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/nbproject/project.xml @@ -0,0 +1,16 @@ + + + org.netbeans.modules.java.j2seproject + + + UnitsyncTest + 1.6.5 + + + + + + + + + diff --git a/tools/unitsync/JavaUnitsyncTest/src/aflobby/CJNAUnitsync.java b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CJNAUnitsync.java new file mode 100644 index 00000000000..da903a8ec7d --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CJNAUnitsync.java @@ -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(); +} \ No newline at end of file diff --git a/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSync.java b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSync.java new file mode 100644 index 00000000000..65e03a66d5c --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSync.java @@ -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 ("UnitSync Exception error

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.

AFlobby needs the unitsync library to be able to use spring.

Linux users need libjavaunitsync.so

Windows users need javaunitsync.dll

Apple Mac users need libjavaunitsync.dylib (Mac is not entirely supported and upto date mac builds of unitsync arent included due to time restrictions)



path variable = "+ System.getProperty ("user.dir")+"
library path = "+System.getProperty("java.library.path")+"
", + // "UnitSync Error" + // ).setVisible (true); + // } + // }); + // }*/ + return loaded; + } +} diff --git a/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIBindings.java b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIBindings.java new file mode 100644 index 00000000000..50cc691b8fa --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIBindings.java @@ -0,0 +1,157 @@ +/* + * CUnitSyncJNIBindings.java + * + * Created on 31 May 2006, 14:43 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package aflobby; + +/** + * CUnitSyncJNIBindings.java + * + * + * + * @author AF + */ + +//CUnitSyncJNIBindings +public class CUnitSyncJNIBindings { + + /** + * Creates a new instance of CUnitSyncJNIBindings + */ + public CUnitSyncJNIBindings() { + } + + // 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 ("UnitSync Exception error

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.

AFlobby needs the unitsync library to be able to use spring.

Linux users need libjavaunitsync.so

Windows users need javaunitsync.dll

Apple Mac users need libjavaunitsync.dylib (Mac is not entirely supported and upto date mac builds of unitsync arent included due to time restrictions)



path variable = "+ System.getProperty ("user.dir")+"
library path = "+System.getProperty("java.library.path")+"
", + // "UnitSync Error" + // ).setVisible (true); + // } + // }); + // }*/ + return loaded; + } + + + public static native String GetSpringVersion(); + + public static native void Message(String p_szMessage); + + public static native int Init(boolean isServer, int id); + + public static native void UnInit(); + + public static native int ProcessUnits(); + + public static native int ProcessUnitsNoChecksum(); + + public static native String GetCurrentList(); + + public static native void AddClient(int id, String unitList); + + public static native void RemoveClient(int id); + + public static native String GetClientDiff(int id); + + public static native void InstallClientDiff(String diff); + + public static native int GetUnitCount(); + + public static native String GetUnitName(int unit); + + public static native String GetFullUnitName(int unit); + + public static native int IsUnitDisabled(int unit); + + public static native int IsUnitDisabledByClient(int unit, int clientId); + + //public static native int InitArchiveScanner(); + public static native void AddArchive(String name); + + public static native void AddAllArchives(String root); + + public static native String GetArchiveChecksum(String arname); //unsigned integer + + public static native int GetMapCount(); + + public static native String GetMapName(int index); + + //public static native int GetMapInfoEx(String name, MapInfo outInfo, int version); + //public static native int GetMapInfo(String name, MapInfo outInfo); + //public static native void* GetMinimap(String filename, int miplevel); + public static native int GetMapArchiveCount(String mapName); + + public static native String GetMapArchiveName(int index); + + public static native String GetMapChecksum(int index); // unsigned + + public static native int GetPrimaryModCount(); + + public static native String GetPrimaryModName(int index); + + public static native String GetPrimaryModArchive(int index); + + public static native int GetPrimaryModArchiveCount(int index); + + public static native String GetPrimaryModArchiveList(int arnr); + + public static native int GetPrimaryModIndex(String name); + + public static native String GetPrimaryModChecksum(int index); //unsigned + + public static native int GetSideCount(); + + public static native String GetSideName(int side); + + + public static native int OpenFileVFS(String name); + + public static native void CloseFileVFS(int handle); + + public static native String ReadFileVFS(int handle); + + public static native int FileSizeVFS(int handle); + + public static native int InitFindVFS (); + public static native String SearchVFS (String pattern);//////////// + public static native int OpenArchive(String name); + + public static native void CloseArchive(int archive); + + public static native int FindFilesArchive(int archive, int cur, String nameBuf, int size); + + public static native int OpenArchiveFile(int archive, String name); + + public static native String ReadArchiveFile(int archive, int handle); + + public static native void CloseArchiveFile(int archive, int handle); + + public static native int SizeArchiveFile(int archive, int handle); + + public static native String GetDataDirs(boolean write); + + public static native boolean WriteMiniMap(String mapfile, String imagename, int miplevel); +} diff --git a/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIVersion.java b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIVersion.java new file mode 100644 index 00000000000..7a9d4c466c8 --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/src/aflobby/CUnitSyncJNIVersion.java @@ -0,0 +1,47 @@ +/* + * CUnitSyncJNIVersion.java + * + * Created on 15-Sep-2007, 13:35:52 + * + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package aflobby; + +/** + * + * @author AF-StandardUsr + */ +public class CUnitSyncJNIVersion { + // 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 ("UnitSync Exception error

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.

AFlobby needs the unitsync library to be able to use spring.

Linux users need libjavaunitsync.so

Windows users need javaunitsync.dll

Apple Mac users need libjavaunitsync.dylib (Mac is not entirely supported and upto date mac builds of unitsync arent included due to time restrictions)



path variable = "+ System.getProperty ("user.dir")+"
library path = "+System.getProperty("java.library.path")+"
", + // "UnitSync Error" + // ).setVisible (true); + // } + // }); + // }*/ + return loaded; + } + + public static native int GetVersion(); +} diff --git a/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.form b/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.form new file mode 100644 index 00000000000..b4b4548b80f --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.form @@ -0,0 +1,113 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.java b/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.java new file mode 100644 index 00000000000..cb3e07e58c6 --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/CGUI.java @@ -0,0 +1,188 @@ +/* + * CGUI.java + * + * Created on 15 September 2007, 12:47 + */ + +package unitsynctest; + +import aflobby.CJNAUnitsync; +import aflobby.CUnitSyncJNIBindings; +import aflobby.CUnitSyncJNIVersion; +import java.awt.Color; + +/** + * + * @author AF-StandardUsr + */ +public class CGUI extends javax.swing.JFrame { + + /** Creates new form CGUI */ + public CGUI() { + initComponents(); + javax.swing.SwingUtilities.invokeLater (new Runnable () { + public void run () { + setLocationRelativeTo(null); + } + }); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jButton1 = new javax.swing.JButton(); + Test1 = new javax.swing.JLabel(); + Test2 = new javax.swing.JLabel(); + Test3 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + Test4 = new javax.swing.JLabel(); + Test5 = new javax.swing.JLabel(); + Test6 = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jButton1.setText("Run Tests"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + Test1.setText("Test 1 (mingw32)"); + + Test2.setText("Test 2 (VS2005)"); + + Test3.setText("Test 3 (JNI version bindings mingw32 (SVN only))"); + + jLabel1.setText("Click on Run tests to the right."); + + Test4.setText("Test 4 (JNI version Bindings VS2005 (SVN only))"); + + Test5.setText("Test 5 (JNA Mingw32)"); + + Test6.setText("Test 6 (JNA VS2005)"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(Test3) + .addComponent(Test4) + .addComponent(Test2) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 122, Short.MAX_VALUE) + .addComponent(jButton1)) + .addComponent(Test1) + .addComponent(Test5) + .addComponent(Test6)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jButton1)) + .addGap(15, 15, 15) + .addComponent(Test1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(Test2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(Test3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(Test4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(Test5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(Test6) + .addContainerGap(37, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + jButton1.setEnabled(false); + + CUnitSyncJNIBindings.LoadUnitSync("unitsync"); + if(CUnitSyncJNIBindings.loaded){ + Test1.setForeground(Color.GREEN); + }else{ + Test1.setForeground(Color.RED); + } + + CUnitSyncJNIVersion.LoadUnitSync("unitsync"); + if(CUnitSyncJNIVersion.loaded){ + Test3.setForeground(Color.GREEN); + }else{ + Test3.setForeground(Color.RED); + } + + CUnitSyncJNIBindings.LoadUnitSync("unitsyncvs2005"); + if(CUnitSyncJNIBindings.loaded){ + Test2.setForeground(Color.GREEN); + }else{ + Test2.setForeground(Color.RED); + } + + CUnitSyncJNIVersion.LoadUnitSync("unitsyncvs2005"); + if(CUnitSyncJNIVersion.loaded){ + Test4.setForeground(Color.GREEN); + }else{ + Test4.setForeground(Color.RED); + } + + try{ + CJNAUnitsync c1 = CJNAUnitsync.INSTANCE; + String s = c1.GetSpringVersion(); + Test5.setForeground(Color.GREEN); + Test5.setText("Test 5 (JNA Mingw32) spring version: "+s); + } catch (Exception e){ + Test5.setForeground(Color.RED); + Test5.setText("Test 5 (JNA Mingw32)"); + } + + try{ + CJNAUnitsync c1 = CJNAUnitsync.INSTANCE2; + String s = c1.GetSpringVersion(); + Test6.setForeground(Color.GREEN); + Test6.setText("Test 6 (JNA VS2005) spring version: "+s); + } catch (Exception e){ + Test6.setForeground(Color.RED); + Test6.setText("Test 6 (JNA VS2005)"); + } + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new CGUI().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel Test1; + private javax.swing.JLabel Test2; + private javax.swing.JLabel Test3; + private javax.swing.JLabel Test4; + private javax.swing.JLabel Test5; + private javax.swing.JLabel Test6; + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + // End of variables declaration//GEN-END:variables + +} diff --git a/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/Main.java b/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/Main.java new file mode 100644 index 00000000000..139daeb7d86 --- /dev/null +++ b/tools/unitsync/JavaUnitsyncTest/src/unitsynctest/Main.java @@ -0,0 +1,51 @@ +/* + * Main.java + * + * Created on 15-Sep-2007, 12:47:38 + * + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package unitsynctest; + +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +/** + * + * @author AF-StandardUsr + */ +public class Main { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + javax.swing.SwingUtilities.invokeLater (new Runnable () { + public void run () { + CreateGUI (); + } + }); + } + + /** + * Creates the programs GUI window + */ + public static void CreateGUI() { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException ex) { + ex.printStackTrace (); + } catch (UnsupportedLookAndFeelException ex) { + ex.printStackTrace (); + } catch (InstantiationException ex) { + ex.printStackTrace (); + } catch (IllegalAccessException ex) { + ex.printStackTrace (); + } + + CGUI c =new CGUI (); + c.setVisible (true); + } +}