diff options
Diffstat (limited to 'src/test/java/org/uic/barcode/ticketTestDB')
5 files changed, 16 insertions, 10 deletions
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/BahnCardTest.java b/src/test/java/org/uic/barcode/ticketTestDB/BahnCardTest.java index 8a0dd8d..f89e7e7 100644 --- a/src/test/java/org/uic/barcode/ticketTestDB/BahnCardTest.java +++ b/src/test/java/org/uic/barcode/ticketTestDB/BahnCardTest.java @@ -61,7 +61,7 @@ public class BahnCardTest { assert(card.getCardTypeDescr().equals("My BahnCard 50 (2. Klasse)")); assert(card.getClassCode().equals(ITravelClassType.second)); assert(card.getExtension() != null); - assert(card.getIncludedServices().contains(new Integer(1))); + assert(card.getIncludedServices().contains(Integer.valueOf(1))); Assert.assertNotNull(card.getCustomer() != null); diff --git a/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java index 2898b59..90e33c1 100644 --- a/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java +++ b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java @@ -98,7 +98,7 @@ public class DecodeSparpreisTicketDBTest { Assert.assertNotNull(tl); assert(tl.getTrain().equals("ICE973")); String departureDate = tl.getDepartureDateTime().toString(); - assert(departureDate.equals("Fri Nov 06 11:58:00 CET 2020")); + assert(departureDate.equals("Thu Nov 05 11:58:00 CET 2020")); Assert.assertNull(layout); Assert.assertNotNull(decoder); } diff --git a/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java b/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java index 2cb6d69..cddcd60 100644 --- a/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java +++ b/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java @@ -5,6 +5,7 @@ import java.security.InvalidAlgorithmParameterException; import java.security.KeyPair;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
+import java.security.Provider;
import java.security.Security;
import java.util.TimeZone;
import java.util.zip.DataFormatException;
@@ -39,6 +40,8 @@ public class EncodeSparpreisTicketDBTest { public IUicRailTicket ticket = null;
TimeZone defaulttimeZone = null;
+
+ public Provider provider = null;
/**
* Prepare tickets.
@@ -57,7 +60,8 @@ public class EncodeSparpreisTicketDBTest { algorithmOID = Constants.DSA_SHA1;
keySize = 1024;
- Security.addProvider(new BouncyCastleProvider());
+ provider = new BouncyCastleProvider();
+ Security.addProvider(provider);
try {
keyPair = TestUtils.generateDSAKeys(keySize);
@@ -88,7 +92,7 @@ public class EncodeSparpreisTicketDBTest { public void testDecoder() throws Exception {
Encoder encoder = new Encoder(ticket, null, Encoder.UIC_BARCODE_TYPE_CLASSIC, 1, 2);
- encoder.signLevel1(securityProvider, keyPair.getPrivate(), algorithmOID, "1");
+ encoder.signLevel1(securityProvider, keyPair.getPrivate(), algorithmOID, "1", null);
byte[] encoded = encoder.encode();
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java b/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java index b75f248..cc317b8 100644 --- a/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java +++ b/src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java @@ -1,7 +1,6 @@ package org.uic.barcode.ticketTestDB; -import java.util.Base64; import java.util.TimeZone; import org.junit.After; @@ -12,7 +11,6 @@ import org.uic.barcode.Decoder; import org.uic.barcode.logger.LoggerFactory; import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout; import org.uic.barcode.test.utils.TestUtils; -import org.uic.barcode.ticket.api.spec.IUicRailTicket; public class EurailPassTest { @@ -70,7 +68,7 @@ public class EurailPassTest { // try to decode Decoder decoder = new Decoder(content); TicketLayout layout = decoder.getLayout(); - IUicRailTicket ticket = decoder.getUicTicket(); + //IUicRailTicket ticket = decoder.getUicTicket(); Assert.assertNotNull(layout); //Assert.assertNotNull(ticket); diff --git a/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java b/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java index e8922d2..d4b262f 100644 --- a/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java +++ b/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java @@ -2,6 +2,7 @@ package org.uic.barcode.ticketTestDB; import java.io.ByteArrayInputStream;
import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
import java.security.PublicKey;
import java.security.Security;
import java.security.cert.CertificateException;
@@ -23,6 +24,8 @@ import org.uic.barcode.logger.LoggerFactory; public class SignatureValidationDBTicketTest {
TimeZone defaulttimeZone = null;
+
+ Provider provider= null;
/**
* Prepare tickets.
@@ -30,8 +33,9 @@ public class SignatureValidationDBTicketTest { @Before public void prepare() {
LoggerFactory.setActivateConsoleLog(true);
-
- Security.addProvider(new BouncyCastleProvider());
+
+ provider = new BouncyCastleProvider();
+ Security.addProvider(provider);
defaulttimeZone = TimeZone.getDefault();
//decode in local CET time zone
@@ -63,7 +67,7 @@ public class SignatureValidationDBTicketTest { String algorithmOID = Constants.DSA_SHA256;
- int result = decoder.validateLevel1(getPublicKey2(), algorithmOID);
+ int result = decoder.validateLevel1(getPublicKey2(), algorithmOID,provider);
assert(result == 0);
|