summaryrefslogtreecommitdiffstats
path: root/src/org/uic/barcode/ticket/api/test
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-03-29 14:08:45 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-03-29 14:08:45 +0200
commite023e674020f1a435f7b8c8b9276704f576ea6e5 (patch)
tree011863c021df3e5356f07b056d30d0e7476061e4 /src/org/uic/barcode/ticket/api/test
parentMerge pull request #13 from UnionInternationalCheminsdeFer/time_zone_fix_3 (diff)
downloadUIC-barcode-e023e674020f1a435f7b8c8b9276704f576ea6e5.tar
UIC-barcode-e023e674020f1a435f7b8c8b9276704f576ea6e5.tar.gz
UIC-barcode-e023e674020f1a435f7b8c8b9276704f576ea6e5.tar.bz2
UIC-barcode-e023e674020f1a435f7b8c8b9276704f576ea6e5.tar.lz
UIC-barcode-e023e674020f1a435f7b8c8b9276704f576ea6e5.tar.xz
UIC-barcode-e023e674020f1a435f7b8c8b9276704f576ea6e5.tar.zst
UIC-barcode-e023e674020f1a435f7b8c8b9276704f576ea6e5.zip
Diffstat (limited to 'src/org/uic/barcode/ticket/api/test')
-rw-r--r--src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java45
-rw-r--r--src/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java345
-rw-r--r--src/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java345
-rw-r--r--src/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java345
-rw-r--r--src/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV2.java345
-rw-r--r--src/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java455
-rw-r--r--src/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java345
-rw-r--r--src/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java54
-rw-r--r--src/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java53
-rw-r--r--src/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java75
-rw-r--r--src/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java118
-rw-r--r--src/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java126
-rw-r--r--src/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java312
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java578
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java175
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java175
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java163
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java155
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java155
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java578
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java157
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java157
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java147
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java147
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java150
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java168
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java165
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java204
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java168
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java201
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java201
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java574
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java244
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java183
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java183
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java145
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java145
46 files changed, 0 insertions, 11089 deletions
diff --git a/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
deleted file mode 100644
index 315774e..0000000
--- a/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV1.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.ICustomerCard;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.CustomerCardTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class CustomerCardTestV1.
- *
- *
- *
- */
-public class CustomerCardTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = CustomerCardTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = CustomerCardTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = CustomerCardTestTicketV1.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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 CET 2022" ));
-
-
- }
-
-
- /**
- * 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");
- setValidUntilDateTo("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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 GMT 2022" ));
-
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFromDate1 = ((ICustomerCard) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate2 = ((ICustomerCard) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate3 = ((ICustomerCard) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntilDate1 = ((ICustomerCard) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate2 = ((ICustomerCard) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate3 = ((ICustomerCard) 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);
- ((ICustomerCard) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((ICustomerCard) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((ICustomerCard) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setValidUntilDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((ICustomerCard) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((ICustomerCard) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((ICustomerCard) 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/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java
deleted file mode 100644
index e8857ab..0000000
--- a/src/org/uic/barcode/ticket/api/test/CustomerCardTimeZoneTestV2.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv2.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.ICustomerCard;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.CustomerCardTestTicketV2;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
-
-
-/**
- * The Class CustomerCardTestV1.
- *
- *
- *
- */
-public class CustomerCardTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoderV2 decoder = new OpenAsn2ApiDecoderV2();
-
- /** The encoder. */
- Api2OpenAsnEncoderV2 encoder = new Api2OpenAsnEncoderV2();
-
- /** 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 = CustomerCardTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket2 = CustomerCardTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket3 = CustomerCardTestTicketV2.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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 CET 2022" ));
-
-
- }
-
-
- /**
- * 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");
- setValidUntilDateTo("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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 GMT 2022" ));
-
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFromDate1 = ((ICustomerCard) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate2 = ((ICustomerCard) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate3 = ((ICustomerCard) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntilDate1 = ((ICustomerCard) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate2 = ((ICustomerCard) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate3 = ((ICustomerCard) 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);
- ((ICustomerCard) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((ICustomerCard) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((ICustomerCard) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setValidUntilDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((ICustomerCard) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((ICustomerCard) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((ICustomerCard) 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/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java b/src/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java
deleted file mode 100644
index 5b2e578..0000000
--- a/src/org/uic/barcode/ticket/api/test/DateTimeUtilsTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.util.Calendar;
-import java.util.TimeZone;
-import org.junit.Test;
-import org.uic.barcode.ticket.api.utils.DateTimeUtils;
-
-
-public class DateTimeUtilsTest{
-
-
-
- @Test public void testDateDiff1() throws IllegalArgumentException, IllegalAccessException {
-
- Calendar issuing = Calendar.getInstance();
- issuing.setTimeZone(TimeZone.getTimeZone("UTC"));
- issuing.set(Calendar.YEAR,2017);
- issuing.set(Calendar.DAY_OF_MONTH, 31);
- issuing.set(Calendar.MONTH, 12);
- issuing.set(Calendar.HOUR_OF_DAY, 23);
- issuing.set(Calendar.MINUTE, 5);
-
- Calendar local = Calendar.getInstance();
- local.set(Calendar.YEAR,2018);
- local.set(Calendar.DAY_OF_MONTH, 1);
- local.set(Calendar.MONTH, 1);
- issuing.set(Calendar.HOUR_OF_DAY, 0);
- issuing.set(Calendar.MINUTE, 5);
-
- Long diff = DateTimeUtils.getDateDifference(issuing.getTime(), local.getTime());
-
-
- assert(diff.intValue() == 1);
- }
-
-
-
-
-
-
-
-
-
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
deleted file mode 100644
index c9b0f31..0000000
--- a/src/org/uic/barcode/ticket/api/test/FipTimeZoneTestV1.java
+++ /dev/null
@@ -1,345 +0,0 @@
-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.omv1.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.FipTimeZoneTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class FipTimeZoneTestV1.
- *
- *
- *
- */
-public class FipTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = FipTimeZoneTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = FipTimeZoneTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = FipTimeZoneTestTicketV1.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/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java
deleted file mode 100644
index 89b6562..0000000
--- a/src/org/uic/barcode/ticket/api/test/FipTimeZoneTestV2.java
+++ /dev/null
@@ -1,345 +0,0 @@
-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.omv2.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.FipTimeZoneTestTicketV2;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
-
-
-/**
- * The Class FipTimeZoneTestV1.
- *
- *
- *
- */
-public class FipTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoderV2 decoder = new OpenAsn2ApiDecoderV2();
-
- /** The encoder. */
- Api2OpenAsnEncoderV2 encoder = new Api2OpenAsnEncoderV2();
-
- /** 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 = FipTimeZoneTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket2 = FipTimeZoneTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket3 = FipTimeZoneTestTicketV2.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/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
deleted file mode 100644
index c2d288e..0000000
--- a/src/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV1.java
+++ /dev/null
@@ -1,345 +0,0 @@
-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.omv1.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.OpenTicketTimeZoneTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class FipTimeZoneTestV1.
- *
- *
- *
- */
-public class OpenTicketTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = OpenTicketTimeZoneTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = OpenTicketTimeZoneTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = OpenTicketTimeZoneTestTicketV1.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/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV2.java
deleted file mode 100644
index ab16716..0000000
--- a/src/org/uic/barcode/ticket/api/test/OpenTicketTimeZoneTestV2.java
+++ /dev/null
@@ -1,345 +0,0 @@
-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.omv2.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.OpenTicketTimeZoneTestTicketV2;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
-
-
-/**
- * The Class FipTimeZoneTestV2.
- *
- *
- *
- */
-public class OpenTicketTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoderV2 decoder = new OpenAsn2ApiDecoderV2();
-
- /** The encoder. */
- Api2OpenAsnEncoderV2 encoder = new Api2OpenAsnEncoderV2();
-
- /** 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 = OpenTicketTimeZoneTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket2 = OpenTicketTimeZoneTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket3 = OpenTicketTimeZoneTestTicketV2.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/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
deleted file mode 100644
index 0cda25e..0000000
--- a/src/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV1.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IParkingGround;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.ParkingTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class ParkingTestV1.
- *
- *
- *
- */
-public class ParkingTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 FromParkingDateDate1 = null;
- String FromParkingDateDate2 = null;
- String FromParkingDateDate3 = null;
-
- String ToParkingDateDate1 = null;
- String ToParkingDateDate2 = null;
- String ToParkingDateDate3 = null;
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- UicRailTicketData ticket1 = ParkingTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = ParkingTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = ParkingTestTicketV1.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" ));
-
- setFromParkingDateDateTo("2021.03.14-00:00");
- setToParkingDateDateTo("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(FromParkingDateDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(ToParkingDateDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate3.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" ));
-
- setFromParkingDateDateTo("2021.03.14-00:00");
- setToParkingDateDateTo("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(FromParkingDateDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(ToParkingDateDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate3.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" ));
-
- setFromParkingDateDateTo("2021.03.14-00:00");
- setToParkingDateDateTo("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(FromParkingDateDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(FromParkingDateDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(FromParkingDateDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- assert(ToParkingDateDate1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(ToParkingDateDate2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(ToParkingDateDate3.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();
-
- FromParkingDateDate1 = ((IParkingGround) iTicketDecodedCase1.getDocumentData().iterator().next()).getFromParkingDate().toString();
- FromParkingDateDate2 = ((IParkingGround) iTicketDecodedCase2.getDocumentData().iterator().next()).getFromParkingDate().toString();
- FromParkingDateDate3 = ((IParkingGround) iTicketDecodedCase3.getDocumentData().iterator().next()).getFromParkingDate().toString();
-
- ToParkingDateDate1 = ((IParkingGround) iTicketDecodedCase1.getDocumentData().iterator().next()).getToParkingDate().toString();
- ToParkingDateDate2 = ((IParkingGround) iTicketDecodedCase2.getDocumentData().iterator().next()).getToParkingDate().toString();
- ToParkingDateDate3 = ((IParkingGround) iTicketDecodedCase3.getDocumentData().iterator().next()).getToParkingDate().toString();
-
-
- }
-
-
- private void setFromParkingDateDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IParkingGround) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setFromParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setFromParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setFromParkingDate(date);
- }
-
- private void setToParkingDateDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IParkingGround) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setToParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setToParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setToParkingDate(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/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java
deleted file mode 100644
index 3833034..0000000
--- a/src/org/uic/barcode/ticket/api/test/ParkingTimeZoneTestV2.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv2.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IParkingGround;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.ParkingTestTicketV2;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
-
-
-/**
- * The Class ParkingTestV2.
- *
- *
- *
- */
-public class ParkingTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoderV2 decoder = new OpenAsn2ApiDecoderV2();
-
- /** The encoder. */
- Api2OpenAsnEncoderV2 encoder = new Api2OpenAsnEncoderV2();
-
- /** 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 FromParkingDateDate1 = null;
- String FromParkingDateDate2 = null;
- String FromParkingDateDate3 = null;
-
- String ToParkingDateDate1 = null;
- String ToParkingDateDate2 = null;
- String ToParkingDateDate3 = null;
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- UicRailTicketData ticket1 = ParkingTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket2 = ParkingTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket3 = ParkingTestTicketV2.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" ));
-
- setFromParkingDateDateTo("2021.03.14-00:00");
- setToParkingDateDateTo("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(FromParkingDateDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(ToParkingDateDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate3.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" ));
-
- setFromParkingDateDateTo("2021.03.14-00:00");
- setToParkingDateDateTo("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(FromParkingDateDate1.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate2.equals("Sun Mar 14 00:00:00 CET 2021" ));
- assert(FromParkingDateDate3.equals("Sun Mar 14 00:00:00 CET 2021" ));
-
- assert(ToParkingDateDate1.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate2.equals("Wed Mar 24 23:59:00 CET 2021" ));
- assert(ToParkingDateDate3.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" ));
-
- setFromParkingDateDateTo("2021.03.14-00:00");
- setToParkingDateDateTo("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(FromParkingDateDate1.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(FromParkingDateDate2.equals("Sun Mar 14 00:00:00 GMT 2021" ));
- assert(FromParkingDateDate3.equals("Sun Mar 14 00:00:00 GMT 2021" ));
-
- assert(ToParkingDateDate1.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(ToParkingDateDate2.equals("Wed Mar 24 23:59:00 GMT 2021" ));
- assert(ToParkingDateDate3.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();
-
- FromParkingDateDate1 = ((IParkingGround) iTicketDecodedCase1.getDocumentData().iterator().next()).getFromParkingDate().toString();
- FromParkingDateDate2 = ((IParkingGround) iTicketDecodedCase2.getDocumentData().iterator().next()).getFromParkingDate().toString();
- FromParkingDateDate3 = ((IParkingGround) iTicketDecodedCase3.getDocumentData().iterator().next()).getFromParkingDate().toString();
-
- ToParkingDateDate1 = ((IParkingGround) iTicketDecodedCase1.getDocumentData().iterator().next()).getToParkingDate().toString();
- ToParkingDateDate2 = ((IParkingGround) iTicketDecodedCase2.getDocumentData().iterator().next()).getToParkingDate().toString();
- ToParkingDateDate3 = ((IParkingGround) iTicketDecodedCase3.getDocumentData().iterator().next()).getToParkingDate().toString();
-
-
- }
-
-
- private void setFromParkingDateDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IParkingGround) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setFromParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setFromParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setFromParkingDate(date);
- }
-
- private void setToParkingDateDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IParkingGround) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setToParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setToParkingDate(date);
- ((IParkingGround) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setToParkingDate(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/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
deleted file mode 100644
index e7aeae8..0000000
--- a/src/org/uic/barcode/ticket/api/test/PassTimeZoneTestV1.java
+++ /dev/null
@@ -1,455 +0,0 @@
-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.omv1.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.PassTimeZoneTestTicketCase1V1;
-import org.uic.barcode.ticket.api.test.testtickets.PassTimeZoneTestTicketCase2V1;
-import org.uic.barcode.ticket.api.test.testtickets.PassTimeZoneTestTicketCase3V1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class PassTimeZoneTestV1.
- *
- *
- * test validity dates and activated days in different time zones
- *
- Case 1:
- issue date: 04-03-2021 12:30 UTC
- issuingYear: 2021
- issuingDay: 63
- issuingTime: 750
- validFromDay: 10
- activatedDays: [0]
- utcOffset: 0
-
- expected: activated for 04-03-2021 + 10 + 0 00:00 UTC --> 14-03-2021
-
- Case 2:
- issue date: 04-03-2021 00:30 UTC
- issuingYear: 2021
- issuingDay: 63
- issuingTime: 30
- validFromDay: 10
- activatedDays: [0]
- utcOffset: 0
-
- expected: activated for 04-03-2021 + 10 + 0 00:00 UTC --> 14-03-2021
-
- Case 3:
- issue date: 03-03-2021 23:30 UTC
- issuingYear: 2021
- issuingDay: 62
- issuingTime: 1410
- validFromDay: 11
- activatedDays: [0]
-
- expected: activated for 03-03-2021 + 11 + 0 00:00 UTC --> 14-03-2021
- *
- * - Test tickets defined on the level of the asn.1 object model
- * - set the local time zone
- * - decoded to get an API ticket object
- * - encode again to
- *
- *
- *
- *
- */
-public class PassTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = PassTimeZoneTestTicketCase1V1.getUicTestTicket();
- UicRailTicketData ticket2 = PassTimeZoneTestTicketCase2V1.getUicTestTicket();
- UicRailTicketData ticket3 = PassTimeZoneTestTicketCase3V1.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 decode test tickets in CET.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- */
- @Test public void testCETdecodeOnly() throws IllegalArgumentException, IllegalAccessException {
-
- encodedInTimeZone1 = encoded1;
- encodedInTimeZone2 = encoded2;
- encodedInTimeZone3 = encoded3;
-
- 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 decode test tickets in GMT.
- *
- * @throws IllegalArgumentException the illegal argument exception
- * @throws IllegalAccessException the illegal access exception
- */
- @Test public void testGMTdecodeOnly() throws IllegalArgumentException, IllegalAccessException {
-
- encodedInTimeZone1 = encoded1;
- encodedInTimeZone2 = encoded2;
- encodedInTimeZone3 = encoded3;
-
- //test decoded ticket
- 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" ));
-
- }
-
-
- /**
- * 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/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java
deleted file mode 100644
index decc26b..0000000
--- a/src/org/uic/barcode/ticket/api/test/PassTimeZoneTestV2.java
+++ /dev/null
@@ -1,345 +0,0 @@
-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.omv2.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.PassTimeZoneTestTicketV2;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
-
-
-/**
- * The Class FipTimeZoneTestV2.
- *
- *
- *
- */
-public class PassTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoderV2 decoder = new OpenAsn2ApiDecoderV2();
-
- /** The encoder. */
- Api2OpenAsnEncoderV2 encoder = new Api2OpenAsnEncoderV2();
-
- /** 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 = PassTimeZoneTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket2 = PassTimeZoneTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket3 = PassTimeZoneTestTicketV2.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/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
deleted file mode 100644
index 5bf78cb..0000000
--- a/src/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV1.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv1.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.ReservationTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class FipTimeZoneTestV1.
- *
- *
- *
- */
-public class ReservationTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = ReservationTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = ReservationTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = ReservationTestTicketV1.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/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java
deleted file mode 100644
index 34d3bc2..0000000
--- a/src/org/uic/barcode/ticket/api/test/ReservationTimeZoneTestV2.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv2.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.ReservationTestTicketV2;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
-
-
-/**
- * The Class FipTimeZoneTestV1.
- *
- *
- *
- */
-public class ReservationTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoderV2 decoder = new OpenAsn2ApiDecoderV2();
-
- /** The encoder. */
- Api2OpenAsnEncoderV2 encoder = new Api2OpenAsnEncoderV2();
-
- /** 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 = ReservationTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket2 = ReservationTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket3 = ReservationTestTicketV2.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/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
deleted file mode 100644
index aedf569..0000000
--- a/src/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV1.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv1.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.StationPassageTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class FipTimeZoneTestV1.
- *
- *
- *
- */
-public class StationPassageTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = StationPassageTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = StationPassageTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = StationPassageTestTicketV1.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/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java
deleted file mode 100644
index e87e968..0000000
--- a/src/org/uic/barcode/ticket/api/test/StationPassageTimeZoneTestV2.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv2.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.StationPassageTestTicketV2;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV2;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV2;
-
-
-/**
- * The Class FipTimeZoneTestV2.
- *
- *
- *
- */
-public class StationPassageTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoderV2 decoder = new OpenAsn2ApiDecoderV2();
-
- /** The encoder. */
- Api2OpenAsnEncoderV2 encoder = new Api2OpenAsnEncoderV2();
-
- /** 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 = StationPassageTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket2 = StationPassageTestTicketV2.getUicTestTicket();
- UicRailTicketData ticket3 = StationPassageTestTicketV2.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/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java b/src/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java
deleted file mode 100644
index cb20d79..0000000
--- a/src/org/uic/barcode/ticket/api/test/UperEncodeOpenTicketTestV1.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.uic.barcode.ticket.api.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.logging.Level;
-
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.OpenTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-public class UperEncodeOpenTicketTestV1 {
-
-
-
- @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException {
- UicRailTicketData ticket = OpenTestTicketV1.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
- //String expectedHex = "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA021282DAE6E8CAE4C8C2DA0080BDA60100402C800131B20081013A65E7D00805881416D00B20283DA0";
- //assertEquals(hex,expectedHex);
- UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class);
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
- IUicRailTicket iTicket = null;
- try {
- iTicket = decoder.decodeFromAsn(encoded);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
- try {
- encoded = encoder.encode(iTicket);
- } catch (EncodingFormatException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assert(decodedTicket != null);
- assertEquals(decodedTicket.controlDetail.ageCheckRequired , false );
- assertEquals(decodedTicket.controlDetail.getInfoText() , "cd" );
- assertEquals(decodedTicket.controlDetail.getIncludedTickets().get(0).getProductOwnerIA5() , "test" );
- assert(decodedTicket.controlDetail.getIdentificationByCardReference().get(0).getTrailingCardIdNum() == 100L );
- }
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java b/src/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java
deleted file mode 100644
index 7436f5d..0000000
--- a/src/org/uic/barcode/ticket/api/test/UperEncodePassTestV1.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.uic.barcode.ticket.api.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.logging.Level;
-
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.EncodingFormatException;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.PassTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-public class UperEncodePassTestV1 {
-
-
- @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException {
- UicRailTicketData ticket = PassTestTicketV1.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
-
- UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class);
-
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
- IUicRailTicket iTicket = null;
- try {
- iTicket = decoder.decodeFromAsn(encoded);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
- try {
- encoded = encoder.encode(iTicket);
- } catch (EncodingFormatException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assert(decodedTicket != null);
- assertEquals(decodedTicket.controlDetail.ageCheckRequired , false );
- assertEquals(decodedTicket.controlDetail.getInfoText() , "cd" );
- assertEquals(decodedTicket.controlDetail.getIncludedTickets().get(0).getProductOwnerIA5() , "test" );
- assert(decodedTicket.controlDetail.getIdentificationByCardReference().get(0).getTrailingCardIdNum() == 100L );
- }
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java b/src/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java
deleted file mode 100644
index 0a4b04c..0000000
--- a/src/org/uic/barcode/ticket/api/test/UperEncodeTicketLinkTestV1.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.uic.barcode.ticket.api.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.logging.Level;
-
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-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;
-import org.uic.barcode.ticket.api.spec.ITicketType;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.SimpleTicketLinkTestTicket;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-public class UperEncodeTicketLinkTestV1 {
-
-
-
-
-
- @Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException {
- UicRailTicketData ticket = SimpleTicketLinkTestTicket.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
-
- String expectedHex = SimpleTicketLinkTestTicket.getEncodingV1Hex();
- UperEncoder.logger.debug(String.format("first difference at index: %d",hex.compareTo(expectedHex)));
- UperEncoder.logger.debug(String.format("data returned: %s",hex));
- UperEncoder.logger.debug(String.format("data expected: %s",expectedHex));
- assert(hex.equals(expectedHex));
- }
-
- @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException {
- UicRailTicketData ticket = SimpleTicketLinkTestTicket.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
- String expectedHex = SimpleTicketLinkTestTicket.getEncodingV1Hex();
- assertEquals(hex,expectedHex);
- UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class);
- assert(decodedTicket != null);
- assertEquals(decodedTicket.controlDetail.ageCheckRequired , false );
- assertEquals(decodedTicket.controlDetail.getInfoText() , "cd" );
- assertEquals(decodedTicket.controlDetail.getIncludedTickets().get(0).getProductOwnerIA5() , "test" );
- assert(decodedTicket.controlDetail.getIdentificationByCardReference().get(0).getTrailingCardIdNum() == 100L );
- assert(decodedTicket.controlDetail.getIncludedTickets().size() == 1);
- }
-
- @Test public void testDecodeTicket2Api() throws IllegalArgumentException, IllegalAccessException {
- UicRailTicketData ticket = SimpleTicketLinkTestTicket.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
- UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class);
-
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
- IUicRailTicket uicTicket = null;
- try {
- uicTicket = decoder.decodeFromAsn(decodedTicket);
- } catch (IOException e) {
- assert (false);
- }
-
- assert(uicTicket.getControlDetails().getLinkedTickets().size() == 1);
- for (ITicketLink link: uicTicket.getControlDetails().getLinkedTickets() ) {
- assert(link.getLinkMode() == ILinkMode.onlyValidInCombination);
- assert(link.getTicketType() == ITicketType.pass);
- }
- }
-
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java b/src/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java
deleted file mode 100644
index cf8eec6..0000000
--- a/src/org/uic/barcode/ticket/api/test/UperEncodeTicketTestV1.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package org.uic.barcode.ticket.api.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.logging.Level;
-
-import org.junit.Test;
-import org.uic.barcode.asn1.uper.UperEncoder;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.test.testtickets.SimpleUicTestTicket;
-
-
-public class UperEncodeTicketTestV1 {
-
- /**
- * Example from the Standard on UPER.
- <pre>
- value UicRailTicketData ::= {
- issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- ,transportDocument {
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- infoText "openTicketInfo"
- }
- }
- ,{
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- }
- }
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { productOwnerIA5 "test" }
- }
- }
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- }
-
-
-78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00082 2537B437 01A237BB
-82B164CD A3580883 73CBBB4E FE40EDAF 28EE4DEE AE004A03 AD12B014 16D08000
-00000403 9BDC195B 951A58DA D95D125B 999BC480 88040EE0 C2E6E6C2 CECA0212
-82DAE6E8 CAE4C8C2 DA0080BD A6010040 2C800131 B2008101 3A65E7D0 08058814
-16D00B20 283DA0
-
- </pre>
- */
-
-
-
- @Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException {
- UicRailTicketData ticket = SimpleUicTestTicket.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
-
- String expectedHex = "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA021282DAE6E8CAE4C8C2DA0080BDA60100402C800131B20081013A65E7D00805881416D00B20283DA0";
- UperEncoder.logger.debug(String.format("first difference at index: %d",hex.compareTo(expectedHex)));
- UperEncoder.logger.debug(String.format("data returned: %s",hex));
- UperEncoder.logger.debug(String.format("data expected: %s",expectedHex));
- assert(hex.equals(expectedHex));
- }
-
- @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException {
- UicRailTicketData ticket = SimpleUicTestTicket.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
- String expectedHex = "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA021282DAE6E8CAE4C8C2DA0080BDA60100402C800131B20081013A65E7D00805881416D00B20283DA0";
- assertEquals(hex,expectedHex);
- UicRailTicketData decodedTicket = UperEncoder.decode(encoded, UicRailTicketData.class);
- assert(decodedTicket != null);
- assertEquals(decodedTicket.controlDetail.ageCheckRequired , false );
- assertEquals(decodedTicket.controlDetail.getInfoText() , "cd" );
- assertEquals(decodedTicket.controlDetail.getIncludedTickets().get(0).getProductOwnerIA5() , "test" );
- assert(decodedTicket.controlDetail.getIdentificationByCardReference().get(0).getTrailingCardIdNum() == 100L );
- }
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java b/src/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java
deleted file mode 100644
index da59f67..0000000
--- a/src/org/uic/barcode/ticket/api/test/UperEncodeUICTicketExtensionTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.uic.barcode.ticket.api.test;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.logging.Level;
-
-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.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-
-
-public class UperEncodeUICTicketExtensionTest {
-
- /**
- * Example from the Standard on UPER.
- <pre>
- World-Schema DEFINITIONS AUTOMATIC TAGS ::=
- BEGIN
- TestRecord ::= [APPLICATION 0] IMPLICIT SEQUENCE {
- extensionList SEQUENCE OF ExtensionData OPTIONAL
- }
- ExtensionData ::= SEQUENCE {
- extensionId IA5String,
- extensionData OCTET STRING
- }
- END
-
-
- value TestRecord ::= { extensionList {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- }
-
-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>
- */
-
-
- @Sequence
- public static class TestRecord {
-
- @Asn1Optional public SequenceOfExtensionData extension;
-
- public TestRecord() {}
- public void setExtensionList(SequenceOfExtensionData sd){
- this.extension = sd;
- }
- }
-
-
- @Test public void testEncodeTicket() throws IllegalArgumentException, IllegalAccessException {
- TestRecord ticket = new TestRecord();
- populateTicket(ticket);
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
- String expectedHex = "8100B10282DA01640507B4";
- UperEncoder.logger.debug(String.format("first diference at index: %d",hex.compareTo(expectedHex)));
- assertEquals(hex,expectedHex);
- }
-
- @Test public void testDecodeTicket() throws IllegalArgumentException, IllegalAccessException {
- TestRecord ticket = new TestRecord();
- populateTicket(ticket);
- byte[] encoded = UperEncoder.encode(ticket);
- String hex = UperEncoder.hexStringFromBytes(encoded);
- UperEncoder.logger.log(Level.FINEST,String.format("data hex: %s", hex));
- String expectedHex = "8100B10282DA01640507B4";
- TestRecord decodedTicket = UperEncoder.decode(encoded, TestRecord.class);
- assert(decodedTicket != null);
- assertEquals(hex,expectedHex);
- }
-
- private void populateTicket(TestRecord ticket) {
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtensionList(ed);
-
- }
-
-
-
- /*
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- */
- private void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
-
-
-
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java b/src/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java
deleted file mode 100644
index 423908b..0000000
--- a/src/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV1.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IVoucher;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.VoucherTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class VoucherTestV1.
- *
- *
- *
- */
-public class VoucherTimeZoneTestV1 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = VoucherTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = VoucherTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = VoucherTestTicketV1.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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 CET 2022" ));
-
-
- }
-
-
- /**
- * 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");
- setValidUntilDateTo("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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 GMT 2022" ));
-
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFromDate1 = ((IVoucher) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate2 = ((IVoucher) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate3 = ((IVoucher) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntilDate1 = ((IVoucher) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate2 = ((IVoucher) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate3 = ((IVoucher) 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);
- ((IVoucher) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((IVoucher) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((IVoucher) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setValidUntilDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IVoucher) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((IVoucher) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((IVoucher) 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/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java b/src/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java
deleted file mode 100644
index 53dc248..0000000
--- a/src/org/uic/barcode/ticket/api/test/VoucherTimeZoneTestV2.java
+++ /dev/null
@@ -1,312 +0,0 @@
-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.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.spec.IVoucher;
-import org.uic.barcode.ticket.api.spec.IUicRailTicket;
-import org.uic.barcode.ticket.api.test.testtickets.VoucherTestTicketV1;
-import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoder;
-import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoder;
-
-
-/**
- * The Class VoucherTestV1.
- *
- *
- *
- */
-public class VoucherTimeZoneTestV2 {
-
- /** 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. */
- OpenAsn2ApiDecoder decoder = new OpenAsn2ApiDecoder();
-
- /** The encoder. */
- Api2OpenAsnEncoder encoder = new Api2OpenAsnEncoder();
-
- /** 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 = VoucherTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket2 = VoucherTestTicketV1.getUicTestTicket();
- UicRailTicketData ticket3 = VoucherTestTicketV1.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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 CET 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 CET 2022" ));
-
-
- }
-
-
- /**
- * 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");
- setValidUntilDateTo("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");
- setValidUntilDateTo("2022.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("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate2.equals("Thu Mar 24 23:59:00 GMT 2022" ));
- assert(validUntilDate3.equals("Thu Mar 24 23:59:00 GMT 2022" ));
-
-
- }
-
- private void decodedDateToStrings() {
-
- issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
- issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
- issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
-
- validFromDate1 = ((IVoucher) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate2 = ((IVoucher) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
- validFromDate3 = ((IVoucher) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
-
- validUntilDate1 = ((IVoucher) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate2 = ((IVoucher) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
- validUntilDate3 = ((IVoucher) 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);
- ((IVoucher) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
- ((IVoucher) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
- ((IVoucher) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidFrom(date);
- }
-
- private void setValidUntilDateTo(String dateString) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
- Date date = dateFormat.parse(dateString);
- ((IVoucher) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
- ((IVoucher) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
- ((IVoucher) 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/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java
deleted file mode 100644
index 5408638..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java
+++ /dev/null
@@ -1,578 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketType;
-import org.uic.barcode.ticket.api.asn.omv1.TokenType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
-
- public class AsnLevelPassTimeZoneTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
- /*
- value UicRailTicketData ::= {
- issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- ,transportDocument {
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- ,infoText "openTicketInfo"
- ,classCode "second"
- }
- }
- ,{
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- }
- }
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { referenceIA5 "UED12435867"
- ,issuerName "OEBB"
- ,issuerPNR "PNR"
- ,productOwnerIA5 "test"
- ,ticketType pass
- ,linkMode onlyValidInCombination
-
- }
- }
- }
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- }
- */
-
- /*
- * asn.1 version 1.3 encoding:
-Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
-UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
- issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
- issuingYear INTEGER [length (not encoded) = 1.0]
- 2018
- issuingDay INTEGER [length (not encoded) = 1.1]
- 1
- specimen BOOLEAN [length (not encoded) = 0.1]
- TRUE
- securePaperTicket BOOLEAN [length (not encoded) = 0.1]
- FALSE
- activated BOOLEAN [length (not encoded) = 0.1]
- TRUE
- issuerPNR IA5String [length = 13.0]
- "issuerTestPNR"
- issuedOnLine INTEGER [length = 1.0]
- 12
- travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
- traveler SEQUENCE OF [count = 1]
- TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
- firstName UTF8String [length = 4.0]
- 0x4a6f686e
- secondName UTF8String [length = 3.0]
- 0x446f77
- idCard IA5String [length = 5.0]
- "12345"
- ticketHolder BOOLEAN [length (not encoded) = 0.1]
- TRUE
- status SEQUENCE OF [count = 1]
- CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
- customerStatusDescr IA5String [length = 6.0]
- "senior"
- groupName UTF8String [length = 7.0]
- 0x6d7947726f7570
- transportDocument SEQUENCE OF [count = 2]
- DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
- token TokenType SEQUENCE [fieldcount (not encoded) = 2]
- tokenProviderIA5 IA5String [length = 3.0]
- "VDV"
- token OCTET STRING [length = 2.0]
- 0x82da
- ticket CHOICE [index = 2]
- openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
- returnIncluded BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 14.0]
- 0x6f70656e5469636b6574496e666f
- DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
- ticket CHOICE [index = 9]
- stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
- productName UTF8String [length = 7.0]
- 0x70617373616765
- stationNameUTF8 SEQUENCE OF [count = 1]
- UTF8String [length = 9.0]
- 0x416d7374657264616d
- validFromDay INTEGER [length (not encoded) = 1.2]
- 0
- numberOfDaysValid INTEGER [length = 1.0]
- 123
- controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
- identificationByCardReference SEQUENCE OF [count = 1]
- CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
- trailingCardIdNum INTEGER [length = 1.0]
- 100
- identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
- FALSE
- identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
- FALSE
- passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 2.0]
- 0x6364
- includedTickets SEQUENCE OF [count = 1]
- TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
- referenceIA5 IA5String [length = 11.0]
- "UED12435867"
- issuerName UTF8String [length = 4.0]
- 0x4f454242
- issuerPNR IA5String [length = 3.0]
- "PNR"
- productOwnerIA5 IA5String [length = 4.0]
- "test"
- ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
- 1
- linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
- 1
- extension 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 = 154.3
-Encoded successfully in 155 bytes:
-78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00082 2537B437 01A237BB
-82B164CD A3580883 73CBBB4E FE40EDAF 28EE4DEE AE004A03 AD12B014 16D08000
-00000403 9BDC195B 951A58DA D95D125B 999BC480 88040EE0 C2E6E6C2 CECA0212
-82DAE6E8 CAE4C8C2 DA0080BD A6010040 2C800131 B200ADC2 EAC588C5 93466D5C
-366E089E 8A848407 4275204E 9979F428 100B1028 2DA01640 507B40
- *
- *
- */
-
- /*
- * asn.1 version 2.0 encoding
- *
- Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
-UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
- issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
- issuingYear INTEGER [length (not encoded) = 1.0]
- 2018
- issuingDay INTEGER [length (not encoded) = 1.1]
- 1
- specimen BOOLEAN [length (not encoded) = 0.1]
- TRUE
- securePaperTicket BOOLEAN [length (not encoded) = 0.1]
- FALSE
- activated BOOLEAN [length (not encoded) = 0.1]
- TRUE
- issuerPNR IA5String [length = 13.0]
- "issuerTestPNR"
- issuedOnLine INTEGER [length = 1.0]
- 12
- travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
- traveler SEQUENCE OF [count = 1]
- TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
- firstName UTF8String [length = 4.0]
- 0x4a6f686e
- secondName UTF8String [length = 3.0]
- 0x446f77
- idCard IA5String [length = 5.0]
- "12345"
- ticketHolder BOOLEAN [length (not encoded) = 0.1]
- TRUE
- status SEQUENCE OF [count = 1]
- CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
- customerStatusDescr IA5String [length = 6.0]
- "senior"
- groupName UTF8String [length = 7.0]
- 0x6d7947726f7570
- transportDocument SEQUENCE OF [count = 2]
- DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
- token TokenType SEQUENCE [fieldcount (not encoded) = 2]
- tokenProviderIA5 IA5String [length = 3.0]
- "VDV"
- token OCTET STRING [length = 2.0]
- 0x82da
- ticket CHOICE [index = 2]
- openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
- returnIncluded BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 14.0]
- 0x6f70656e5469636b6574496e666f
- DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
- ticket CHOICE [index = 9]
- stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
- productName UTF8String [length = 7.0]
- 0x70617373616765
- stationNameUTF8 SEQUENCE OF [count = 1]
- UTF8String [length = 9.0]
- 0x416d7374657264616d
- validFromDay INTEGER [length (not encoded) = 1.2]
- 0
- numberOfDaysValid INTEGER [length = 1.0]
- 123
- controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
- identificationByCardReference SEQUENCE OF [count = 1]
- CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
- trailingCardIdNum INTEGER [length = 1.0]
- 100
- identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
- FALSE
- identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
- FALSE
- passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 2.0]
- 0x6364
- includedTickets SEQUENCE OF [count = 1]
- TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
- referenceIA5 IA5String [length = 11.0]
- "UED12435867"
- issuerName UTF8String [length = 4.0]
- 0x4f454242
- issuerPNR IA5String [length = 3.0]
- "PNR"
- productOwnerIA5 IA5String [length = 4.0]
- "test"
- ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
- 1
- linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
- 1
- extension 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 = 154.6
-Encoded successfully in 155 bytes:
-78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00041 129BDA1B 80D11BDD
-C158B266 D1AC0441 B9E5DDA7 7F2076D7 947726F7 57002501 D689580A 0B684000
-00000200 737B832B 72A34B1B 5B2BA24B 73337890 110081DC 185CDCD8 59D94042
-505B5CDD 195C9918 5B401017 B4C02008 05900026 364015B8 5D58B118 B268CDAB
-86CDC113 D1509080 E84EA409 D32F3E85 02016205 05B402C8 0A0F68
- *
- *
- *
- */
-
- public static String getEncodingV1Hex() {
- return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB" +
- "82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000" +
- "000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA0212" +
- "82DAE6E8CAE4C8C2DA0080BDA60100402C800131B200ADC2EAC588C593466D5C" +
- "366E089E8A8484074275204E9979F428100B10282DA01640507B40";
- }
-
- public static String getEncodingV2Hex() {
- return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D00041129BDA1B80D11BDD" +
- "C158B266D1AC0441B9E5DDA77F2076D7947726F757002501D689580A0B684000" +
- "00000200737B832B72A34B1B5B2BA24B73337890110081DC185CDCD859D94042" +
- "505B5CDD195C99185B401017B4C0200805900026364015B85D58B118B268CDAB" +
- "86CDC113D1509080E84EA409D32F3E850201620505B402C80A0F68";
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addOpenTicketData(do1);
- ds.add(do1);
-
- //StationPassage
- DocumentData do2 = new DocumentData();
- addStationPassage(do2);
- ds.add(do2);
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
- /*
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- */
- private static void addStationPassage(DocumentData dd) {
- TicketDetailData tdd = new TicketDetailData();
- StationPassageData sp = new StationPassageData();
- sp.setProductName("passage");
- sp.setValidFromDay(0L);
- sp.setNumberOfDaysValid(123L);
- SequenceOfStringUTF8 ss = new SequenceOfStringUTF8();
- ss.add("Amsterdam");
- sp.setStationNameUTF8(ss);
- tdd.setStationPassage(sp);
- dd.setTicket(tdd);
- }
-
- /*
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- infoText "openTicketInfo"
- }
- }
- */
-
-
-
- private static void addOpenTicketData(DocumentData dd) {
- TokenType to = new TokenType();
- to.setTokenProviderIA5("VDV");
- byte[] ba = { (byte) 0x82, (byte) 0xDA };
- to.setToken(ba);
- dd.setToken(to);
-
- TicketDetailData tdd = new TicketDetailData();
- OpenTicketData otd = new OpenTicketData();
- otd.setInfoText("openTicketInfo");
- otd.setClassCode(TravelClassType.first);
- otd.setReturnIncluded(false);
- tdd.setOpenTicket(otd);
- dd.setTicket(tdd);
- }
-
-
- /*
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- */
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- /*
- ,issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- */
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- /*
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- */
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- /*
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { productOwnerIA5 "test"
- ,
-
-
- }
- }
- }
- */
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
-
- /*
- *
- */
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java
deleted file mode 100644
index 09faac8..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerCardData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.GenderType;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class CustomerCardTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addCustomerCard(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addCustomerCard(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- CustomerCardData card = new CustomerCardData();
- card.setCustomer(getTraveler());
- card.setClassCode(TravelClassType.first);
- card.setValidFromYear(2021L);
- card.setValidFromDay(10L);
- card.setValidUntilYear(1L);
- card.setValidUntilDay(10L);
- card.setCardTypeDescr("RAILPLUS");
- tdd.setCustomerCard(card);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static TravelerType getTraveler() {
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setDayOfBirth(100L);
- tr.setGender(GenderType.male);
- tr.setIdCard("IEDZ235FT");
- return tr;
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java
deleted file mode 100644
index 7f01b94..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerCardData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.GenderType;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-
- public class CustomerCardTestTicketV2 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addCustomerCard(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addCustomerCard(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- CustomerCardData card = new CustomerCardData();
- card.setCustomer(getTraveler());
- card.setClassCode(TravelClassType.first);
- card.setValidFromYear(2021L);
- card.setValidFromDay(10L);
- card.setValidUntilYear(1L);
- card.setValidUntilDay(10L);
- card.setCardTypeDescr("RAILPLUS");
- tdd.setCustomerCard(card);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static TravelerType getTraveler() {
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setDayOfBirth(100L);
- tr.setGender(GenderType.male);
- tr.setIdCard("IEDZ235FT");
- return tr;
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java b/src/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
deleted file mode 100644
index 9364acd..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DelayConfirmation;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class DelayTestTicketV3 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //FipTicket
- DocumentData do1 = new DocumentData();
- addTicket(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addTicket(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- DelayConfirmation ticket = new DelayConfirmation();
- ticket.setPlannedArrivalDay(0L);
- ticket.setPlannedArrivalTime(1000L);
- ticket.setDelay(30L);
- ticket.setInfoText("delay confirmation");
- ticket.setAffectedTickets(getAffectedTickets());
- ticket.setPlannedArrivalYear(2022L);
- ticket.setReferenceIA5("ABDJ12345");
- ticket.setStationNum(8000001L);
- ticket.setStationNameUTF8("station of delay");
- ticket.setTrainCancelled(false);
- ticket.setTrainNum(Asn1BigInteger.toAsn1(100L));
- tdd.setDelayConfirmation(ticket);
- dd.setTicket(tdd);
- }
-
- private static SequenceOfTicketLinkType getAffectedTickets() {
-
- SequenceOfTicketLinkType lts = new SequenceOfTicketLinkType();
- TicketLinkType t1 = new TicketLinkType();
- t1.setReferenceNum(1080L);
- t1.setReferenceNum(801234567890L);
- t1.setProductOwnerNum(1080L);
- lts.add(t1);
- return lts;
-
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("employee");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java
deleted file mode 100644
index bfd54fe..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.FIPTicketData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCarrierNum;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class FipTimeZoneTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //FipTicket
- DocumentData do1 = new DocumentData();
- addFip(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addFip(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- FIPTicketData otd = new FIPTicketData();
- otd.setClassCode(TravelClassType.first);
- otd.setNumberOfTravelDays(8L);
- otd.setValidFromDay(10L);
- otd.setValidUntilDay(10L);
- SequenceOfCarrierNum carriers = new SequenceOfCarrierNum();
- carriers.add(1080L);
- carriers.add(1181L);
- otd.setCarrierNum(carriers);
- otd.setIncludesSupplements(true);
- otd.setReferenceNum(Asn1BigInteger.toAsn1(123456789));
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- s.add(0L);
- otd.setActivatedDay(s);
-
- tdd.setFipTicket(otd);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("employee");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java
deleted file mode 100644
index 08b4507..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.FIPTicketData;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCarrierNum;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-
- public class FipTimeZoneTestTicketV2 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //FipTicket
- DocumentData do1 = new DocumentData();
- addFip(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addFip(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- FIPTicketData otd = new FIPTicketData();
- otd.setClassCode(TravelClassType.first);
- otd.setNumberOfTravelDays(8L);
- otd.setValidFromDay(10L);
- otd.setValidUntilDay(10L);
- SequenceOfCarrierNum carriers = new SequenceOfCarrierNum();
- carriers.add(1080L);
- carriers.add(1181L);
- otd.setCarrierNum(carriers);
- otd.setIncludesSupplements(true);
- otd.setReferenceNum(Asn1BigInteger.toAsn1(123445));
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- s.add(0L);
- otd.setActivatedDay(s);
-
- tdd.setFipTicket(otd);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("employee");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java
deleted file mode 100644
index 69a61a9..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java
+++ /dev/null
@@ -1,578 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketType;
-import org.uic.barcode.ticket.api.asn.omv1.TokenType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
-
- public class OpenTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
- /*
- value UicRailTicketData ::= {
- issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- ,transportDocument {
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- ,infoText "openTicketInfo"
- ,classCode "second"
- }
- }
- ,{
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- }
- }
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { referenceIA5 "UED12435867"
- ,issuerName "OEBB"
- ,issuerPNR "PNR"
- ,productOwnerIA5 "test"
- ,ticketType pass
- ,linkMode onlyValidInCombination
-
- }
- }
- }
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- }
- */
-
- /*
- * asn.1 version 1.3 encoding:
-Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
-UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
- issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
- issuingYear INTEGER [length (not encoded) = 1.0]
- 2018
- issuingDay INTEGER [length (not encoded) = 1.1]
- 1
- specimen BOOLEAN [length (not encoded) = 0.1]
- TRUE
- securePaperTicket BOOLEAN [length (not encoded) = 0.1]
- FALSE
- activated BOOLEAN [length (not encoded) = 0.1]
- TRUE
- issuerPNR IA5String [length = 13.0]
- "issuerTestPNR"
- issuedOnLine INTEGER [length = 1.0]
- 12
- travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
- traveler SEQUENCE OF [count = 1]
- TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
- firstName UTF8String [length = 4.0]
- 0x4a6f686e
- secondName UTF8String [length = 3.0]
- 0x446f77
- idCard IA5String [length = 5.0]
- "12345"
- ticketHolder BOOLEAN [length (not encoded) = 0.1]
- TRUE
- status SEQUENCE OF [count = 1]
- CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
- customerStatusDescr IA5String [length = 6.0]
- "senior"
- groupName UTF8String [length = 7.0]
- 0x6d7947726f7570
- transportDocument SEQUENCE OF [count = 2]
- DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
- token TokenType SEQUENCE [fieldcount (not encoded) = 2]
- tokenProviderIA5 IA5String [length = 3.0]
- "VDV"
- token OCTET STRING [length = 2.0]
- 0x82da
- ticket CHOICE [index = 2]
- openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
- returnIncluded BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 14.0]
- 0x6f70656e5469636b6574496e666f
- DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
- ticket CHOICE [index = 9]
- stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
- productName UTF8String [length = 7.0]
- 0x70617373616765
- stationNameUTF8 SEQUENCE OF [count = 1]
- UTF8String [length = 9.0]
- 0x416d7374657264616d
- validFromDay INTEGER [length (not encoded) = 1.2]
- 0
- numberOfDaysValid INTEGER [length = 1.0]
- 123
- controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
- identificationByCardReference SEQUENCE OF [count = 1]
- CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
- trailingCardIdNum INTEGER [length = 1.0]
- 100
- identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
- FALSE
- identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
- FALSE
- passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 2.0]
- 0x6364
- includedTickets SEQUENCE OF [count = 1]
- TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
- referenceIA5 IA5String [length = 11.0]
- "UED12435867"
- issuerName UTF8String [length = 4.0]
- 0x4f454242
- issuerPNR IA5String [length = 3.0]
- "PNR"
- productOwnerIA5 IA5String [length = 4.0]
- "test"
- ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
- 1
- linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
- 1
- extension 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 = 154.3
-Encoded successfully in 155 bytes:
-78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00082 2537B437 01A237BB
-82B164CD A3580883 73CBBB4E FE40EDAF 28EE4DEE AE004A03 AD12B014 16D08000
-00000403 9BDC195B 951A58DA D95D125B 999BC480 88040EE0 C2E6E6C2 CECA0212
-82DAE6E8 CAE4C8C2 DA0080BD A6010040 2C800131 B200ADC2 EAC588C5 93466D5C
-366E089E 8A848407 4275204E 9979F428 100B1028 2DA01640 507B40
- *
- *
- */
-
- /*
- * asn.1 version 2.0 encoding
- *
- Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
-UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
- issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
- issuingYear INTEGER [length (not encoded) = 1.0]
- 2018
- issuingDay INTEGER [length (not encoded) = 1.1]
- 1
- specimen BOOLEAN [length (not encoded) = 0.1]
- TRUE
- securePaperTicket BOOLEAN [length (not encoded) = 0.1]
- FALSE
- activated BOOLEAN [length (not encoded) = 0.1]
- TRUE
- issuerPNR IA5String [length = 13.0]
- "issuerTestPNR"
- issuedOnLine INTEGER [length = 1.0]
- 12
- travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
- traveler SEQUENCE OF [count = 1]
- TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
- firstName UTF8String [length = 4.0]
- 0x4a6f686e
- secondName UTF8String [length = 3.0]
- 0x446f77
- idCard IA5String [length = 5.0]
- "12345"
- ticketHolder BOOLEAN [length (not encoded) = 0.1]
- TRUE
- status SEQUENCE OF [count = 1]
- CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
- customerStatusDescr IA5String [length = 6.0]
- "senior"
- groupName UTF8String [length = 7.0]
- 0x6d7947726f7570
- transportDocument SEQUENCE OF [count = 2]
- DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
- token TokenType SEQUENCE [fieldcount (not encoded) = 2]
- tokenProviderIA5 IA5String [length = 3.0]
- "VDV"
- token OCTET STRING [length = 2.0]
- 0x82da
- ticket CHOICE [index = 2]
- openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
- returnIncluded BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 14.0]
- 0x6f70656e5469636b6574496e666f
- DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
- ticket CHOICE [index = 9]
- stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
- productName UTF8String [length = 7.0]
- 0x70617373616765
- stationNameUTF8 SEQUENCE OF [count = 1]
- UTF8String [length = 9.0]
- 0x416d7374657264616d
- validFromDay INTEGER [length (not encoded) = 1.2]
- 0
- numberOfDaysValid INTEGER [length = 1.0]
- 123
- controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
- identificationByCardReference SEQUENCE OF [count = 1]
- CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
- trailingCardIdNum INTEGER [length = 1.0]
- 100
- identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
- FALSE
- identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
- FALSE
- passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 2.0]
- 0x6364
- includedTickets SEQUENCE OF [count = 1]
- TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
- referenceIA5 IA5String [length = 11.0]
- "UED12435867"
- issuerName UTF8String [length = 4.0]
- 0x4f454242
- issuerPNR IA5String [length = 3.0]
- "PNR"
- productOwnerIA5 IA5String [length = 4.0]
- "test"
- ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
- 1
- linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
- 1
- extension 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 = 154.6
-Encoded successfully in 155 bytes:
-78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00041 129BDA1B 80D11BDD
-C158B266 D1AC0441 B9E5DDA7 7F2076D7 947726F7 57002501 D689580A 0B684000
-00000200 737B832B 72A34B1B 5B2BA24B 73337890 110081DC 185CDCD8 59D94042
-505B5CDD 195C9918 5B401017 B4C02008 05900026 364015B8 5D58B118 B268CDAB
-86CDC113 D1509080 E84EA409 D32F3E85 02016205 05B402C8 0A0F68
- *
- *
- *
- */
-
- public static String getEncodingV1Hex() {
- return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB" +
- "82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000" +
- "000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA0212" +
- "82DAE6E8CAE4C8C2DA0080BDA60100402C800131B200ADC2EAC588C593466D5C" +
- "366E089E8A8484074275204E9979F428100B10282DA01640507B40";
- }
-
- public static String getEncodingV2Hex() {
- return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D00041129BDA1B80D11BDD" +
- "C158B266D1AC0441B9E5DDA77F2076D7947726F757002501D689580A0B684000" +
- "00000200737B832B72A34B1B5B2BA24B73337890110081DC185CDCD859D94042" +
- "505B5CDD195C99185B401017B4C0200805900026364015B85D58B118B268CDAB" +
- "86CDC113D1509080E84EA409D32F3E850201620505B402C80A0F68";
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addOpenTicketData(do1);
- ds.add(do1);
-
- //StationPassage
- DocumentData do2 = new DocumentData();
- addStationPassage(do2);
- ds.add(do2);
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
- /*
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- */
- private static void addStationPassage(DocumentData dd) {
- TicketDetailData tdd = new TicketDetailData();
- StationPassageData sp = new StationPassageData();
- sp.setProductName("passage");
- sp.setValidFromDay(0L);
- sp.setNumberOfDaysValid(123L);
- SequenceOfStringUTF8 ss = new SequenceOfStringUTF8();
- ss.add("Amsterdam");
- sp.setStationNameUTF8(ss);
- tdd.setStationPassage(sp);
- dd.setTicket(tdd);
- }
-
- /*
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- infoText "openTicketInfo"
- }
- }
- */
-
-
-
- private static void addOpenTicketData(DocumentData dd) {
- TokenType to = new TokenType();
- to.setTokenProviderIA5("VDV");
- byte[] ba = { (byte) 0x82, (byte) 0xDA };
- to.setToken(ba);
- dd.setToken(to);
-
- TicketDetailData tdd = new TicketDetailData();
- OpenTicketData otd = new OpenTicketData();
- otd.setInfoText("openTicketInfo");
- otd.setClassCode(TravelClassType.first);
- otd.setReturnIncluded(false);
- tdd.setOpenTicket(otd);
- dd.setTicket(tdd);
- }
-
-
- /*
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- */
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- /*
- ,issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- */
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- /*
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- */
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- /*
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { productOwnerIA5 "test"
- ,
-
-
- }
- }
- }
- */
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
-
- /*
- *
- */
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java
deleted file mode 100644
index 5ca6b73..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TokenType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
-
- public class OpenTicketTimeZoneTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addOpenTicketData(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
-
- private static void addOpenTicketData(DocumentData dd) {
- TokenType to = new TokenType();
- to.setTokenProviderIA5("VDV");
- byte[] ba = { (byte) 0x82, (byte) 0xDA };
- to.setToken(ba);
- dd.setToken(to);
-
- TicketDetailData tdd = new TicketDetailData();
- OpenTicketData otd = new OpenTicketData();
- otd.setInfoText("openTicketInfo");
- otd.setClassCode(TravelClassType.first);
- otd.setReturnIncluded(false);
- otd.setValidFromDay(10L);
- otd.setValidFromTime(0L);
- otd.setValidUntilDay(10L);
- otd.setValidUntilTime(1439L);
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- otd.setActivatedDay(s);
- s.add(0L);
- tdd.setOpenTicket(otd);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java
deleted file mode 100644
index 3acc754..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.OpenTicketData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TokenType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-
-
- public class OpenTicketTimeZoneTestTicketV2 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addOpenTicketData(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
-
- private static void addOpenTicketData(DocumentData dd) {
- TokenType to = new TokenType();
- to.setTokenProviderIA5("VDV");
- byte[] ba = { (byte) 0x82, (byte) 0xDA };
- to.setToken(ba);
- dd.setToken(to);
-
- TicketDetailData tdd = new TicketDetailData();
- OpenTicketData otd = new OpenTicketData();
- otd.setInfoText("openTicketInfo");
- otd.setClassCode(TravelClassType.first);
- otd.setReturnIncluded(false);
- otd.setValidFromDay(10L);
- otd.setValidFromTime(0L);
- otd.setValidUntilDay(10L);
- otd.setValidUntilTime(1439L);
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- otd.setActivatedDay(s);
- s.add(0L);
- tdd.setOpenTicket(otd);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java
deleted file mode 100644
index ad70424..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.ParkingGroundData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class ParkingTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //FipTicket
- DocumentData do1 = new DocumentData();
- addTicket(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addTicket(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- ParkingGroundData ticket = new ParkingGroundData();
- ticket.setFromParkingDate(01L);
- ticket.setToParkingDate(01L);
- ticket.setReferenceIA5("ACHE12345");
- ticket.setLocation("Parking Frankfurt Main West");
- ticket.setNumberPlate("AA-DE-12345");
- ticket.setStationNum(8000001L);
- ticket.setPrice(500L);
- ticket.setParkingGroundId("P47623");
- ticket.setSpecialInformation("outdoor parking");
-
- tdd.setParkingGround(ticket);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("employee");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java
deleted file mode 100644
index 99d9711..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.ParkingGroundData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-
- public class ParkingTestTicketV2 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //FipTicket
- DocumentData do1 = new DocumentData();
- addTicket(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addTicket(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- ParkingGroundData ticket = new ParkingGroundData();
- ticket.setFromParkingDate(01L);
- ticket.setToParkingDate(01L);
- ticket.setReferenceIA5("ACHE12345");
- ticket.setLocation("Parking Frankfurt Main West");
- ticket.setNumberPlate("AA-DE-12345");
- ticket.setStationNum(8000001L);
- ticket.setPrice(500L);
- ticket.setParkingGroundId("P47623");
- ticket.setSpecialInformation("outdoor parking");
-
- tdd.setParkingGround(ticket);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("employee");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java
deleted file mode 100644
index a165308..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv1.PassData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class PassTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addPass(do1);
- ds.add(do1);
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- private static void addPass(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- PassData otd = new PassData();
- otd.setInfoText("pass");
- otd.setClassCode(TravelClassType.first);
- otd.setPassDescription("ONE COUNTRY");
- tdd.setPass(otd);
- dd.setTicket(tdd);
- }
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java b/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java
deleted file mode 100644
index 8bea50a..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv1.PassData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class PassTimeZoneTestTicketCase1V1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addPass1(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addPass1(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- PassData otd = new PassData();
- otd.setInfoText("pass");
- otd.setClassCode(TravelClassType.first);
- otd.setPassDescription("ONE COUNTRY");
- otd.setValidFromDay(10L);
- otd.setValidFromTime(0L);
- otd.setValidUntilDay(10L);
- otd.setValidUntilTime(1439L);
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- otd.setActivatedDay(s);
- s.add(0L);
-
- tdd.setPass(otd);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java b/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java
deleted file mode 100644
index cc30e72..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv1.PassData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class PassTimeZoneTestTicketCase2V1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addPass1(do1);
-
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 00:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(30L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addPass1(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- PassData otd = new PassData();
- otd.setInfoText("pass");
- otd.setClassCode(TravelClassType.first);
- otd.setPassDescription("ONE COUNTRY");
- otd.setValidFromDay(10L);
- otd.setValidFromTime(0L);
- otd.setValidUntilDay(10L);
- otd.setValidUntilTime(1439L);
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- otd.setActivatedDay(s);
- s.add(0L);
-
- tdd.setPass(otd);
- dd.setTicket(tdd);
- }
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java b/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java
deleted file mode 100644
index 715a292..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv1.PassData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class PassTimeZoneTestTicketCase3V1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
- /*
- *
- * Case 1:
- issue date: 04-03-2021 12:30 UTC
- issuingYear: 2021
- issuingDay: 63
- issuingTime: 750
- validFromDay: 10
- activatedDays: [0]
- utcOffset: 0
-
- expected: activated for 04-03-2021 + 10 + 0 00:00 UTC --> 14-03-2021
-
- Case 2:
- issue date: 04-03-2021 00:30 UTC
- issuingYear: 2021
- issuingDay: 63
- issuingTime: 30
- validFromDay: 10
- activatedDays: [0]
- utcOffset: 0
-
- expected: activated for 04-03-2021 + 10 + 0 00:00 UTC --> 14-03-2021
-
- Case 3:
- issue date: 03-03-2021 23:30 UTC
- issuingYear: 2021
- issuingDay: 62
- issuingTime: 1410
- validFromDay: 11
- activatedDays: [0]
-
- expected: activated for 03-03-2021 + 11 + 0 00:00 UTC --> 14-03-2021
-
-
- */
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addPass1(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //03-03-2021 23:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(1410L);
- issuingDetail.setIssuingDay(62L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addPass1(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- PassData otd = new PassData();
- otd.setInfoText("pass");
- otd.setClassCode(TravelClassType.first);
- otd.setPassDescription("ONE COUNTRY");
- otd.setValidFromDay(11L);
- otd.setValidFromTime(0L);
- otd.setValidUntilDay(10L);
- otd.setValidUntilTime(1439L);
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- otd.setActivatedDay(s);
- s.add(0L);
-
- tdd.setPass(otd);
- dd.setTicket(tdd);
- }
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java
deleted file mode 100644
index 7539f0d..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.LinkMode;
-import org.uic.barcode.ticket.api.asn.omv2.PassData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfActivatedDays;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-
- public class PassTimeZoneTestTicketV2 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addPass1(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addPass1(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- PassData otd = new PassData();
- otd.setInfoText("pass");
- otd.setClassCode(TravelClassType.first);
- otd.setPassDescription("ONE COUNTRY");
- otd.setValidFromDay(10L);
- otd.setValidFromTime(0L);
- otd.setValidUntilDay(10L);
- otd.setValidUntilTime(1439L);
- SequenceOfActivatedDays s = new SequenceOfActivatedDays();
- otd.setActivatedDay(s);
- s.add(0L);
-
- tdd.setPass(otd);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java
deleted file mode 100644
index 840b584..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.PassengerType;
-import org.uic.barcode.ticket.api.asn.omv1.PlacesType;
-import org.uic.barcode.ticket.api.asn.omv1.PriceTypeType;
-import org.uic.barcode.ticket.api.asn.omv1.ReservationData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCarrierNum;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTariffType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.ServiceType;
-import org.uic.barcode.ticket.api.asn.omv1.TariffType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
-
- public class ReservationTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addReservation(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
-
- private static void addReservation(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- ReservationData ticket = new ReservationData();
- ticket.setTrainNum(123L);
- ticket.setService(ServiceType.seat);
- ticket.setReferenceNum(810123456789L);
- ticket.setServiceBrandAbrUTF8("XYZ");
- ticket.setServiceBrandNameUTF8("special train");
- SequenceOfCarrierNum carriers = new SequenceOfCarrierNum();
- carriers.add(1080L);
- carriers.add(1181L);
- ticket.setCarrierNum(carriers);
- ticket.setFromStationNum(8100001L);
- ticket.setToStationNum(800001L);
- ticket.setNumberOfSupplements(1L);
- ticket.setServiceBrand(100L);
- ticket.setPrice(12345L);
- ticket.setPriceType(PriceTypeType.supplement);
-
- ticket.setPlaces(getPlaces());
- ticket.setTariff(getTariffs());
-
- ticket.setInfoText("reservation");
- ticket.setClassCode(TravelClassType.first);
- ticket.setDepartureDate(10L);
- ticket.setDepartureTime(0L);
- ticket.setArrivalDate(10L);
- ticket.setArrivalTime(1439L);
- tdd.setReservation(ticket);
- dd.setTicket(tdd);
- }
-
-
-
- private static SequenceOfTariffType getTariffs() {
- SequenceOfTariffType tariffs = new SequenceOfTariffType();
-
- TariffType tariff = new TariffType();
- tariff.setNumberOfPassengers(1L);
- tariff.setRestrictedToCountryOfResidence(false);
- tariff.setPassengerType(PassengerType.adult);
- tariff.setTariffIdNum(72L);
- tariff.setTariffDesc("Full Fare Adult");
- tariffs.add(tariff);
- TariffType tariff2 = new TariffType();
- tariff2.setRestrictedToCountryOfResidence(false);
- tariff2.setNumberOfPassengers(2L);
- tariff2.setPassengerType(PassengerType.child);
- tariff2.setTariffIdNum(73L);
- tariff2.setTariffDesc("Full Fare Child");
- tariffs.add(tariff2);
- return tariffs;
- }
-
-
- private static PlacesType getPlaces() {
- PlacesType places = new PlacesType();
- places.setPlaceDescription("11-13");
- places.setCoach("12");
- return places;
- }
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java
deleted file mode 100644
index ef84644..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.PassengerType;
-import org.uic.barcode.ticket.api.asn.omv2.PlacesType;
-import org.uic.barcode.ticket.api.asn.omv2.PriceTypeType;
-import org.uic.barcode.ticket.api.asn.omv2.ReservationData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCarrierNum;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTariffType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.ServiceType;
-import org.uic.barcode.ticket.api.asn.omv2.TariffType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelClassType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-
-
- public class ReservationTestTicketV2 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addReservation(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
-
- private static void addReservation(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- ReservationData ticket = new ReservationData();
- ticket.setTrainNum(123L);
- ticket.setService(ServiceType.seat);
- ticket.setReferenceNum(810123456789L);
- ticket.setServiceBrandAbrUTF8("XYZ");
- ticket.setServiceBrandNameUTF8("special train");
- SequenceOfCarrierNum carriers = new SequenceOfCarrierNum();
- carriers.add(1080L);
- carriers.add(1181L);
- ticket.setCarrierNum(carriers);
- ticket.setFromStationNum(8100001L);
- ticket.setToStationNum(800001L);
- ticket.setNumberOfSupplements(1L);
- ticket.setServiceBrand(100L);
- ticket.setPrice(12345L);
- ticket.setPriceType(PriceTypeType.supplement);
-
- ticket.setPlaces(getPlaces());
- ticket.setTariff(getTariffs());
-
- ticket.setInfoText("reservation");
- ticket.setClassCode(TravelClassType.first);
- ticket.setDepartureDate(10L);
- ticket.setDepartureTime(0L);
- ticket.setArrivalDate(10L);
- ticket.setArrivalTime(1439L);
- tdd.setReservation(ticket);
- dd.setTicket(tdd);
- }
-
-
-
- private static SequenceOfTariffType getTariffs() {
- SequenceOfTariffType tariffs = new SequenceOfTariffType();
-
- TariffType tariff = new TariffType();
- tariff.setNumberOfPassengers(1L);
- tariff.setRestrictedToCountryOfResidence(false);
- tariff.setPassengerType(PassengerType.adult);
- tariff.setTariffIdNum(72L);
- tariff.setTariffDesc("Full Fare Adult");
- tariffs.add(tariff);
- TariffType tariff2 = new TariffType();
- tariff2.setRestrictedToCountryOfResidence(false);
- tariff2.setNumberOfPassengers(2L);
- tariff2.setPassengerType(PassengerType.child);
- tariff2.setTariffIdNum(73L);
- tariff2.setTariffDesc("Full Fare Child");
- tariffs.add(tariff2);
- return tariffs;
- }
-
-
- private static PlacesType getPlaces() {
- PlacesType places = new PlacesType();
- places.setPlaceDescription("11-13");
- places.setCoach("12");
- return places;
- }
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java b/src/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java
deleted file mode 100644
index d752043..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java
+++ /dev/null
@@ -1,574 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
- import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
- import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
- import org.uic.barcode.ticket.api.asn.omv1.ControlData;
- import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
- import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
- import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
- import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
- import org.uic.barcode.ticket.api.asn.omv1.LinkMode;
- import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
- import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
- import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
- import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
- import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
- import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
- import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
- import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
- import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
- import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
- import org.uic.barcode.ticket.api.asn.omv1.TicketType;
- import org.uic.barcode.ticket.api.asn.omv1.TokenType;
- import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
- import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
- import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
- public class SimpleTicketLinkTestTicket {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
- /*
- value UicRailTicketData ::= {
- issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- ,transportDocument {
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- infoText "openTicketInfo"
- }
- }
- ,{
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- }
- }
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { referenceIA5 "UED12435867"
- ,issuerName "OEBB"
- ,issuerPNR "PNR"
- ,productOwnerIA5 "test"
- ,ticketType pass
- ,linkMode onlyValidInCombination
-
- }
- }
- }
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- }
- */
-
- /*
- * asn.1 version 1.3 encoding:
-Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
-UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
- issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
- issuingYear INTEGER [length (not encoded) = 1.0]
- 2018
- issuingDay INTEGER [length (not encoded) = 1.1]
- 1
- specimen BOOLEAN [length (not encoded) = 0.1]
- TRUE
- securePaperTicket BOOLEAN [length (not encoded) = 0.1]
- FALSE
- activated BOOLEAN [length (not encoded) = 0.1]
- TRUE
- issuerPNR IA5String [length = 13.0]
- "issuerTestPNR"
- issuedOnLine INTEGER [length = 1.0]
- 12
- travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
- traveler SEQUENCE OF [count = 1]
- TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
- firstName UTF8String [length = 4.0]
- 0x4a6f686e
- secondName UTF8String [length = 3.0]
- 0x446f77
- idCard IA5String [length = 5.0]
- "12345"
- ticketHolder BOOLEAN [length (not encoded) = 0.1]
- TRUE
- status SEQUENCE OF [count = 1]
- CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
- customerStatusDescr IA5String [length = 6.0]
- "senior"
- groupName UTF8String [length = 7.0]
- 0x6d7947726f7570
- transportDocument SEQUENCE OF [count = 2]
- DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
- token TokenType SEQUENCE [fieldcount (not encoded) = 2]
- tokenProviderIA5 IA5String [length = 3.0]
- "VDV"
- token OCTET STRING [length = 2.0]
- 0x82da
- ticket CHOICE [index = 2]
- openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
- returnIncluded BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 14.0]
- 0x6f70656e5469636b6574496e666f
- DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
- ticket CHOICE [index = 9]
- stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
- productName UTF8String [length = 7.0]
- 0x70617373616765
- stationNameUTF8 SEQUENCE OF [count = 1]
- UTF8String [length = 9.0]
- 0x416d7374657264616d
- validFromDay INTEGER [length (not encoded) = 1.2]
- 0
- numberOfDaysValid INTEGER [length = 1.0]
- 123
- controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
- identificationByCardReference SEQUENCE OF [count = 1]
- CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
- trailingCardIdNum INTEGER [length = 1.0]
- 100
- identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
- FALSE
- identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
- FALSE
- passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 2.0]
- 0x6364
- includedTickets SEQUENCE OF [count = 1]
- TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
- referenceIA5 IA5String [length = 11.0]
- "UED12435867"
- issuerName UTF8String [length = 4.0]
- 0x4f454242
- issuerPNR IA5String [length = 3.0]
- "PNR"
- productOwnerIA5 IA5String [length = 4.0]
- "test"
- ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
- 1
- linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
- 1
- extension 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 = 154.3
-Encoded successfully in 155 bytes:
-78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00082 2537B437 01A237BB
-82B164CD A3580883 73CBBB4E FE40EDAF 28EE4DEE AE004A03 AD12B014 16D08000
-00000403 9BDC195B 951A58DA D95D125B 999BC480 88040EE0 C2E6E6C2 CECA0212
-82DAE6E8 CAE4C8C2 DA0080BD A6010040 2C800131 B200ADC2 EAC588C5 93466D5C
-366E089E 8A848407 4275204E 9979F428 100B1028 2DA01640 507B40
- *
- *
- */
-
- /*
- * asn.1 version 2.0 encoding
- *
- Encoding to the file 'data.uper' using PER UNALIGNED encoding rule...
-UicRailTicketData SEQUENCE [root fieldcount (not encoded) = 5]
- issuingDetail IssuingData SEQUENCE [root fieldcount (not encoded) = 7]
- issuingYear INTEGER [length (not encoded) = 1.0]
- 2018
- issuingDay INTEGER [length (not encoded) = 1.1]
- 1
- specimen BOOLEAN [length (not encoded) = 0.1]
- TRUE
- securePaperTicket BOOLEAN [length (not encoded) = 0.1]
- FALSE
- activated BOOLEAN [length (not encoded) = 0.1]
- TRUE
- issuerPNR IA5String [length = 13.0]
- "issuerTestPNR"
- issuedOnLine INTEGER [length = 1.0]
- 12
- travelerDetail TravelerData SEQUENCE [root fieldcount (not encoded) = 2]
- traveler SEQUENCE OF [count = 1]
- TravelerType SEQUENCE [root fieldcount (not encoded) = 5]
- firstName UTF8String [length = 4.0]
- 0x4a6f686e
- secondName UTF8String [length = 3.0]
- 0x446f77
- idCard IA5String [length = 5.0]
- "12345"
- ticketHolder BOOLEAN [length (not encoded) = 0.1]
- TRUE
- status SEQUENCE OF [count = 1]
- CustomerStatusType SEQUENCE [fieldcount (not encoded) = 1]
- customerStatusDescr IA5String [length = 6.0]
- "senior"
- groupName UTF8String [length = 7.0]
- 0x6d7947726f7570
- transportDocument SEQUENCE OF [count = 2]
- DocumentData SEQUENCE [root fieldcount (not encoded) = 2]
- token TokenType SEQUENCE [fieldcount (not encoded) = 2]
- tokenProviderIA5 IA5String [length = 3.0]
- "VDV"
- token OCTET STRING [length = 2.0]
- 0x82da
- ticket CHOICE [index = 2]
- openTicket OpenTicketData SEQUENCE [root fieldcount (not encoded) = 2]
- returnIncluded BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 14.0]
- 0x6f70656e5469636b6574496e666f
- DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
- ticket CHOICE [index = 9]
- stationPassage StationPassageData SEQUENCE [root fieldcount (not encoded) = 4]
- productName UTF8String [length = 7.0]
- 0x70617373616765
- stationNameUTF8 SEQUENCE OF [count = 1]
- UTF8String [length = 9.0]
- 0x416d7374657264616d
- validFromDay INTEGER [length (not encoded) = 1.2]
- 0
- numberOfDaysValid INTEGER [length = 1.0]
- 123
- controlDetail ControlData SEQUENCE [root fieldcount (not encoded) = 9]
- identificationByCardReference SEQUENCE OF [count = 1]
- CardReferenceType SEQUENCE [root fieldcount (not encoded) = 1]
- trailingCardIdNum INTEGER [length = 1.0]
- 100
- identificationByIdCard BOOLEAN [length (not encoded) = 0.1]
- FALSE
- identificationByPassportId BOOLEAN [length (not encoded) = 0.1]
- FALSE
- passportValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- onlineValidationRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ageCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- reductionCardCheckRequired BOOLEAN [length (not encoded) = 0.1]
- FALSE
- infoText UTF8String [length = 2.0]
- 0x6364
- includedTickets SEQUENCE OF [count = 1]
- TicketLinkType SEQUENCE [root fieldcount (not encoded) = 6]
- referenceIA5 IA5String [length = 11.0]
- "UED12435867"
- issuerName UTF8String [length = 4.0]
- 0x4f454242
- issuerPNR IA5String [length = 3.0]
- "PNR"
- productOwnerIA5 IA5String [length = 4.0]
- "test"
- ticketType TicketType ENUMERATED [length (not encoded) = 0.2]
- 1
- linkMode LinkMode ENUMERATED [length (not encoded) = 0.1]
- 1
- extension 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 = 154.6
-Encoded successfully in 155 bytes:
-78022020 050DD3CF 9F5CBCAA 65E7D284 EA40218A 02D00041 129BDA1B 80D11BDD
-C158B266 D1AC0441 B9E5DDA7 7F2076D7 947726F7 57002501 D689580A 0B684000
-00000200 737B832B 72A34B1B 5B2BA24B 73337890 110081DC 185CDCD8 59D94042
-505B5CDD 195C9918 5B401017 B4C02008 05900026 364015B8 5D58B118 B268CDAB
-86CDC113 D1509080 E84EA409 D32F3E85 02016205 05B402C8 0A0F68
- *
- *
- *
- */
-
- public static String getEncodingV1Hex() {
- return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB" +
- "82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000" +
- "000004039BDC195B951A58DAD95D125B999BC48088040EE0C2E6E6C2CECA0212" +
- "82DAE6E8CAE4C8C2DA0080BDA60100402C800131B200ADC2EAC588C593466D5C" +
- "366E089E8A8484074275204E9979F428100B10282DA01640507B40";
- }
-
- public static String getEncodingV2Hex() {
- return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D00041129BDA1B80D11BDD" +
- "C158B266D1AC0441B9E5DDA77F2076D7947726F757002501D689580A0B684000" +
- "00000200737B832B72A34B1B5B2BA24B73337890110081DC185CDCD859D94042" +
- "505B5CDD195C99185B401017B4C0200805900026364015B85D58B118B268CDAB" +
- "86CDC113D1509080E84EA409D32F3E850201620505B402C80A0F68";
- }
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addOpenTicketData(do1);
- ds.add(do1);
-
- //StationPassage
- DocumentData do2 = new DocumentData();
- addStationPassage(do2);
- ds.add(do2);
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
- /*
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- */
- private static void addStationPassage(DocumentData dd) {
- TicketDetailData tdd = new TicketDetailData();
- StationPassageData sp = new StationPassageData();
- sp.setProductName("passage");
- sp.setValidFromDay(0L);
- sp.setNumberOfDaysValid(123L);
- SequenceOfStringUTF8 ss = new SequenceOfStringUTF8();
- ss.add("Amsterdam");
- sp.setStationNameUTF8(ss);
- tdd.setStationPassage(sp);
- dd.setTicket(tdd);
- }
-
- /*
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- infoText "openTicketInfo"
- }
- }
- */
-
-
-
- private static void addOpenTicketData(DocumentData dd) {
- TokenType to = new TokenType();
- to.setTokenProviderIA5("VDV");
- byte[] ba = { (byte) 0x82, (byte) 0xDA };
- to.setToken(ba);
- dd.setToken(to);
-
- TicketDetailData tdd = new TicketDetailData();
- OpenTicketData otd = new OpenTicketData();
- otd.setInfoText("openTicketInfo");
- otd.setReturnIncluded(false);
- tdd.setOpenTicket(otd);
- dd.setTicket(tdd);
- }
-
-
- /*
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- */
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- /*
- ,issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- */
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- /*
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- */
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- /*
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { productOwnerIA5 "test"
- ,
-
-
- }
- }
- }
- */
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
-
- /*
- *
- */
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- tlt.setTicketType(TicketType.pass);
- tlt.setIssuerPNR("PNR");
- tlt.setReferenceIA5("UED12435867");
- tlt.setLinkMode(LinkMode.onlyValidInCombination);
- tlt.setIssuerName("OEBB");
- sequenceOfTicketLinkType.add(tlt);
- }
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java b/src/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java
deleted file mode 100644
index d8adb3d..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TokenType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
-public class SimpleUicTestTicket {
-
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //OpenTicket
- DocumentData do1 = new DocumentData();
- addOpenTicketData(do1);
- ds.add(do1);
-
- //StationPassage
- DocumentData do2 = new DocumentData();
- addStationPassage(do2);
- ds.add(do2);
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
- /*
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- */
- private static void addStationPassage(DocumentData dd) {
- TicketDetailData tdd = new TicketDetailData();
- StationPassageData sp = new StationPassageData();
- sp.setProductName("passage");
- sp.setValidFromDay(0L);
- sp.setNumberOfDaysValid(123L);
- SequenceOfStringUTF8 ss = new SequenceOfStringUTF8();
- ss.add("Amsterdam");
- sp.setStationNameUTF8(ss);
- tdd.setStationPassage(sp);
- dd.setTicket(tdd);
- }
-
- /*
- {
- token {tokenProviderIA5 "VDV", token '82DA'H }
- ,ticket openTicket : {
- returnIncluded FALSE
- infoText "openTicketInfo"
- }
- }
- */
-
- private static void addOpenTicketData(DocumentData dd) {
- TokenType to = new TokenType();
- to.setTokenProviderIA5("VDV");
- byte[] ba = { (byte) 0x82, (byte) 0xDA };
- to.setToken(ba);
- dd.setToken(to);
-
- TicketDetailData tdd = new TicketDetailData();
- OpenTicketData otd = new OpenTicketData();
- otd.setInfoText("openTicketInfo");
- otd.setReturnIncluded(false);
- tdd.setOpenTicket(otd);
- dd.setTicket(tdd);
- }
-
-
- /*
- ,travelerDetail{
- traveler {
- {
- firstName "John"
- ,secondName "Dow"
- ,idCard "12345"
- ,ticketHolder TRUE
- ,status {{customerStatusDescr "senior" }}
- }
- }
- ,groupName "myGroup"
- }
- */
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- /*
- ,issuingDetail {
- issuingYear 2018
- issuingDay 1
- specimen TRUE,
- securePaperTicket FALSE,
- activated TRUE,
- issuerPNR "issuerTestPNR",
- issuedOnLine 12
- }
- */
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- /*
- ,extension {
- { extensionId "1", extensionData '82DA'H }
- ,{ extensionId "2", extensionData '83DA'H }
- }
- */
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- /*
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { productOwnerIA5 "test" }
- }
- }
- */
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
-
- /*
- *
- */
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- sequenceOfTicketLinkType.add(tlt);
- }
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java
deleted file mode 100644
index b0626f1..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.StationPassageData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-
-public class StationPassageTestTicketV1 {
-
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //StationPassage
- DocumentData do2 = new DocumentData();
- addStationPassage(do2);
- ds.add(do2);
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
- /*
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- */
- private static void addStationPassage(DocumentData dd) {
- TicketDetailData tdd = new TicketDetailData();
- StationPassageData sp = new StationPassageData();
- sp.setProductName("passage");
- sp.setValidFromDay(5L);
- sp.setValidFromTime(0L);
- sp.setValidUntilDay(5L);
- sp.setValidUntilTime(1000L);
- sp.setNumberOfDaysValid(5L);
- SequenceOfStringUTF8 ss = new SequenceOfStringUTF8();
- ss.add("Amsterdam");
- sp.setStationNameUTF8(ss);
- tdd.setStationPassage(sp);
- dd.setTicket(tdd);
- }
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- /*
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { productOwnerIA5 "test" }
- }
- }
- */
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
-
- /*
- *
- */
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- sequenceOfTicketLinkType.add(tlt);
- }
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java
deleted file mode 100644
index c551293..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.StationPassageData;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TicketLinkType;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-
-public class StationPassageTestTicketV2 {
-
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //StationPassage
- DocumentData do2 = new DocumentData();
- addStationPassage(do2);
- ds.add(do2);
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
- /*
- ticket stationPassage : {
- productName "passage"
- ,stationNameUTF8 { "Amsterdam" }
- ,validFromDay 0
- ,numberOfDaysValid 123
- }
- */
- private static void addStationPassage(DocumentData dd) {
- TicketDetailData tdd = new TicketDetailData();
- StationPassageData sp = new StationPassageData();
- sp.setProductName("passage");
- sp.setValidFromDay(5L);
- sp.setValidFromTime(0L);
- sp.setValidUntilDay(5L);
- sp.setValidUntilTime(1000L);
- sp.setNumberOfDaysValid(5L);
- SequenceOfStringUTF8 ss = new SequenceOfStringUTF8();
- ss.add("Amsterdam");
- sp.setStationNameUTF8(ss);
- tdd.setStationPassage(sp);
- dd.setTicket(tdd);
- }
-
-
- private static void populateTravelerData(TravelerData td) {
- td.setGroupName("myGroup");
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("senior");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2018L);
- issuingDetail.setIssuingDay(1L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- /*
- ,controlDetail {
- identificationByCardReference {
- { trailingCardIdNum 100 }
- }
- ,identificationByIdCard FALSE
- ,identificationByPassportId FALSE
- ,passportValidationRequired FALSE
- ,onlineValidationRequired FALSE
- ,ageCheckRequired FALSE
- ,reductionCardCheckRequired FALSE
- ,infoText "cd"
- ,includedTickets {
- { productOwnerIA5 "test" }
- }
- }
- */
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType();
- populateLinkedTickets(sit);
- controlDetail.setIncludedTickets(sit);
- }
-
-
- /*
- *
- */
- private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) {
- TicketLinkType tlt = new TicketLinkType();
- tlt.productOwnerIA5="test";
- sequenceOfTicketLinkType.add(tlt);
- }
-
- /*
- {
- trailingCardIdNum 100
- }
- */
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
-}
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java b/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java
deleted file mode 100644
index b3c2a76..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.ControlData;
-import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
-import org.uic.barcode.ticket.api.asn.omv1.VoucherData;
-
- public class VoucherTestTicketV1 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //FipTicket
- DocumentData do1 = new DocumentData();
- addTicket(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addTicket(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- VoucherData ticket = new VoucherData();
- ticket.setInfoText("coffee voucher");
- ticket.setValidFromYear(2022L);
- ticket.setValidFromDay(01L);
- ticket.setValidUntilYear(2022L);
- ticket.setValidUntilDay(01L);
- ticket.setReferenceIA5("ACHE12345");
- ticket.setProductOwnerIA5("COFFEEMACHINE");
- ticket.setValue(500L);
- tdd.setVoucher(ticket);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("employee");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java b/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java
deleted file mode 100644
index e7844d6..0000000
--- a/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.uic.barcode.ticket.api.test.testtickets;
-
-import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.ControlData;
-import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.DocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.ExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.IssuingData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData;
-import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerData;
-import org.uic.barcode.ticket.api.asn.omv2.TravelerType;
-import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData;
-import org.uic.barcode.ticket.api.asn.omv2.VoucherData;
-
- public class VoucherTestTicketV2 {
-
- public static UicRailTicketData getUicTestTicket() {
- UicRailTicketData ticket = new UicRailTicketData();
- populateTicket(ticket);
- return ticket;
- }
-
-
-
- private static void populateTicket(UicRailTicketData ticket) {
-
- ticket.setControlDetail(new ControlData());
- populate(ticket.getControlDetail());
-
-
- ticket.setIssuingDetail(new IssuingData());
- populateIssuingData(ticket.getIssuingDetail());
-
- TravelerData td = new TravelerData();
- populateTravelerData(td);
- ticket.setTravelerDetail(td);
-
- SequenceOfDocumentData ds = new SequenceOfDocumentData();
-
-
- //FipTicket
- DocumentData do1 = new DocumentData();
- addTicket(do1);
- ds.add(do1);
-
-
- ticket.setTransportDocument(ds);
-
- SequenceOfExtensionData ed = new SequenceOfExtensionData();
- populateExtensionSequence(ed);
- ticket.setExtension(ed);
-
- }
-
-
- //issue date: 04-03-2021 12:30 UTC
- private static void populateIssuingData(IssuingData issuingDetail) {
- issuingDetail.setIssuingYear(2021L);
- issuingDetail.setIssuingTime(750L);
- issuingDetail.setIssuingDay(63L);
- issuingDetail.setIssuerPNR("issuerTestPNR");
- issuingDetail.setSpecimen(true);
- issuingDetail.setSecurePaperTicket(false);
- issuingDetail.setActivated(true);
- issuingDetail.setIssuedOnLine(12L);
- }
-
- private static void addTicket(DocumentData dd) {
-
- TicketDetailData tdd = new TicketDetailData();
- VoucherData ticket = new VoucherData();
- ticket.setInfoText("coffee voucher");
- ticket.setValidFromYear(2022L);
- ticket.setValidFromDay(01L);
- ticket.setValidUntilYear(2022L);
- ticket.setValidUntilDay(01L);
- ticket.setReferenceIA5("ACHE12345");
- ticket.setProductOwnerIA5("COFFEEMACHINE");
- ticket.setValue(500L);
- tdd.setVoucher(ticket);
- dd.setTicket(tdd);
- }
-
-
-
- private static void populateTravelerData(TravelerData td) {
- SequenceOfTravelerType trs = new SequenceOfTravelerType();
- TravelerType tr = new TravelerType();
- tr.setIdCard("12345");
- tr.setFirstName("John");
- tr.setSecondName("Dow");
- tr.setTicketHolder(true);
- SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
- CustomerStatusType cst = new CustomerStatusType();
- cst.setCustomerStatusDescr("employee");
- ts.add(cst);
- tr.setStatus(ts);
- trs.add(tr);
- td.setTraveler(trs);
- }
-
-
-
-
-
- private static void populateExtensionSequence(SequenceOfExtensionData ed) {
- ExtensionData ed1 = new ExtensionData();
- ed1.setExtensionId("1");
- byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
- ed1.setExtensionData(ba1);
- ExtensionData ed2 = new ExtensionData();
- ed2.setExtensionId("2");
- byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
- ed2.setExtensionData(ba2);
- ed.add(ed1);
- ed.add(ed2);
- }
-
- private static void populate(ControlData controlDetail) {
- controlDetail.infoText = "cd";
- controlDetail.setAgeCheckRequired(false);
- controlDetail.setIdentificationByIdCard(false);
- controlDetail.setIdentificationByPassportId(false);
- controlDetail.setOnlineValidationRequired(false);
- controlDetail.setPassportValidationRequired(false);
- controlDetail.setReductionCardCheckRequired(false);
- controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
- controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
- }
-
-
- private static CardReferenceType populateCardRefrence() {
- CardReferenceType cr = new CardReferenceType();
- cr.setTrailingCardIdNum(100L);
- return cr;
- }
-
-
-
- }