summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java8
-rw-r--r--src/main/java/org/uic/barcode/asn1/uper/StringCoder.java8
-rw-r--r--src/main/java/org/uic/barcode/logger/Logger.java20
-rw-r--r--src/main/java/org/uic/barcode/logger/LoggerFactory.java55
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeBitStringTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java7
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedStringLengthTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java7
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeStringCustomAlphabetTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java6
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeStringTest.java5
-rw-r--r--src/test/java/org/uic/barcode/asn1/test/UperEncodeVarBitStringTest.java5
-rw-r--r--src/test/java/org/uic/barcode/test/AsnLevelDynamicContentTest.java5
-rw-r--r--src/test/java/org/uic/barcode/test/BinaryStringTest.java7
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureProviderSelectionTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentApiTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion1Test.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameLOwLevelTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameSimpleTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameV2FcbVersion3Test.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsert2Test.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsertTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameV2ValidityDateTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/SignatureSplitTest.java17
-rw-r--r--src/test/java/org/uic/barcode/test/StaticFrameBarcodeTest.java3
-rw-r--r--src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java3
-rw-r--r--src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB3.java3
-rw-r--r--src/test/java/org/uic/barcode/test/TicketLayoutTest.java5
-rw-r--r--src/test/java/org/uic/barcode/test/TimeStampTest.java5
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java4
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java7
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java697
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java697
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java697
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java631
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV3.java631
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java5
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java5
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java6
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java6
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java20
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java3
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV3.java3
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java7
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java4
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java3
103 files changed, 2133 insertions, 1721 deletions
diff --git a/pom.xml b/pom.xml
index 675888e..20ee16e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.uic.barcode</groupId>
<artifactId>org.uic.barcode</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.1</version>
<packaging>jar</packaging>
<name>UIC barcode</name>
<description>encoding and decoding of bar code content according to UIC IRS 90918-9</description>
diff --git a/src/main/java/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java b/src/main/java/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java
index 4924b50..8e24222 100644
--- a/src/main/java/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java
+++ b/src/main/java/org/uic/barcode/asn1/datatypes/Asn1SequenceOf.java
@@ -3,8 +3,7 @@ package org.uic.barcode.asn1.datatypes;
import java.lang.reflect.ParameterizedType;
import java.util.*;
-import org.uic.barcode.logger.Logger;
-import org.uic.barcode.logger.LoggerFactory;
+import org.uic.barcode.asn1.uper.UperEncoder;
/**
@@ -35,8 +34,7 @@ import org.uic.barcode.logger.LoggerFactory;
* @param <T> type of elements contained.
*/
public abstract class Asn1SequenceOf<T> extends AbstractList<T> {
- private final static Logger logger = LoggerFactory.getLogger("asnLogger");
-
+
private final List<T> bakingList;
@Override public T get(int index) { return bakingList.get(index); }
@@ -45,7 +43,7 @@ public abstract class Asn1SequenceOf<T> extends AbstractList<T> {
public Asn1SequenceOf() { this(new ArrayList<T>()); }
public Asn1SequenceOf(Collection<T> coll) {
- logger.debug(String.format("Instantiating Sequence Of %s with %s",
+ UperEncoder.logger.debug(String.format("Instantiating Sequence Of %s with %s",
((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0],
coll));
bakingList = new ArrayList<>(coll);
diff --git a/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java b/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java
index a504096..94e0aad 100644
--- a/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java
+++ b/src/main/java/org/uic/barcode/asn1/uper/StringCoder.java
@@ -17,14 +17,10 @@ import org.uic.barcode.asn1.datatypes.DefaultAlphabet;
import org.uic.barcode.asn1.datatypes.FixedSize;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.SizeRange;
-import org.uic.barcode.logger.Logger;
-import org.uic.barcode.logger.LoggerFactory;
class StringCoder implements Decoder, Encoder {
- private static final Logger LOGGER = LoggerFactory.getLogger("asnLogger");
-
@Override public <T> boolean canEncode(T obj, Annotation[] extraAnnotations) {
return obj instanceof String || obj instanceof Asn1String;
}
@@ -231,7 +227,7 @@ class StringCoder implements Decoder, Encoder {
try {
chars = UperEncoder.instantiate(restriction.alphabet()).chars().toCharArray();
} catch (IllegalArgumentException e) {
- LOGGER.info("Uninstantinatable alphabet ", e);
+ UperEncoder.logger.info("Uninstantinatable alphabet ", e);
throw new IllegalArgumentException("Uninstantinatable alphabet" + restriction.alphabet().getName());
}
if (BigInteger.valueOf(chars.length - 1).bitLength() < BigInteger.valueOf(126)
@@ -293,7 +289,7 @@ class StringCoder implements Decoder, Encoder {
try {
chars = UperEncoder.instantiate(restrictionAnnotation.alphabet()).chars().toCharArray();
} catch (IllegalArgumentException e) {
- LOGGER.info("Uninstantinatable alphabet ", e);
+ UperEncoder.logger.info("Uninstantinatable alphabet ", e);
throw new IllegalArgumentException("Uninstantinatable alphabet " + restrictionAnnotation.alphabet().getName());
}
if (BigInteger.valueOf(chars.length - 1).bitLength() < BigInteger.valueOf(126)
diff --git a/src/main/java/org/uic/barcode/logger/Logger.java b/src/main/java/org/uic/barcode/logger/Logger.java
index b536154..baae70d 100644
--- a/src/main/java/org/uic/barcode/logger/Logger.java
+++ b/src/main/java/org/uic/barcode/logger/Logger.java
@@ -3,11 +3,23 @@ package org.uic.barcode.logger;
import java.util.logging.Level;
-public class Logger {
+public class Logger {
+
+ private boolean consoleLog = false;
+
+ public Logger(boolean consoleLog) {
+ this.consoleLog = consoleLog;
+ }
+
+ public Logger() {
+ this.consoleLog = false;
+ }
public void debug(String text){
java.util.logging.Logger.getGlobal().log(Level.FINEST,text);
- System.out.println(text);
+ if (consoleLog) {
+ System.out.println(text);
+ }
}
public void log(Level level,String text){
@@ -17,6 +29,10 @@ public class Logger {
public void info(String text, IllegalArgumentException e) {
java.util.logging.Logger.getGlobal().log(Level.INFO,text);
}
+
+ public void activateConsoleLog(boolean consoleLogActive) {
+ this.consoleLog = consoleLogActive;
+ }
}
diff --git a/src/main/java/org/uic/barcode/logger/LoggerFactory.java b/src/main/java/org/uic/barcode/logger/LoggerFactory.java
index 0a1a83c..be5736e 100644
--- a/src/main/java/org/uic/barcode/logger/LoggerFactory.java
+++ b/src/main/java/org/uic/barcode/logger/LoggerFactory.java
@@ -1,9 +1,60 @@
package org.uic.barcode.logger;
+import java.util.HashMap;
+
+/**
+ * A factory for creating Logger objects. This allows to replace the default logger by your own loggers.
+ */
public class LoggerFactory {
+
+ /** The registered loggers. */
+ private static HashMap<String,Logger> registeredLoggers = new HashMap<String,Logger>();
+
+ /** The activate console log. */
+ public static boolean activateConsoleLog = false;
+
+ /**
+ * Gets the logger.
+ *
+ * @param name the name of the logger. UperEncoder uses asnLogger
+ * @return the logger
+ */
public static Logger getLogger(String name) {
- return new Logger();
- }
+ Logger logger = registeredLoggers.get(name);
+ if (logger == null) {
+ logger = new Logger(activateConsoleLog);
+ registeredLoggers.put(name, logger);
+ }
+ return logger;
+ }
+ /**
+ * Checks if console log is on.
+ *
+ * @return true, if console log is on
+ */
+ public static boolean isActivateConsoleLog() {
+ return activateConsoleLog;
+ }
+
+ /**
+ * Sets the console log on
+ *
+ * @param activateConsoleLog the new activate console log
+ */
+ public static void setActivateConsoleLog(boolean activateConsoleLog) {
+ LoggerFactory.activateConsoleLog = activateConsoleLog;
+ }
+
+ /**
+ * Register logger.
+ *
+ * @param name the name of the logger
+ * @param logger the logger to be registered
+ */
+ public void registerLogger(String name, Logger logger) {
+ registeredLoggers.put(name, logger);
+ }
+
}
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeBitStringTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeBitStringTest.java
index 94f29c2..9906fa0 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeBitStringTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeBitStringTest.java
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.Bitstring;
@@ -12,6 +13,7 @@ import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.FixedSize;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeBitStringTest {
@@ -55,6 +57,10 @@ public class UperEncodeBitStringTest {
booleans.add(value3);
}
}
+
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java
index b5e73b0..dea2716 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeBooleanTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeBooleanTest {
@@ -36,6 +38,9 @@ public class UperEncodeBooleanTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testTrue() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord(new Boolean(true));
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java
index 3833ff2..94fbee7 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceExtensionTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -13,6 +14,7 @@ import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
import org.uic.barcode.asn1.datatypes.IsExtension;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeChoiceExtensionTest {
@@ -58,6 +60,9 @@ public class UperEncodeChoiceExtensionTest {
public TestRecord() { }
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
TestRecordExtended record = new TestRecordExtended();
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java
index 69b92d1..ebd994f 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeChoiceTest.java
@@ -4,12 +4,14 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
import org.uic.barcode.asn1.datatypes.Choice;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeChoiceTest {
@@ -48,6 +50,10 @@ public class UperEncodeChoiceTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
+
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord(null, "Meier");
byte[] encoded = UperEncoder.encode(record);
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java
index a2ecbe1..fdbcd5c 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumExtensionTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.FieldOrder;
@@ -11,6 +12,7 @@ import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
import org.uic.barcode.asn1.datatypes.IsExtension;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeEnumExtensionTest {
@@ -105,6 +107,9 @@ public class UperEncodeEnumExtensionTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testExtension() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumTest.java
index d1d2d82..a99a1b9 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeEnumTest.java
@@ -4,12 +4,14 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Default;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeEnumTest {
@@ -79,7 +81,9 @@ public class UperEncodeEnumTest {
}
}
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testNonDefaultValue() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java
index ff97c27..6a7680d 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeExtensionFieldOrderTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
import org.uic.barcode.asn1.datatypes.FieldOrder;
@@ -11,6 +12,7 @@ import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
import org.uic.barcode.asn1.datatypes.IsExtension;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeExtensionFieldOrderTest {
@@ -69,6 +71,10 @@ Encoded successfully in 21 bytes:
}
+
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java
index d86b4cd..9f38d69 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeFieldOrderTest.java
@@ -2,6 +2,7 @@ package org.uic.barcode.asn1.test;
import static org.junit.Assert.assertEquals;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -9,6 +10,7 @@ import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeFieldOrderTest {
@@ -46,6 +48,9 @@ public class UperEncodeFieldOrderTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java
index 575597f..2f46046 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerConstrainedTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.IntRange;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeIntegerConstrainedTest {
@@ -50,7 +52,9 @@ public class UperEncodeIntegerConstrainedTest {
}
}
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java
index acec756..bde0683 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerExtensionTest.java
@@ -2,6 +2,7 @@ package org.uic.barcode.asn1.test;
import static org.junit.Assert.assertEquals;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
import org.uic.barcode.asn1.datatypes.FieldOrder;
@@ -9,6 +10,7 @@ import org.uic.barcode.asn1.datatypes.HasExtensionMarker;
import org.uic.barcode.asn1.datatypes.IsExtension;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeIntegerExtensionTest {
@@ -69,7 +71,10 @@ Encoded successfully in 21 bytes:
}
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
+
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord();
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java
index 5ada54d..39bfb32 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerSmallTest.java
@@ -4,10 +4,12 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeIntegerSmallTest {
@@ -40,6 +42,9 @@ public class UperEncodeIntegerSmallTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test1() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java
index d57fd00..412689b 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeIntegerTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeIntegerTest {
@@ -36,6 +38,9 @@ public class UperEncodeIntegerTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java
index 4b09604..f3a23a3 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeObjectIdentifierTest.java
@@ -3,12 +3,14 @@ package org.uic.barcode.asn1.test;
import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeObjectIdentifierTest {
@@ -49,6 +51,10 @@ public class UperEncodeObjectIdentifierTest {
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
+
@Test
public void testEncode() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord();
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java
index 24896f0..89041cc 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeOctetStringTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.OctetString;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeOctetStringTest {
@@ -40,6 +42,9 @@ public class UperEncodeOctetStringTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java
index 55e6026..bfb6a74 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeOptionalSequenceExtensionTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -13,6 +14,7 @@ import org.uic.barcode.asn1.datatypes.IsExtension;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeOptionalSequenceExtensionTest {
@@ -69,6 +71,9 @@ public class UperEncodeOptionalSequenceExtensionTest {
public TestRecord() { }
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
TestRecordExtended record = new TestRecordExtended();
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java
index bc82621..f806c88 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedIntegerTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.IntRange;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeRestrictedIntegerTest {
@@ -36,6 +38,10 @@ TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE {
value = num;
}
}
+
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedStringLengthTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedStringLengthTest.java
index 6e3d4ee..9dffd3a 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedStringLengthTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeRestrictedStringLengthTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -12,6 +13,7 @@ import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypes.SizeRange;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeRestrictedStringLengthTest {
@@ -51,6 +53,9 @@ public class UperEncodeRestrictedStringLengthTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode1() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord("A");
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java
index 29d203b..4ee42c5 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceExtensionTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -13,6 +14,7 @@ import org.uic.barcode.asn1.datatypes.IsExtension;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeSequenceExtensionTest {
@@ -57,6 +59,9 @@ public class UperEncodeSequenceExtensionTest {
public TestRecord() { }
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
TestRecordExtended record = new TestRecordExtended();
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java
index 9194dca..3213b1e 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfIntegerTest.java
@@ -6,11 +6,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeSequenceOfIntegerTest {
@@ -37,6 +39,9 @@ TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java
index d1834d0..33e9b9f 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfRestrictedIntegerTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.IntRange;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeSequenceOfRestrictedIntegerTest {
@@ -39,6 +41,9 @@ TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java
index 49350cc..e038d51 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringListTest.java
@@ -6,12 +6,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeSequenceOfStringListTest {
@@ -41,6 +43,9 @@ public class UperEncodeSequenceOfStringListTest {
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java
index f3bff6d..8c9cd70 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfStringTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeSequenceOfStringTest {
@@ -37,7 +39,10 @@ public class UperEncodeSequenceOfStringTest {
}
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
+
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord();
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java
index ab8fa2a..a39a4be 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeSequenceOfUtf8StringTest.java
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeSequenceOfUtf8StringTest {
@@ -59,6 +61,9 @@ Encoded successfully in 19 bytes:
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void test() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringCustomAlphabetTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringCustomAlphabetTest.java
index 03b8bac..557fad1 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringCustomAlphabetTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringCustomAlphabetTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -11,6 +12,7 @@ import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeStringCustomAlphabetTest {
@@ -52,6 +54,9 @@ public class UperEncodeStringCustomAlphabetTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java
index d8e5029..9023d51 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringDefaultTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Default;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
@@ -12,6 +13,7 @@ import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeStringDefaultTest {
@@ -45,6 +47,9 @@ public class UperEncodeStringDefaultTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord("Müller", "testString");
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java
index 9dd4389..0b24cb7 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringLengthTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -11,6 +12,7 @@ import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeStringLengthTest {
@@ -32,7 +34,9 @@ public class UperEncodeStringLengthTest {
</pre>
*/
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Sequence
public static class TestRecord {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringTest.java
index 75ace32..68eccc8 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeStringTest.java
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.CharacterRestriction;
@@ -11,6 +12,7 @@ import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.RestrictedString;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeStringTest {
@@ -47,6 +49,9 @@ public class UperEncodeStringTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/asn1/test/UperEncodeVarBitStringTest.java b/src/test/java/org/uic/barcode/asn1/test/UperEncodeVarBitStringTest.java
index d6212e2..7b0f943 100644
--- a/src/test/java/org/uic/barcode/asn1/test/UperEncodeVarBitStringTest.java
+++ b/src/test/java/org/uic/barcode/asn1/test/UperEncodeVarBitStringTest.java
@@ -6,12 +6,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.Asn1VarSizeBitstring;
import org.uic.barcode.asn1.datatypes.FieldOrder;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
public class UperEncodeVarBitStringTest {
@@ -55,6 +57,9 @@ public class UperEncodeVarBitStringTest {
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncode() throws IllegalArgumentException, IllegalAccessException {
TestRecord record = new TestRecord(false,false,true);
diff --git a/src/test/java/org/uic/barcode/test/AsnLevelDynamicContentTest.java b/src/test/java/org/uic/barcode/test/AsnLevelDynamicContentTest.java
index 955066d..7e36489 100644
--- a/src/test/java/org/uic/barcode/test/AsnLevelDynamicContentTest.java
+++ b/src/test/java/org/uic/barcode/test/AsnLevelDynamicContentTest.java
@@ -6,6 +6,7 @@ import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.dynamicContent.fdc1.ExtensionData;
import org.uic.barcode.dynamicContent.fdc1.TimeStamp;
import org.uic.barcode.dynamicContent.fdc1.UicDynamicContentDataFDC1;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.dynamicContent.fdc1.GeoCoordinateType;
public class AsnLevelDynamicContentTest {
@@ -53,6 +54,10 @@ public class AsnLevelDynamicContentTest {
}
+
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testDynamicContentEncoding() {
diff --git a/src/test/java/org/uic/barcode/test/BinaryStringTest.java b/src/test/java/org/uic/barcode/test/BinaryStringTest.java
index d5533fa..11fc3c8 100644
--- a/src/test/java/org/uic/barcode/test/BinaryStringTest.java
+++ b/src/test/java/org/uic/barcode/test/BinaryStringTest.java
@@ -1,13 +1,18 @@
package org.uic.barcode.test;
import java.io.IOException;
+
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.AsnUtils;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
public class BinaryStringTest {
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testBinaryString() throws IOException, EncodingFormatException{
diff --git a/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java b/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java
index 5355d5d..c6a693f 100644
--- a/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java
@@ -9,6 +9,7 @@ import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.dynamicContent.api.DynamicContentCoder;
import org.uic.barcode.dynamicContent.api.IUicDynamicContent;
import org.uic.barcode.dynamicContent.api.SimpleUicDynamicContent;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.impl.SimpleExtension;
import org.uic.barcode.ticket.api.impl.SimpleGeoCoordinate;
@@ -21,6 +22,8 @@ public class DynamicContentCoderTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
content = new SimpleUicDynamicContent();
content.setAppId("appID");
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureProviderSelectionTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureProviderSelectionTest.java
index 0730e69..f531f70 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureProviderSelectionTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureProviderSelectionTest.java
@@ -23,6 +23,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.api.IData;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.Level2TestDataFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
@@ -43,6 +44,8 @@ public class DynamicFrameDoubleSignatureProviderSelectionTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java
index 787ebae..160ebc1 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java
@@ -22,6 +22,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.api.IData;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.Level2TestDataFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
@@ -41,6 +42,8 @@ public class DynamicFrameDoubleSignatureTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentApiTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentApiTest.java
index 4d34c1b..4c039ff 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentApiTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentApiTest.java
@@ -26,6 +26,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicContent.api.IUicDynamicContent;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.DynamicTestContent;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
@@ -49,6 +50,8 @@ public class DynamicFrameDynamicContentApiTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentTest.java
index d26ab77..656dbb4 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameDynamicContentTest.java
@@ -29,6 +29,7 @@ import org.uic.barcode.dynamicContent.fdc1.GeoCoordinateType;
import org.uic.barcode.dynamicContent.fdc1.TimeStamp;
import org.uic.barcode.dynamicContent.fdc1.UicDynamicContentDataFDC1;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -52,6 +53,8 @@ public class DynamicFrameDynamicContentTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion1Test.java b/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion1Test.java
index ea95a88..f5a4705 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion1Test.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion1Test.java
@@ -21,6 +21,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.api.IData;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -38,6 +39,8 @@ public class DynamicFrameFcbVersion1Test {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java b/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java
index 199a32d..4eb821a 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java
@@ -21,6 +21,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.api.IData;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -38,6 +39,8 @@ public class DynamicFrameFcbVersion3Test {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameLOwLevelTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameLOwLevelTest.java
index b8a851b..e1345e5 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameLOwLevelTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameLOwLevelTest.java
@@ -22,6 +22,7 @@ import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.v1.DynamicFrame;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.SimpleDynamicFrameTestBarcode;
public class DynamicFrameLOwLevelTest {
@@ -35,6 +36,8 @@ public class DynamicFrameLOwLevelTest {
@Before public void initialize() {
+
+ LoggerFactory.setActivateConsoleLog(true);
Security.addProvider(new BouncyCastleProvider());
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameSimpleTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameSimpleTest.java
index 190924d..2c7cce3 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameSimpleTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameSimpleTest.java
@@ -20,6 +20,7 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -37,6 +38,8 @@ public class DynamicFrameSimpleTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameV2FcbVersion3Test.java b/src/test/java/org/uic/barcode/test/DynamicFrameV2FcbVersion3Test.java
index 17bccd6..5fcb07a 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameV2FcbVersion3Test.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameV2FcbVersion3Test.java
@@ -21,6 +21,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.api.IData;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -38,6 +39,8 @@ public class DynamicFrameV2FcbVersion3Test {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsert2Test.java b/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsert2Test.java
index a7d5098..c50172b 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsert2Test.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsert2Test.java
@@ -26,6 +26,7 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.DynamicTestContent;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
@@ -49,6 +50,8 @@ public class DynamicFrameV2SignatureInsert2Test {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsertTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsertTest.java
index 8f97574..90d3c2b 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsertTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameV2SignatureInsertTest.java
@@ -26,6 +26,7 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.DynamicTestContent;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
@@ -49,6 +50,8 @@ public class DynamicFrameV2SignatureInsertTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameV2ValidityDateTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameV2ValidityDateTest.java
index 9bbd736..d4f5d6a 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameV2ValidityDateTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameV2ValidityDateTest.java
@@ -25,6 +25,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.dynamicFrame.api.IData;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -42,6 +43,8 @@ public class DynamicFrameV2ValidityDateTest {
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
elipticCurve = "secp256k1";
diff --git a/src/test/java/org/uic/barcode/test/SignatureSplitTest.java b/src/test/java/org/uic/barcode/test/SignatureSplitTest.java
index 08fe3ad..300515a 100644
--- a/src/test/java/org/uic/barcode/test/SignatureSplitTest.java
+++ b/src/test/java/org/uic/barcode/test/SignatureSplitTest.java
@@ -5,7 +5,9 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.math.BigInteger;
+import org.junit.Before;
import org.junit.Test;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.staticFrame.StaticFrame;
import org.uic.barcode.test.utils.TestUtils;
import org.uic.barcode.ticket.EncodingFormatException;
@@ -27,20 +29,15 @@ public class SignatureSplitTest {
134515671861986
}
-
- Encoding using DER encoding rule
- Signature SEQUENCE OF: tag = [UNIVERSAL 16] constructed; length = 18
- INTEGER: tag = [UNIVERSAL 2] primitive; length = 8
- 340282366920938463
- INTEGER: tag = [UNIVERSAL 2] primitive; length = 6
- 134515671861986
- Encoded successfully in 20 bytes: 30120208 04B8ED02 83A6D3DF 02067A57 5ED68AE2
-
-
*
*
*/
+ @Before public void initialize() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
+ }
@Test public void testSplitSignature() throws IOException, EncodingFormatException{
diff --git a/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTest.java b/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTest.java
index 9600191..0aafc3b 100644
--- a/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTest.java
+++ b/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTest.java
@@ -18,6 +18,7 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
@@ -53,6 +54,8 @@ public class StaticFrameBarcodeTest {
*/
@Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+
algorithmOID = Constants.DSA_SHA224;
keySize = 2048;
testFCBticket = SimpleUICTestTicket.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java b/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java
index 048d684..0a0c245 100644
--- a/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java
+++ b/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB2.java
@@ -18,6 +18,7 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
@@ -52,6 +53,8 @@ public class StaticFrameBarcodeTestFCB2 {
* for ticket and layout
*/
@Before public void initialize() {
+
+ LoggerFactory.setActivateConsoleLog(true);
algorithmOID = Constants.DSA_SHA224;
keySize = 2048;
diff --git a/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB3.java b/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB3.java
index 41ce365..b519308 100644
--- a/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB3.java
+++ b/src/test/java/org/uic/barcode/test/StaticFrameBarcodeTestFCB3.java
@@ -18,6 +18,7 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.SimpleUICTestTicket;
@@ -52,6 +53,8 @@ public class StaticFrameBarcodeTestFCB3 {
* for ticket and layout
*/
@Before public void initialize() {
+
+ LoggerFactory.setActivateConsoleLog(true);
algorithmOID = Constants.DSA_SHA224;
keySize = 2048;
diff --git a/src/test/java/org/uic/barcode/test/TicketLayoutTest.java b/src/test/java/org/uic/barcode/test/TicketLayoutTest.java
index 3d053e7..69fddbb 100644
--- a/src/test/java/org/uic/barcode/test/TicketLayoutTest.java
+++ b/src/test/java/org/uic/barcode/test/TicketLayoutTest.java
@@ -4,7 +4,9 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
+import org.junit.Before;
import org.junit.Test;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.staticFrame.UTLAYDataRecord;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.LayoutElement;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
@@ -15,6 +17,9 @@ import org.uic.barcode.ticket.EncodingFormatException;
public class TicketLayoutTest {
+ @Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testTicketLayout() throws IOException, EncodingFormatException{
diff --git a/src/test/java/org/uic/barcode/test/TimeStampTest.java b/src/test/java/org/uic/barcode/test/TimeStampTest.java
index b2e3ab1..c15e0fb 100644
--- a/src/test/java/org/uic/barcode/test/TimeStampTest.java
+++ b/src/test/java/org/uic/barcode/test/TimeStampTest.java
@@ -4,12 +4,17 @@ import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.dynamicContent.fdc1.TimeStamp;
+import org.uic.barcode.logger.LoggerFactory;
public class TimeStampTest {
+ @Before public void initialize() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testDateConversion() {
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java
index a5b4765..c0fb248 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.HemisphereLongitudeType;
import org.uic.barcode.ticket.api.asn.omv3.IncludedOpenTicketType;
import org.uic.barcode.ticket.api.asn.omv3.LineType;
@@ -70,6 +71,8 @@ public class AsnLevelAllElementsTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java
index 955e2cf..39c4440 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java
@@ -10,6 +10,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.CarCarriageReservationData;
import org.uic.barcode.ticket.api.asn.omv3.LoadingDeckType;
import org.uic.barcode.ticket.api.asn.omv3.PriceTypeType;
@@ -41,6 +42,8 @@ public class AsnLevelCarCarriageTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java
index e7dbd50..21fe946 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.test.testtickets.CountermarkTestComplexTicketV1;
@@ -34,6 +35,8 @@ public class AsnLevelCountermarkComplexTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java
index 918615c..60f5375 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.CountermarkData;
import org.uic.barcode.ticket.api.asn.omv3.TravelClassType;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
@@ -38,6 +39,8 @@ public class AsnLevelCountermarkComplexTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java
index 8a2cbde..3bcd759 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java
@@ -10,6 +10,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.LinkMode;
import org.uic.barcode.ticket.api.asn.omv3.TicketType;
import org.uic.barcode.ticket.api.asn.omv3.DelayConfirmation;
@@ -40,6 +41,8 @@ public class AsnLevelDelayConfirmationTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java
index e45ae13..8077a13 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.ParkingGroundData;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
import org.uic.barcode.ticket.api.test.testtickets.ParkingTestTicketV3;
@@ -35,6 +36,8 @@ public class AsnLevelParkingTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java
index a1496c8..b2f1c9b 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
import org.uic.barcode.ticket.api.test.testtickets.StationPassageTestTicketV3;
@@ -34,6 +35,8 @@ public class AsnLevelStationPassageTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java
index eacdabb..6d25531 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.VoucherData;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
import org.uic.barcode.ticket.api.test.testtickets.VoucherTestTicketV3;
@@ -35,6 +36,8 @@ public class AsnLevelVoucherTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java
index 1a05e6f..c83c95b 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.ICounterMark;
@@ -87,6 +88,8 @@ public class CounterMarkTimeZoneTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = CountermarkTestComplexTicketV3.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
index 315774e..d9e5ba9 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.ICustomerCard;
@@ -85,6 +86,8 @@ public class CustomerCardTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = CustomerCardTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java
index e8857ab..d9ae8dc 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.ICustomerCard;
@@ -85,6 +86,9 @@ public class CustomerCardTimeZoneTestV2 {
*/
@Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = CustomerCardTestTicketV2.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java
index da0879b..ad1b0da 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV3.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.ICustomerCard;
@@ -87,6 +88,8 @@ public class CustomerCardTimeZoneTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = CustomerCardTestTicketV3.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java b/src/test/java/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java
index 5b2e578..b818738 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java
@@ -2,13 +2,18 @@ package org.uic.barcode.ticket.api.test;
import java.util.Calendar;
import java.util.TimeZone;
+
+import org.junit.Before;
import org.junit.Test;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.utils.DateTimeUtils;
public class DateTimeUtilsTest{
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testDateDiff1() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
index c9b0f31..8cf0736 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IFipTicket;
@@ -89,6 +90,8 @@ public class FipTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = FipTimeZoneTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java
index 89b6562..8b8c542 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IFipTicket;
@@ -89,6 +90,8 @@ public class FipTimeZoneTestV2 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = FipTimeZoneTestTicketV2.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java
index a4c542e..fca31a9 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/FipTimeZoneTestV3.java
@@ -1,347 +1,350 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IFipTicket;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.FipTimeZoneTestTicketV3;
-import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
-import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
-
-
-/**
- * The Class FipTimeZoneTestV1.
- *
- *
- *
- */
-public class FipTimeZoneTestV3 {
-
- /** The low level encoded test ticket test case 1 . */
- private byte[] encoded1 = null;
-
- /** The low level encoded test ticket test case 2 . */
- private byte[] encoded2 = null;
-
- /** The low level encoded test ticket test case 3 . */
- private byte[] encoded3 = null;
-
- /** The decoder. */
- Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
-
- /** The encoder. */
- Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
-
- /** The API ticket low level encoded for case 1. */
- IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
-
- /** The API ticket low level encoded for case 2. */
- IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
-
- /** The API ticket low level encoded for case 3. */
- IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
-
-
- /** The ticket decoded 1. */
- IUicRailTicket iTicketDecodedCase1 = null;
-
- /** The i ticket decoded 2. */
- IUicRailTicket iTicketDecodedCase2 = null;
-
- /** The i ticket decoded 3. */
- IUicRailTicket iTicketDecodedCase3 = null;
-
- byte[] encodedInTimeZone1 = null;
- byte[] encodedInTimeZone2 = null;
- byte[] encodedInTimeZone3 = null;
-
- String issuingDate1 = null;
- String issuingDate2 = null;
- String issuingDate3 = null;
-
- String validFrom1 = null;
- String validFrom2 = null;
- String validFrom3 = null;
-
- String validUntil1 = null;
- String validUntil2 = null;
- String validUntil3 = null;
-
- String activationDate1 = null;
- String activationDate2 = null;
- String activationDate3 = null;
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- UicRailTicketData ticket1 = FipTimeZoneTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket2 = FipTimeZoneTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket3 = FipTimeZoneTestTicketV3.getUicTestTicket();
-
- //encode in UTC time zone
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
-
- encoded1 = UperEncoder.encode(ticket1);
- encoded2 = UperEncoder.encode(ticket2);
- encoded3 = UperEncoder.encode(ticket3);
-
- }
-
- /**
- * clean up
- */
- @After public void resetTimeZone() {
- TimeZone.setDefault(defaulttimeZone);
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone CET
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("CET");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("GMT");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- }
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("CET");
- decode("GMT");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
- assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFrom1 = ((IFipTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFrom2 = ((IFipTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFrom3 = ((IFipTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntil1 = ((IFipTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntil2 = ((IFipTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntil3 = ((IFipTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
-
- activationDate1 = ((IFipTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
- activationDate2 = ((IFipTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
- activationDate3 = ((IFipTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
-
- }
-
-
- private void setActivatedDayTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- }
-
- private void setValidFromTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setValidUntilTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
- }
-
-
- /**
- * Encode in Time Zone
- */
- private void encode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
- try {
- encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
- encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
- encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
- } catch (EncodingFormatException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Decode in Time Zone
- */
- private void decode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
-
- try {
- iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
- iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
- iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Encode decode.
- */
- private void decodeTestTicketUTC() {
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- try {
- iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
- iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
- iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
-}
+package org.uic.barcode.ticket.api.test;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.IFipTicket;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.test.testtickets.FipTimeZoneTestTicketV3;
+import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
+import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
+
+
+/**
+ * The Class FipTimeZoneTestV1.
+ *
+ *
+ *
+ */
+public class FipTimeZoneTestV3 {
+
+ /** The low level encoded test ticket test case 1 . */
+ private byte[] encoded1 = null;
+
+ /** The low level encoded test ticket test case 2 . */
+ private byte[] encoded2 = null;
+
+ /** The low level encoded test ticket test case 3 . */
+ private byte[] encoded3 = null;
+
+ /** The decoder. */
+ Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
+
+ /** The encoder. */
+ Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
+
+ /** The API ticket low level encoded for case 1. */
+ IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
+
+ /** The API ticket low level encoded for case 2. */
+ IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
+
+ /** The API ticket low level encoded for case 3. */
+ IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
+
+
+ /** The ticket decoded 1. */
+ IUicRailTicket iTicketDecodedCase1 = null;
+
+ /** The i ticket decoded 2. */
+ IUicRailTicket iTicketDecodedCase2 = null;
+
+ /** The i ticket decoded 3. */
+ IUicRailTicket iTicketDecodedCase3 = null;
+
+ byte[] encodedInTimeZone1 = null;
+ byte[] encodedInTimeZone2 = null;
+ byte[] encodedInTimeZone3 = null;
+
+ String issuingDate1 = null;
+ String issuingDate2 = null;
+ String issuingDate3 = null;
+
+ String validFrom1 = null;
+ String validFrom2 = null;
+ String validFrom3 = null;
+
+ String validUntil1 = null;
+ String validUntil2 = null;
+ String validUntil3 = null;
+
+ String activationDate1 = null;
+ String activationDate2 = null;
+ String activationDate3 = null;
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ UicRailTicketData ticket1 = FipTimeZoneTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket2 = FipTimeZoneTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket3 = FipTimeZoneTestTicketV3.getUicTestTicket();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+ encoded1 = UperEncoder.encode(ticket1);
+ encoded2 = UperEncoder.encode(ticket2);
+ encoded3 = UperEncoder.encode(ticket3);
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone CET
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("CET");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("GMT");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ }
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("CET");
+ decode("GMT");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
+ assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ }
+
+ private void decodedDateToStrings() {
+
+ issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
+ issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
+ issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
+
+ validFrom1 = ((IFipTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom2 = ((IFipTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom3 = ((IFipTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
+
+ validUntil1 = ((IFipTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil2 = ((IFipTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil3 = ((IFipTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
+
+ activationDate1 = ((IFipTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+ activationDate2 = ((IFipTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+ activationDate3 = ((IFipTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+
+ }
+
+
+ private void setActivatedDayTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ }
+
+ private void setValidFromTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
+ }
+
+ private void setValidUntilTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IFipTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IFipTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IFipTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
+ }
+
+
+ /**
+ * Encode in Time Zone
+ */
+ private void encode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+ try {
+ encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
+ encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
+ encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
+ } catch (EncodingFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Decode in Time Zone
+ */
+ private void decode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ try {
+ iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
+ iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
+ iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Encode decode.
+ */
+ private void decodeTestTicketUTC() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ try {
+ iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
+ iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
+ iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java
index 4b1d61e..1ee9bc1 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.test.testtickets.OpenTestComplexTicketV1;
@@ -35,6 +36,8 @@ public class OpenTicketComplexTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java
index da167c4..86bf2d4 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.test.testtickets.OpenTestComplexTicketV2;
@@ -35,6 +36,8 @@ public class OpenTicketComplexTestV2 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java
index 21266a9..e04fbb7 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java
@@ -8,6 +8,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.IncludedOpenTicketType;
import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
import org.uic.barcode.ticket.api.asn.omv3.PassengerType;
@@ -39,6 +40,8 @@ public class OpenTicketComplexTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java
index 5631489..5420675 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.CodeTableType;
import org.uic.barcode.ticket.api.asn.omv3.IncludedOpenTicketType;
import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
@@ -42,6 +43,8 @@ public class OpenTicketINcludedTicketDateTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java
index fe0bdda..5ae24b4 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java
@@ -8,6 +8,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.IncludedOpenTicketType;
import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
import org.uic.barcode.ticket.api.asn.omv3.PassengerType;
@@ -39,6 +40,8 @@ public class OpenTicketRestrictedLuggageComplexTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
index c2d288e..8d632c8 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IOpenTicket;
@@ -89,6 +90,8 @@ public class OpenTicketTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = OpenTicketTimeZoneTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java
index 236d8b0..cc94978 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV3.java
@@ -1,347 +1,350 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IOpenTicket;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.OpenTicketTimeZoneTestTicketV3;
-import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
-import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
-
-
-/**
- * The Class FipTimeZoneTestV2.
- *
- *
- *
- */
-public class OpenTicketTimeZoneTestV3 {
-
- /** The low level encoded test ticket test case 1 . */
- private byte[] encoded1 = null;
-
- /** The low level encoded test ticket test case 2 . */
- private byte[] encoded2 = null;
-
- /** The low level encoded test ticket test case 3 . */
- private byte[] encoded3 = null;
-
- /** The decoder. */
- Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
-
- /** The encoder. */
- Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
-
- /** The API ticket low level encoded for case 1. */
- IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
-
- /** The API ticket low level encoded for case 2. */
- IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
-
- /** The API ticket low level encoded for case 3. */
- IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
-
-
- /** The ticket decoded 1. */
- IUicRailTicket iTicketDecodedCase1 = null;
-
- /** The i ticket decoded 2. */
- IUicRailTicket iTicketDecodedCase2 = null;
-
- /** The i ticket decoded 3. */
- IUicRailTicket iTicketDecodedCase3 = null;
-
- byte[] encodedInTimeZone1 = null;
- byte[] encodedInTimeZone2 = null;
- byte[] encodedInTimeZone3 = null;
-
- String issuingDate1 = null;
- String issuingDate2 = null;
- String issuingDate3 = null;
-
- String validFrom1 = null;
- String validFrom2 = null;
- String validFrom3 = null;
-
- String validUntil1 = null;
- String validUntil2 = null;
- String validUntil3 = null;
-
- String activationDate1 = null;
- String activationDate2 = null;
- String activationDate3 = null;
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- UicRailTicketData ticket1 = OpenTicketTimeZoneTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket2 = OpenTicketTimeZoneTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket3 = OpenTicketTimeZoneTestTicketV3.getUicTestTicket();
-
- //encode in UTC time zone
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
-
- encoded1 = UperEncoder.encode(ticket1);
- encoded2 = UperEncoder.encode(ticket2);
- encoded3 = UperEncoder.encode(ticket3);
-
- }
-
- /**
- * clean up
- */
- @After public void resetTimeZone() {
- TimeZone.setDefault(defaulttimeZone);
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone CET
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("CET");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("GMT");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- }
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("CET");
- decode("GMT");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
- assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFrom1 = ((IOpenTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFrom2 = ((IOpenTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFrom3 = ((IOpenTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntil1 = ((IOpenTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntil2 = ((IOpenTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntil3 = ((IOpenTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
-
- activationDate1 = ((IOpenTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
- activationDate2 = ((IOpenTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
- activationDate3 = ((IOpenTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
-
- }
-
-
- private void setActivatedDayTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- }
-
- private void setValidFromTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setValidUntilTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
- }
-
-
- /**
- * Encode in Time Zone
- */
- private void encode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
- try {
- encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
- encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
- encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
- } catch (EncodingFormatException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Decode in Time Zone
- */
- private void decode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
-
- try {
- iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
- iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
- iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Encode decode.
- */
- private void decodeTestTicketUTC() {
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- try {
- iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
- iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
- iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
-}
+package org.uic.barcode.ticket.api.test;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.IOpenTicket;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.test.testtickets.OpenTicketTimeZoneTestTicketV3;
+import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
+import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
+
+
+/**
+ * The Class FipTimeZoneTestV2.
+ *
+ *
+ *
+ */
+public class OpenTicketTimeZoneTestV3 {
+
+ /** The low level encoded test ticket test case 1 . */
+ private byte[] encoded1 = null;
+
+ /** The low level encoded test ticket test case 2 . */
+ private byte[] encoded2 = null;
+
+ /** The low level encoded test ticket test case 3 . */
+ private byte[] encoded3 = null;
+
+ /** The decoder. */
+ Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
+
+ /** The encoder. */
+ Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
+
+ /** The API ticket low level encoded for case 1. */
+ IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
+
+ /** The API ticket low level encoded for case 2. */
+ IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
+
+ /** The API ticket low level encoded for case 3. */
+ IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
+
+
+ /** The ticket decoded 1. */
+ IUicRailTicket iTicketDecodedCase1 = null;
+
+ /** The i ticket decoded 2. */
+ IUicRailTicket iTicketDecodedCase2 = null;
+
+ /** The i ticket decoded 3. */
+ IUicRailTicket iTicketDecodedCase3 = null;
+
+ byte[] encodedInTimeZone1 = null;
+ byte[] encodedInTimeZone2 = null;
+ byte[] encodedInTimeZone3 = null;
+
+ String issuingDate1 = null;
+ String issuingDate2 = null;
+ String issuingDate3 = null;
+
+ String validFrom1 = null;
+ String validFrom2 = null;
+ String validFrom3 = null;
+
+ String validUntil1 = null;
+ String validUntil2 = null;
+ String validUntil3 = null;
+
+ String activationDate1 = null;
+ String activationDate2 = null;
+ String activationDate3 = null;
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ UicRailTicketData ticket1 = OpenTicketTimeZoneTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket2 = OpenTicketTimeZoneTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket3 = OpenTicketTimeZoneTestTicketV3.getUicTestTicket();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+ encoded1 = UperEncoder.encode(ticket1);
+ encoded2 = UperEncoder.encode(ticket2);
+ encoded3 = UperEncoder.encode(ticket3);
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone CET
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("CET");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("GMT");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ }
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("CET");
+ decode("GMT");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
+ assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ }
+
+ private void decodedDateToStrings() {
+
+ issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
+ issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
+ issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
+
+ validFrom1 = ((IOpenTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom2 = ((IOpenTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom3 = ((IOpenTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
+
+ validUntil1 = ((IOpenTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil2 = ((IOpenTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil3 = ((IOpenTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
+
+ activationDate1 = ((IOpenTicket) iTicketDecodedCase1.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+ activationDate2 = ((IOpenTicket) iTicketDecodedCase2.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+ activationDate3 = ((IOpenTicket) iTicketDecodedCase3.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+
+ }
+
+
+ private void setActivatedDayTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ }
+
+ private void setValidFromTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
+ }
+
+ private void setValidUntilTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IOpenTicket) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IOpenTicket) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IOpenTicket) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
+ }
+
+
+ /**
+ * Encode in Time Zone
+ */
+ private void encode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+ try {
+ encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
+ encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
+ encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
+ } catch (EncodingFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Decode in Time Zone
+ */
+ private void decode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ try {
+ iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
+ iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
+ iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Encode decode.
+ */
+ private void decodeTestTicketUTC() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ try {
+ iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
+ iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
+ iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java
index ae6a75a..75de2ae 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
import org.uic.barcode.ticket.api.asn.omv3.TrainLinkType;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
@@ -40,6 +41,8 @@ public class OpenTicketTrainLinkDateTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
index 0cda25e..3855967 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IParkingGround;
@@ -85,6 +86,8 @@ public class ParkingTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = ParkingTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java
index 3833034..b4c2560 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IParkingGround;
@@ -85,6 +86,8 @@ public class ParkingTimeZoneTestV2 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = ParkingTestTicketV2.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java
index 88c7a6e..e6bdf8f 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV3.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IParkingGround;
@@ -87,6 +88,8 @@ public class ParkingTimeZoneTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = ParkingTestTicketV3.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java
index 6b73221..9dc3bb5 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java
@@ -7,6 +7,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.BoardingOrArrivalType;
import org.uic.barcode.ticket.api.asn.omv3.PassData;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
@@ -35,6 +36,8 @@ public class PassComplexTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
index e7aeae8..ad7a0dd 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IPass;
@@ -132,6 +133,8 @@ public class PassTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = PassTimeZoneTestTicketCase1V1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java
index decc26b..6b71547 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IPass;
@@ -89,6 +90,8 @@ public class PassTimeZoneTestV2 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = PassTimeZoneTestTicketV2.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java
index d8ea9f3..7a2f392 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassTimeZoneTestV3.java
@@ -1,347 +1,350 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IPass;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.PassTimeZoneTestTicketV3;
-import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
-import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
-
-
-/**
- * The Class FipTimeZoneTestV2.
- *
- *
- *
- */
-public class PassTimeZoneTestV3 {
-
- /** The low level encoded test ticket test case 1 . */
- private byte[] encoded1 = null;
-
- /** The low level encoded test ticket test case 2 . */
- private byte[] encoded2 = null;
-
- /** The low level encoded test ticket test case 3 . */
- private byte[] encoded3 = null;
-
- /** The decoder. */
- Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
-
- /** The encoder. */
- Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
-
- /** The API ticket low level encoded for case 1. */
- IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
-
- /** The API ticket low level encoded for case 2. */
- IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
-
- /** The API ticket low level encoded for case 3. */
- IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
-
-
- /** The ticket decoded 1. */
- IUicRailTicket iTicketDecodedCase1 = null;
-
- /** The i ticket decoded 2. */
- IUicRailTicket iTicketDecodedCase2 = null;
-
- /** The i ticket decoded 3. */
- IUicRailTicket iTicketDecodedCase3 = null;
-
- byte[] encodedInTimeZone1 = null;
- byte[] encodedInTimeZone2 = null;
- byte[] encodedInTimeZone3 = null;
-
- String issuingDate1 = null;
- String issuingDate2 = null;
- String issuingDate3 = null;
-
- String validFrom1 = null;
- String validFrom2 = null;
- String validFrom3 = null;
-
- String validUntil1 = null;
- String validUntil2 = null;
- String validUntil3 = null;
-
- String activationDate1 = null;
- String activationDate2 = null;
- String activationDate3 = null;
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- UicRailTicketData ticket1 = PassTimeZoneTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket2 = PassTimeZoneTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket3 = PassTimeZoneTestTicketV3.getUicTestTicket();
-
- //encode in UTC time zone
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
-
- encoded1 = UperEncoder.encode(ticket1);
- encoded2 = UperEncoder.encode(ticket2);
- encoded3 = UperEncoder.encode(ticket3);
-
- }
-
- /**
- * clean up
- */
- @After public void resetTimeZone() {
- TimeZone.setDefault(defaulttimeZone);
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone CET
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("CET");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("GMT");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- }
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromTo("2021.03.14-00:00");
- setValidUntilTo("2021.03.24-23:59");
- setActivatedDayTo("2021.03.14-00:00");
-
- encode("CET");
- decode("GMT");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
- assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
-
- assert(validFrom1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFrom2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFrom3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- assert(validUntil1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntil2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntil3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
-
- assert(activationDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(activationDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(activationDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFrom1 = ((IPass) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFrom2 = ((IPass) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFrom3 = ((IPass) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntil1 = ((IPass) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntil2 = ((IPass) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntil3 = ((IPass) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
-
- activationDate1 = ((IPass) iTicketDecodedCase1.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
- activationDate2 = ((IPass) iTicketDecodedCase2.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
- activationDate3 = ((IPass) iTicketDecodedCase3.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
-
- }
-
-
- private void setActivatedDayTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().clear();
- ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().add(date);
-
- }
-
- private void setValidFromTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setValidUntilTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
- }
-
-
- /**
- * Encode in Time Zone
- */
- private void encode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
- try {
- encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
- encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
- encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
- } catch (EncodingFormatException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Decode in Time Zone
- */
- private void decode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
-
- try {
- iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
- iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
- iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Encode decode.
- */
- private void decodeTestTicketUTC() {
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- try {
- iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
- iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
- iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
-}
+package org.uic.barcode.ticket.api.test;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.IPass;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.test.testtickets.PassTimeZoneTestTicketV3;
+import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
+import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
+
+
+/**
+ * The Class FipTimeZoneTestV2.
+ *
+ *
+ *
+ */
+public class PassTimeZoneTestV3 {
+
+ /** The low level encoded test ticket test case 1 . */
+ private byte[] encoded1 = null;
+
+ /** The low level encoded test ticket test case 2 . */
+ private byte[] encoded2 = null;
+
+ /** The low level encoded test ticket test case 3 . */
+ private byte[] encoded3 = null;
+
+ /** The decoder. */
+ Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
+
+ /** The encoder. */
+ Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
+
+ /** The API ticket low level encoded for case 1. */
+ IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
+
+ /** The API ticket low level encoded for case 2. */
+ IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
+
+ /** The API ticket low level encoded for case 3. */
+ IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
+
+
+ /** The ticket decoded 1. */
+ IUicRailTicket iTicketDecodedCase1 = null;
+
+ /** The i ticket decoded 2. */
+ IUicRailTicket iTicketDecodedCase2 = null;
+
+ /** The i ticket decoded 3. */
+ IUicRailTicket iTicketDecodedCase3 = null;
+
+ byte[] encodedInTimeZone1 = null;
+ byte[] encodedInTimeZone2 = null;
+ byte[] encodedInTimeZone3 = null;
+
+ String issuingDate1 = null;
+ String issuingDate2 = null;
+ String issuingDate3 = null;
+
+ String validFrom1 = null;
+ String validFrom2 = null;
+ String validFrom3 = null;
+
+ String validUntil1 = null;
+ String validUntil2 = null;
+ String validUntil3 = null;
+
+ String activationDate1 = null;
+ String activationDate2 = null;
+ String activationDate3 = null;
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ UicRailTicketData ticket1 = PassTimeZoneTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket2 = PassTimeZoneTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket3 = PassTimeZoneTestTicketV3.getUicTestTicket();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+ encoded1 = UperEncoder.encode(ticket1);
+ encoded2 = UperEncoder.encode(ticket2);
+ encoded3 = UperEncoder.encode(ticket3);
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone CET
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("CET");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("GMT");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ }
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromTo("2021.03.14-00:00");
+ setValidUntilTo("2021.03.24-23:59");
+ setActivatedDayTo("2021.03.14-00:00");
+
+ encode("CET");
+ decode("GMT");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
+ assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
+
+ assert(validFrom1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFrom2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFrom3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ assert(validUntil1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntil2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntil3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+
+ assert(activationDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(activationDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(activationDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ }
+
+ private void decodedDateToStrings() {
+
+ issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
+ issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
+ issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
+
+ validFrom1 = ((IPass) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom2 = ((IPass) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom3 = ((IPass) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
+
+ validUntil1 = ((IPass) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil2 = ((IPass) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil3 = ((IPass) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
+
+ activationDate1 = ((IPass) iTicketDecodedCase1.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+ activationDate2 = ((IPass) iTicketDecodedCase2.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+ activationDate3 = ((IPass) iTicketDecodedCase3.getDocumentData().iterator().next()).getActivatedDays().iterator().next().toString();
+
+ }
+
+
+ private void setActivatedDayTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().clear();
+ ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).getActivatedDays().add(date);
+
+ }
+
+ private void setValidFromTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
+ }
+
+ private void setValidUntilTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IPass) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IPass) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IPass) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
+ }
+
+
+ /**
+ * Encode in Time Zone
+ */
+ private void encode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+ try {
+ encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
+ encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
+ encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
+ } catch (EncodingFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Decode in Time Zone
+ */
+ private void decode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ try {
+ iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
+ iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
+ iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Encode decode.
+ */
+ private void decodeTestTicketUTC() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ try {
+ iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
+ iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
+ iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java
index 2e78ef3..3691a69 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java
@@ -10,6 +10,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv3.BoardingOrArrivalType;
import org.uic.barcode.ticket.api.asn.omv3.PassData;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
@@ -38,6 +39,8 @@ public class PassTrainValidityTestV3 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//encode in UTC time zone
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
index 5bf78cb..ac0ab37 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IReservation;
@@ -85,6 +86,8 @@ public class ReservationTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = ReservationTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java
index 34d3bc2..72e7313 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IReservation;
@@ -85,6 +86,8 @@ public class ReservationTimeZoneTestV2 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = ReservationTestTicketV2.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java
index 3eb43e1..e479e10 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV3.java
@@ -1,314 +1,317 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IReservation;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.ReservationTestTicketV3;
-import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
-import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
-
-
-/**
- * The Class FipTimeZoneTestV3.
- *
- *
- *
- */
-public class ReservationTimeZoneTestV3 {
-
- /** The low level encoded test ticket test case 1 . */
- private byte[] encoded1 = null;
-
- /** The low level encoded test ticket test case 2 . */
- private byte[] encoded2 = null;
-
- /** The low level encoded test ticket test case 3 . */
- private byte[] encoded3 = null;
-
- /** The decoder. */
- Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
-
- /** The encoder. */
- Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
-
- /** The API ticket low level encoded for case 1. */
- IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
-
- /** The API ticket low level encoded for case 2. */
- IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
-
- /** The API ticket low level encoded for case 3. */
- IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
-
-
- /** The ticket decoded 1. */
- IUicRailTicket iTicketDecodedCase1 = null;
-
- /** The i ticket decoded 2. */
- IUicRailTicket iTicketDecodedCase2 = null;
-
- /** The i ticket decoded 3. */
- IUicRailTicket iTicketDecodedCase3 = null;
-
- byte[] encodedInTimeZone1 = null;
- byte[] encodedInTimeZone2 = null;
- byte[] encodedInTimeZone3 = null;
-
- String issuingDate1 = null;
- String issuingDate2 = null;
- String issuingDate3 = null;
-
- String departureDate1 = null;
- String departureDate2 = null;
- String departureDate3 = null;
-
- String arrivalDate1 = null;
- String arrivalDate2 = null;
- String arrivalDate3 = null;
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- UicRailTicketData ticket1 = ReservationTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket2 = ReservationTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket3 = ReservationTestTicketV3.getUicTestTicket();
-
- //encode in UTC time zone
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
-
- encoded1 = UperEncoder.encode(ticket1);
- encoded2 = UperEncoder.encode(ticket2);
- encoded3 = UperEncoder.encode(ticket3);
-
- }
-
- /**
- * clean up
- */
- @After public void resetTimeZone() {
- TimeZone.setDefault(defaulttimeZone);
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone CET
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setdepartureDateTo("2021.03.14-00:00");
- setarrivalDateTo("2021.03.24-23:59");
-
- encode("CET");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(departureDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(departureDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(departureDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(arrivalDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(arrivalDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(arrivalDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
-
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setdepartureDateTo("2021.03.14-00:00");
- setarrivalDateTo("2021.03.24-23:59");
-
- encode("GMT");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(departureDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(departureDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(departureDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(arrivalDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(arrivalDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(arrivalDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
-
- }
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setdepartureDateTo("2021.03.14-00:00");
- setarrivalDateTo("2021.03.24-23:59");
-
- encode("CET");
- decode("GMT");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
- assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
-
- assert(departureDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(departureDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(departureDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- assert(arrivalDate1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(arrivalDate2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(arrivalDate3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
-
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- departureDate1 = ((IReservation) iTicketDecodedCase1.getDocumentData().iterator().next()).getDepartureDate().toString();
- departureDate2 = ((IReservation) iTicketDecodedCase2.getDocumentData().iterator().next()).getDepartureDate().toString();
- departureDate3 = ((IReservation) iTicketDecodedCase3.getDocumentData().iterator().next()).getDepartureDate().toString();
-
- arrivalDate1 = ((IReservation) iTicketDecodedCase1.getDocumentData().iterator().next()).getArrivalDate().toString();
- arrivalDate2 = ((IReservation) iTicketDecodedCase2.getDocumentData().iterator().next()).getArrivalDate().toString();
- arrivalDate3 = ((IReservation) iTicketDecodedCase3.getDocumentData().iterator().next()).getArrivalDate().toString();
-
-
- }
-
-
- private void setdepartureDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IReservation) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setDepartureDate(date);
- ((IReservation) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setDepartureDate(date);
- ((IReservation) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setDepartureDate(date);
- }
-
- private void setarrivalDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IReservation) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setArrivalDate(date);
- ((IReservation) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setArrivalDate(date);
- ((IReservation) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setArrivalDate(date);
- }
-
-
- /**
- * Encode in Time Zone
- */
- private void encode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
- try {
- encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
- encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
- encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
- } catch (EncodingFormatException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Decode in Time Zone
- */
- private void decode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
-
- try {
- iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
- iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
- iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Encode decode.
- */
- private void decodeTestTicketUTC() {
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- try {
- iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
- iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
- iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
-}
+package org.uic.barcode.ticket.api.test;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.IReservation;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.test.testtickets.ReservationTestTicketV3;
+import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
+import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class ReservationTimeZoneTestV3 {
+
+ /** The low level encoded test ticket test case 1 . */
+ private byte[] encoded1 = null;
+
+ /** The low level encoded test ticket test case 2 . */
+ private byte[] encoded2 = null;
+
+ /** The low level encoded test ticket test case 3 . */
+ private byte[] encoded3 = null;
+
+ /** The decoder. */
+ Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
+
+ /** The encoder. */
+ Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
+
+ /** The API ticket low level encoded for case 1. */
+ IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
+
+ /** The API ticket low level encoded for case 2. */
+ IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
+
+ /** The API ticket low level encoded for case 3. */
+ IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
+
+
+ /** The ticket decoded 1. */
+ IUicRailTicket iTicketDecodedCase1 = null;
+
+ /** The i ticket decoded 2. */
+ IUicRailTicket iTicketDecodedCase2 = null;
+
+ /** The i ticket decoded 3. */
+ IUicRailTicket iTicketDecodedCase3 = null;
+
+ byte[] encodedInTimeZone1 = null;
+ byte[] encodedInTimeZone2 = null;
+ byte[] encodedInTimeZone3 = null;
+
+ String issuingDate1 = null;
+ String issuingDate2 = null;
+ String issuingDate3 = null;
+
+ String departureDate1 = null;
+ String departureDate2 = null;
+ String departureDate3 = null;
+
+ String arrivalDate1 = null;
+ String arrivalDate2 = null;
+ String arrivalDate3 = null;
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ UicRailTicketData ticket1 = ReservationTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket2 = ReservationTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket3 = ReservationTestTicketV3.getUicTestTicket();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+ encoded1 = UperEncoder.encode(ticket1);
+ encoded2 = UperEncoder.encode(ticket2);
+ encoded3 = UperEncoder.encode(ticket3);
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone CET
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setdepartureDateTo("2021.03.14-00:00");
+ setarrivalDateTo("2021.03.24-23:59");
+
+ encode("CET");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(departureDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(departureDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(departureDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(arrivalDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(arrivalDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(arrivalDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setdepartureDateTo("2021.03.14-00:00");
+ setarrivalDateTo("2021.03.24-23:59");
+
+ encode("GMT");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(departureDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(departureDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(departureDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(arrivalDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(arrivalDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(arrivalDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+
+ }
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setdepartureDateTo("2021.03.14-00:00");
+ setarrivalDateTo("2021.03.24-23:59");
+
+ encode("CET");
+ decode("GMT");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
+ assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
+
+ assert(departureDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(departureDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(departureDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ assert(arrivalDate1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(arrivalDate2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(arrivalDate3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+
+
+ }
+
+ private void decodedDateToStrings() {
+
+ issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
+ issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
+ issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
+
+ departureDate1 = ((IReservation) iTicketDecodedCase1.getDocumentData().iterator().next()).getDepartureDate().toString();
+ departureDate2 = ((IReservation) iTicketDecodedCase2.getDocumentData().iterator().next()).getDepartureDate().toString();
+ departureDate3 = ((IReservation) iTicketDecodedCase3.getDocumentData().iterator().next()).getDepartureDate().toString();
+
+ arrivalDate1 = ((IReservation) iTicketDecodedCase1.getDocumentData().iterator().next()).getArrivalDate().toString();
+ arrivalDate2 = ((IReservation) iTicketDecodedCase2.getDocumentData().iterator().next()).getArrivalDate().toString();
+ arrivalDate3 = ((IReservation) iTicketDecodedCase3.getDocumentData().iterator().next()).getArrivalDate().toString();
+
+
+ }
+
+
+ private void setdepartureDateTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IReservation) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setDepartureDate(date);
+ ((IReservation) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setDepartureDate(date);
+ ((IReservation) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setDepartureDate(date);
+ }
+
+ private void setarrivalDateTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IReservation) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setArrivalDate(date);
+ ((IReservation) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setArrivalDate(date);
+ ((IReservation) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setArrivalDate(date);
+ }
+
+
+ /**
+ * Encode in Time Zone
+ */
+ private void encode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+ try {
+ encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
+ encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
+ encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
+ } catch (EncodingFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Decode in Time Zone
+ */
+ private void decode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ try {
+ iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
+ iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
+ iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Encode decode.
+ */
+ private void decodeTestTicketUTC() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ try {
+ iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
+ iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
+ iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
index aedf569..f8379f1 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IStationPassage;
@@ -85,6 +86,8 @@ public class StationPassageTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = StationPassageTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java
index e87e968..dffd5a8 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IStationPassage;
@@ -85,6 +86,8 @@ public class StationPassageTimeZoneTestV2 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = StationPassageTestTicketV2.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV3.java
index c60225d..ffe8916 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV3.java
@@ -1,314 +1,317 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IStationPassage;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.StationPassageTestTicketV3;
-import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
-import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
-
-
-/**
- * The Class FipTimeZoneTestV3.
- *
- *
- *
- */
-public class StationPassageTimeZoneTestV3 {
-
- /** The low level encoded test ticket test case 1 . */
- private byte[] encoded1 = null;
-
- /** The low level encoded test ticket test case 2 . */
- private byte[] encoded2 = null;
-
- /** The low level encoded test ticket test case 3 . */
- private byte[] encoded3 = null;
-
- /** The decoder. */
- Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
-
- /** The encoder. */
- Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
-
- /** The API ticket low level encoded for case 1. */
- IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
-
- /** The API ticket low level encoded for case 2. */
- IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
-
- /** The API ticket low level encoded for case 3. */
- IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
-
-
- /** The ticket decoded 1. */
- IUicRailTicket iTicketDecodedCase1 = null;
-
- /** The i ticket decoded 2. */
- IUicRailTicket iTicketDecodedCase2 = null;
-
- /** The i ticket decoded 3. */
- IUicRailTicket iTicketDecodedCase3 = null;
-
- byte[] encodedInTimeZone1 = null;
- byte[] encodedInTimeZone2 = null;
- byte[] encodedInTimeZone3 = null;
-
- String issuingDate1 = null;
- String issuingDate2 = null;
- String issuingDate3 = null;
-
- String validFromDate1 = null;
- String validFromDate2 = null;
- String validFromDate3 = null;
-
- String validUntilDate1 = null;
- String validUntilDate2 = null;
- String validUntilDate3 = null;
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- UicRailTicketData ticket1 = StationPassageTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket2 = StationPassageTestTicketV3.getUicTestTicket();
- UicRailTicketData ticket3 = StationPassageTestTicketV3.getUicTestTicket();
-
- //encode in UTC time zone
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
-
- encoded1 = UperEncoder.encode(ticket1);
- encoded2 = UperEncoder.encode(ticket2);
- encoded3 = UperEncoder.encode(ticket3);
-
- }
-
- /**
- * clean up
- */
- @After public void resetTimeZone() {
- TimeZone.setDefault(defaulttimeZone);
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone CET
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromDateTo("2021.03.14-00:00");
- setUntilDateTo("2021.03.24-23:59");
-
- encode("CET");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFromDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFromDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFromDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntilDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntilDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntilDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
-
- }
-
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromDateTo("2021.03.14-00:00");
- setUntilDateTo("2021.03.24-23:59");
-
- encode("GMT");
- decode("CET");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
- assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
-
- assert(validFromDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFromDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(validFromDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(validUntilDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntilDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(validUntilDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
-
-
- }
-
- /**
- * Test encode test tickets in UTC and decode in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- * @throws ParseException
- */
- @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- decodeTestTicketUTC();
-
- //set the dates in the time zone GMT
- TimeZone.setDefault(TimeZone.getTimeZone("CET"));
- iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
- iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
-
- setValidFromDateTo("2021.03.14-00:00");
- setUntilDateTo("2021.03.24-23:59");
-
- encode("CET");
- decode("GMT");
- decodedDateToStrings();
-
- assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
- assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
- assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
-
- assert(validFromDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFromDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(validFromDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- assert(validUntilDate1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntilDate2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(validUntilDate3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
-
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFromDate1 = ((IStationPassage) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate2 = ((IStationPassage) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate3 = ((IStationPassage) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntilDate1 = ((IStationPassage) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate2 = ((IStationPassage) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate3 = ((IStationPassage) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
-
-
- }
-
-
- private void setValidFromDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IStationPassage) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((IStationPassage) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((IStationPassage) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setUntilDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IStationPassage) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((IStationPassage) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((IStationPassage) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
- }
-
-
- /**
- * Encode in Time Zone
- */
- private void encode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
- try {
- encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
- encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
- encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
- } catch (EncodingFormatException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Decode in Time Zone
- */
- private void decode(String timeZone) {
- TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
-
- try {
- iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
- iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
- iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
-
- /**
- * Encode decode.
- */
- private void decodeTestTicketUTC() {
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
- try {
- iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
- iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
- iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
-}
+package org.uic.barcode.ticket.api.test;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.IStationPassage;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.test.testtickets.StationPassageTestTicketV3;
+import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
+import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class StationPassageTimeZoneTestV3 {
+
+ /** The low level encoded test ticket test case 1 . */
+ private byte[] encoded1 = null;
+
+ /** The low level encoded test ticket test case 2 . */
+ private byte[] encoded2 = null;
+
+ /** The low level encoded test ticket test case 3 . */
+ private byte[] encoded3 = null;
+
+ /** The decoder. */
+ Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
+
+ /** The encoder. */
+ Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
+
+ /** The API ticket low level encoded for case 1. */
+ IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
+
+ /** The API ticket low level encoded for case 2. */
+ IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
+
+ /** The API ticket low level encoded for case 3. */
+ IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
+
+
+ /** The ticket decoded 1. */
+ IUicRailTicket iTicketDecodedCase1 = null;
+
+ /** The i ticket decoded 2. */
+ IUicRailTicket iTicketDecodedCase2 = null;
+
+ /** The i ticket decoded 3. */
+ IUicRailTicket iTicketDecodedCase3 = null;
+
+ byte[] encodedInTimeZone1 = null;
+ byte[] encodedInTimeZone2 = null;
+ byte[] encodedInTimeZone3 = null;
+
+ String issuingDate1 = null;
+ String issuingDate2 = null;
+ String issuingDate3 = null;
+
+ String validFromDate1 = null;
+ String validFromDate2 = null;
+ String validFromDate3 = null;
+
+ String validUntilDate1 = null;
+ String validUntilDate2 = null;
+ String validUntilDate3 = null;
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ UicRailTicketData ticket1 = StationPassageTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket2 = StationPassageTestTicketV3.getUicTestTicket();
+ UicRailTicketData ticket3 = StationPassageTestTicketV3.getUicTestTicket();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+ encoded1 = UperEncoder.encode(ticket1);
+ encoded2 = UperEncoder.encode(ticket2);
+ encoded3 = UperEncoder.encode(ticket3);
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone CET
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromDateTo("2021.03.14-00:00");
+ setUntilDateTo("2021.03.24-23:59");
+
+ encode("CET");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFromDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFromDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFromDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntilDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntilDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntilDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testGMTCETencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromDateTo("2021.03.14-00:00");
+ setUntilDateTo("2021.03.24-23:59");
+
+ encode("GMT");
+ decode("CET");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 13:30:00 CET 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 01:30:00 CET 2021" ));
+ assert(issuingDate3.equals("Thu Mar 04 00:30:00 CET 2021" ));
+
+ assert(validFromDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFromDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
+ assert(validFromDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
+
+ assert(validUntilDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntilDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
+ assert(validUntilDate3.equals("Wed Mar 24 23:59:00 CET 2021" ));
+
+
+ }
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void testCETGMTencoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ decodeTestTicketUTC();
+
+ //set the dates in the time zone GMT
+ TimeZone.setDefault(TimeZone.getTimeZone("CET"));
+ iTicketDecodedFromAsn1Case1.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ iTicketDecodedFromAsn1Case2.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-00:30" ));
+ iTicketDecodedFromAsn1Case3.getIssuerDetails().setIssuingDate(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.03-23:30" ));
+
+ setValidFromDateTo("2021.03.14-00:00");
+ setUntilDateTo("2021.03.24-23:59");
+
+ encode("CET");
+ decode("GMT");
+ decodedDateToStrings();
+
+ assert(issuingDate1.equals("Thu Mar 04 12:30:00 GMT 2021" ));
+ assert(issuingDate2.equals("Thu Mar 04 00:30:00 GMT 2021" ));
+ assert(issuingDate3.equals("Wed Mar 03 23:30:00 GMT 2021" ));
+
+ assert(validFromDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFromDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+ assert(validFromDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
+
+ assert(validUntilDate1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntilDate2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+ assert(validUntilDate3.equals("Wed Mar 24 23:59:00 GMT 2021" ));
+
+
+ }
+
+ private void decodedDateToStrings() {
+
+ issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
+ issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
+ issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
+
+ validFromDate1 = ((IStationPassage) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFromDate2 = ((IStationPassage) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFromDate3 = ((IStationPassage) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
+
+ validUntilDate1 = ((IStationPassage) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntilDate2 = ((IStationPassage) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntilDate3 = ((IStationPassage) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
+
+
+ }
+
+
+ private void setValidFromDateTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IStationPassage) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IStationPassage) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
+ ((IStationPassage) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
+ }
+
+ private void setUntilDateTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((IStationPassage) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IStationPassage) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
+ ((IStationPassage) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
+ }
+
+
+ /**
+ * Encode in Time Zone
+ */
+ private void encode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+ try {
+ encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
+ encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
+ encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
+ } catch (EncodingFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Decode in Time Zone
+ */
+ private void decode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ try {
+ iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
+ iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
+ iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Encode decode.
+ */
+ private void decodeTestTicketUTC() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ try {
+ iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
+ iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
+ iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java
index cb20d79..d9a2944 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java
@@ -5,8 +5,10 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -17,6 +19,9 @@ import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
public class UperEncodeOpenTicketTestV1 {
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java
index 7436f5d..a60296a 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java
@@ -5,8 +5,10 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
@@ -17,6 +19,9 @@ import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
public class UperEncodePassTestV1 {
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException {
UicRailTicketData ticket = PassTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java
index 0a4b04c..a512ff3 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java
@@ -5,8 +5,10 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.ILinkMode;
import org.uic.barcode.ticket.api.spec.ITicketLink;
@@ -19,7 +21,9 @@ import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
public class UperEncodeTicketLinkTestV1 {
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException {
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java
index cf8eec6..fd59308 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java
@@ -4,8 +4,10 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.test.testtickets.SimpleUicTestTicket;
@@ -85,7 +87,9 @@ public class UperEncodeTicketTestV1 {
</pre>
*/
-
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException {
UicRailTicketData ticket = SimpleUicTestTicket.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java
index da59f67..6dda463 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java
@@ -4,10 +4,12 @@ import static org.junit.Assert.assertEquals;
import java.util.logging.Level;
+import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.datatypes.Asn1Optional;
import org.uic.barcode.asn1.datatypes.Sequence;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
@@ -35,20 +37,7 @@ public class UperEncodeUICTicketExtensionTest {
}
}
-Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
-TestRecord SEQUENCE [fieldcount (not encoded) = 1]
- extensionList SEQUENCE OF [count = 2]
- ExtensionData SEQUENCE [fieldcount (not encoded) = 2]
- extensionId IA5String [length = 1.0]
- "1"
- extensionData OCTET STRING [length = 2.0]
- 0x82da
- ExtensionData SEQUENCE [fieldcount (not encoded) = 2]
- extensionId IA5String [length = 1.0]
- "2"
- extensionData OCTET STRING [length = 2.0]
- 0x83da
-Total encoded length = 10.7
+
Encoded successfully in 11 bytes:
8100B102 82DA0164 0507B4
</pre>
@@ -66,6 +55,9 @@ Encoded successfully in 11 bytes:
}
}
+ @Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+ }
@Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException {
TestRecord ticket = new TestRecord();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java
index 423908b..e2629a3 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IVoucher;
@@ -85,6 +86,8 @@ public class VoucherTimeZoneTestV1 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = VoucherTestTicketV1.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java
index c7c2512..f7b4618 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IVoucher;
@@ -87,6 +88,8 @@ public class VoucherTimeZoneTestV2 {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
UicRailTicketData ticket1 = VoucherTestTicketV2.getUicTestTicket();
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV3.java
index 22b17c2..b76b6cc 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV3.java
@@ -11,6 +11,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
import org.uic.barcode.ticket.api.spec.IVoucher;
@@ -86,6 +87,8 @@ public class VoucherTimeZoneTestV3 {
* Prepare tickets.
*/
@Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
defaulttimeZone = TimeZone.getDefault();
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
index 326eb99..2898b59 100644
--- a/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
+++ b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
@@ -1,7 +1,6 @@
package org.uic.barcode.ticketTestDB;
-import java.util.Iterator;
import java.util.TimeZone;
import org.junit.After;
@@ -10,11 +9,10 @@ import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
-import org.uic.barcode.ticket.api.impl.SimpleTrainLink;
import org.uic.barcode.ticket.api.spec.IOpenTicket;
import org.uic.barcode.ticket.api.spec.IPassengerType;
-import org.uic.barcode.ticket.api.spec.IRegionalValidity;
import org.uic.barcode.ticket.api.spec.ITariff;
import org.uic.barcode.ticket.api.spec.ITrainLink;
import org.uic.barcode.ticket.api.spec.ITraveler;
@@ -28,6 +26,9 @@ public class DecodeSparpreisTicketDBTest {
* Prepare tickets.
*/
@Before public void prepare() {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//decode in local CET time zone
TimeZone.setDefault(TimeZone.getTimeZone("CET"));
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java b/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java
index 787abf5..2cb6d69 100644
--- a/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java
+++ b/src/test/java/org/uic/barcode/ticketTestDB/EncodeSparpreisTicketDBTest.java
@@ -17,6 +17,7 @@ import org.uic.barcode.Decoder;
import org.uic.barcode.Encoder;
import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
import org.uic.barcode.staticFrame.StaticFrame;
import org.uic.barcode.test.utils.TestUtils;
import org.uic.barcode.ticket.EncodingFormatException;
@@ -46,6 +47,9 @@ public class EncodeSparpreisTicketDBTest {
* @throws IOException
*/
@Before public void prepare() throws IOException, EncodingFormatException, DataFormatException {
+
+ LoggerFactory.setActivateConsoleLog(true);
+
defaulttimeZone = TimeZone.getDefault();
//decode in local CET time zone
TimeZone.setDefault(TimeZone.getTimeZone("CET"));
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java b/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java
index 9249f4f..e8922d2 100644
--- a/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java
+++ b/src/test/java/org/uic/barcode/ticketTestDB/SignatureValidationDBTicketTest.java
@@ -18,6 +18,7 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.dynamicFrame.Constants;
+import org.uic.barcode.logger.LoggerFactory;
public class SignatureValidationDBTicketTest {
@@ -28,6 +29,8 @@ public class SignatureValidationDBTicketTest {
*/
@Before public void prepare() {
+ LoggerFactory.setActivateConsoleLog(true);
+
Security.addProvider(new BouncyCastleProvider());
defaulttimeZone = TimeZone.getDefault();