summaryrefslogtreecommitdiff
path: root/BKUGuiExt/src/test/java/at/gv/egiz
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-20 16:24:55 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-20 16:24:55 +0000
commit22001c93bca360d1b15c252cb22d2a4147ff350d (patch)
tree813f8cd7e0afa47a78ecc40cc8884eb770b89588 /BKUGuiExt/src/test/java/at/gv/egiz
parent2bd3c3e61966cf136d39826b6e1c6ff9fc946cef (diff)
downloadmocca-22001c93bca360d1b15c252cb22d2a4147ff350d.tar.gz
mocca-22001c93bca360d1b15c252cb22d2a4147ff350d.tar.bz2
mocca-22001c93bca360d1b15c252cb22d2a4147ff350d.zip
[#430] Activation/PIN-management in MOCCA Web Start
- new Modules: smccSTALExt, BKUGuiExt in order not to depend on BKUAppletExt in BKULocal - provide stal-request handler de-registration in abstractSMCCSTAL git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@448 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUGuiExt/src/test/java/at/gv/egiz')
-rw-r--r--BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java63
-rw-r--r--BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java203
2 files changed, 266 insertions, 0 deletions
diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
new file mode 100644
index 00000000..49ae577b
--- /dev/null
+++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
@@ -0,0 +1,63 @@
+/*
+* Copyright 2008 Federal Chancellery Austria and
+* Graz University of Technology
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import java.awt.Container;
+import java.awt.Dimension;
+import javax.swing.JFrame;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+/**
+ *
+ * @author clemens
+ */
+@Ignore
+public class ActivationGuiTest {
+
+ @Test
+ public void testBKUGUI() {
+ JFrame testFrame = new JFrame("BKUGUITest");
+ Container contentPane = testFrame.getContentPane();
+ contentPane.setPreferredSize(new Dimension(152, 145));
+// contentPane.setPreferredSize(new Dimension(300, 190));
+ ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null);
+ BKUGUIWorker worker = new BKUGUIWorker();
+ worker.init(gui);
+ testFrame.pack();
+ testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ testFrame.setVisible(true);
+ new Thread(worker).start();
+
+ while(true) ;
+ }
+
+ @Test
+ public void dummyTest() {
+ }
+
+// public static void main(String[] args) {
+// new BKUGUITest().testBKUGUI();
+// }
+}
diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
new file mode 100644
index 00000000..74ea8952
--- /dev/null
+++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.stal.HashDataInput;
+import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author clemens
+ */
+public class BKUGUIWorker implements Runnable {
+
+ ActivationGUIFacade gui;
+
+ public void init(ActivationGUIFacade gui) {
+ this.gui = gui;
+ }
+
+ @Override
+ public void run() {
+ try {
+
+ final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null);
+
+
+ final ActionListener cancelListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("CANCEL EVENT OCCURED: " + e);
+ }
+ };
+ ActionListener okListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("OK EVENT OCCURED: " + e);
+ }
+ };
+ final ActionListener signListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("SIGN EVENT OCCURED: " + e);
+ }
+ };
+ ActionListener hashdataListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("HASHDATA EVENT OCCURED: " + e);
+ ActionListener returnListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ gui.showSignaturePINDialog(signPinSpec, -1, signListener, "sign", cancelListener, "cancel", null, "hashdata");
+ }
+ };
+ HashDataInput signedRef1 = new ByteArrayHashDataInput(
+ "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(),
+ "ref-id-0000000000000000000000001",
+ "text/plain",
+ "UTF-8");
+
+ HashDataInput signedRef2 = new ByteArrayHashDataInput(
+ "<xml>HashDataInput_002</xml>".getBytes(),
+ "ref-id-000000002",
+ "application/xhtml+xml",
+ "UTF-8");
+
+ HashDataInput signedRef3 = new ByteArrayHashDataInput(
+ "<xml>HashDataInput_003</xml>".getBytes(),
+ "ref-id-000000003",
+ "application/xhtml+xml",
+ "UTF-8");
+
+ HashDataInput signedRef4 = new ByteArrayHashDataInput(
+ "<xml>HashDataInput_004</xml>".getBytes(),
+ "ref-id-000000004",
+ "text/xml",
+ "UTF-8");
+
+ //
+ List<HashDataInput> signedRefs = new ArrayList();
+ signedRefs.add(signedRef1);
+ signedRefs.add(signedRef2);
+ signedRefs.add(signedRef3);
+ signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs = Collections.singletonList(signedRef1);
+ gui.showSecureViewer(signedRefs, returnListener, "return");
+ }
+ };
+
+
+
+// gui.showWelcomeDialog();
+//
+// Thread.sleep(2000);
+//
+// gui.showWaitDialog(null);
+//
+// Thread.sleep(1000);
+//
+// gui.showWaitDialog("test");
+//
+// Thread.sleep(1000);
+//
+//
+// gui.showInsertCardDialog(cancelListener, "cancel");
+//
+// Thread.sleep(2000);
+//
+// gui.showCardNotSupportedDialog(cancelListener, "cancel");
+//
+// Thread.sleep(2000);
+//
+// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN");
+//
+// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel");
+//
+// Thread.sleep(2000);
+//
+// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+//
+// Thread.sleep(4000);
+//
+
+// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null);
+
+// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null);
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"});
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog("error.no.hashdata", null);
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"});
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog("error.unknown", null);
+
+ gui.showActivationProgressDialog(1, 3, null, null);
+
+ gui.incrementProgress();
+
+ Thread.sleep(1000);
+
+ gui.incrementProgress();
+
+ Thread.sleep(1000);
+
+ gui.incrementProgress();
+
+
+ Thread.sleep(1000);
+
+ gui.showIdleDialog(null, null);
+
+// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
+// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
+// Thread.sleep(2000);
+
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ }
+}