summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/uic/barcode/ticketTestDB
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2024-06-18 15:42:51 +0200
committerGitHub <noreply@github.com>2024-06-18 15:42:51 +0200
commit6b9254296a5b3b323c2e103db40865c01ffad005 (patch)
treea02e7adfe7c44ab01feaf94cd26689f9e09bfc62 /src/test/java/org/uic/barcode/ticketTestDB
parentMerge pull request #81 from UnionInternationalCheminsdeFer/fix_test_for_year_with_feb29 (diff)
parentCreate MAVticketTest.java (diff)
downloadUIC-barcode-1.4.6.tar
UIC-barcode-1.4.6.tar.gz
UIC-barcode-1.4.6.tar.bz2
UIC-barcode-1.4.6.tar.lz
UIC-barcode-1.4.6.tar.xz
UIC-barcode-1.4.6.tar.zst
UIC-barcode-1.4.6.zip
Diffstat (limited to 'src/test/java/org/uic/barcode/ticketTestDB')
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/BahnCardTest.java2
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java2
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java8
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/EurailPassTest.java4
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java10
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);