summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java133
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java (renamed from src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV1.java)2
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java158
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java143
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java110
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java (renamed from src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java)62
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java108
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java312
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java222
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java131
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java201
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/CarCarriageReservationTestTicketV3.java325
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/CountermarkTestComplexTicketV3.java170
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java138
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/LuggageTestTicketV2.java150
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java87
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV3.java93
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java81
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java4
19 files changed, 2211 insertions, 419 deletions
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java
new file mode 100644
index 0000000..294c9d9
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java
@@ -0,0 +1,133 @@
+package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+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.api.asn.omv3.CarCarriageReservationData;
+import org.uic.barcode.ticket.api.asn.omv3.LoadingDeckType;
+import org.uic.barcode.ticket.api.asn.omv3.PriceTypeType;
+import org.uic.barcode.ticket.api.asn.omv3.RoofRackType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.CarCarriageReservationTestTicketV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class AsnLevelCarCarriageTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = CarCarriageReservationTestTicketV3.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = CarCarriageReservationTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = CarCarriageReservationTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ byte[] encoded = UperEncoder.encode(ticket);
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = CarCarriageReservationTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getCarCarriageReservation() != null);
+
+ CarCarriageReservationData c = ticket.getTransportDocument().get(0).getTicket().getCarCarriageReservation();
+
+ assert(c.getAttachedBicycles() == 1L);
+ assert(c.getAttachedSurfboards() == 2L);
+ assert(c.getBeginLoadingDate() == 10L);
+ assert(c.getBeginLoadingTime() == 0L);
+ assert(c.getCarCategory() == 3L);
+ assert(c.getCoach().equals("21"));
+ assert(c.getPlace().equals("41"));
+ assert(c.getEndLoadingTime() == 500L);
+ assert(c.getFromStationNum() == 8100001L);
+ assert(c.getToStationNum() == 800001L);
+ assert(c.getInfoText().equals("car carriage"));
+ assert(c.getLoadingDeck().equals(LoadingDeckType.upper));
+ assert(c.getLoadingListEntry() == 421L);
+ assert(c.getTrainNum() == 123L);
+ assert(c.getNumberPlate().equals("AD-DE-123"));
+ assert(c.getTrailerPlate().equals("DX-AB-123"));
+ assert(c.getTextileRoof() == false);
+ assert(c.getServiceBrandAbrUTF8().equals("AZ"));
+ assert(c.getServiceBrandNameUTF8().equals("special train"));
+ assert(c.getServiceBrand() == 100L);
+ assert(c.getRoofRackType().equals(RoofRackType.bicycleRack));
+ assert(c.getTariff() != null);
+ assert(c.getRoofRackHeight() == 20L);
+ assert(c.getPriceType().equals(PriceTypeType.travelPrice));
+ assert(c.getReferenceNum() == 810123456789L);
+ assert(c.getVatDetails() != null);
+ assert(c.getCarrierNum().contains(1080L));
+ assert(c.getCarrierNum().contains(1181L));
+ assert(c.getPrice() == 12345L);
+
+
+ }
+
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java
index 5226880..e7dbd50 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV1.java
@@ -17,7 +17,7 @@ import org.uic.barcode.ticket.api.test.testtickets.CountermarkTestComplexTicketV
*
*
*/
-public class CountermarkComplexTestV1 {
+public class AsnLevelCountermarkComplexTestV1 {
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java
new file mode 100644
index 0000000..918615c
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCountermarkComplexTestV3.java
@@ -0,0 +1,158 @@
+package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+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.api.asn.omv3.CountermarkData;
+import org.uic.barcode.ticket.api.asn.omv3.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.ViaStationType;
+import org.uic.barcode.ticket.api.asn.omv3.ZoneType;
+import org.uic.barcode.ticket.api.test.testtickets.CountermarkTestComplexTicketV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class AsnLevelCountermarkComplexTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = CountermarkTestComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ assert(ticket.getControlDetail() != null);
+
+ assert(ticket.getIssuingDetail() != null);
+
+ assert(ticket.getTransportDocument() != null);
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getCounterMark() != null);
+
+ CountermarkData cm = ticket.getTransportDocument().get(0).getTicket().getCounterMark();
+
+ assert(cm.getClassCode().equals(TravelClassType.first));
+ assert(cm.getGroupName().equals("groupName"));
+ assert(cm.getInfoText().equals("counterMark"));
+ assert(cm.getNumberOfCountermark().equals(12L));
+ assert(cm.getTotalOfCountermarks().equals(24L));
+ assert(cm.getReturnIncluded().equals(false));
+ assert(cm.getValidRegion() != null);
+ assert(cm.getValidRegion().get(0).getViaStations() != null);
+ assert(cm.getValidRegion().get(1).getZones() != null);
+
+ ZoneType zone = cm.getValidRegion().get(1).getZones();
+
+ assert(zone.getZoneId() != null);
+ assert(zone.getZoneId().get(0).equals(100L));
+ assert(zone.getZoneId().get(1).equals(200L));
+
+ ViaStationType via = cm.getValidRegion().get(0).getViaStations();
+
+ assert(via.getBorder().equals(false));
+ assert(via.getSeriesId().equals(999L));
+ assert(via.getRoute().size() == 4);
+ assert(via.getRoute().get(0).getStationNum() == 123455L);
+ assert(via.getRoute().get(1).getStationNum() == 123456L);
+ assert(via.getRoute().get(2).getAlternativeRoutes().size() == 2);
+ assert(via.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().size() == 2);
+ assert(via.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().size() == 2);
+ assert(via.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).getStationNum() == 23455L);
+ assert(via.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).getStationNum() == 23456L);
+ assert(via.getRoute().get(3).getStationNum() == 123457L);
+
+ assert(ticket.getTravelerDetail() != null);
+
+
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ String hex = CountermarkTestComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+
+ //ticket = OpenTestComplexTicketV2.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = CountermarkTestComplexTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ @Test public void encodingDecoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = CountermarkTestComplexTicketV3.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = CountermarkTestComplexTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java
new file mode 100644
index 0000000..72af687
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java
@@ -0,0 +1,143 @@
+package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+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.api.asn.omv3.LinkMode;
+import org.uic.barcode.ticket.api.asn.omv3.TicketType;
+import org.uic.barcode.ticket.api.asn.omv3.DelayConfirmation;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.DelayTestTicketV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class AsnLevelDelayConfirmationTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = DelayTestTicketV3.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = DelayTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = DelayTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ byte[] encoded = UperEncoder.encode(ticket);
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = DelayTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getDelayConfirmation() != null);
+
+ DelayConfirmation del = ticket.getTransportDocument().get(0).getTicket().getDelayConfirmation();
+
+ /*
+ *
+ referenceIA5 "ABDJ12345",
+ trainNum 100,
+ departureYear 2022,
+ departureDay 12,
+ departureTime 1000,
+ stationCodeTable stationUIC,
+ stationNum 8000001,
+ delay 31,
+ trainCancelled FALSE,
+ confirmationType travelerDelayConfirmation,
+ affectedTickets {
+ {
+ referenceNum 801234567890,
+ productOwnerNum 1080,
+ ticketType openTicket,
+ linkMode issuedTogether
+ }
+ },
+ infoText "delay confirmation"
+ */
+
+ assert(del.getAffectedTickets().size() == 1);
+ assert(del.getDelay() == 31L);
+ assert(del.getPlannedArrivalDay() == 12L);
+ assert(del.getPlannedArrivalTime() == 1000L);
+ assert(del.getPlannedArrivalYear() == 2022L);
+ assert(del.getTrainCancelled() == false);
+ assert(del.getInfoText().equals("delay confirmation"));
+ assert(del.getReferenceIA5().equals("ABDJ12345"));
+ assert(del.getTrainNum() == 100L);
+
+ assert(del.getAffectedTickets().get(0).getReferenceNum() == 801234567890L);
+ assert(del.getAffectedTickets().get(0).getProductOwnerNum() == 1080L);
+ assert(del.getAffectedTickets().get(0).getTicketType().equals(TicketType.openTicket));
+ assert(del.getAffectedTickets().get(0).getLinkMode().equals(LinkMode.issuedTogether));
+
+
+
+
+
+ }
+
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java
new file mode 100644
index 0000000..e45ae13
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelParkingTestV3.java
@@ -0,0 +1,110 @@
+package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+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.api.asn.omv3.ParkingGroundData;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.ParkingTestTicketV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class AsnLevelParkingTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = ParkingTestTicketV3.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = ParkingTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = ParkingTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ byte[] encoded = UperEncoder.encode(ticket);
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = ParkingTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getParkingGround() != null);
+
+ ParkingGroundData p = ticket.getTransportDocument().get(0).getTicket().getParkingGround();
+
+ assert(p.getReferenceIA5().equals("ACHE12345"));
+ assert(p.getParkingGroundId().equals("P47623"));
+ assert(p.getFromParkingDate() == 1L);
+ assert(p.getToParkingDate() == 1L);
+ assert(p.getLocation().equals("Parking Frankfurt Main West"));
+ assert(p.getStationNum() == 8000001L);
+ assert(p.getSpecialInformation().equals("outdoor parking"));
+ assert(p.getPrice() == 500L);
+ assert(p.getNumberPlate().equals("AA-DE-12345"));
+
+
+ }
+
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java
index 86495f0..a1496c8 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelStationPassageTestV3.java
@@ -8,7 +8,7 @@ import org.junit.Before;
import org.junit.Test;
import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.test.testtickets.CountermarkTestComplexTicketV3;
+import org.uic.barcode.ticket.api.test.testtickets.StationPassageTestTicketV3;
/**
@@ -17,7 +17,7 @@ import org.uic.barcode.ticket.api.test.testtickets.CountermarkTestComplexTicketV
*
*
*/
-public class CountermarkComplexTestV3 {
+public class AsnLevelStationPassageTestV3 {
@@ -49,6 +49,21 @@ public class CountermarkComplexTestV3 {
TimeZone.setDefault(defaulttimeZone);
}
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = StationPassageTestTicketV3.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = StationPassageTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
/**
* Test encode test tickets in UTC and decode in CET.
@@ -60,52 +75,21 @@ public class CountermarkComplexTestV3 {
@Test public void decoding() {
//get tickets
- String hex = CountermarkTestComplexTicketV3.getEncodingHex();
+ String hex = StationPassageTestTicketV3.getEncodingHex();
byte[] content = UperEncoder.bytesFromHexString(hex);
ticket = UperEncoder.decode(content, UicRailTicketData.class);
assert(ticket != null);
-
- }
- @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- String hex = CountermarkTestComplexTicketV3.getEncodingHex();
- byte[] content = UperEncoder.bytesFromHexString(hex);
- ticket = UperEncoder.decode(content, UicRailTicketData.class);
-
-
- //ticket = OpenTestComplexTicketV2.getUicTestTicket();
byte[] encoded = UperEncoder.encode(ticket);
-
-
-
- assert(encoded != null);
- assert(encoded.length > 20);
-
String encodedHex = UperEncoder.hexStringFromBytes(encoded);
- String expectedHex = CountermarkTestComplexTicketV3.getEncodingHex();
+ String expectedHex = StationPassageTestTicketV3.getEncodingHex();
assert(expectedHex.equals(encodedHex));
+
- }
+ }
+
- @Test public void encodingDecoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- ticket = CountermarkTestComplexTicketV3.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
-
-
-
- assert(encoded != null);
- assert(encoded.length > 20);
-
- String encodedHex = UperEncoder.hexStringFromBytes(encoded);
- String expectedHex = CountermarkTestComplexTicketV3.getEncodingHex();
-
- assert(expectedHex.equals(encodedHex));
-
- }
+
}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java
new file mode 100644
index 0000000..eacdabb
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelVoucherTestV3.java
@@ -0,0 +1,108 @@
+package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+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.api.asn.omv3.VoucherData;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.VoucherTestTicketV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class AsnLevelVoucherTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = VoucherTestTicketV3.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = VoucherTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = VoucherTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ byte[] encoded = UperEncoder.encode(ticket);
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = VoucherTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getVoucher() != null);
+
+ VoucherData vo = ticket.getTransportDocument().get(0).getTicket().getVoucher();
+
+
+ assert(vo.getReferenceIA5().equals("ACHE12345"));
+ assert(vo.getProductOwnerIA5().equals("COFFEEMACHINE"));
+ assert(vo.getValidFromYear() == 2022L);
+ assert(vo.getValidFromDay() == 1L);
+ assert(vo.getValidUntilYear() == 2022L);
+ assert(vo.getValidUntilDay() == 1);
+ assert(vo.value == 500L);
+ assert(vo.getInfoText().equals("coffee voucher"));
+ }
+
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java
new file mode 100644
index 0000000..1a05e6f
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/CounterMarkTimeZoneTestV3.java
@@ -0,0 +1,312 @@
+package org.uic.barcode.ticket.api.test;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.ticket.EncodingFormatException;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.spec.ICounterMark;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.ticket.api.test.testtickets.CountermarkTestComplexTicketV3;
+import org.uic.barcode.ticket.api.utils.Api2AsnEncoder;
+import org.uic.barcode.ticket.api.utils.Api2OpenAsnEncoderV3;
+import org.uic.barcode.ticket.api.utils.Asn2ApiDecoder;
+import org.uic.barcode.ticket.api.utils.OpenAsn2ApiDecoderV3;
+
+
+/**
+ * Test of Countermark
+ *
+ *
+ *
+ */
+public class CounterMarkTimeZoneTestV3 {
+
+ /** The low level encoded test ticket test case 1 . */
+ private byte[] encoded1 = null;
+
+ /** The low level encoded test ticket test case 2 . */
+ private byte[] encoded2 = null;
+
+ /** The low level encoded test ticket test case 3 . */
+ private byte[] encoded3 = null;
+
+ /** The decoder. */
+ Asn2ApiDecoder decoder = new OpenAsn2ApiDecoderV3();
+
+ /** The encoder. */
+ Api2AsnEncoder encoder = new Api2OpenAsnEncoderV3();
+
+ /** The API ticket low level encoded for case 1. */
+ IUicRailTicket iTicketDecodedFromAsn1Case1 = null;
+
+ /** The API ticket low level encoded for case 2. */
+ IUicRailTicket iTicketDecodedFromAsn1Case2 = null;
+
+ /** The API ticket low level encoded for case 3. */
+ IUicRailTicket iTicketDecodedFromAsn1Case3 = null;
+
+
+ /** The ticket decoded 1. */
+ IUicRailTicket iTicketDecodedCase1 = null;
+
+ /** The i ticket decoded 2. */
+ IUicRailTicket iTicketDecodedCase2 = null;
+
+ /** The i ticket decoded 3. */
+ IUicRailTicket iTicketDecodedCase3 = null;
+
+ byte[] encodedInTimeZone1 = null;
+ byte[] encodedInTimeZone2 = null;
+ byte[] encodedInTimeZone3 = null;
+
+ String issuingDate1 = null;
+ String issuingDate2 = null;
+ String issuingDate3 = null;
+
+ String validFrom1 = null;
+ String validFrom2 = null;
+ String validFrom3 = null;
+
+ String validUntil1 = null;
+ String validUntil2 = null;
+ String validUntil3 = null;
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ UicRailTicketData ticket1 = CountermarkTestComplexTicketV3.getUicTestTicket();
+ UicRailTicketData ticket2 = CountermarkTestComplexTicketV3.getUicTestTicket();
+ UicRailTicketData ticket3 = CountermarkTestComplexTicketV3.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");
+
+ 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" ));
+
+ }
+
+
+ /**
+ * 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");
+
+ 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" ));
+
+
+ }
+
+ /**
+ * 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");
+
+ 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" ));
+
+
+ }
+
+ private void decodedDateToStrings() {
+
+ issuingDate1 = iTicketDecodedCase1.getIssuerDetails().getIssuingDate().toString();
+ issuingDate2 = iTicketDecodedCase2.getIssuerDetails().getIssuingDate().toString();
+ issuingDate3 = iTicketDecodedCase3.getIssuerDetails().getIssuingDate().toString();
+
+ validFrom1 = ((ICounterMark) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom2 = ((ICounterMark) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidFrom().toString();
+ validFrom3 = ((ICounterMark) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidFrom().toString();
+
+ validUntil1 = ((ICounterMark) iTicketDecodedCase1.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil2 = ((ICounterMark) iTicketDecodedCase2.getDocumentData().iterator().next()).getValidUntil().toString();
+ validUntil3 = ((ICounterMark) iTicketDecodedCase3.getDocumentData().iterator().next()).getValidUntil().toString();
+
+ }
+
+
+ private void setValidFromTo(String dateString) throws ParseException {
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date date = dateFormat.parse(dateString);
+ ((ICounterMark) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidFrom(date);
+ ((ICounterMark) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidFrom(date);
+ ((ICounterMark) 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);
+ ((ICounterMark) iTicketDecodedFromAsn1Case1.getDocumentData().iterator().next()).setValidUntil(date);
+ ((ICounterMark) iTicketDecodedFromAsn1Case2.getDocumentData().iterator().next()).setValidUntil(date);
+ ((ICounterMark) iTicketDecodedFromAsn1Case3.getDocumentData().iterator().next()).setValidUntil(date);
+ }
+
+
+ /**
+ * Encode in Time Zone
+ */
+ private void encode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+ try {
+ encodedInTimeZone1 = encoder.encode(iTicketDecodedFromAsn1Case1);
+ encodedInTimeZone2 = encoder.encode(iTicketDecodedFromAsn1Case2);
+ encodedInTimeZone3 = encoder.encode(iTicketDecodedFromAsn1Case3);
+ } catch (EncodingFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Decode in Time Zone
+ */
+ private void decode(String timeZone) {
+ TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+ try {
+ iTicketDecodedCase1 = decoder.decodeFromAsn(encodedInTimeZone1);
+ iTicketDecodedCase2 = decoder.decodeFromAsn(encodedInTimeZone2);
+ iTicketDecodedCase3 = decoder.decodeFromAsn(encodedInTimeZone3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Encode decode.
+ */
+ private void decodeTestTicketUTC() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ try {
+ iTicketDecodedFromAsn1Case1 = decoder.decodeFromAsn(encoded1);
+ iTicketDecodedFromAsn1Case2 = decoder.decodeFromAsn(encoded2);
+ iTicketDecodedFromAsn1Case3 = decoder.decodeFromAsn(encoded3);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java
index d39a0ba..21266a9 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV3.java
@@ -1,95 +1,127 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.text.ParseException;
-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.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.test.testtickets.OpenTestComplexTicketV3;
-
-
-/**
- * The Class FipTimeZoneTestV3.
- *
- *
- *
- */
-public class OpenTicketComplexTestV3 {
-
-
-
- /** The ticket decoded 1. */
- UicRailTicketData ticket = null;
-
- byte[] encodedInTimeZone1 = null;
-
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- //encode in UTC time zone
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
-
-
- }
-
- /**
- * 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 decoding() {
-
- //get tickets
- String hex = OpenTestComplexTicketV3.getEncodingHex();
- byte[] content = UperEncoder.bytesFromHexString(hex);
- ticket = UperEncoder.decode(content, UicRailTicketData.class);
-
- assert(ticket != null);
-
- }
-
- @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- String hex = OpenTestComplexTicketV3.getEncodingHex();
- byte[] content = UperEncoder.bytesFromHexString(hex);
- ticket = UperEncoder.decode(content, UicRailTicketData.class);
-
-
- //ticket = OpenTestComplexTicketV2.getUicTestTicket();
- byte[] encoded = UperEncoder.encode(ticket);
-
-
-
- assert(encoded != null);
- assert(encoded.length > 20);
-
- String encodedHex = UperEncoder.hexStringFromBytes(encoded);
- String expectedHex = OpenTestComplexTicketV3.getEncodingHex();
-
- assert(expectedHex.equals(encodedHex));
-
- }
-
-
-}
+package org.uic.barcode.ticket.api.test;
+
+
+import java.text.ParseException;
+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.api.asn.omv3.IncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.PassengerType;
+import org.uic.barcode.ticket.api.asn.omv3.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.OpenTestComplexTicketV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class OpenTicketComplexTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = OpenTestComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getOpenTicket() != null);
+
+ OpenTicketData ot = ticket.getTransportDocument().get(0).getTicket().getOpenTicket();
+
+ assert(ot.getReturnIncluded() == false);
+ assert(ot.getClassCode().equals(TravelClassType.first));
+ assert(ot.getInfoText().equals("openTicketInfo"));
+ assert(ot.getVatDetails().size() == 1);
+ assert(ot.getVatDetails().get(0).getCountry() == 80L);
+ assert(ot.getVatDetails().get(0).getPercentage() == 70L);
+ assert(ot.getVatDetails().get(0).getAmount() == 10L);
+ assert(ot.getVatDetails().get(0).getVatId().equals("IUDGTE"));
+
+ assert(ot.getIncludedAddOns().size() == 1);
+ IncludedOpenTicketType inc = ot.getIncludedAddOns().get(0);
+ assert(inc.getProductOwnerNum() == 1080L);
+ assert(inc.getClassCode().equals(TravelClassType.second));
+ assert(inc.getInfoText().equals("included ticket"));
+ assert(inc.getValidRegion().get(0).getZones() != null);
+ assert(inc.getValidRegion().get(0).getZones().getZoneId().get(0) == 100L);
+ assert(inc.getTariffs().size() == 1);
+ assert(inc.getTariffs().get(0).getNumberOfPassengers() == 2L);
+ assert(inc.getTariffs().get(0).getPassengerType().equals(PassengerType.adult));
+ assert(inc.getTariffs().get(0).getRestrictedToCountryOfResidence() == false);
+ assert(inc.getTariffs().get(0).getRestrictedToRouteSection().getFromStationNum() == 8000001L);
+ assert(inc.getTariffs().get(0).getRestrictedToRouteSection().getToStationNum() == 8010000L);
+
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ String hex = OpenTestComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+
+ //ticket = OpenTestComplexTicketV2.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = OpenTestComplexTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java
new file mode 100644
index 0000000..fe0bdda
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketRestrictedLuggageComplexTestV3.java
@@ -0,0 +1,131 @@
+package org.uic.barcode.ticket.api.test;
+
+
+import java.text.ParseException;
+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.api.asn.omv3.IncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.PassengerType;
+import org.uic.barcode.ticket.api.asn.omv3.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.OpenLuggageRestrictionTestTicketV3;
+
+
+/**
+ *
+ *
+ *
+ *
+ */
+public class OpenTicketRestrictedLuggageComplexTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = OpenLuggageRestrictionTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getOpenTicket() != null);
+
+ OpenTicketData ot = ticket.getTransportDocument().get(0).getTicket().getOpenTicket();
+
+ assert(ot.getReturnIncluded() == false);
+ assert(ot.getClassCode().equals(TravelClassType.first));
+ assert(ot.getInfoText().equals("openTicketInfo"));
+ assert(ot.getVatDetails().size() == 1);
+ assert(ot.getVatDetails().get(0).getCountry() == 80L);
+ assert(ot.getVatDetails().get(0).getPercentage() == 70L);
+ assert(ot.getVatDetails().get(0).getAmount() == 10L);
+ assert(ot.getVatDetails().get(0).getVatId().equals("IUDGTE"));
+
+ assert(ot.getIncludedAddOns().size() == 1);
+ IncludedOpenTicketType inc = ot.getIncludedAddOns().get(0);
+ assert(inc.getProductOwnerNum() == 1080L);
+ assert(inc.getClassCode().equals(TravelClassType.second));
+ assert(inc.getInfoText().equals("included ticket"));
+ assert(inc.getValidRegion().get(0).getZones() != null);
+ assert(inc.getValidRegion().get(0).getZones().getZoneId().get(0) == 100L);
+ assert(inc.getTariffs().size() == 1);
+ assert(inc.getTariffs().get(0).getNumberOfPassengers() == 2L);
+ assert(inc.getTariffs().get(0).getPassengerType().equals(PassengerType.adult));
+ assert(inc.getTariffs().get(0).getRestrictedToCountryOfResidence() == false);
+ assert(inc.getTariffs().get(0).getRestrictedToRouteSection().getFromStationNum() == 8000001L);
+ assert(inc.getTariffs().get(0).getRestrictedToRouteSection().getToStationNum() == 8010000L);
+
+ assert(ot.getLuggage() != null);
+ assert(ot.getLuggage().maxHandLuggagePieces == 2L);
+ assert(ot.getLuggage().getMaxNonHandLuggagePieces() == 1L);
+ assert(ot.getLuggage().getRegisteredLuggage().size() == 2);
+ assert(ot.getLuggage().getRegisteredLuggage().get(0).getMaxSize() == 100L);
+ assert(ot.getLuggage().getRegisteredLuggage().get(1).getMaxSize() == 101L);
+ assert(ot.getLuggage().getRegisteredLuggage().get(0).getMaxWeight() == 20L);
+ assert(ot.getLuggage().getRegisteredLuggage().get(1).getMaxWeight() == 21L);
+ assert(ot.getLuggage().getRegisteredLuggage().get(0).getRegistrationId().equals("IODHUV"));
+ assert(ot.getLuggage().getRegisteredLuggage().get(1).getRegistrationId().equals("XXDHUV"));
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = OpenLuggageRestrictionTestTicketV3.getUicTestTicket();
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = OpenLuggageRestrictionTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java
index de7fe88..6b73221 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/PassComplexTestV3.java
@@ -1,92 +1,109 @@
-package org.uic.barcode.ticket.api.test;
-
-import java.text.ParseException;
-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.api.asn.omv3.UicRailTicketData;
-import org.uic.barcode.ticket.api.test.testtickets.PassComplexTicketV3;
-
-
-/**
- * The Class Test asn.1 encoding of a pass.
- *
- *
- *
- */
-public class PassComplexTestV3 {
-
-
- /** The ticket decoded 1. */
- UicRailTicketData ticket = null;
-
- byte[] encodedInTimeZone1 = null;
-
-
- TimeZone defaulttimeZone = null;
-
- /**
- * Prepare tickets.
- */
- @Before public void prepare() {
-
- defaulttimeZone = TimeZone.getDefault();
-
- //encode in UTC time zone
- TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
-
-
- }
-
- /**
- * 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 decoding() {
-
- //get tickets
- String hex = PassComplexTicketV3.getEncodingHex();
- byte[] content = UperEncoder.bytesFromHexString(hex);
- ticket = UperEncoder.decode(content, UicRailTicketData.class);
-
- assert(ticket != null);
-
- }
-
- @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
-
- //get tickets
- String hex = PassComplexTicketV3.getEncodingHex();
- byte[] content = UperEncoder.bytesFromHexString(hex);
- ticket = UperEncoder.decode(content, UicRailTicketData.class);
-
-
- byte[] encoded = UperEncoder.encode(ticket);
-
-
-
- assert(encoded != null);
- assert(encoded.length > 20);
-
- String encodedHex = UperEncoder.hexStringFromBytes(encoded);
- String expectedHex = PassComplexTicketV3.getEncodingHex();
-
- assert(expectedHex.equals(encodedHex));
-
- }
-
-}
+package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+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.api.asn.omv3.BoardingOrArrivalType;
+import org.uic.barcode.ticket.api.asn.omv3.PassData;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.PassComplexTicketV3;
+
+
+/**
+ * The Class Test asn.1 encoding of a pass.
+ *
+ *
+ *
+ */
+public class PassComplexTestV3 {
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * 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 decoding() {
+
+ //get tickets
+ String hex = PassComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ String hex = PassComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = PassComplexTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ assert(ticket.getTransportDocument().get(0).getTicket().getPass() != null);
+
+ PassData p = ticket.getTransportDocument().get(0).getTicket().getPass();
+
+
+ assert(p.getTrainValidity().getBordingOrArrival().equals(BoardingOrArrivalType.boarding));
+ assert(p.getTrainValidity().getIncludedCarriersNum().contains(1234L));
+ assert(p.getTrainValidity().getIncludedCarriersNum().contains(5678L));
+ assert(p.getTrainValidity().getValidFromDay() == 0L);
+ assert(p.getTrainValidity().getValidFromTime() == 1000L);
+ assert(p.getTrainValidity().getValidUntilDay() == 1L);
+ assert(p.getTrainValidity().getValidUntilTime() == 1000L);
+
+
+
+ }
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CarCarriageReservationTestTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CarCarriageReservationTestTicketV3.java
new file mode 100644
index 0000000..157c6db
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CarCarriageReservationTestTicketV3.java
@@ -0,0 +1,325 @@
+package org.uic.barcode.ticket.api.test.testtickets;
+
+import org.uic.barcode.ticket.api.asn.omv3.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv3.ControlData;
+import org.uic.barcode.ticket.api.asn.omv3.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv3.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv3.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv3.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv3.LoadingDeckType;
+import org.uic.barcode.ticket.api.asn.omv3.PriceTypeType;
+import org.uic.barcode.ticket.api.asn.omv3.RoofRackType;
+import org.uic.barcode.ticket.api.asn.omv3.CarCarriageReservationData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCarrierNum;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfVatDetail;
+import org.uic.barcode.ticket.api.asn.omv3.TariffType;
+import org.uic.barcode.ticket.api.asn.omv3.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.VatDetailType;
+
+
+ public class CarCarriageReservationTestTicketV3 {
+
+ /*
+ * rec1value UicRailTicketData ::= {
+ issuingDetail {
+ issuingYear 2018,
+ issuingDay 1,
+ issuingTime 600,
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ currency "EUR",
+ currencyFract 2,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ },
+ travelerDetail {
+ traveler {
+ {
+ firstName "John",
+ secondName "Dow",
+ idCard "12345",
+ ticketHolder TRUE,
+ status {
+ {
+ customerStatusDescr "senior"
+ }
+ }
+ }
+ },
+ groupName "myGroup"
+ },
+ transportDocument {
+ {
+ ticket carCarriageReservation : {
+ trainNum 123,
+ beginLoadingDate 10,
+ beginLoadingTime 0,
+ endLoadingTime 500,
+ referenceNum 810123456789,
+ serviceBrand 100,
+ serviceBrandAbrUTF8 "AZ",
+ serviceBrandNameUTF8 "special train",
+ stationCodeTable stationUICReservation,
+ fromStationNum 8100001,
+ toStationNum 800001,
+ coach "21",
+ place "41",
+ numberPlate "AD-DE-123",
+ trailerPlate "DX-AB-123",
+ carCategory 3,
+ textileRoof FALSE,
+ roofRackType bicycleRack,
+ roofRackHeight 20,
+ attachedBicycles 1,
+ attachedSurfboards 2,
+ loadingListEntry 421,
+ loadingDeck upper,
+ carrierNum {
+ 1080,
+ 1181
+ },
+ tariff {
+ numberOfPassengers 1,
+ restrictedToCountryOfResidence FALSE,
+ tariffIdNum 72,
+ tariffDesc "Large Car Full Fare"
+ },
+ priceType travelPrice,
+ price 12345,
+ vatDetail {
+ {
+ country 80,
+ percentage 70,
+ amount 10,
+ vatId "IUDGTE"
+ }
+ },
+ infoText "car carriage"
+ }
+ }
+ },
+ controlDetail {
+ identificationByCardReference {
+ {
+ trailingCardIdNum 100
+ }
+ },
+ identificationByIdCard FALSE,
+ identificationByPassportId FALSE,
+ passportValidationRequired FALSE,
+ onlineValidationRequired FALSE,
+ ageCheckRequired FALSE,
+ reductionCardCheckRequired FALSE,
+ infoText "cd"
+ },
+ extension {
+ {
+ extensionId "1",
+ extensionData '82DA'H
+ },
+ {
+ extensionId "2",
+ extensionData '83DA'H
+ }
+ }
+}
+ */
+
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+ public static String getEncodingHex() {
+
+ return "7804404004B14374F3E7D72F2A9979F4A13A90086280B4001"
+ + "044A6F686E03446F770562C99B46B01106E797769DFC81"
+ + "DB5E51DC9BDD5C0040AE43A8D6E9C02F60B0007D01802F"
+ + "27C7BC4540318120AD06B9B832B1B4B0B6103A3930B4B7"
+ + "3DCC50061A8001326204D1884C188B62455AC593309896"
+ + "16C184B58B266639429A502086E127002802902698C2E4"
+ + "CECA4086C2E4408CEAD8D8408CC2E4CA0460720389E230"
+ + "0850349AB123D48A18C6C2E440C6C2E4E4D2C2CECA9004"
+ + "0100B20004C6C80402C40A0B680590141ED00";
+
+ }
+
+
+ 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();
+ CarCarriageReservationData ticket = new CarCarriageReservationData();
+ ticket.setTrainNum(123L);
+ 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.setServiceBrand(100L);
+ ticket.setPrice(12345L);
+ ticket.setPriceType(PriceTypeType.travelPrice);
+ ticket.setAttachedBicycles(1L);
+ ticket.setCarCategory(3L);
+ ticket.setInfoText("car carriage");
+ ticket.setLoadingDeck(LoadingDeckType.upper);
+ ticket.setNumberPlate("AD-DE-123");
+ ticket.setRoofRackHeight(20L);
+ ticket.setRoofRackType(RoofRackType.bicycleRack);
+ ticket.setServiceBrandAbrUTF8("AZ");
+ ticket.setServiceBrand(100L);
+ ticket.setTextileRoof(false);
+ ticket.setTrailerPlate("DX-AB-123");
+ ticket.setAttachedSurfboards(2L);
+ ticket.setLoadingListEntry(421L);
+
+ ticket.setVatDetails(new SequenceOfVatDetail());
+ ticket.getVatDetails().add(getVatDetail());
+
+ ticket.setTariff(getTariff());
+
+ ticket.setPlace("41");
+ ticket.setCoach("21");
+ ticket.setBeginLoadingDate(10L);
+ ticket.setBeginLoadingTime(0L);
+ ticket.setEndLoadingTime(500L);
+ tdd.setCarCarriageReservation(ticket);
+ dd.setTicket(tdd);
+ }
+
+
+
+ private static TariffType getTariff() {
+
+ TariffType tariff = new TariffType();
+ tariff.setNumberOfPassengers(1L);
+ tariff.setRestrictedToCountryOfResidence(false);
+ tariff.setTariffIdNum(72L);
+ tariff.setTariffDesc("Large Car Full Fare");
+
+ return tariff;
+ }
+
+ private static VatDetailType getVatDetail() {
+ VatDetailType v = new VatDetailType();
+ v.setAmount(10L);
+ v.setCountry(80L);
+ v.setPercentage(70L);
+ v.setVatId("IUDGTE");
+ return v;
+ }
+
+ 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.setIssuingTime(600L);
+ 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/test/java/org/uic/barcode/ticket/api/test/testtickets/CountermarkTestComplexTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CountermarkTestComplexTicketV3.java
index 1843ec3..7e1b127 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CountermarkTestComplexTicketV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CountermarkTestComplexTicketV3.java
@@ -116,177 +116,9 @@ value UicRailTicketData ::= {
}
}
-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) = 8]
- issuingYear INTEGER [length (not encoded) = 1.0]
- 2018
- issuingDay INTEGER [length (not encoded) = 1.1]
- 1
- issuingTime INTEGER [length (not encoded) = 1.3]
- 600
- 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 = 1]
- DocumentData SEQUENCE [root fieldcount (not encoded) = 1]
- ticket CHOICE [index = 6]
- counterMark CountermarkData SEQUENCE [root fieldcount (not encoded) = 7]
- numberOfCountermark INTEGER [length (not encoded) = 1.0]
- 12
- totalOfCountermarks INTEGER [length (not encoded) = 1.0]
- 24
- groupName UTF8String [length = 9.0]
- 0x67726f75704e616d65
- validRegion SEQUENCE OF [count = 2]
- RegionalValidityType CHOICE [index = 1]
- viaStations ViaStationType SEQUENCE [root fieldcount (not encoded) = 3]
- route SEQUENCE OF [count = 4]
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- stationNum INTEGER [length (not encoded) = 3.0]
- 123455
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- stationNum INTEGER [length (not encoded) = 3.0]
- 123456
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- alternativeRoutes SEQUENCE OF [count = 2]
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- route SEQUENCE OF [count = 2]
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- stationNum INTEGER [length (not encoded) = 3.0]
- 23455
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- stationNum INTEGER [length (not encoded) = 3.0]
- 23456
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- route SEQUENCE OF [count = 2]
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- stationNum INTEGER [length (not encoded) = 3.0]
- 3455
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- stationNum INTEGER [length (not encoded) = 3.0]
- 3456
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- ViaStationType SEQUENCE [root fieldcount (not encoded) = 2]
- stationNum INTEGER [length (not encoded) = 3.0]
- 123457
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- border BOOLEAN [length (not encoded) = 0.1]
- FALSE
- seriesId INTEGER [length = 2.0]
- 999
- RegionalValidityType CHOICE [index = 2]
- zones ZoneType SEQUENCE [root fieldcount (not encoded) = 1]
- zoneId SEQUENCE OF [count = 2]
- INTEGER [length = 1.0]
- 100
- INTEGER [length = 2.0]
- 200
- returnIncluded BOOLEAN [length (not encoded) = 0.1]
- FALSE
- classCode TravelClassType ENUMERATED [length (not encoded) = 0.4]
- 1
- infoText UTF8String [length = 11.0]
- 0x636f756e7465724d61726b
- 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 = 187.0
-Encoded successfully in 187 bytes:
-78044040 04B14374 F3E7D72F 2A9979F4 A13A9008 6280B400 1044A6F6 86E03446
-F770562C 99B46B01 106E7977 69DFC81D B5E51DC9 BDD5C004 30000202 1058B84B
-3B937BAB 82730B6B 28108240 210000F1 1F080007 88FC1000 40800440 000B73C2
-00005B9F 01000880 00035F84 00001AFE 08000789 000203E7 20040201 640200C8
-042D8DBD D5B9D195 C93585C9 AD300802 01640009 8D90056E 17562C46 2C9A336A
-E1B37044 F4542420 3A13A902 74CBCFA1 40805881 416D00B2 0283DA
-
*/
-
-
+
public static String getEncodingHex() {
return
"7804404004B14374F3E7D72F2A9979F4A13A90086280B4001044A6F686E03446" +
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
index 9364acd..a74ad18 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
@@ -1,33 +1,126 @@
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;
+import org.uic.barcode.ticket.api.asn.omv3.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv3.ControlData;
+import org.uic.barcode.ticket.api.asn.omv3.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv3.DelayConfirmation;
+import org.uic.barcode.ticket.api.asn.omv3.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv3.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv3.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv3.TicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
public class DelayTestTicketV3 {
+
+ /*
+ *
+ *
+value UicRailTicketData ::= {
+ issuingDetail {
+ issuingYear 2021,
+ issuingDay 63,
+ issuingTime 750,
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ currency "EUR",
+ currencyFract 2,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ },
+ travelerDetail {
+ traveler {
+ {
+ firstName "John",
+ secondName "Dow",
+ idCard "12345",
+ ticketHolder TRUE,
+ status {
+ {
+ customerStatusDescr "employee"
+ }
+ }
+ }
+ }
+ },
+ transportDocument {
+ {
+ ticket delayConfirmation : {
+ referenceIA5 "ABDJ12345",
+ trainNum 100,
+ departureYear 2022,
+ departureDay 12,
+ departureTime 1000,
+ stationCodeTable stationUIC,
+ stationNum 8000001,
+ delay 31,
+ trainCancelled FALSE,
+ confirmationType travelerDelayConfirmation,
+ affectedTickets {
+ {
+ referenceNum 801234567890,
+ productOwnerNum 1080,
+ ticketType openTicket,
+ linkMode issuedTogether
+ }
+ },
+ infoText "delay confirmation"
+ }
+ }
+ },
+ controlDetail {
+ identificationByCardReference {
+ {
+ trailingCardIdNum 100
+ }
+ },
+ identificationByIdCard FALSE,
+ identificationByPassportId FALSE,
+ passportValidationRequired FALSE,
+ onlineValidationRequired FALSE,
+ ageCheckRequired FALSE,
+ reductionCardCheckRequired FALSE,
+ infoText "cd"
+ },
+ extension {
+ {
+ extensionId "1",
+ extensionData '82DA'H
+ },
+ {
+ extensionId "2",
+ extensionData '83DA'H
+ }
+ }
+}
+
+ */
+
public static UicRailTicketData getUicTestTicket() {
UicRailTicketData ticket = new UicRailTicketData();
populateTicket(ticket);
return ticket;
}
+ public static String getEncodingHex() {
+ return "780440A3E5DD4374F3E7D72F2A9979F4A13A90086200B4001044A6F686E03446F77"
+ + "0562C99B46B01108CBB786CDFE72E50116AE4C130614494C593368D405901816"
+ + "FA1E848001E009201802EA35350B4821B893232B630BC9031B7B73334B936B0B"
+ + "A34B7B7240100402C800131B20100B10282DA01640507B4";
+
+ }
+
private static void populateTicket(UicRailTicketData ticket) {
@@ -77,15 +170,14 @@ import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
TicketDetailData tdd = new TicketDetailData();
DelayConfirmation ticket = new DelayConfirmation();
- ticket.setPlannedArrivalDay(0L);
+ ticket.setPlannedArrivalDay(12L);
ticket.setPlannedArrivalTime(1000L);
- ticket.setDelay(30L);
+ ticket.setDelay(31L);
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);
@@ -96,7 +188,6 @@ import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
SequenceOfTicketLinkType lts = new SequenceOfTicketLinkType();
TicketLinkType t1 = new TicketLinkType();
- t1.setReferenceNum(1080L);
t1.setReferenceNum(801234567890L);
t1.setProductOwnerNum(1080L);
lts.add(t1);
@@ -160,4 +251,7 @@ import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+
+
+
}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/LuggageTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/LuggageTestTicketV2.java
new file mode 100644
index 0000000..abc6690
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/LuggageTestTicketV2.java
@@ -0,0 +1,150 @@
+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 LuggageTestTicketV2 {
+
+ 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/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java
index bacdb41..54be392 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java
@@ -19,12 +19,96 @@ import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
public class ParkingTestTicketV3 {
+ /*
+ *
+value UicRailTicketData ::= {
+ issuingDetail {
+ issuingYear 2021,
+ issuingDay 63,
+ issuingTime 750,
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ currency "EUR",
+ currencyFract 2,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ },
+ travelerDetail {
+ traveler {
+ {
+ firstName "John",
+ secondName "Dow",
+ idCard "12345",
+ ticketHolder TRUE,
+ status {
+ {
+ customerStatusDescr "employee"
+ }
+ }
+ }
+ }
+ },
+ transportDocument {
+ {
+ ticket parkingGround : {
+ referenceIA5 "ACHE12345",
+ parkingGroundId "P47623",
+ fromParkingDate 1,
+ untilParkingDate 1,
+ location "Parking Frankfurt Main West",
+ stationCodeTable stationUIC,
+ stationNum 8000001,
+ specialInformation "outdoor parking",
+ numberPlate "AA-DE-12345",
+ price 500
+ }
+ }
+ },
+ controlDetail {
+ identificationByCardReference {
+ {
+ trailingCardIdNum 100
+ }
+ },
+ identificationByIdCard FALSE,
+ identificationByPassportId FALSE,
+ passportValidationRequired FALSE,
+ onlineValidationRequired FALSE,
+ ageCheckRequired FALSE,
+ reductionCardCheckRequired FALSE,
+ infoText "cd"
+ },
+ extension {
+ {
+ extensionId "1",
+ extensionData '82DA'H
+ },
+ {
+ extensionId "2",
+ extensionData '83DA'H
+ }
+ }
+}
+
+ */
+
public static UicRailTicketData getUicTestTicket() {
UicRailTicketData ticket = new UicRailTicketData();
populateTicket(ticket);
return ticket;
}
+
+ public static String getEncodingHex() {
+ return "780440A3E5DD4374F3E7D72F2A9979F4A13A90086200B400104"
+ + "4A6F686E03446F770562C99B46B01108CBB786CDFE72E501"
+ + "0EA05604C187222B164CDA3506A0D1BB664CD70008DA830B"
+ + "935B4B73390233930B735B33AB93A1026B0B4B7102BB2B9B"
+ + "A01BD090087B7BABA3237B7B9103830B935B4B73385C182B"
+ + "62455AC593368D40807D1200802016400098D90080588141"
+ + "6D00B20283DA0";
+ }
private static void populateTicket(UicRailTicketData ticket) {
@@ -144,4 +228,7 @@ import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+
+
+
}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV3.java
index b2f1816..e7127e0 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV3.java
@@ -22,6 +22,87 @@ import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
public class StationPassageTestTicketV3 {
+ /*
+ *
+value UicRailTicketData ::= {
+ issuingDetail {
+ issuingYear 2018,
+ issuingDay 1,
+ issuingTime 600,
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ currency "EUR",
+ currencyFract 2,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ },
+ travelerDetail {
+ traveler {
+ {
+ firstName "John",
+ secondName "Dow",
+ idCard "12345",
+ ticketHolder TRUE,
+ status {
+ {
+ customerStatusDescr "senior"
+ }
+ }
+ }
+ },
+ groupName "myGroup"
+ },
+ transportDocument {
+ {
+ ticket stationPassage : {
+ productName "passage",
+ stationCodeTable stationUIC,
+ stationNameUTF8 {
+ "Amsterdam"
+ },
+ validFromDay 5,
+ validFromTime 0,
+ validUntilDay 5,
+ validUntilTime 1000,
+ numberOfDaysValid 5
+ }
+ }
+ },
+ controlDetail {
+ identificationByCardReference {
+ {
+ trailingCardIdNum 100
+ }
+ },
+ identificationByIdCard FALSE,
+ identificationByPassportId FALSE,
+ passportValidationRequired FALSE,
+ onlineValidationRequired FALSE,
+ ageCheckRequired FALSE,
+ reductionCardCheckRequired FALSE,
+ infoText "cd",
+ includedTickets {
+ {
+ productOwnerIA5 "test",
+ ticketType openTicket,
+ linkMode issuedTogether
+ }
+ }
+ },
+ extension {
+ {
+ extensionId "1",
+ extensionData '82DA'H
+ },
+ {
+ extensionId "2",
+ extensionData '83DA'H
+ }
+ }
+}
+ */
+
public static UicRailTicketData getUicTestTicket() {
UicRailTicketData ticket = new UicRailTicketData();
@@ -29,7 +110,13 @@ public class StationPassageTestTicketV3 {
return ticket;
}
-
+ public static String getEncodingHex() {
+ return
+ "7804404004B14374F3E7D72F2A9979F4A13A90086280B4001044A6F686E03446"
+ + "F770562C99B46B01106E797769DFC81DB5E51DC9BDD5C00448088B40EE0C2E"
+ + "6E6C2CECA021282DAE6E8CAE4C8C2DA5D000019F40082A60100402C800131B"
+ + "20081013A65E7D00805881416D00B20283DA";
+ }
private static void populateTicket(UicRailTicketData ticket) {
@@ -181,4 +268,8 @@ public class StationPassageTestTicketV3 {
+
+
+
+
}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java
index 20bfdaa..4098232 100644
--- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java
@@ -19,11 +19,91 @@ import org.uic.barcode.ticket.api.asn.omv3.VoucherData;
public class VoucherTestTicketV3 {
+ /*
+ * rec1value UicRailTicketData ::= {
+ issuingDetail {
+ issuingYear 2021,
+ issuingDay 63,
+ issuingTime 600,
+ specimen TRUE,
+ securePaperTicket FALSE,
+ activated TRUE,
+ currency "EUR",
+ currencyFract 2,
+ issuerPNR "issuerTestPNR",
+ issuedOnLine 12
+ },
+ travelerDetail {
+ traveler {
+ {
+ firstName "John",
+ secondName "Dow",
+ idCard "12345",
+ ticketHolder TRUE,
+ status {
+ {
+ customerStatusDescr "employee"
+ }
+ }
+ }
+ }
+ },
+ transportDocument {
+ {
+ ticket voucher : {
+ referenceIA5 "ACHE12345",
+ productOwnerIA5 "COFFEEMACHINE",
+ validFromYear 2022,
+ validFromDay 1,
+ validUntilYear 2022,
+ validUntilDay 1,
+ value 500,
+ infoText "coffee voucher"
+ }
+ }
+ },
+ controlDetail {
+ identificationByCardReference {
+ {
+ trailingCardIdNum 100
+ }
+ },
+ identificationByIdCard FALSE,
+ identificationByPassportId FALSE,
+ passportValidationRequired FALSE,
+ onlineValidationRequired FALSE,
+ ageCheckRequired FALSE,
+ reductionCardCheckRequired FALSE,
+ infoText "cd"
+ },
+ extension {
+ {
+ extensionId "1",
+ extensionData '82DA'H
+ },
+ {
+ extensionId "2",
+ extensionData '83DA'H
+ }
+ }
+}
+
+ */
+
public static UicRailTicketData getUicTestTicket() {
UicRailTicketData ticket = new UicRailTicketData();
populateTicket(ticket);
return ticket;
}
+
+ public static String getEncodingHex() {
+
+ return "780440A3E4B14374F3E7D72F2A9979F4A13A90086200B4001044A6F686"
+ + "E03446F770562C99B46B01108CBB786CDFE72E50108928260C39115"
+ + "8B266D1A86C39F1A3458B360C391267450600830040807D0398DBD9"
+ + "999959481D9BDD58DA195C9200802016400098D900805881416D00B"
+ + "20283DA";
+ }
private static void populateTicket(UicRailTicketData ticket) {
@@ -138,4 +218,5 @@ import org.uic.barcode.ticket.api.asn.omv3.VoucherData;
+
}
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
index 1f1be30..326eb99 100644
--- a/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
+++ b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
@@ -1,6 +1,7 @@
package org.uic.barcode.ticketTestDB;
+import java.util.Iterator;
import java.util.TimeZone;
import org.junit.After;
@@ -10,8 +11,10 @@ import org.junit.Test;
import org.uic.barcode.Decoder;
import org.uic.barcode.asn1.uper.UperEncoder;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
+import org.uic.barcode.ticket.api.impl.SimpleTrainLink;
import org.uic.barcode.ticket.api.spec.IOpenTicket;
import org.uic.barcode.ticket.api.spec.IPassengerType;
+import org.uic.barcode.ticket.api.spec.IRegionalValidity;
import org.uic.barcode.ticket.api.spec.ITariff;
import org.uic.barcode.ticket.api.spec.ITrainLink;
import org.uic.barcode.ticket.api.spec.ITraveler;
@@ -89,6 +92,7 @@ public class DecodeSparpreisTicketDBTest {
assert(tariff.getPassengerType().equals(IPassengerType.adult));
assert(tariff.getTariffDescription().equals("Super Sparpreis"));
+
ITrainLink tl = (ITrainLink) openTicket.getValidRegionList().iterator().next();
Assert.assertNotNull(tl);
assert(tl.getTrain().equals("ICE973"));