summaryrefslogtreecommitdiffstats
path: root/java/tests
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2005-01-15 14:43:26 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2005-01-15 14:43:26 +0000
commit8d53ec860626142e1b8d91de871c05b1e05d982e (patch)
tree7a50fac686287ecede284c0ded0821777cc4acb6 /java/tests
parente8de39bae08b511e9b62e71a7d52cce2df10d54f (diff)
downloadlasso-8d53ec860626142e1b8d91de871c05b1e05d982e.tar.gz
lasso-8d53ec860626142e1b8d91de871c05b1e05d982e.tar.xz
lasso-8d53ec860626142e1b8d91de871c05b1e05d982e.zip
Added first 2 binding tests for Java.
Corrected help for Java login test.
Diffstat (limited to 'java/tests')
-rw-r--r--java/tests/BindingTests.java86
-rw-r--r--java/tests/LoginTest.java12
2 files changed, 92 insertions, 6 deletions
diff --git a/java/tests/BindingTests.java b/java/tests/BindingTests.java
new file mode 100644
index 00000000..a09f4e20
--- /dev/null
+++ b/java/tests/BindingTests.java
@@ -0,0 +1,86 @@
+/*
+ * $Id$
+ *
+ * Java unit tests for Lasso library
+ *
+ * Copyright (C) 2004, 2005 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: See AUTHORS file.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+// To run it:
+// $ export LD_LIBRARY_PATH=../
+// $ javac -classpath /usr/share/java/junit.jar:../lasso.jar:. BindingTests.java
+// $ java -classpath /usr/share/java/junit.jar:../lasso.jar:. BindingTests
+// or for gcj:
+// $ export LD_LIBRARY_PATH=../
+// $ gcj -C -classpath /usr/share/java/junit.jar:../lasso.jar:. BindingTests.java
+// $ gij -classpath /usr/share/java/junit.jar:../lasso.jar:. BindingTests
+
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import com.entrouvert.lasso.*;
+
+
+public class BindingTests extends TestCase {
+ public void test01() {
+ // Create and delete nodes.
+ LibAuthnRequest authnRequest = new LibAuthnRequest();
+ authnRequest = null;
+ }
+
+ public void test02() {
+ // Get & set simple attributes of nodes.
+
+ LibAuthnRequest authnRequest = new LibAuthnRequest();
+
+ // Test a string attribute.
+ assertNull(authnRequest.getConsent());
+ authnRequest.setConsent(lasso.libConsentObtained);
+ assertEquals(authnRequest.getConsent(), lasso.libConsentObtained);
+ authnRequest.setConsent(null);
+ assertNull(authnRequest.getConsent());
+
+ // Test a renamed string attribute.
+ assertNull(authnRequest.getRelayState());
+ authnRequest.setRelayState("Hello World!");
+ assertEquals(authnRequest.getRelayState(), "Hello World!");
+ authnRequest.setRelayState(null);
+ assertNull(authnRequest.getRelayState());
+
+ // Test an integer attribute.
+ assertEquals(authnRequest.getMajorVersion(), 0);
+ authnRequest.setMajorVersion(314);
+ assertEquals(authnRequest.getMajorVersion(), 314);
+
+ authnRequest = null;
+ }
+
+ public static Test suite() {
+ return new TestSuite(BindingTests.class);
+ }
+
+ public static void main(String args[]) {
+ lasso.init();
+ junit.textui.TestRunner.run(suite());
+ lasso.shutdown();
+ }
+}
diff --git a/java/tests/LoginTest.java b/java/tests/LoginTest.java
index 9ff66239..996fc9d6 100644
--- a/java/tests/LoginTest.java
+++ b/java/tests/LoginTest.java
@@ -24,13 +24,13 @@
*/
// To run it:
-// $ export LD_LIBRARY_PATH=../target/
-// $ javac -classpath /usr/share/java/junit.jar:../target/lasso.jar:. LoginTest.java
-// $ java -classpath /usr/share/java/junit.jar:../target/lasso.jar:. LoginTest
+// $ export LD_LIBRARY_PATH=../
+// $ javac -classpath /usr/share/java/junit.jar:../lasso.jar:. LoginTest.java
+// $ java -classpath /usr/share/java/junit.jar:../lasso.jar:. LoginTest
// or for gcj:
-// $ export LD_LIBRARY_PATH=../target/
-// $ gcj -C -classpath /usr/share/java/junit.jar:../target/lasso.jar:. LoginTest.java
-// $ gij -classpath /usr/share/java/junit.jar:../target/lasso.jar:. LoginTest
+// $ export LD_LIBRARY_PATH=../
+// $ gcj -C -classpath /usr/share/java/junit.jar:../lasso.jar:. LoginTest.java
+// $ gij -classpath /usr/share/java/junit.jar:../lasso.jar:. LoginTest
import junit.framework.Test;