summaryrefslogtreecommitdiffstats
path: root/java/tests
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-07-21 15:03:14 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-07-21 15:03:14 +0000
commitb9535cfed51d92e1abff0134e74825b1eb38b11f (patch)
tree86b4f1ef4a64e037a9c833d545e0d0ac802c085f /java/tests
parent08254badc10dc83c4bb941e498aba0737deff485 (diff)
downloadlasso-b9535cfed51d92e1abff0134e74825b1eb38b11f.tar.gz
lasso-b9535cfed51d92e1abff0134e74825b1eb38b11f.tar.xz
lasso-b9535cfed51d92e1abff0134e74825b1eb38b11f.zip
Changed Makefile for Kaffe support.
Added new class LassoObject. First non regression test.
Diffstat (limited to 'java/tests')
-rw-r--r--java/tests/.cvsignore1
-rw-r--r--java/tests/LoginTest.java85
2 files changed, 86 insertions, 0 deletions
diff --git a/java/tests/.cvsignore b/java/tests/.cvsignore
new file mode 100644
index 00000000..6b468b62
--- /dev/null
+++ b/java/tests/.cvsignore
@@ -0,0 +1 @@
+*.class
diff --git a/java/tests/LoginTest.java b/java/tests/LoginTest.java
new file mode 100644
index 00000000..cac7bff0
--- /dev/null
+++ b/java/tests/LoginTest.java
@@ -0,0 +1,85 @@
+/*
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ * Emmanuel Raviart <eraviart@entrouvert.com>
+ *
+ * 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=../target/
+// $ javac -classpath /usr/share/java/junit.jar:../target/lasso.jar:.:/ LoginTest.java
+// $ java -classpath /usr/share/java/junit.jar:../target/lasso.jar:.:/ LoginTest
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import com.entrouvert.lasso.Lasso;
+import com.entrouvert.lasso.LassoServer;
+
+
+public class LoginTest extends TestCase {
+ public String generateIdentityProviderContextDump() {
+ LassoServer serverContext = new LassoServer(
+ "../../examples/data/idp-metadata.xml",
+ "../../examples/idp-public-key.pem",
+ "../../examples/idp-private-key.pem",
+ "../../examples/idp-crt.pem",
+ 1); // FIXME: Replace with lasso.signatureMethodRsaSha1
+ serverContext.addProvider(
+ "../../examples/data/sp-metadata.xml",
+ "../../examples/sp-public-key.pem",
+ "../../examples/ca-crt.pem");
+ String serverContextDump = serverContext.dump();
+ return serverContextDump;
+ }
+
+ public String generateServiceProviderContextDump() {
+ LassoServer serverContext = new LassoServer(
+ "../../examples/data/sp-metadata.xml",
+ "../../examples/sp-public-key.pem",
+ "../../examples/sp-private-key.pem",
+ "../../examples/sp-crt.pem",
+ 1); // FIXME: Replace with lasso.signatureMethodRsaSha1
+ serverContext.addProvider(
+ "../../examples/data/idp-metadata.xml",
+ "../../examples/idp-public-key.pem",
+ "../../examples/ca-crt.pem");
+ String serverContextDump = serverContext.dump();
+ return serverContextDump;
+ }
+
+ public void testSimpleAdd() {
+ String identityProviderContextDump = generateIdentityProviderContextDump();
+ assertNotNull(identityProviderContextDump);
+ String serviceProviderContextDump = generateServiceProviderContextDump();
+ assertNotNull(serviceProviderContextDump);
+ }
+
+ public static Test suite() {
+ return new TestSuite(LoginTest.class);
+ }
+
+ public static void main(String args[]) {
+ Lasso.init();
+ junit.textui.TestRunner.run(suite());
+ Lasso.shutdown();
+ }
+}