From 667af128d0adfeee2aa4748ab58411c91bc4905f Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 26 Jan 2010 16:27:04 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/mocca/branches/mocca-1.2.11-sha2@600 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 62 ------- .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 199 --------------------- .../java/at/gv/egiz/bku/gui/DummyFontLoader.java | 41 ----- .../at/gv/egiz/bku/gui/SecureViewerDialogTest.java | 167 ----------------- .../src/test/resources/commons-logging.properties | 1 - .../src/test/resources/log4j.properties | 19 -- 6 files changed, 489 deletions(-) delete mode 100644 mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java delete mode 100644 mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java delete mode 100644 mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java delete mode 100644 mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java delete mode 100644 mocca-1.2.11/BKUCommonGUI/src/test/resources/commons-logging.properties delete mode 100644 mocca-1.2.11/BKUCommonGUI/src/test/resources/log4j.properties (limited to 'mocca-1.2.11/BKUCommonGUI/src/test') diff --git a/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java deleted file mode 100644 index fdd58850..00000000 --- a/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -* 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 java.awt.Container; -import java.awt.Dimension; -import javax.swing.JFrame; -import org.junit.Ignore; -import org.junit.Test; - - -/** - * - * @author clemens - */ -@Ignore -public class BKUGUITest { - - @Test - public void testBKUGUI() { - JFrame testFrame = new JFrame("BKUGUITest"); - Container contentPane = testFrame.getContentPane(); -// contentPane.setPreferredSize(new Dimension(170, 150)); - contentPane.setPreferredSize(new Dimension(290, 190)); - BKUGUIFacade gui = new BKUGUIImpl(contentPane, null, BKUGUIFacade.Style.advanced, null, new DummyFontLoader(), 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/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java deleted file mode 100644 index a2a84d6e..00000000 --- a/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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.smcc.PINSpec; -import at.gv.egiz.smcc.STARCOSCard; -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.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author clemens - */ -public class BKUGUIWorker implements Runnable { - - BKUGUIFacade gui; - - public void init(BKUGUIFacade gui) { - this.gui = gui; - } - - @Override - public void run() { - try { - - final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Test-PIN", (byte) 0x81, null); - final PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Test-PIN", (byte) 0x01, 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", - "file.txt"); - - HashDataInput signedRef2 = new ByteArrayHashDataInput( - "HashDataInput_002".getBytes(), - "ref-id-000000002", - "application/xhtml+xml", - "UTF-8", - "file.xhtml"); - - HashDataInput signedRef3 = new ByteArrayHashDataInput( - "HashDataInput_003".getBytes(), - "ref-id-000000003", - "application/xhtml+xml", - "UTF-8", - "file2.xhtml"); - - HashDataInput signedRef4 = new ByteArrayHashDataInput( - "HashDataInput_004".getBytes(), - "ref-id-000000004", - "text/xml", - "UTF-8", - "file.xml"); - - // - List 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, -1, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); - - gui.showSignatureDataDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); - Thread.sleep(2000); - - gui.showEnterPINDirect(signPinSpec, -1); -// -// 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.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(); - } - } -} diff --git a/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java b/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java deleted file mode 100644 index 505c4247..00000000 --- a/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ - -package at.gv.egiz.bku.gui; - -import at.gv.egiz.bku.gui.viewer.FontProviderException; -import at.gv.egiz.bku.gui.viewer.FontProvider; -import java.awt.Font; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author Clemens Orthacker - */ -public class DummyFontLoader implements FontProvider { - - protected final static Log log = LogFactory.getLog(DummyFontLoader.class); - - @Override - public Font getFont() throws FontProviderException { - log.debug("return font"); - return new Font("monospaced", Font.PLAIN, 10); - } - -} diff --git a/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java b/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java deleted file mode 100644 index 9bbc1b1a..00000000 --- a/mocca-1.2.11/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package at.gv.egiz.bku.gui; - -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.BufferedInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ResourceBundle; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - -/** - * - * @author clemens - */ -@Ignore -public class SecureViewerDialogTest { - - static SecureViewerDialog secureViewer; - static ResourceBundle messages; - - @BeforeClass - public static void setUpClass() throws Exception { - messages = ResourceBundle.getBundle("at/gv/egiz/bku/gui/Messages"); - secureViewer = new SecureViewerDialog(null, messages,null, null, new DummyFontLoader(), null); - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @Before - public void setUp() { - } - - @After - public void tearDown() { - } - - - @Test - @Ignore - public void testLatin1Supplement() throws UnsupportedEncodingException, FileNotFoundException, IOException { -// StringBuilder data = new StringBuilder(); -// data.append("\nhttp://www.unicode.org/charts/PDF/U0080.pdf\n"); -// for (int i = 0x0080; i <= 0x00ff; i++) { -// data.append((char) i); -// } -// System.out.println(data.toString()); - BufferedInputStream bis = new BufferedInputStream(new FileInputStream("/home/clemens/IAIK/MOCCA/encoding/test_iso-8859-1.txt")); - byte[] bytes = new byte[bis.available()]; - bis.read(bytes); - String s = new String(bytes, "iso-8859-1"); - System.out.println("read iso-8859-1 bytes " + s); - - secureViewer.setContent(new ByteArrayHashDataInput(s.getBytes("UTF-8"), "id-1", "text/plain", "iso-8859-1", "file.txt")); - - } - - @Test - @Ignore - public void testGreek() throws UnsupportedEncodingException { -// Font fm = new Font(Font.MONOSPACED, Font.PLAIN, 10); - Font fm = new Font("Lucida Sans Typewriter", Font.PLAIN, 18); //GothicBBB-MediumH", Font.PLAIN, 10); - System.out.println(fm.getFontName() + ", " + fm.getPSName() + ", " + fm); - - StringBuilder data = new StringBuilder(); - data.append("\nhttp://www.unicode.org/charts/PDF/U0370.pdf\n"); - for (int i = 0x0370; i <= 0x03ff; i++) { - if (!fm.canDisplay((char) i)) { - System.out.println("cannot display " + Integer.toHexString(i) ); - } - data.append((char) i); - } - - System.out.println(data.toString()); - secureViewer.setContent(new ByteArrayHashDataInput(data.toString().getBytes("UTF-8"), "id-1", "text/plain", "UTF-8", "file.txt")); - - } - - /** - * Test of setContent method, of class SecureViewerDialog. - */ - @Test -// @Ignore - public void testCyrillic() throws UnsupportedEncodingException { - - StringBuilder data = new StringBuilder("\n"); - - int[] mocca = new int[] {0x041c, 0x04a8, 0x0480, 0x0480, 0x0466 }; - - for (int i = 0; i < mocca.length; i++) { - data.append((char) mocca[i]); - } - data.append(" goes cyrillic\n"); - - data.append("\nCyrillic - http://www.unicode.org/charts/PDF/U0400.pdf\n"); - for (int i = 0x0400; i <= 0x04ff; i++) { -// System.out.printf("%c%04x=%c\t", (i & 7) == 0 ? '\n' : '\0', i, (char)i); -// System.out.print((char) i); - data.append((char)i); - } - - data.append("\n\nCyrillic Supplement - http://www.unicode.org/charts/PDF/U0500.pdf\n"); - for (int i = 0x0500; i <= 0x0525; i++) { -// System.out.printf("%c%04x=%c\t", (i & 7) == 0 ? '\n' : '\0', i, (char)i); -// System.out.print((char) i); - data.append((char) i); - } - - for (int i = 0; i < data.length(); i++) { - char c = data.charAt(i); - if (c >= '\u0400' && c <= '\u0525') { - System.out.println(c + "\tcyrillic"); - } else if (c < '\u007f') { - System.out.println(c + "\tlatin"); - } else { - System.out.println(c + "\tunknown"); - } - } - - System.out.println(data.toString()); - -// char[] cyrillicChars = new char[] {(char) 0x0411, (char) 0x0444}; -// System.out.println(new String(cyrillicChars)); // + ": " + SMCCHelper.toString(cyrillicBytes)); -// byte[] cyrillicBytes = new byte[] {(byte) 0x11, (byte) 0x04, (byte) 0x0444}; -// System.out.println(new String(cyrillicBytes, "UTF-8") + ": " + SMCCHelper.toString(cyrillicBytes)); - -// String encoding = "cp1252"; -// String data = "öäü߀"; -// byte[] bytes = data.getBytes(encoding); -// System.out.println(data + "\t" + SMCCHelper.toString(bytes)); -// byte[] bytes2 = data.getBytes("cp1252"); -// System.out.println(data + "\t" + SMCCHelper.toString(bytes2)); - - secureViewer.setContent(new ByteArrayHashDataInput(data.toString().getBytes("UTF-8"), "id-1", "text/plain", "UTF-8", "file.txt")); - - System.out.println("\n\n=============================\n"); -// -//// int[] mocca = new int[] {0x0428, 0x0429, 0x04a8, 0x04e8, 0x047a, 0x042d, 0x042d, 0x0421, 0x0421, 0x04d0, 0x0466 }; -// int[] mocca = new int[] {0x0429, 0x04a8, 0x0480, 0x0480, 0x0466 }; - for (int i = 0; i < mocca.length; i++) { - System.out.print((char) mocca[i]); - } -// for (int i = 0; i < mocca.length; i++) { -// System.out.printf(" 0x%04x", mocca[i]); -// } -// - System.out.println("\n=============================\n"); - - } - - -} \ No newline at end of file diff --git a/mocca-1.2.11/BKUCommonGUI/src/test/resources/commons-logging.properties b/mocca-1.2.11/BKUCommonGUI/src/test/resources/commons-logging.properties deleted file mode 100644 index 29292562..00000000 --- a/mocca-1.2.11/BKUCommonGUI/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/mocca-1.2.11/BKUCommonGUI/src/test/resources/log4j.properties b/mocca-1.2.11/BKUCommonGUI/src/test/resources/log4j.properties deleted file mode 100644 index 053eac17..00000000 --- a/mocca-1.2.11/BKUCommonGUI/src/test/resources/log4j.properties +++ /dev/null @@ -1,19 +0,0 @@ -# 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 -- cgit v1.2.3