diff options
author | wbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-11-03 11:11:30 +0000 |
---|---|---|
committer | wbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-11-03 11:11:30 +0000 |
commit | 16b188bae57cfc10c94a0e251a815ab35345e113 (patch) | |
tree | c839c830a0152318117df5779365eb40bcca4a2a /smccSTAL/src/test/java/at/gv/egiz | |
parent | 9829de9c9b19dcca15676aaf9737195cc059a66c (diff) | |
download | mocca-16b188bae57cfc10c94a0e251a815ab35345e113.tar.gz mocca-16b188bae57cfc10c94a0e251a815ab35345e113.tar.bz2 mocca-16b188bae57cfc10c94a0e251a815ab35345e113.zip |
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@139 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccSTAL/src/test/java/at/gv/egiz')
-rw-r--r-- | smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java b/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java new file mode 100644 index 00000000..59ea141c --- /dev/null +++ b/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java @@ -0,0 +1,110 @@ +package at.gv.egiz.smcc;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import javax.smartcardio.Card;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL;
+import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
+import at.gv.egiz.stal.ErrorResponse;
+import at.gv.egiz.stal.InfoboxReadRequest;
+import at.gv.egiz.stal.InfoboxReadResponse;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+
+public class AbstractSMCCSTALTest extends AbstractSMCCSTAL implements
+ SMCCSTALRequestHandler {
+ private int errorConter;
+
+ @Override
+ protected BKUGUIFacade getGUI() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected boolean waitForCard() {
+ signatureCard = new SignatureCard() {
+
+ @Override
+ public byte[] createSignature(byte[] hash, KeyboxName keyboxName,
+ PINProvider provider) throws SignatureCardException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void disconnect(boolean reset) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public byte[] getCertificate(KeyboxName keyboxName)
+ throws SignatureCardException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public byte[] getInfobox(String infobox, PINProvider provider,
+ String domainId) throws SignatureCardException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void init(Card card) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ // TODO Auto-generated method stub
+
+ }
+
+ };
+ return false;
+ }
+
+ @Before
+ public void setUp() {
+ addRequestHandler(InfoboxReadRequest.class, this);
+ }
+
+ @Test
+ public void testRetry() {
+ InfoboxReadRequest irr = new InfoboxReadRequest();
+ List<STALRequest> irrl = new ArrayList<STALRequest>();
+ irrl.add(irr);
+ List<STALResponse> list = handleRequest(irrl);
+ Assert.assertFalse(list.get(0) instanceof ErrorResponse);
+ }
+
+ @Override
+ public STALResponse handleRequest(STALRequest request) {
+ if (++errorConter < 3) {
+ return new ErrorResponse(400);
+ }
+ return new InfoboxReadResponse();
+ }
+
+ @Override
+ public void init(SignatureCard sc, BKUGUIFacade gui) {
+ }
+
+ @Override
+ public boolean requireCard() {
+ return true;
+ }
+
+}
|