summaryrefslogtreecommitdiff
path: root/BKUCommonGUI/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'BKUCommonGUI/src/test')
-rw-r--r--BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java10
-rw-r--r--BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java90
-rw-r--r--BKUCommonGUI/src/test/resources/commons-logging.properties1
-rw-r--r--BKUCommonGUI/src/test/resources/log4j.properties19
4 files changed, 104 insertions, 16 deletions
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 4dc1f8b3..a9c21a00 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -21,6 +21,8 @@
package 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;
@@ -36,7 +38,9 @@ public class BKUGUITest {
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
BKUGUI gui = new BKUGUI();
- gui.init(testFrame.getContentPane(), null);
+ Container contentPane = testFrame.getContentPane();
+ contentPane.setPreferredSize(new Dimension(500, 200));
+ gui.init(contentPane, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
@@ -50,4 +54,8 @@ public class BKUGUITest {
@Test
public void dummyTest() {
}
+
+// public static void main(String[] args) {
+// new BKUGUITest().testBKUGUI();
+// }
}
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index e2f478c9..4367f642 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -26,7 +26,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.util.Collections;
+import java.util.ArrayList;
+import java.util.List;
/**
*
@@ -42,7 +43,7 @@ public class BKUGUIWorker implements Runnable {
@Override
public void run() {
- try {
+// try {
final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
@@ -77,11 +78,11 @@ public class BKUGUIWorker implements Runnable {
gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", null, "hashdata");
}
};
- HashDataInput signedRef = new HashDataInput() {
+ HashDataInput signedRef1 = new HashDataInput() {
@Override
public InputStream getHashDataInput() {
- return new ByteArrayInputStream("<xml>HashDataInput_002</xml>".getBytes());
+ return new ByteArrayInputStream("HashDataInput_001\n12345\n\tHello, world!\n12345\n\n12345\n6789\nblabla".getBytes());
}
@Override
@@ -91,10 +92,69 @@ public class BKUGUIWorker implements Runnable {
@Override
public String getReferenceId() {
- return "ref123";
+ return "Reference-ref1-00000000000000000000001";
}
};
- gui.showHashDataInputDialog(Collections.singletonList(signedRef), returnListener, "return");
+ HashDataInput signedRef2 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("<xml>HashDataInput_002</xml>".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "Reference-ref2-00000000000000000000002";
+ }
+ };
+ HashDataInput signedRef3 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("<xml>HashDataInput_003</xml>".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "Reference-ref3-00000000000000000000003";
+ }
+ };
+ HashDataInput signedRef4 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("<xml>HashDataInput_004</xml>".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "ref4";
+ }
+ };
+
+ //
+ List<HashDataInput> signedRefs = new ArrayList();
+ signedRefs.add(signedRef1);
+ signedRefs.add(signedRef2);
+ signedRefs.add(signedRef3);
+ signedRefs.add(signedRef4);
+// signedRefs = Collections.singletonList(signedRef1);
+ gui.showHashDataInputDialog(signedRefs, returnListener, "return");
}
};
@@ -105,7 +165,7 @@ public class BKUGUIWorker implements Runnable {
// Thread.sleep(2000);
// gui.showInsertCardDialog(cancelListener, "cancel");
-//
+
// Thread.sleep(2000);
//
// gui.showCardNotSupportedDialog(cancelListener, "cancel");
@@ -113,7 +173,7 @@ public class BKUGUIWorker implements Runnable {
// Thread.sleep(2000);
// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN");
-//
+////
// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel");
//
// Thread.sleep(2000);
@@ -121,11 +181,11 @@ public class BKUGUIWorker implements Runnable {
gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
- Thread.sleep(2000);
+// Thread.sleep(2000);
- gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
-
- Thread.sleep(2000);
+// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+//
+// Thread.sleep(2000);
////
// gui.showErrorDialog("Testfehler occured", null, null);
//
@@ -137,8 +197,8 @@ public class BKUGUIWorker implements Runnable {
// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
// Thread.sleep(2000);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
+// } catch (InterruptedException ex) {
+// ex.printStackTrace();
+// }
}
}
diff --git a/BKUCommonGUI/src/test/resources/commons-logging.properties b/BKUCommonGUI/src/test/resources/commons-logging.properties
new file mode 100644
index 00000000..29292562
--- /dev/null
+++ b/BKUCommonGUI/src/test/resources/commons-logging.properties
@@ -0,0 +1 @@
+org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
diff --git a/BKUCommonGUI/src/test/resources/log4j.properties b/BKUCommonGUI/src/test/resources/log4j.properties
new file mode 100644
index 00000000..053eac17
--- /dev/null
+++ b/BKUCommonGUI/src/test/resources/log4j.properties
@@ -0,0 +1,19 @@
+# loglever DEBUG, appender STDOUT
+log4j.rootLogger=TRACE, STDOUT
+#log4j.logger.at.gv.egiz.slbinding.RedirectEventFilter=DEBUG, STDOUT
+
+# STDOUT appender
+log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
+log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
+#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n
+#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+log4j.appender.STDOUT.layout.ConversionPattern=%-5p |%d | %t | %c %x- %m%n
+
+### FILE appender
+#log4j.appender.file=org.apache.log4j.RollingFileAppender
+#log4j.appender.file.maxFileSize=100KB
+#log4j.appender.file.maxBackupIndex=9
+#log4j.appender.file.File=egovbus_ca.log
+#log4j.appender.file.threshold=info
+#log4j.appender.file.layout=org.apache.log4j.PatternLayout
+#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n \ No newline at end of file