diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-12-08 12:35:34 +0100 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-12-08 12:35:34 +0100 |
commit | 7e0339b14310237dba58e0119c134a782beed27d (patch) | |
tree | 3750a34ee588aba663c19c0e80dd506b6f69cd0e /src/test/java/org | |
parent | pass default value (diff) | |
download | UIC-barcode-7e0339b14310237dba58e0119c134a782beed27d.tar UIC-barcode-7e0339b14310237dba58e0119c134a782beed27d.tar.gz UIC-barcode-7e0339b14310237dba58e0119c134a782beed27d.tar.bz2 UIC-barcode-7e0339b14310237dba58e0119c134a782beed27d.tar.lz UIC-barcode-7e0339b14310237dba58e0119c134a782beed27d.tar.xz UIC-barcode-7e0339b14310237dba58e0119c134a782beed27d.tar.zst UIC-barcode-7e0339b14310237dba58e0119c134a782beed27d.zip |
Diffstat (limited to 'src/test/java/org')
8 files changed, 2243 insertions, 19 deletions
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java index f5b7f18..a5b4765 100644 --- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java +++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelAllElementsTestV3.java @@ -12,10 +12,12 @@ import org.uic.barcode.ticket.api.asn.omv3.IncludedOpenTicketType; import org.uic.barcode.ticket.api.asn.omv3.LineType;
import org.uic.barcode.ticket.api.asn.omv3.BerthTypeType;
import org.uic.barcode.ticket.api.asn.omv3.BoardingOrArrivalType;
+import org.uic.barcode.ticket.api.asn.omv3.CarCarriageReservationData;
import org.uic.barcode.ticket.api.asn.omv3.CodeTableType;
import org.uic.barcode.ticket.api.asn.omv3.CompartmentGenderType;
import org.uic.barcode.ticket.api.asn.omv3.CompartmentPositionType;
import org.uic.barcode.ticket.api.asn.omv3.ConfirmationTypeType;
+import org.uic.barcode.ticket.api.asn.omv3.CountermarkData;
import org.uic.barcode.ticket.api.asn.omv3.CustomerCardData;
import org.uic.barcode.ticket.api.asn.omv3.DelayConfirmation;
import org.uic.barcode.ticket.api.asn.omv3.DocumentData;
@@ -25,6 +27,7 @@ import org.uic.barcode.ticket.api.asn.omv3.GeoCoordinateSystemType; import org.uic.barcode.ticket.api.asn.omv3.GeoUnitType;
import org.uic.barcode.ticket.api.asn.omv3.HemisphereLatitudeType;
import org.uic.barcode.ticket.api.asn.omv3.LinkMode;
+import org.uic.barcode.ticket.api.asn.omv3.LoadingDeckType;
import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
import org.uic.barcode.ticket.api.asn.omv3.ParkingGroundData;
import org.uic.barcode.ticket.api.asn.omv3.PassData;
@@ -32,6 +35,7 @@ import org.uic.barcode.ticket.api.asn.omv3.PassengerType; import org.uic.barcode.ticket.api.asn.omv3.PolygoneType;
import org.uic.barcode.ticket.api.asn.omv3.PriceTypeType;
import org.uic.barcode.ticket.api.asn.omv3.ReservationData;
+import org.uic.barcode.ticket.api.asn.omv3.RoofRackType;
import org.uic.barcode.ticket.api.asn.omv3.ServiceType;
import org.uic.barcode.ticket.api.asn.omv3.StationPassageData;
import org.uic.barcode.ticket.api.asn.omv3.TicketType;
@@ -136,6 +140,30 @@ public class AsnLevelAllElementsTestV3 { }
+ @Test public void encodingDecodingValues() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get ticket
+ ticket = AllElementsTestTicketV3.getUicTestTicket();
+
+ assert(ticket != null);
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ ticket = UperEncoder.decode(encoded, UicRailTicketData.class);
+
+
+ validateTicketContent(ticket);
+
+ }
+
+
+
+
+
+
private void validateTicketContent(UicRailTicketData t) {
assert (t != null);
@@ -227,6 +255,7 @@ public class AsnLevelAllElementsTestV3 { DocumentData d2 = t.getTransportDocument().get(1);
assert(d2 != null);
assert(d2.getTicket().getCarCarriageReservation() != null);
+ validateCarCarriage(d2.getTicket().getCarCarriageReservation());
assert(d2.getToken() != null);
assert(UperEncoder.hexStringFromBytes(d2.getToken().getToken()).equals("82DA"));
assert(d2.getToken().getTokenProviderIA5().equals("VDV"));
@@ -257,7 +286,7 @@ public class AsnLevelAllElementsTestV3 { DocumentData d7 = t.getTransportDocument().get(6);
assert(d7 != null);
assert(d7.getTicket().getCounterMark() != null);
-
+ validateCounterMark(d7.getTicket().getCounterMark());
DocumentData d8 = t.getTransportDocument().get(7);
assert(d8 != null);
@@ -316,6 +345,87 @@ public class AsnLevelAllElementsTestV3 { +
+
+ private void validateCounterMark(CountermarkData t) {
+
+ assert(t != null);
+
+ assert(t.getReferenceNum().longValue() == 810123456789L);
+ assert(t.getReferenceIA5().equals("810123456789"));
+ assert(t.getProductOwnerNum() == 23456);
+ assert(t.getProductOwnerIA5().equals( "23456"));
+ assert(t.getProductIdNum() == 65535);
+ assert(t.getProductIdIA5().equals( "123456"));
+ assert(t.getTicketReferenceIA5().equals( "810123456789"));
+ assert(t.getTicketReferenceNum() == 810123456789L);
+ assert(t.getNumberOfCountermark() == 12L);
+ assert(t.getTotalOfCountermarks() == 24L);
+ assert(t.getGroupName().equals( "groupName"));
+ assert(t.getReturnIncluded() == false);
+
+ assert(t.getStationCodeTable().equals(CodeTableType.stationERA));
+ assert(t.getFromStationNum() == 8100001);
+ assert(t.getFromStationIA5().equals("8100001"));
+ assert(t.getToStationNum() == 8000002);
+ assert(t.getToStationIA5().equals( "8100002"));
+ assert(t.getFromStationNameUTF8().equals( "A-STATION"));
+ assert(t.getToStationNameUTF8().equals( "B-STATION"));
+
+ assert(t.getValidRegionDesc().equals("From A to B via C"));
+
+ assert(t.getValidRegion() != null);
+ assert(t.getValidRegion().size() == 1);
+ assert(t.getValidRegion().get(0).getViaStations() != null);
+
+ assert(t.getReturnDescription() != null);
+ assert(t.getReturnDescription().getFromStationNum() == 8100001);
+ assert(t.getReturnDescription().getFromStationIA5().equals("8100001"));
+ assert(t.getReturnDescription().getToStationNum() == 8000002);
+ assert(t.getReturnDescription().getToStationIA5().equals( "8100002"));
+ assert(t.getReturnDescription().getFromStationNameUTF8().equals( "A-STATION"));
+ assert(t.getReturnDescription().getToStationNameUTF8().equals( "B-STATION"));
+ assert(t.getReturnDescription().getValidReturnRegionDesc().equals( "return"));
+ assert(t.getReturnDescription().getValidReturnRegion() != null);
+ assert(t.getReturnDescription().getValidReturnRegion().size() == 1);
+
+ assert(t.getValidFromDay() == 700);
+ assert(t.getValidFromTime() == 0);
+ assert(t.getValidFromUTCOffset() == 60);
+ assert(t.getValidUntilDay() == 370);
+ assert(t.getValidUntilTime() == 1439);
+ assert(t.getValidUntilUTCOffset() == 10);
+
+ assert(t.getClassCode().equals(TravelClassType.first));
+
+ assert(t.getCarriersNum() != null);
+ assert(t.getCarriersNum().size() == 2);
+ assert(t.getCarriersNum().get(0) == 1080);
+ assert(t.getCarriersNum().get(1) == 1181);
+
+ assert(t.getCarriersIA5() != null);
+ assert(t.getCarriersIA5().size() == 2);
+ assert(t.getCarriersIA5().get(0).equals("1080"));
+ assert(t.getCarriersIA5().get(1).equals("1181"));
+
+ assert(t.getIncludedServiceBrands() != null);
+ assert(t.getIncludedServiceBrands().size() == 2);
+ assert(t.getIncludedServiceBrands().get(0) == 108);
+ assert(t.getIncludedServiceBrands().get(1) == 118);
+
+ assert(t.getExcludedServiceBrands() != null);
+ assert(t.getExcludedServiceBrands().size() == 2);
+ assert(t.getExcludedServiceBrands().get(0) == 108);
+ assert(t.getExcludedServiceBrands().get(1) == 118);
+
+
+ assert (t.getInfoText().equals("counterMark"));
+
+ assert(t.getExtension() != null);
+
+
+ }
+
private void validateDelay(DelayConfirmation t) {
assert(t != null);
@@ -1040,6 +1150,80 @@ public class AsnLevelAllElementsTestV3 { assert(r.getExtension() != null);
}
+
+
+ private void validateCarCarriage(CarCarriageReservationData r) {
+
+ assert(r.getTrainNum() == 123);
+ assert(r.getTrainIA5().equals("123"));
+ assert(r.getReferenceIA5().equals("810123456789"));
+ assert(r.getReferenceNum() == 810123456789L);
+ assert(r.getProductOwnerNum() == 23456);
+ assert(r.getProductOwnerIA5().equals("23456"));
+ assert(r.getProductIdNum() == 65535);
+ assert(r.getProductIdIA5().equals("123456"));
+ assert(r.getServiceBrand() == 100);
+ assert(r.getServiceBrandAbrUTF8().equals("AZ"));
+ assert(r.getServiceBrandNameUTF8().equals("special train"));
+
+ assert(r.getBeginLoadingDate() == 10);
+ assert(r.getBeginLoadingTime() == 0);
+ assert(r.getEndLoadingTime() == 500);
+ assert(r.getLoadingUTCOffset() == 30);
+
+ assert(r.getStationCodeTable().equals(CodeTableType.stationERA));
+ assert(r.getFromStationNum() == 8100001);
+ assert(r.getFromStationIA5().equals("8100001"));
+ assert(r.getToStationNum() == 8000002);
+ assert(r.getToStationIA5().equals( "8100002"));
+ assert(r.getFromStationNameUTF8().equals( "A-STATION"));
+ assert(r.getToStationNameUTF8().equals( "B-STATION"));
+
+ assert(r.getCoach().equals("21"));
+ assert(r.getPlace().equals("41"));
+ assert(r.getCompartmentDetails() != null);
+
+ assert(r.getCompartmentDetails().getCoachType() == 1L);
+ assert(r.getCompartmentDetails().getCompartmentType() == 99L);
+ assert(r.getCompartmentDetails().getSpecialAllocation() == 50L);
+ assert(r.getCompartmentDetails().getCoachTypeDescr().equals("xwz"));
+ assert(r.getCompartmentDetails().getCompartmentTypeDescr().equals("xwz"));
+ assert(r.getCompartmentDetails().getSpecialAllocationDescr().equals("xwz"));
+ assert(r.getCompartmentDetails().getPosition().equals(CompartmentPositionType.upperLevel));
+
+ assert(r.getNumberPlate().equals( "AD-DE-123"));
+ assert(r.getTrailerPlate().equals( "DX-AB-123"));
+ assert(r.getCarCategory() == 3L);
+ assert(r.getBoatCategory() == 5L);
+ assert(r.getTextileRoof() == false);
+ assert(r.getRoofRackType().equals(RoofRackType.bicycleRack));
+ assert(r.getRoofRackHeight() == 20L);
+ assert(r.getAttachedBoats() == 2L);
+ assert(r.getAttachedBicycles() == 1L);
+ assert(r.getAttachedSurfboards() == 2L);
+ assert(r.getLoadingListEntry() == 421L);
+ assert(r.getLoadingDeck().equals(LoadingDeckType.upper));
+
+ assert(r.getCarrierNum()!= null);
+ assert(r.getCarrierNum().size() == 2);
+ assert(r.getCarrierNum().get(0) == 1080);
+ assert(r.getCarrierNum().get(1) == 1181);
+
+ assert(r.getCarrierIA5() != null);
+ assert(r.getCarrierIA5().size() == 2);
+ assert(r.getCarrierIA5().contains("1080"));
+ assert(r.getCarrierIA5().contains("1181"));
+
+ assert(r.getTariff() != null);
+ assert(r.getPriceType().equals(PriceTypeType.travelPrice));
+ assert(r.getPrice() == 12345L);
+
+ assert(r.getVatDetails() != null);
+
+ assert(r.getInfoText().equals("car carriage"));
+ assert(r.getExtension() != null);
+
+ }
public static int getIndexOfDifference(String s1, String s2) {
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java index 294c9d9..955e2cf 100644 --- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java +++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelCarCarriageTestV3.java @@ -1,6 +1,9 @@ package org.uic.barcode.ticket.api.test;
+import java.text.DateFormat;
import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.TimeZone;
import org.junit.After;
@@ -124,10 +127,52 @@ public class AsnLevelCarCarriageTestV3 { assert(c.getCarrierNum().contains(1080L));
assert(c.getCarrierNum().contains(1181L));
assert(c.getPrice() == 12345L);
+
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date df = c.getBeginLoadingDate(ticket.getIssuingDetail().getIssuingDate());
+ String vf = dateFormat.format(df);
+ assert(vf.equals("2018.01.11-00:00"));
+
+ Date du = c.getEndLoadingDate(ticket.getIssuingDetail().getIssuingDate());
+ String vu = dateFormat.format(du);
+ assert(vu.equals("2018.01.11-08:20"));
+
+ String id = dateFormat.format(ticket.getIssuingDetail().getIssuingDate());
+ assert(id.equals("2018.01.01-10:00"));
+
+ TimeZone.setDefault(current);
}
+ @Test public void encodingDate() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = CarCarriageReservationTestTicketV3.getUicTestTicket();
+
+ CarCarriageReservationData c = ticket.getTransportDocument().get(0).getTicket().getCarCarriageReservation();
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date d1 = dateFormat.parse("2018.01.11-00:00");
+ Date d2 = dateFormat.parse("2018.01.11-08:20");
+ c.setLoadingDates(d1, d2, ticket.getIssuingDetail().getIssuingDate());
+
+ TimeZone.setDefault(current);
+
+ 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));
+
+ }
}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java index 72af687..8a2cbde 100644 --- a/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java +++ b/src/test/java/org/uic/barcode/ticket/api/test/AsnLevelDelayConfirmationTestV3.java @@ -1,6 +1,9 @@ package org.uic.barcode.ticket.api.test;
+import java.text.DateFormat;
import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.TimeZone;
import org.junit.After;
@@ -67,6 +70,30 @@ public class AsnLevelDelayConfirmationTestV3 { assert(expectedHex.equals(encodedHex));
}
+
+ @Test public void encodingDate() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = DelayTestTicketV3.getUicTestTicket();
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date d = dateFormat.parse("2022.01.12-16:40");
+ ticket.getTransportDocument().get(0).getTicket().getDelayConfirmation().setPlannedArrivalDate(d);
+ TimeZone.setDefault(current);
+
+
+ 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.
@@ -132,9 +159,11 @@ public class AsnLevelDelayConfirmationTestV3 { assert(del.getAffectedTickets().get(0).getTicketType().equals(TicketType.openTicket));
assert(del.getAffectedTickets().get(0).getLinkMode().equals(LinkMode.issuedTogether));
-
-
-
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ String pd = dateFormat.format(del.getPlannedArrivalDate());
+ assert(pd.equals("2022.01.12-16:40"));
+ TimeZone.setDefault(current);
}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java new file mode 100644 index 0000000..5631489 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketINcludedTicketDateTestV3.java @@ -0,0 +1,213 @@ +package org.uic.barcode.ticket.api.test;
+
+
+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.api.asn.omv3.CodeTableType;
+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.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.AllElementsTestTicketV3;
+
+
+/**
+ *
+ *
+ *
+ *
+ */
+public class OpenTicketINcludedTicketDateTestV3 {
+
+
+
+ /** 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 = AllElementsTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ assert(ticket.getTransportDocument().get(2).getTicket().getOpenTicket() != null);
+
+ OpenTicketData ot = ticket.getTransportDocument().get(2).getTicket().getOpenTicket();
+
+ assert(ot.getIncludedAddOns().size() == 1);
+ IncludedOpenTicketType inc = ot.getIncludedAddOns().get(0);
+
+ validate(inc);
+
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date df = inc.getValidFromDate(ticket.getIssuingDetail().getIssuingDate());
+ String vf = dateFormat.format(df);
+ assert(vf.equals("2018.01.01-16:40"));
+
+ Date du = inc.getValidUntilDate(ticket.getIssuingDetail().getIssuingDate());
+ String vu = dateFormat.format(du);
+ assert(vu.equals("2018.01.02-16:40"));
+
+ String id = dateFormat.format(ticket.getIssuingDetail().getIssuingDate());
+ assert(id.equals("2018.01.01-10:00"));
+
+ TimeZone.setDefault(current);
+
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = AllElementsTestTicketV3.getUicTestTicket();
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = AllElementsTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ @Test public void encodingDate() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = AllElementsTestTicketV3.getUicTestTicket();
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ OpenTicketData ot = ticket.getTransportDocument().get(2).getTicket().getOpenTicket();
+
+ assert(ot.getIncludedAddOns().size() == 1);
+ IncludedOpenTicketType inc = ot.getIncludedAddOns().get(0);
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date d1 = dateFormat.parse("2018.01.01-16:40");
+ Date d2 = dateFormat.parse("2018.01.02-16:40");
+
+ inc.setValidityDates(d1, d2, ticket.getIssuingDetail().getIssuingDate());
+
+ TimeZone.setDefault(current);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = AllElementsTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+ private void validate(IncludedOpenTicketType t) {
+
+ assert(t.getProductOwnerNum() == 23456);
+ assert(t.getProductOwnerIA5().equals("23456"));
+ assert(t.getProductIdNum() == 65535);
+ assert(t.getProductIdIA5().equals( "123456"));
+ assert(t.getExternalIssuerId() == 12);
+ assert(t.getIssuerAutorizationId() == 13);
+ assert(t.getStationCodeTable().equals(CodeTableType.stationERA));
+ assert(t.getValidRegion() != null);
+ assert(t.getValidRegion().size() == 1);
+ assert(t.getValidFromDay() == 0);
+ assert(t.getValidFromTime() == 1000);
+ assert(t.getValidUntilDay() == 1);
+ assert(t.getValidUntilTime() == 1000);
+ assert(t.getClassCode().equals(TravelClassType.second));
+ assert(t.getServiceLevel().equals("A"));
+
+ assert(t.getIncludedCarriersNum() != null);
+ assert(t.getIncludedCarriersNum().size() == 2);
+ assert(t.getIncludedCarriersNum().get(0) == 1080);
+ assert(t.getIncludedCarriersNum().get(1) == 1181);
+
+ assert(t.getIncludedCarriersIA5() != null);
+ assert(t.getIncludedCarriersIA5().size() == 2);
+ assert(t.getIncludedCarriersIA5().get(0).equals("1080"));
+ assert(t.getIncludedCarriersIA5().get(1).equals("1181"));
+
+
+
+ assert(t.getIncludedServiceBrands() != null);
+ assert(t.getIncludedServiceBrands().size() == 2);
+ assert(t.getIncludedServiceBrands().get(0) == 108);
+ assert(t.getIncludedServiceBrands().get(1) == 118);
+
+ assert(t.getExcludedServiceBrands() != null);
+ assert(t.getExcludedServiceBrands().size() == 2);
+ assert(t.getExcludedServiceBrands().get(0) == 108);
+ assert(t.getExcludedServiceBrands().get(1) == 118);
+
+ assert(t.getTariffs() != null);
+ assert(t.getTariffs().size() == 1);
+
+ assert(t.getInfoText().equals("included ticket"));
+
+ assert(t.getIncludedTransportTypes() != null);
+ assert(t.getIncludedTransportTypes().size() == 2);
+ assert(t.getIncludedTransportTypes().get(0) == 10);
+ assert(t.getIncludedTransportTypes().get(1) == 11);
+
+ assert(t.getExcludedTransportTypes() != null);
+ assert(t.getExcludedTransportTypes().size() == 2);
+ assert(t.getExcludedTransportTypes().get(0) == 10);
+ assert(t.getExcludedTransportTypes().get(1) == 18);
+
+ assert(t.getExtension() != null);
+
+
+
+ }
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java new file mode 100644 index 0000000..ae6a75a --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketTrainLinkDateTestV3.java @@ -0,0 +1,147 @@ +package org.uic.barcode.ticket.api.test;
+
+
+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.api.asn.omv3.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.TrainLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.AllElementsTestTicketV3;
+
+
+/**
+ *
+ *
+ *
+ *
+ */
+public class OpenTicketTrainLinkDateTestV3 {
+
+
+
+ /** 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 = AllElementsTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ assert(ticket.getTransportDocument().get(2).getTicket().getOpenTicket() != null);
+
+ OpenTicketData ot = ticket.getTransportDocument().get(2).getTicket().getOpenTicket();
+
+ assert(ot.getValidRegion().size() > 2);
+
+ TrainLinkType tl = ot.getValidRegion().get(3).getTrainLink();
+
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date df = tl.getDepartureDate(ticket.getIssuingDetail().getIssuingDate());
+ String vf = dateFormat.format(df);
+ assert(vf.equals("2018.01.03-23:59"));
+
+ String id = dateFormat.format(ticket.getIssuingDetail().getIssuingDate());
+ assert(id.equals("2018.01.01-10:00"));
+
+ TimeZone.setDefault(current);
+
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = AllElementsTestTicketV3.getUicTestTicket();
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = AllElementsTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ @Test public void encodingDate() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = AllElementsTestTicketV3.getUicTestTicket();
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ OpenTicketData ot = ticket.getTransportDocument().get(2).getTicket().getOpenTicket();
+
+ assert(ot.getValidRegion().size() > 2);
+
+ TrainLinkType tl = ot.getValidRegion().get(3).getTrainLink();
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date d = dateFormat.parse("2018.01.03-23:59");
+
+ tl.setDepartureDate(d, ticket.getIssuingDetail().getIssuingDate());
+
+ TimeZone.setDefault(current);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = AllElementsTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+
+
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java new file mode 100644 index 0000000..2e78ef3 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/PassTrainValidityTestV3.java @@ -0,0 +1,175 @@ +package org.uic.barcode.ticket.api.test;
+
+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.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.AllElementsTestTicketV3;
+
+
+/**
+ * The Class Test asn.1 encoding of a pass.
+ *
+ *
+ *
+ */
+public class PassTrainValidityTestV3 {
+
+
+ /** 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 = AllElementsTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ assert(ticket.getTransportDocument().get(3).getTicket().getPass() != null);
+
+ PassData p = ticket.getTransportDocument().get(3).getTicket().getPass();
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date df = p.getValidFromDate(ticket.getIssuingDetail().getIssuingDate());
+ String vf = dateFormat.format(df);
+ assert(vf.equals("2018.01.01-16:40"));
+
+ Date du = p.getValidUntilDate(ticket.getIssuingDetail().getIssuingDate());
+ String vu = dateFormat.format(du);
+ assert(vu.equals("2018.01.02-16:40"));
+
+ String id = dateFormat.format(ticket.getIssuingDetail().getIssuingDate());
+ assert(id.equals("2018.01.01-10:00"));
+
+ //ticketvalidity
+ String tvf = dateFormat.format(p.getTrainValidity().getValidFromDate(ticket.getIssuingDetail().getIssuingDate()));
+ assert(tvf.equals("2018.01.01-16:40"));
+
+ String tvu = dateFormat.format(p.getTrainValidity().getValidUntilDate(ticket.getIssuingDetail().getIssuingDate()));
+ assert(tvu.equals("2018.01.02-16:40"));
+
+ //validityDetails
+ String vdf = dateFormat.format(p.getValidityPeriodDetails().getValidityPeriod().get(0).getValidFromDate(ticket.getIssuingDetail().getIssuingDate()));
+ assert(vdf.equals("2018.01.01-16:40"));
+
+ String vdu = dateFormat.format(p.getValidityPeriodDetails().getValidityPeriod().get(0).getValidUntilDate(ticket.getIssuingDetail().getIssuingDate()));
+ assert(vdu.equals("2018.01.02-16:40"));
+
+ TimeZone.setDefault(current);
+
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ String hex = AllElementsTestTicketV3.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 = AllElementsTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ assert(ticket.getTransportDocument().get(3).getTicket().getPass() != null);
+
+ PassData p = ticket.getTransportDocument().get(3).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);
+
+ }
+
+ @Test public void encodingDate() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ String hex = AllElementsTestTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ PassData p = ticket.getTransportDocument().get(3).getTicket().getPass();
+
+ TimeZone current = TimeZone.getDefault();
+ DateFormat dateFormat = new SimpleDateFormat( "yyyy.MM.dd-HH:mm" );
+ Date d1 = dateFormat.parse("2018.01.01-16:40");
+ Date d2 = dateFormat.parse("2018.01.02-16:40");
+
+ p.setValidityDates(d1, d2, ticket.getIssuingDetail().getIssuingDate());
+ p.getTrainValidity().setValidityDates(d1, d2, ticket.getIssuingDetail().getIssuingDate());
+ p.getValidityPeriodDetails().getValidityPeriod().get(0).setValidityDates(d1, d2, ticket.getIssuingDetail().getIssuingDate());
+
+ TimeZone.setDefault(current);
+
+
+ byte[] encoded = UperEncoder.encode(ticket);
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = AllElementsTestTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+
+
+ }
+}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV3.java index f377986..5bd2965 100644 --- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV3.java +++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AllElementsTestTicketV3.java @@ -1,11 +1,107 @@ package org.uic.barcode.ticket.api.test.testtickets;
- public class AllElementsTestTicketV3 {
+import java.util.List;
+
+import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
+import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfDeltaCoordinates;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfRegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfRegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv3.DeltaCoordinates;
+import org.uic.barcode.ticket.api.asn.omv3.BerthDetailData;
+import org.uic.barcode.ticket.api.asn.omv3.BerthTypeType;
+import org.uic.barcode.ticket.api.asn.omv3.BoardingOrArrivalType;
+import org.uic.barcode.ticket.api.asn.omv3.CarCarriageReservationData;
+import org.uic.barcode.ticket.api.asn.omv3.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv3.CodeTableType;
+import org.uic.barcode.ticket.api.asn.omv3.CompartmentDetailsType;
+import org.uic.barcode.ticket.api.asn.omv3.CompartmentGenderType;
+import org.uic.barcode.ticket.api.asn.omv3.CompartmentPositionType;
+import org.uic.barcode.ticket.api.asn.omv3.ConfirmationTypeType;
+import org.uic.barcode.ticket.api.asn.omv3.ControlData;
+import org.uic.barcode.ticket.api.asn.omv3.CountermarkData;
+import org.uic.barcode.ticket.api.asn.omv3.CustomerCardData;
+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.FIPTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.GenderType;
+import org.uic.barcode.ticket.api.asn.omv3.GeoCoordinateSystemType;
+import org.uic.barcode.ticket.api.asn.omv3.GeoCoordinateType;
+import org.uic.barcode.ticket.api.asn.omv3.GeoUnitType;
+import org.uic.barcode.ticket.api.asn.omv3.HemisphereLatitudeType;
+import org.uic.barcode.ticket.api.asn.omv3.HemisphereLongitudeType;
+import org.uic.barcode.ticket.api.asn.omv3.IncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv3.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv3.LineType;
+import org.uic.barcode.ticket.api.asn.omv3.LinkMode;
+import org.uic.barcode.ticket.api.asn.omv3.LoadingDeckType;
+import org.uic.barcode.ticket.api.asn.omv3.LuggageRestrictionType;
+import org.uic.barcode.ticket.api.asn.omv3.OpenTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.ParkingGroundData;
+import org.uic.barcode.ticket.api.asn.omv3.PassData;
+import org.uic.barcode.ticket.api.asn.omv3.PassengerType;
+import org.uic.barcode.ticket.api.asn.omv3.PlacesType;
+import org.uic.barcode.ticket.api.asn.omv3.PolygoneType;
+import org.uic.barcode.ticket.api.asn.omv3.PriceTypeType;
+import org.uic.barcode.ticket.api.asn.omv3.RegionalValidityType;
+import org.uic.barcode.ticket.api.asn.omv3.RegisteredLuggageType;
+import org.uic.barcode.ticket.api.asn.omv3.ReservationData;
+import org.uic.barcode.ticket.api.asn.omv3.ReturnRouteDescriptionType;
+import org.uic.barcode.ticket.api.asn.omv3.RoofRackType;
+import org.uic.barcode.ticket.api.asn.omv3.RouteSectionType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfActivatedDays;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfBerthDetailData;
+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.SequenceOfCountries;
+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.SequenceOfIncludedOpenTicketType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfPlaceNum;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfServiceBrands;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTariffType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTimeRangeType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTransportTypes;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTravelerId;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfValidityPeriodType;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfVatDetail;
+import org.uic.barcode.ticket.api.asn.omv3.SequenceOfViaStationType;
+import org.uic.barcode.ticket.api.asn.omv3.SeriesDetailType;
+import org.uic.barcode.ticket.api.asn.omv3.ServiceType;
+import org.uic.barcode.ticket.api.asn.omv3.StationPassageData;
+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.TicketLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.TicketType;
+import org.uic.barcode.ticket.api.asn.omv3.TimeRangeType;
+import org.uic.barcode.ticket.api.asn.omv3.TokenType;
+import org.uic.barcode.ticket.api.asn.omv3.TrainLinkType;
+import org.uic.barcode.ticket.api.asn.omv3.TrainValidityType;
+import org.uic.barcode.ticket.api.asn.omv3.TravelClassType;
+import org.uic.barcode.ticket.api.asn.omv3.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv3.ValidityPeriodDetailType;
+import org.uic.barcode.ticket.api.asn.omv3.ValidityPeriodType;
+import org.uic.barcode.ticket.api.asn.omv3.VatDetailType;
+import org.uic.barcode.ticket.api.asn.omv3.ViaStationType;
+import org.uic.barcode.ticket.api.asn.omv3.VoucherData;
+import org.uic.barcode.ticket.api.asn.omv3.ZoneType;
+
+public class AllElementsTestTicketV3 {
/*
- value UicRailTicketData ::= {
+value UicRailTicketData ::= {
issuingDetail {
securityProviderNum 1,
securityProviderIA5 "1",
@@ -74,7 +170,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceNum 80123456789,
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
serviceBrand 12,
serviceBrandAbrUTF8 "TGV",
@@ -224,7 +320,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceNum 810123456789,
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
serviceBrand 100,
serviceBrandAbrUTF8 "AZ",
@@ -287,7 +383,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceIA5 "810123456789",
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
extIssuerId 12,
issuerAutorizationId 13,
@@ -418,7 +514,7 @@ package org.uic.barcode.ticket.api.test.testtickets; {
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
externalIssuerId 12,
issuerAutorizationId 13,
@@ -460,7 +556,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceIA5 "810123456789",
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
passType 2,
passDescription "Eurail FlexPass",
@@ -535,7 +631,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceNum 810123456789,
productOwnerNum 23456,
productOwnerIA5 "COFFEEMACHINE",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
validFromYear 2022,
validFromDay 1,
@@ -575,7 +671,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceNum 810123456789,
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
ticketReferenceIA5 "810123456789",
ticketReferenceNum 810123456789,
@@ -658,7 +754,7 @@ package org.uic.barcode.ticket.api.test.testtickets; productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
accessCode "4ga"
location "Parking Frankfurt Main West",
@@ -685,7 +781,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceNum 810123456789,
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
validFromDay -367,
validUntilDay -1,
@@ -704,7 +800,7 @@ package org.uic.barcode.ticket.api.test.testtickets; referenceNum 810123456789,
productOwnerNum 23456,
productOwnerIA5 "23456",
- productIdNum 123456,
+ productIdNum 65535,
productIdIA5 "123456",
productName "passage",
stationCodeTable stationUIC,
@@ -891,7 +987,1345 @@ package org.uic.barcode.ticket.api.test.testtickets; }
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+
+ private static void populateTicket(UicRailTicketData ticket) {
+
+ ticket.setControlDetail(new ControlData());
+ populateControlDetail(ticket.getControlDetail());
+
+ ticket.setExtension(new SequenceOfExtensionData());
+ populateExtension(ticket.getExtension());
+
+ ticket.setIssuingDetail(new IssuingData());
+ populateIssuingData(ticket.getIssuingDetail());
+
+ ticket.setTravelerDetail(new TravelerData());
+ populateTravelerData(ticket.getTravelerDetail());
+
+ ticket.setTransportDocument(new SequenceOfDocumentData());
+
+ DocumentData d1 = new DocumentData();
+ populateReservation(d1);
+ ticket.getTransportDocument().add(d1);
+
+ DocumentData d2 = new DocumentData();
+ populateCarCarriage(d2);
+ ticket.getTransportDocument().add(d2);
+
+ DocumentData d3 = new DocumentData();
+ populateOpenTicket(d3);
+ ticket.getTransportDocument().add(d3);
+
+ DocumentData d4 = new DocumentData();
+ populatePass(d4);
+ ticket.getTransportDocument().add(d4);
+
+ DocumentData d5 = new DocumentData();
+ populateVoucher(d5);
+ ticket.getTransportDocument().add(d5);
+
+ DocumentData d6 = new DocumentData();
+ populateCustomerCard(d6);
+ ticket.getTransportDocument().add(d6);
+
+ DocumentData d7 = new DocumentData();
+ populateCounterMark(d7);
+ ticket.getTransportDocument().add(d7);
+
+ DocumentData d8 = new DocumentData();
+ populateParking(d8);
+ ticket.getTransportDocument().add(d8);
+
+ DocumentData d9 = new DocumentData();
+ populateFip(d9);
+ ticket.getTransportDocument().add(d9);
+
+ DocumentData d10 = new DocumentData();
+ populateStationPassage(d10);
+ ticket.getTransportDocument().add(d10);
+
+ DocumentData d11 = new DocumentData();
+ populateExtensionDocument(d11);
+ ticket.getTransportDocument().add(d11);
+
+ DocumentData d12 = new DocumentData();
+ populateDelay(d12);
+ ticket.getTransportDocument().add(d12);
+
+ }
+
+ private static void populateDelay(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ DelayConfirmation dc = new DelayConfirmation();
+ d.getTicket().setDelayConfirmation(dc);
+
+ dc.setTrainNum(Asn1BigInteger.toAsn1(100L));
+ dc.setTrainIA5("100");
+ dc.setPlannedArrivalYear(2022L);
+ dc.setPlannedArrivalDay(12L);
+ dc.setPlannedArrivalTime(1000L);
+ dc.setDepartureUTCOffset(30L);
+ dc.setReferenceIA5("ABDJ12345");
+ dc.setReferenceNum(12345L);
+
+ dc.setStationCodeTable(CodeTableType.stationUIC);
+ dc.setStationNum(8000001L);
+ dc.setStationIA5("DJE");
+ dc.setDelay(31L);
+ dc.setTrainCancelled(false);
+ dc.setConfirmationType(ConfirmationTypeType.travelerDelayConfirmation);
+
+ dc.setAffectedTickets(new SequenceOfTicketLinkType());
+ TicketLinkType tl = new TicketLinkType();
+ dc.getAffectedTickets().add(tl);
+
+ tl.setReferenceIA5("KDJET");
+ tl.setReferenceNum(801234567890L);
+ tl.setIssuerName("XYZ");
+ tl.setIssuerPNR("LDWDUR45");
+ tl.setProductOwnerNum(1080L);
+ tl.setProductOwnerIA5("IEFHU");
+ tl.setTicketType(TicketType.openTicket);
+ tl.setLinkMode(LinkMode.issuedTogether);
+
+ dc.setInfoText("delay confirmation");
+ dc.setExtension(new ExtensionData());
+ dc.getExtension().setExtensionId("1");
+ dc.getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ }
+
+
+ private static void populateExtensionDocument(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ d.getTicket().setExtension(new ExtensionData());
+ d.getTicket().getExtension().setExtensionId("1");
+ d.getTicket().getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ }
+
+
+ private static void populateStationPassage(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ StationPassageData s = new StationPassageData();
+ d.getTicket().setStationPassage(s);
+
+ s.setExtension(new ExtensionData());
+ s.getExtension().setExtensionId("1");
+ s.getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ s.setReferenceIA5("810123456789");
+ s.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ s.setProductOwnerNum(23456L);
+ s.setProductOwnerIA5("23456");
+ s.setProductIdNum(65535L);
+ s.setProductIdIA5("123456");
+
+ s.setProductName("passage");
+ s.setStationCodeTable(CodeTableType.stationUIC);
+ s.setStationNum(new SequenceOfUnrestrictedLong());
+ s.getStationNum().add(8200001L);
+ s.setStationIA5(new SequenceOfStringIA5());
+ s.getStationIA5().add("AMS");
+ s.setStationNameUTF8(new SequenceOfStringUTF8());
+ s.getStationNameUTF8().add("Amsterdam");
+ s.setAreaCodeNum(new SequenceOfUnrestrictedLong());
+ s.getAreaCodeNum().add(8200001L);
+ s.setAreaCodeIA5(new SequenceOfStringIA5());
+ s.getAreaCodeIA5().add("AMS");
+ s.setAreaNameUTF8(new SequenceOfStringUTF8());
+ s.getAreaNameUTF8().add("Amsterdam");
+ s.setValidFromDay(5L);
+ s.setValidFromTime(0L);
+ s.setValidFromUTCOffset(1L);
+ s.setValidUntilDay(5L);
+ s.setValidUntilTime(1000L);
+ s.setValidUntilUTCOffset(1L);
+ s.setNumberOfDaysValid(5L);
+
+ }
+
+
+ private static void populateFip(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ FIPTicketData f = new FIPTicketData();
+ d.getTicket().setFipTicket(f);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ f.setExtension(e1);
+
+ f.setReferenceIA5("810123456789");
+ f.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ f.setProductOwnerNum(23456L);
+ f.setProductOwnerIA5("23456");
+ f.setProductIdNum(65535L);
+ f.setProductIdIA5("123456");
+
+
+ f.setValidFromDay( -367L);
+ f.setValidUntilDay( -1L);
+ f.setActivatedDay(new SequenceOfActivatedDays());
+ f.getActivatedDay().add(1L);
+ f.getActivatedDay().add(13L);
+ f.getActivatedDay().add(14L);
+ f.getActivatedDay().add(15L);
+
+ f.setCarrierNum(new SequenceOfCarrierNum());
+ f.getCarrierNum().add(1080L);
+ f.getCarrierNum().add(1181L);
+
+ f.setCarrierIA5(new SequenceOfStringIA5());
+ f.getCarrierIA5().add("1080");
+ f.getCarrierIA5().add("1181");
+
+ f.setNumberOfTravelDays(8L);
+ f.setIncludesSupplements(true);
+ f.setClassCode(TravelClassType.first);
+
+ }
+
+
+ private static void populateParking(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ ParkingGroundData p = new ParkingGroundData();
+ d.getTicket().setParkingGround(p);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ p.setExtension(e1);
+
+
+ p.setReferenceIA5("810123456789");
+ p.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ p.setProductOwnerNum(23456L);
+ p.setProductOwnerIA5("23456");
+ p.setProductIdNum(65535L);
+ p.setProductIdIA5("123456");
+
+ p.setParkingGroundId("IA5");
+ p.setFromParkingDate(370L);
+ p.setToParkingDate(370L);
+
+ p.setAccessCode("4ga");
+ p.setLocation("Parking Frankfurt Main West");
+ p.setStationCodeTable(CodeTableType.stationUIC);
+ p.setStationNum(8000001L);
+ p.setStationIA5("8000001");
+ p.setSpecialInformation("outdoor parking");
+ p.setEntryTrack("left");
+ p.setNumberPlate("AA-DE-12345");
+ p.setPrice(500L);
+ p.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v = new VatDetailType();
+ p.getVatDetails().add(v);
+ v.setAmount(10L);
+ v.setCountry(80L);
+ v.setPercentage(70L);
+ v.setVatId("IUDGTE");
+
+ }
+
+
+ private static void populateCounterMark(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ CountermarkData t = new CountermarkData();
+ d.getTicket().setCounterMark(t);
+
+ t.setTicketReferenceIA5("810123456789");
+ t.setTicketReferenceNum(810123456789L);
+ t.setNumberOfCountermark(12L);
+ t.setTotalOfCountermarks(24L);
+ t.setGroupName("groupName");
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ t.setExtension(e1);
+
+ t.setReferenceIA5("810123456789");
+ t.setReferenceNum(810123456789L);
+ t.setProductOwnerNum( 23456L);
+ t.setProductOwnerIA5("23456");
+ t.setProductIdNum( 65535L);
+ t.setProductIdIA5("123456");
+
+ t.setReturnIncluded( false);
+
+ t.setStationCodeTable(CodeTableType.stationERA);
+ t.setFromStationNum( 8100001L);
+ t.setFromStationIA5("8100001");
+ t.setToStationNum( 8000002L);
+ t.setToStationIA5( "8100002");
+ t.setFromStationNameUTF8( "A-STATION");
+ t.setToStationNameUTF8( "B-STATION");
+
+ t.setValidRegionDesc("From A to B via C");
+
+ t.setValidRegion(new SequenceOfRegionalValidityType());
+ t.getValidRegion().add(new RegionalValidityType());
+ t.getValidRegion().get(0).setViaStations(new ViaStationType());
+ populateCounterMarkRoute(t.getValidRegion().get(0).getViaStations());
+
+ t.setReturnDescription(new ReturnRouteDescriptionType());
+ t.getReturnDescription().setFromStationNum( 8100001L);
+ t.getReturnDescription().setFromStationIA5("8100001");
+ t.getReturnDescription().setToStationNum( 8000002L);
+ t.getReturnDescription().setToStationIA5( "8100002");
+ t.getReturnDescription().setFromStationNameUTF8( "A-STATION");
+ t.getReturnDescription().setToStationNameUTF8( "B-STATION");
+ t.getReturnDescription().setValidReturnRegionDesc( "return");
+ t.getReturnDescription().setValidReturnRegion(new SequenceOfRegionalValidityType());
+ t.getReturnDescription().getValidReturnRegion().add(new RegionalValidityType());
+
+ t.getReturnDescription().getValidReturnRegion().get(0).setZones(new ZoneType());
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(100L);
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(200L);
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierNum(1080L);
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierIA5("1181");
+ t.getReturnDescription().getValidReturnRegion().get(0).getZones().setStationCodeTable(CodeTableType.stationERA);
+
+ t.setValidFromDay( 700L);
+ t.setValidFromTime( 0L);
+ t.setValidFromUTCOffset( 60L);
+ t.setValidUntilDay( 370L);
+ t.setValidUntilTime( 1439L);
+ t.setValidUntilUTCOffset( 10L);
+
+ t.setClassCode(TravelClassType.first);
+
+ t.setCarriersNum(new SequenceOfCarrierNum());
+ t.getCarriersNum().add(1080L);
+ t.getCarriersNum().add(1181L);
+
+ t.setCarriersIA5(new SequenceOfStringIA5());
+ t.getCarriersIA5().add("1080");
+ t.getCarriersIA5().add("1181");
+
+ t.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ t.getIncludedServiceBrands().add(108L);
+ t.getIncludedServiceBrands().add(118L);
+
+ t.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ t.getExcludedServiceBrands().add(108L);
+ t.getExcludedServiceBrands().add(118L);
+
+
+ t.setInfoText("counterMark");
+
+ }
+
+
+ private static void populateCustomerCard(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ CustomerCardData c = new CustomerCardData();
+ d.getTicket().setCustomerCard(c);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ c.setExtension(e1);
+
+ TravelerType t = new TravelerType();
+ c.setCustomer(t);
+ t.setCustomerIdIA5("1234");
+ t.setTicketHolder(false);
+ t.setPassengerType(PassengerType.senior);
+
+ c.setCardIdIA5("2345");
+ c.setCardIdNum(123456L);
+ c.setValidFromYear(2269L);
+ c.setValidFromDay(2L);
+ c.setValidUntilYear(1L);
+ c.setValidUntilDay(5L);
+ c.setClassCode(TravelClassType.second);
+ c.setCardType(15L);
+ c.setCardTypeDescr("RAILPLUS");
+ c.setCustomerStatus(1L);
+
+ c.setCustomerStatusDescr("gold");
+ c.setIncludedServices(new SequenceOfUnrestrictedLong());
+ c.getIncludedServices().add(1L);
+ c.getIncludedServices().add(2L);
+
+ }
+
+
+ private static void populateVoucher(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ VoucherData v = new VoucherData();
+ d.getTicket().setVoucher(v);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ v.setExtension(e1);
+
+ v.setReferenceIA5("810123456789");
+ v.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ v.setProductOwnerNum(23456L);
+ v.setProductOwnerIA5("COFFEEMACHINE");
+ v.setProductIdNum(65535L);
+ v.setProductIdIA5("123456");
+
+ v.setValidFromYear(2022L);
+ v.setValidFromDay(1L);
+ v.setValidUntilYear(2022L);
+ v.setValidUntilDay(1L);
+ v.setValue(500L);
+ v.setType(123L);
+ v.setInfoText("coffee voucher");
+ }
+
+
+ private static void populatePass(DocumentData d) {
+
+
+ d.setTicket(new TicketDetailData());
+ PassData p = new PassData();
+ d.getTicket().setPass(p);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ p.setExtension(e1);
+
+ p.setReferenceIA5("810123456789");
+ p.setReferenceNum(Asn1BigInteger.toAsn1(810123456789L));
+ p.setProductOwnerNum(23456L);
+ p.setProductOwnerIA5("23456");
+ p.setProductIdNum(65535L);
+ p.setProductIdIA5("123456");
+
+ p.setPassType(2L);
+ p.setPassDescription("Eurail FlexPass");
+ p.setClassCode(TravelClassType.first);
+ p.setValidFromDay( 0L);
+ p.setValidFromTime( 1000L);
+ p.setValidFromUTCOffset( 1L);
+ p.setValidUntilDay( 1L);
+ p.setValidUntilTime( 1000L);
+ p.setValidUntilUTCOffset(1L);
+
+ ValidityPeriodDetailType v = new ValidityPeriodDetailType();
+ p.setValidityPeriodDetails(v);
+ v.setValidityPeriod(new SequenceOfValidityPeriodType());
+ v.setExcludedTimeRange(new SequenceOfTimeRangeType());
+
+ ValidityPeriodType vp = new ValidityPeriodType();
+ p.getValidityPeriodDetails().getValidityPeriod().add(vp);
+ vp.setValidFromDay(0L);
+ vp.setValidFromTime( 1000L);
+ vp.setValidFromUTCOffset( 1L);
+ vp.setValidUntilDay( 1L);
+ vp.setValidUntilTime( 1000L);
+ vp.setValidUntilUTCOffset(1L);
+
+ TimeRangeType tr = new TimeRangeType();
+ p.getValidityPeriodDetails().getExcludedTimeRange().add(tr);
+
+ tr.setFromTime(6L);
+ tr.setUntilTime(9L);
+
+ p.setNumberOfValidityDays(5L);
+
+ TrainValidityType t = new TrainValidityType();
+ p.setTrainValidity(t);
+
+ t.setValidFromDay(0L);
+ t.setValidFromTime( 1000L);
+ t.setValidUntilDay( 1L);
+ t.setValidUntilTime(1000L);
+ t.setIncludedCarriersNum(new SequenceOfCarrierNum());
+ t.getIncludedCarriersNum().add(1234L);
+ t.getIncludedCarriersNum().add(5678L);
+ t.setBordingOrArrival(BoardingOrArrivalType.boarding);
+
+ p.setNumberOfPossibleTrips( 3L);
+ p.setNumberOfDaysOfTravel( 10L);
+
+ p.setActivatedDay(new SequenceOfActivatedDays());
+ p.getActivatedDay().add(200L);
+ p.getActivatedDay().add(201L);
+
+
+ p.setCountries(new SequenceOfCountries());
+ p.getCountries().add(10L);
+ p.getCountries().add(20L);
+
+ p.setIncludedCarriersNum(new SequenceOfCarrierNum());
+ p.getIncludedCarriersNum().add(1080L);
+ p.getIncludedCarriersNum().add(1181L);
+
+ p.setIncludedCarriersIA5(new SequenceOfStringIA5());
+ p.getIncludedCarriersIA5().add("1080");
+ p.getIncludedCarriersIA5().add("1181");
+
+ p.setExcludedCarriersNum(new SequenceOfCarrierNum());
+ p.getExcludedCarriersNum().add(1080L);
+ p.getExcludedCarriersNum().add(1181L);
+
+ p.setExcludedCarriersIA5(new SequenceOfStringIA5());
+ p.getExcludedCarriersIA5().add("1080");
+ p.getExcludedCarriersIA5().add("1181");
+
+ p.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ p.getIncludedServiceBrands().add(108L);
+ p.getIncludedServiceBrands().add(118L);
+
+ p.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ p.getExcludedServiceBrands().add(108L);
+ p.getExcludedServiceBrands().add(118L);
+
+ p.setValidRegion(new SequenceOfRegionalValidityType());
+
+ RegionalValidityType rv = new RegionalValidityType();
+ p.getValidRegion().add(rv);
+ rv.setZones(new ZoneType());
+ rv.getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ rv.getZones().getZoneId().add(100L);
+
+ p.setTariffs(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ p.getTariffs().add(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ p.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ p.getVatDetails().add(v1);
+ v1.setAmount(10L);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+ v1.setVatId("IUDGTE");
+
+ p.setPrice(10000L);
+ p.setInfoText("pass info");
+
+ }
+
+
+ private static void populateOpenTicket(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ OpenTicketData o = new OpenTicketData();
+ d.getTicket().setOpenTicket(o);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ o.setExtension(e1);
+
+ o.setReferenceIA5("810123456789");
+ o.setReferenceNum(810123456789L);
+ o.setProductOwnerNum( 23456L);
+ o.setProductOwnerIA5("23456");
+ o.setProductIdNum( 65535L);
+ o.setProductIdIA5("123456");
+
+
+ o.setExtIssuerId( 12L);
+ o.setIssuerAutorizationId( 13L);
+ o.setReturnIncluded( false);
+
+ o.setStationCodeTable(CodeTableType.stationERA);
+ o.setFromStationNum( 8100001L);
+ o.setFromStationIA5("8100001");
+ o.setToStationNum( 8000002L);
+ o.setToStationIA5( "8100002");
+ o.setFromStationNameUTF8( "A-STATION");
+ o.setToStationNameUTF8( "B-STATION");
+
+ o.setValidRegionDesc("From A to B via C");
+
+ o.setValidRegion(new SequenceOfRegionalValidityType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(0).setViaStations(new ViaStationType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(1).setZones(new ZoneType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(2).setLines(new LineType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(3).setTrainLink(new TrainLinkType());
+ o.getValidRegion().add(new RegionalValidityType());
+ o.getValidRegion().get(4).setPolygone(new PolygoneType());
+ populateRoute(o.getValidRegion().get(0).getViaStations());
+ populateZone(o.getValidRegion().get(1).getZones());
+ populateLine(o.getValidRegion().get(2).getLines());
+ populateTrainLink(o.getValidRegion().get(3).getTrainLink());
+ populatePolygon(o.getValidRegion().get(4).getPolygone());
+
+ o.setReturnDescription(new ReturnRouteDescriptionType());
+ o.getReturnDescription().setFromStationNum( 8100001L);
+ o.getReturnDescription().setFromStationIA5("8100001");
+ o.getReturnDescription().setToStationNum( 8000002L);
+ o.getReturnDescription().setToStationIA5( "8100002");
+ o.getReturnDescription().setFromStationNameUTF8( "A-STATION");
+ o.getReturnDescription().setToStationNameUTF8( "B-STATION");
+ o.getReturnDescription().setValidReturnRegionDesc( "return");
+ o.getReturnDescription().setValidReturnRegion(new SequenceOfRegionalValidityType());
+ o.getReturnDescription().getValidReturnRegion().add(new RegionalValidityType());
+
+ o.getReturnDescription().getValidReturnRegion().get(0).setZones(new ZoneType());
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(100L);
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().getZoneId().add(200L);
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierIA5("1080");
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setCarrierNum(1080L);
+ o.getReturnDescription().getValidReturnRegion().get(0).getZones().setStationCodeTable(CodeTableType.stationERA);
+
+ o.setValidFromDay( 700L);
+ o.setValidFromTime( 0L);
+ o.setValidFromUTCOffset( 60L);
+ o.setValidUntilDay( 370L);
+ o.setValidUntilTime( 1439L);
+ o.setValidUntilUTCOffset( 10L);
+
+ o.setActivatedDay(new SequenceOfActivatedDays());
+ o.getActivatedDay().add(1L);
+ o.getActivatedDay().add(2L);
+
+
+ o.setClassCode(TravelClassType.first);
+ o.setServiceLevel("A");
+
+ o.setCarriersNum(new SequenceOfCarrierNum());
+ o.getCarriersNum().add(1080L);
+ o.getCarriersNum().add(1181L);
+
+ o.setCarriersIA5(new SequenceOfStringIA5());
+ o.getCarriersIA5().add("1080");
+ o.getCarriersIA5().add("1181");
+
+ o.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ o.getIncludedServiceBrands().add(108L);
+ o.getIncludedServiceBrands().add(118L);
+
+ o.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ o.getExcludedServiceBrands().add(108L);
+ o.getExcludedServiceBrands().add(118L);
+
+ o.setTariffs(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ o.getTariffs().add(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ o.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ o.getVatDetails().add(v1);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+
+ o.setPrice( 12345L);
+
+
+ o.setInfoText("openTicketInfo");
+
+ o.setIncludedAddOns(new SequenceOfIncludedOpenTicketType());
+ o.getIncludedAddOns().add(new IncludedOpenTicketType());
+ populateIncludedTicket(o.getIncludedAddOns().get(0));
+
+ o.setLuggage(new LuggageRestrictionType());
+ o.getLuggage().setMaxHandLuggagePieces(2L);
+ o.getLuggage().setMaxNonHandLuggagePieces(1L);
+
+ o.setIncludedTransportTypes(new SequenceOfTransportTypes());
+ o.getIncludedTransportTypes().add(10L);
+ o.getIncludedTransportTypes().add(11L);
+
+ o.setExcludedTransportTypes(new SequenceOfTransportTypes());
+ o.getExcludedTransportTypes().add(10L);
+ o.getExcludedTransportTypes().add(18L);
+
+
+
+
+ }
+
+
+
+
+ private static void populateTrainLink(TrainLinkType t) {
+
+
+ t.setTrainNum( 12345L);
+ t.setTrainIA5("12345");
+ t.setTravelDate( 2L);
+ t.setDepartureTime( 1439L);
+ t.setDepartureUTCOffset( -60L);
+
+ t.setFromStationNum( 8100001L);
+ t.setFromStationIA5("8100001");
+ t.setToStationNum( 8000002L);
+ t.setToStationIA5( "8100002");
+ t.setFromStationName( "A-STATION");
+ t.setToStationName( "B-STATION");
+
+ }
+
+ private static void populatePolygon(PolygoneType p) {
+
+ p.setFirstEdge(new GeoCoordinateType());
+ p.getFirstEdge().setLongitude( 12345L);
+ p.getFirstEdge().setLatitude( 56789L);
+ p.setEdges(new SequenceOfDeltaCoordinates());
+ p.getEdges().add(new DeltaCoordinates());
+ p.getEdges().add(new DeltaCoordinates());
+ p.getEdges().get(0).setLongitude( Asn1BigInteger.toAsn1(12345L));
+ p.getEdges().get(0).setLatitude(Asn1BigInteger.toAsn1(56789L));
+ p.getEdges().get(1).setLongitude(Asn1BigInteger.toAsn1(12345L));
+ p.getEdges().get(1).setLatitude(Asn1BigInteger.toAsn1(56789L));
+
+ }
+
+ private static void populateZone(ZoneType z) {
+
+ z.setCarrierNum( 1080L);
+ z.setCarrierIA5("1080");
+ z.setStationCodeTable(CodeTableType.stationERA);
+ z.setEntryStationNum( 1234L);
+ z.setEntryStationIA5( "1234");
+ z.setTerminatingStationNum( 2345L);
+ z.setTerminatingStationIA5( "2345");
+ z.setCity(Asn1BigInteger.toAsn1(123456L));
+ z.setZoneId(new SequenceOfUnrestrictedLong());
+ z.getZoneId().add(100L);
+ z.getZoneId().add(200L);
+ z.setNutsCode("DE4711");
+ z.setBinaryZoneId(UperEncoder.bytesFromHexString("82DA"));
+
+ }
+
+ private static void populateLine(LineType z) {
+
+ z.setCarrierNum( 1080L);
+ z.setCarrierIA5("1080");
+ z.setStationCodeTable(CodeTableType.stationERA);
+ z.setEntryStationNum( 1234L);
+ z.setEntryStationIA5( "1234");
+ z.setTerminatingStationNum( 2345L);
+ z.setTerminatingStationIA5( "2345");
+ z.setCity(123456L);
+ z.setLineId(new SequenceOfUnrestrictedLong());
+ z.getLineId().add(100L);
+ z.getLineId().add(200L);
+
+ }
+
+ private static void populateRoute(ViaStationType t) {
+
+
+ t.setRoute(new SequenceOfViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+
+ t.getRoute().get(0).setStationNum( 123455L);
+ t.getRoute().get(0).setStationIA5("123455");
+ t.getRoute().get(0).setBorder( false);
+
+ t.getRoute().get(1).setStationNum( 123456L);
+ t.getRoute().get(1).setBorder( false);
+
+
+ t.getRoute().get(2).setAlternativeRoutes(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).setBorder( false);
+
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setStationNum( 23455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setStationNum( 23456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setStationNum( 3455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(1).setStationNum( 3456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+
+ t.getRoute().get(3).setStationNum( 123457L);
+ t.getRoute().get(3).setBorder(false);
+
+ t.setBorder( false);
+
+ t.setSeriesId( 999L);
+ t.setRouteId( 21L);
+
+ t.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ t.getIncludedServiceBrands().add(108L);
+ t.getIncludedServiceBrands().add(118L);
+
+ t.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ t.getExcludedServiceBrands().add(108L);
+ t.getExcludedServiceBrands().add(118L);
+
+ }
+
+ private static void populateCounterMarkRoute(ViaStationType t) {
+
+
+ t.setRoute(new SequenceOfViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+ t.getRoute().add(new ViaStationType());
+
+ t.getRoute().get(0).setStationNum( 123455L);
+ t.getRoute().get(0).setStationIA5("123455");
+ t.getRoute().get(0).setBorder( false);
+
+ t.getRoute().get(1).setStationNum( 123456L);
+ t.getRoute().get(1).setBorder( false);
+
+
+ t.getRoute().get(2).setAlternativeRoutes(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().add(new ViaStationType());
+ t.getRoute().get(2).setBorder( false);
+
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setStationNum( 23455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setStationNum( 23456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setRoute(new SequenceOfViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().add(new ViaStationType());
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setStationNum( 3455L);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(0).setBorder(false);
+ t.getRoute().get(2).getAlternativeRoutes().get(1).getRoute().get(1).setStationNum( 3456L);
+ t.getRoute().get(2).getAlternativeRoutes().get(0).getRoute().get(1).setBorder(false);
+
+ t.getRoute().get(3).setStationNum( 123457L);
+ t.getRoute().get(3).setBorder(false);
+
+ t.setCarriersIA5(new SequenceOfStringIA5());
+ t.getCarriersIA5().add("1080");
+ t.getCarriersIA5().add("1181");
+
+ t.setCarriersNum(new SequenceOfCarrierNum());
+ t.getCarriersNum().add(1080L);
+ t.getCarriersNum().add(1181L);
+
+
+ t.setBorder( false);
+
+ t.setSeriesId( 999L);
+ t.setRouteId( 21L);
+ }
+ private static void populateIncludedTicket(IncludedOpenTicketType t) {
+
+
+ t.setProductOwnerNum( 23456L);
+ t.setProductOwnerIA5("23456");
+ t.setProductIdNum( 65535L);
+ t.setProductIdIA5("123456");
+
+
+ t.setExternalIssuerId(12L);
+ t.setIssuerAutorizationId(13L);
+ t.setStationCodeTable(CodeTableType.stationERA);
+
+ t.setValidRegion(new SequenceOfRegionalValidityType());
+ RegionalValidityType rv = new RegionalValidityType();
+ t.getValidRegion().add(rv);
+ rv.setZones(new ZoneType());
+ rv.getZones().setZoneId(new SequenceOfUnrestrictedLong());
+ rv.getZones().getZoneId().add(100L);
+
+ t.setValidFromDay( 0L);
+ t.setValidFromTime(1000L);
+ t.setValidUntilDay(1L);
+ t.setValidUntilTime(1000L);
+ t.setClassCode(TravelClassType.second);
+ t.setServiceLevel("A");
+
+ t.setIncludedCarriersNum(new SequenceOfCarrierNum());
+ t.getIncludedCarriersNum().add(1080L);
+ t.getIncludedCarriersNum().add(1181L);
+
+ t.setIncludedCarriersIA5(new SequenceOfStringIA5());
+ t.getIncludedCarriersIA5().add("1080");
+ t.getIncludedCarriersIA5().add("1181");
+
+
+ t.setIncludedServiceBrands(new SequenceOfServiceBrands());
+ t.getIncludedServiceBrands().add(108L);
+ t.getIncludedServiceBrands().add(118L);
+
+ t.setExcludedServiceBrands(new SequenceOfServiceBrands());
+ t.getExcludedServiceBrands().add(108L);
+ t.getExcludedServiceBrands().add(118L);
+
+ t.setTariffs(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ t.getTariffs().add(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ t.setInfoText("included ticket");
+
+ t.setIncludedTransportTypes(new SequenceOfTransportTypes());
+ t.getIncludedTransportTypes().add(10L);
+ t.getIncludedTransportTypes().add(11L);
+
+ t.setExcludedTransportTypes(new SequenceOfTransportTypes());
+ t.getExcludedTransportTypes().add(10L);
+ t.getExcludedTransportTypes().add(18L);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ t.setExtension(e1);
+
+ }
+
+
+ private static void populateCarCarriage(DocumentData d2) {
+
+ d2.setTicket(new TicketDetailData());
+ d2.setToken(new TokenType());
+
+
+ assert(d2.getToken() != null);
+ d2.getToken().setToken(UperEncoder.bytesFromHexString("82DA"));
+ d2.getToken().setTokenProviderIA5("VDV");
+ d2.getToken().setTokenProviderNum(123L);
+ d2.getToken().setTokenSpecification("TEST");
+
+ CarCarriageReservationData r = new CarCarriageReservationData();
+ d2.getTicket().setCarCarriageReservation(r);
+
+ r.setTrainNum( 123L);
+ r.setTrainIA5("123");
+ r.setReferenceIA5("810123456789");
+ r.setReferenceNum( 810123456789L);
+ r.setProductOwnerNum( 23456L);
+ r.setProductOwnerIA5("23456");
+ r.setProductIdNum( 65535L);
+ r.setProductIdIA5("123456");
+ r.setServiceBrand( 100L);
+ r.setServiceBrandAbrUTF8("AZ");
+ r.setServiceBrandNameUTF8("special train");
+
+ r.setBeginLoadingDate( 10L);
+ r.setBeginLoadingTime( 0L);
+ r.setEndLoadingTime( 500L);
+ r.setLoadingUTCOffset( 30L);
+
+ r.setStationCodeTable(CodeTableType.stationERA);
+ r.setFromStationNum( 8100001L);
+ r.setFromStationIA5("8100001");
+ r.setToStationNum( 8000002L);
+ r.setToStationIA5( "8100002");
+ r.setFromStationNameUTF8( "A-STATION");
+ r.setToStationNameUTF8( "B-STATION");
+
+ r.setCoach("21");
+ r.setPlace("41");
+ r.setCompartmentDetails(new CompartmentDetailsType());
+
+ r.getCompartmentDetails().setCoachType( 1L);
+ r.getCompartmentDetails().setCompartmentType( 99L);
+ r.getCompartmentDetails().setSpecialAllocation( 50L);
+ r.getCompartmentDetails().setCoachTypeDescr("xwz");
+ r.getCompartmentDetails().setCompartmentTypeDescr("xwz");
+ r.getCompartmentDetails().setSpecialAllocationDescr("xwz");
+ r.getCompartmentDetails().setPosition(CompartmentPositionType.upperLevel);
+
+ r.setNumberPlate( "AD-DE-123");
+ r.setTrailerPlate( "DX-AB-123");
+ r.setCarCategory( 3L);
+ r.setBoatCategory( 5L);
+ r.setTextileRoof( false);
+ r.setRoofRackType(RoofRackType.bicycleRack);
+ r.setRoofRackHeight( 20L);
+ r.setAttachedBoats( 2L);
+ r.setAttachedBicycles( 1L);
+ r.setAttachedSurfboards( 2L);
+ r.setLoadingListEntry( 421L);
+ r.setLoadingDeck(LoadingDeckType.upper);
+
+ r.setCarrierNum(new SequenceOfCarrierNum());
+ r.getCarrierNum().add(1080L);
+ r.getCarrierNum().add(1181L);
+
+ r.setCarrierIA5(new SequenceOfStringIA5());
+ r.getCarrierIA5().add("1080");
+ r.getCarrierIA5().add("1181");
+
+
+ r.setPriceType(PriceTypeType.travelPrice);
+ r.setPrice(12345L);
+
+ r.setInfoText("car carriage");
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ r.setExtension(e1);
+
+ TariffType ta = new TariffType();
+ r.setTariff(ta);
+ ta.setNumberOfPassengers(1L);
+ ta.setRestrictedToCountryOfResidence(false);
+ ta.setTariffIdNum(72L);
+ ta.setTariffDesc("Large Car Full Fare");
+
+ r.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ r.getVatDetails().add(v1);
+ v1.setAmount(10L);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+ v1.setVatId("IUDGTE");
+
+ }
+
+
+ private static void populateReservation(DocumentData d) {
+
+ d.setTicket(new TicketDetailData());
+ ReservationData r = new ReservationData();
+ d.getTicket().setReservation(r);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ r.setExtension(e1);
+
+ r.setTrainNum( 12345L);
+ r.setTrainIA5("12345");
+ r.setDepartureDate( 2L);
+ r.setReferenceIA5("810123456789");
+ r.setReferenceNum(80123456789L);
+ r.setProductOwnerNum( 23456L);
+ r.setProductOwnerIA5("23456");
+ r.setProductIdNum( 65535L);
+ r.setProductIdIA5("123456");
+ r.setServiceBrand( 12L);
+ r.setServiceBrandAbrUTF8("TGV");
+ r.setServiceBrandNameUTF8("Lyria");
+ r.setService(ServiceType.couchette);
+
+ r.setStationCodeTable(CodeTableType.stationUIC);
+ r.setFromStationNum( 8100001L);
+ r.setFromStationIA5("8100001");
+ r.setToStationNum( 8000002L);
+ r.setToStationIA5( "8100002");
+ r.setFromStationNameUTF8( "A-STATION");
+ r.setToStationNameUTF8( "B-STATION");
+ r.setDepartureTime( 1439L);
+ r.setDepartureUTCOffset( -60L);
+ r.setArrivalDate( 20L);
+ r.setArrivalTime( 0L);
+ r.setArrivalUTCOffset( 10L);
+ r.setCarrierNum(new SequenceOfCarrierNum());
+ r.getCarrierNum().add(1080L);
+ r.getCarrierNum().add(1181L);
+
+ r.setCarrierIA5(new SequenceOfStringIA5());
+ r.getCarrierIA5().add("1080");
+ r.getCarrierIA5().add("1181");
+ r.setClassCode(TravelClassType.first);
+ r.setServiceLevel("A");
+
+ r.setPlaces(new PlacesType());
+ r.getPlaces().setCoach("31A");
+ r.getPlaces().setPlaceString("31-47");
+ r.getPlaces().setPlaceDescription("Window");
+ r.getPlaces().setPlaceIA5(new SequenceOfStringIA5());
+ r.getPlaces().getPlaceIA5().add("31A");
+ r.getPlaces().getPlaceIA5().add("31B");
+ r.getPlaces().setPlaceNum(new SequenceOfPlaceNum());
+ r.getPlaces().getPlaceNum().add(31L);
+ r.getPlaces().getPlaceNum().add(32L);
+
+ r.setAdditionalPlaces(new PlacesType());
+ r.getAdditionalPlaces().setCoach("31A");
+ r.getAdditionalPlaces().setPlaceString("31-47");
+ r.getAdditionalPlaces().setPlaceDescription("Window");
+ r.getAdditionalPlaces().setPlaceIA5(new SequenceOfStringIA5());
+ r.getAdditionalPlaces().getPlaceIA5().add("31A");
+ r.getAdditionalPlaces().getPlaceIA5().add("31B");
+ r.getAdditionalPlaces().setPlaceNum(new SequenceOfPlaceNum());
+ r.getAdditionalPlaces().getPlaceNum().add(31L);
+ r.getAdditionalPlaces().getPlaceNum().add(32L);
+
+ r.setBicyclePlaces(new PlacesType());
+ r.getBicyclePlaces().setCoach("31A");
+ r.getBicyclePlaces().setPlaceString("31-47");
+ r.getBicyclePlaces().setPlaceDescription("Window");
+ r.getBicyclePlaces().setPlaceIA5(new SequenceOfStringIA5());
+ r.getBicyclePlaces().getPlaceIA5().add("31A");
+ r.getBicyclePlaces().getPlaceIA5().add("31B");
+ r.getBicyclePlaces().setPlaceNum(new SequenceOfPlaceNum());
+ r.getBicyclePlaces().getPlaceNum().add(31L);
+ r.getBicyclePlaces().getPlaceNum().add(32L);
+
+
+ r.setCompartmentDetails(new CompartmentDetailsType());
+ r.getCompartmentDetails().setCoachType( 1L);
+ r.getCompartmentDetails().setCompartmentType( 99L);
+ r.getCompartmentDetails().setSpecialAllocation( 50L);
+ r.getCompartmentDetails().setCoachTypeDescr("xwz");
+ r.getCompartmentDetails().setCompartmentTypeDescr( "xwz");
+ r.getCompartmentDetails().setSpecialAllocationDescr( "xwz");
+ r.getCompartmentDetails().setPosition(CompartmentPositionType.upperLevel);
+
+ r.setNumberOfOverbooked( 200L);
+ r.setBerth(new SequenceOfBerthDetailData());
+ BerthDetailData b = new BerthDetailData();
+ r.getBerth().add(b);
+ b.setBerthType(BerthTypeType.single);
+ b.setGender(CompartmentGenderType.female);
+ b.setNumberOfBerths( 999L);
+
+
+ r.setTariff(new SequenceOfTariffType());
+ TariffType ta = new TariffType();
+ r.getTariff().add(ta);
+ ta.setNumberOfPassengers(1L);
+
+ ta.setPassengerType(PassengerType.senior);
+ ta.setAgeBelow( 64L);
+ ta.setAgeAbove( 60L);
+ ta.setTraverlerid(new SequenceOfTravelerId());
+ ta.getTraverlerid().add(1L);
+
+ ta.setRestrictedToCountryOfResidence( false);
+ ta.setRestrictedToRouteSection(new RouteSectionType());
+ ta.getRestrictedToRouteSection().setStationCodeTable(CodeTableType.stationERA);
+ ta.getRestrictedToRouteSection().setFromStationNum( 123L);
+ ta.getRestrictedToRouteSection().setFromStationIA5( "123");
+ ta.getRestrictedToRouteSection().setToStationNum( 234L);
+ ta.getRestrictedToRouteSection().setToStationIA5( "234");
+ ta.getRestrictedToRouteSection().setFromStationNameUTF8( "A");
+ ta.getRestrictedToRouteSection().setToStationNameUTF8( "B");
+
+ ta.setSeriesDataDetails(new SeriesDetailType());
+ ta.getSeriesDataDetails().setSupplyingCarrier(12345L);
+ ta.getSeriesDataDetails().setOfferIdentification( 99L);
+ ta.getSeriesDataDetails().setSeries( 23456L);
+
+ ta.setTariffIdNum( 72L);
+ ta.setTariffIdIA5( "72");
+ ta.setTariffDesc( "Leasure Fare");
+ ta.setReductionCard(new SequenceOfCardReferenceType());
+ ta.getReductionCard().add(new CardReferenceType());
+
+ ta.getReductionCard().get(0).setCardIssuerNum(1234L);
+ ta.getReductionCard().get(0).setCardIssuerIA5( "1234");
+ ta.getReductionCard().get(0).setCardIdNum(5678L);
+ ta.getReductionCard().get(0).setCardIdIA5( "5678");
+ ta.getReductionCard().get(0).setCardName( "testcard");
+ ta.getReductionCard().get(0).setCardType(123L);
+ ta.getReductionCard().get(0).setLeadingCardIdNum(3456L);
+ ta.getReductionCard().get(0).setLeadingCardIdIA5("3456");
+ ta.getReductionCard().get(0).setTrailingCardIdNum(100L);
+ ta.getReductionCard().get(0).setTrailingCardIdIA5("100");
+
+
+ r.setPriceType(PriceTypeType.travelPrice);
+ r.setPrice( 12345L);
+
+ r.setVatDetails(new SequenceOfVatDetail());
+ VatDetailType v1 = new VatDetailType();
+ r.getVatDetails().add(v1);
+ v1.setAmount(10L);
+ v1.setCountry(80L);
+ v1.setPercentage(70L);
+ v1.setVatId("IUDGTE");
+
+ r.setTypeOfSupplement( 9L);
+ r.setNumberOfSupplements( 2L);
+
+ r.setLuggage(new LuggageRestrictionType());
+
+ r.getLuggage().setMaxHandLuggagePieces( 2L);
+ r.getLuggage().setMaxNonHandLuggagePieces( 1L);
+ r.getLuggage().setRegisteredLuggage(new SequenceOfRegisteredLuggageType());
+ r.getLuggage().getRegisteredLuggage().add(new RegisteredLuggageType());
+ r.getLuggage().getRegisteredLuggage().add(new RegisteredLuggageType());
+ r.getLuggage().getRegisteredLuggage().get(0).setRegistrationId("IODHUV");
+ r.getLuggage().getRegisteredLuggage().get(0).setMaxWeight( 20L);
+ r.getLuggage().getRegisteredLuggage().get(0).setMaxSize( 100L);
+ r.getLuggage().getRegisteredLuggage().get(1).setRegistrationId("XXDHUV");
+ r.getLuggage().getRegisteredLuggage().get(1).setMaxWeight( 21L);
+ r.getLuggage().getRegisteredLuggage().get(1).setMaxSize( 101L);
+
+ r.setInfoText("reservation");
+
+
+ }
+
+
+ private static void populateTravelerData(TravelerData td) {
+
+ td.setGroupName("myGroup");
+ td.setPreferedLanguage("EN");
+ td.setTraveler(new SequenceOfTravelerType());
+ TravelerType t = new TravelerType();
+ td.getTraveler().add(t);
+
+ t.setCountryOfIdCard(103L);
+ t.setCountryOfPassport(102L);
+ t.setCountryOfResidence(101L);
+ t.setCustomerIdIA5("DZE5gT");
+ t.setCustomerIdNum(12345L);
+ t.setYearOfBirth(1901L);
+ t.setDayOfBirth(31L);
+ t.setFirstName("John");
+ t.setGender(GenderType.male);
+ t.setIdCard("12345");
+ t.setLastName("Dow");
+ t.setMonthOfBirth(12L);
+ t.setPassengerType(PassengerType.senior);
+ t.setPassengerWithReducedMobility(false);
+ t.setPassportId("JDTS");
+ t.setSecondName("Little");
+ t.setTitle("PhD");
+ t.setTicketHolder(true);
+ t.setStatus(new SequenceOfCustomerStatusType());
+ CustomerStatusType cs = new CustomerStatusType();
+ t.getStatus().add(cs);
+ cs.setCustomerStatus(1L);
+ cs.setCustomerStatusDescr("senior");
+ }
+
+
+ private static void populateIssuingData(IssuingData id) {
+
+ id.setActivated(true);
+ id.setCurrency("SRF");
+ id.setCurrencyFract(3L);
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ id.setExtension(e1);
+
+ id.setIssuedOnLine(12L);
+ id.setIssuedOnTrainIA5("123");
+ id.setIssuedOnTrainNum(123L);
+ id.setIssuerName("name");
+ id.setIssuerIA5("1");
+ id.setIssuerNum(32000L);
+ id.setIssuerPNR("issuerTestPNR");
+ id.setIssuingDay(1L);
+ id.setIssuingTime(600L);
+ id.setIssuingYear(2018L);
+ id.setSecurePaperTicket(false);
+ id.setSecurityProviderIA5("1");
+ id.setSecurityProviderNum(1L);
+ id.setSpecimen(true);
+ id.setPointOfSale(new GeoCoordinateType());
+ id.getPointOfSale().setGeoUnit(GeoUnitType.microDegree);
+ id.getPointOfSale().setCoordinateSystem(GeoCoordinateSystemType.wgs84);
+ id.getPointOfSale().setAccuracy(GeoUnitType.microDegree);
+ id.getPointOfSale().setHemisphereLatitude(HemisphereLatitudeType.east);
+ id.getPointOfSale().setHemisphereLongitude(HemisphereLongitudeType.north);
+ id.getPointOfSale().setLatitude(56789L);
+ id.getPointOfSale().setLongitude(12345L);
+
+ }
+
+
+ private static void populateExtension(List<ExtensionData> extensions) {
+
+ ExtensionData e1 = new ExtensionData();
+ e1.setExtensionId("1");
+ e1.setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+ extensions.add(e1);
+
+ ExtensionData e2 = new ExtensionData();
+ e2.setExtensionId("2");
+ e2.setExtensionData(UperEncoder.bytesFromHexString("83DA"));
+ extensions.add(e2);
+
+ }
+
+
+ private static void populateControlDetail(ControlData controlDetail) {
+
+ controlDetail.setAgeCheckRequired(false);
+ controlDetail.setIdentificationByPassportId(false);
+ controlDetail.setIdentificationByIdCard(false);
+ controlDetail.setOnlineValidationRequired(false);
+ controlDetail.setIdentificationItem(12L);
+ controlDetail.setPassportValidationRequired(false);
+ controlDetail.setRandomDetailedValidationRequired(50L);
+ controlDetail.setExtension(new ExtensionData());
+ controlDetail.getExtension().setExtensionId("1");
+ controlDetail.getExtension().setExtensionData(UperEncoder.bytesFromHexString("82DA"));
+
+ controlDetail.setReductionCardCheckRequired(false);
+ controlDetail.setInfoText("control");
+ controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
+
+ CardReferenceType cr = new CardReferenceType();
+ controlDetail.getIdentificationByCardReference().add(cr);
+ cr.setCardIdIA5("5678");
+ cr.setCardIdNum(5678L);
+ cr.setCardIssuerIA5("1234");
+ cr.setCardIssuerNum(1234L);
+ cr.setCardName("testcard");
+ cr.setCardType(123L);
+ cr.setLeadingCardIdIA5("3456");
+ cr.setLeadingCardIdNum(3456L);
+ cr.setTrailingCardIdIA5("100");
+ cr.setTrailingCardIdNum(100L);
+
+ controlDetail.setIncludedTickets(new SequenceOfTicketLinkType());
+ TicketLinkType tl = new TicketLinkType();
+ controlDetail.getIncludedTickets().add(tl);
+ tl.setIssuerName("XYZ");
+ tl.setIssuerPNR("LDWDUR45");
+ tl.setProductOwnerIA5("IEFHU");
+ tl.setProductOwnerNum(1080L);
+ tl.setLinkMode(LinkMode.issuedTogether);
+ tl.setReferenceIA5("KDJET");
+ tl.setReferenceNum(801234567890L);
+ tl.setTicketType(TicketType.openTicket);
+
+ }
}
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassComplexTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassComplexTicketV3.java index 03df203..af69f69 100644 --- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassComplexTicketV3.java +++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassComplexTicketV3.java @@ -2,7 +2,6 @@ package org.uic.barcode.ticket.api.test.testtickets; import org.uic.barcode.asn1.datatypes.Asn1BigInteger;
import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8;
-import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong;
import org.uic.barcode.ticket.api.asn.omv3.BoardingOrArrivalType;
import org.uic.barcode.ticket.api.asn.omv3.CardReferenceType;
import org.uic.barcode.ticket.api.asn.omv3.ControlData;
@@ -13,7 +12,6 @@ import org.uic.barcode.ticket.api.asn.omv3.IssuingData; import org.uic.barcode.ticket.api.asn.omv3.LinkMode;
import org.uic.barcode.ticket.api.asn.omv3.PassData;
import org.uic.barcode.ticket.api.asn.omv3.PassengerType;
-import org.uic.barcode.ticket.api.asn.omv3.RegionalValidityType;
import org.uic.barcode.ticket.api.asn.omv3.RouteSectionType;
import org.uic.barcode.ticket.api.asn.omv3.SequenceOfActivatedDays;
import org.uic.barcode.ticket.api.asn.omv3.SequenceOfCardReferenceType;
@@ -37,7 +35,6 @@ 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;
-import org.uic.barcode.ticket.api.asn.omv3.ZoneType;
public class PassComplexTicketV3 {
|