summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2021-03-25 18:37:47 +0100
committerGitHub <noreply@github.com>2021-03-25 18:37:47 +0100
commit945963a8118dcf88fe53386df1d0c08c53e79bf9 (patch)
treecafd23ff62d39812466f1751af006d010548eca8 /src
parentMerge pull request #10 from UnionInternationalCheminsdeFer/time-zone-fix_2 (diff)
parent- additional test on LayoutElement with utf-8 (diff)
downloadUIC-barcode-945963a8118dcf88fe53386df1d0c08c53e79bf9.tar
UIC-barcode-945963a8118dcf88fe53386df1d0c08c53e79bf9.tar.gz
UIC-barcode-945963a8118dcf88fe53386df1d0c08c53e79bf9.tar.bz2
UIC-barcode-945963a8118dcf88fe53386df1d0c08c53e79bf9.tar.lz
UIC-barcode-945963a8118dcf88fe53386df1d0c08c53e79bf9.tar.xz
UIC-barcode-945963a8118dcf88fe53386df1d0c08c53e79bf9.tar.zst
UIC-barcode-945963a8118dcf88fe53386df1d0c08c53e79bf9.zip
Diffstat (limited to 'src')
-rw-r--r--src/org/uic/barcode/test/TicketLayoutTest.java27
-rw-r--r--src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java15
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java146
-rw-r--r--src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java145
4 files changed, 333 insertions, 0 deletions
diff --git a/src/org/uic/barcode/test/TicketLayoutTest.java b/src/org/uic/barcode/test/TicketLayoutTest.java
index 089c87d..3d053e7 100644
--- a/src/org/uic/barcode/test/TicketLayoutTest.java
+++ b/src/org/uic/barcode/test/TicketLayoutTest.java
@@ -6,6 +6,7 @@ import java.io.IOException;
import org.junit.Test;
import org.uic.barcode.staticFrame.UTLAYDataRecord;
+import org.uic.barcode.staticFrame.ticketLayoutBarcode.LayoutElement;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.TestUtils;
@@ -40,6 +41,32 @@ public class TicketLayoutTest {
assertEquals(tl1.toString(),tl2.toString());
+ compare(layout, tl2.getLayout());
+
+ }
+
+ public static void compare(TicketLayout layout1, TicketLayout layout2) {
+
+ assert(layout1.getLayoutStandard().equals(layout2.getLayoutStandard()));
+
+ for (LayoutElement e1: layout1.getElements() ) {
+
+ for (LayoutElement e2 :layout2.getElements()) {
+
+ boolean found = false;
+ if (e1.getLine() == e2.getLine() && e1.getColumn() == e2.getColumn()) {
+ found = true;
+ assert(e1.getText().equals(e2.getText()));
+ }
+ assert(found == true);
+
+ }
+
+ }
+
}
+
+
+
}
diff --git a/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java b/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java
index b1b6422..7b9ae1b 100644
--- a/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java
+++ b/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java
@@ -28,6 +28,21 @@ public class SimpleTestTicketLayout {
assert(layout1.getLayoutStandard().equals(layout2.getLayoutStandard()));
+ for (LayoutElement e1: layout1.getElements() ) {
+
+ for (LayoutElement e2 :layout2.getElements()) {
+
+ boolean found = false;
+ if (e1.getLine() == e2.getLine() && e1.getColumn() == e2.getColumn()) {
+ found = true;
+ assert(e1.getText().equals(e2.getText()));
+ }
+ assert(found == true);
+
+ }
+
+ }
+
}
}
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java b/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java
new file mode 100644
index 0000000..2cce30b
--- /dev/null
+++ b/src/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV3.java
@@ -0,0 +1,146 @@
+package org.uic.barcode.ticket.api.test.testtickets;
+
+import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.ControlData;
+import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv1.ParkingGroundData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+
+ public class ParkingTestTicketV3 {
+
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+
+
+ private static void populateTicket(UicRailTicketData ticket) {
+
+ ticket.setControlDetail(new ControlData());
+ populate(ticket.getControlDetail());
+
+
+ ticket.setIssuingDetail(new IssuingData());
+ populateIssuingData(ticket.getIssuingDetail());
+
+ TravelerData td = new TravelerData();
+ populateTravelerData(td);
+ ticket.setTravelerDetail(td);
+
+ SequenceOfDocumentData ds = new SequenceOfDocumentData();
+
+
+ //FipTicket
+ DocumentData do1 = new DocumentData();
+ addTicket(do1);
+ ds.add(do1);
+
+
+ ticket.setTransportDocument(ds);
+
+ SequenceOfExtensionData ed = new SequenceOfExtensionData();
+ populateExtensionSequence(ed);
+ ticket.setExtension(ed);
+
+ }
+
+
+ //issue date: 04-03-2021 12:30 UTC
+ private static void populateIssuingData(IssuingData issuingDetail) {
+ issuingDetail.setIssuingYear(2021L);
+ issuingDetail.setIssuingTime(750L);
+ issuingDetail.setIssuingDay(63L);
+ issuingDetail.setIssuerPNR("issuerTestPNR");
+ issuingDetail.setSpecimen(true);
+ issuingDetail.setSecurePaperTicket(false);
+ issuingDetail.setActivated(true);
+ issuingDetail.setIssuedOnLine(12L);
+ }
+
+ private static void addTicket(DocumentData dd) {
+
+ TicketDetailData tdd = new TicketDetailData();
+ ParkingGroundData ticket = new ParkingGroundData();
+ ticket.setFromParkingDate(01L);
+ ticket.setToParkingDate(01L);
+ ticket.setReferenceIA5("ACHE12345");
+ ticket.setLocation("Parking Frankfurt Main West");
+ ticket.setNumberPlate("AA-DE-12345");
+ ticket.setStationNum(8000001L);
+ ticket.setPrice(500L);
+ ticket.setSpecialInformation("outdoor parking");
+
+ tdd.setParkingGround(ticket);
+ dd.setTicket(tdd);
+ }
+
+
+
+ private static void populateTravelerData(TravelerData td) {
+ SequenceOfTravelerType trs = new SequenceOfTravelerType();
+ TravelerType tr = new TravelerType();
+ tr.setIdCard("12345");
+ tr.setFirstName("John");
+ tr.setSecondName("Dow");
+ tr.setTicketHolder(true);
+ SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
+ CustomerStatusType cst = new CustomerStatusType();
+ cst.setCustomerStatusDescr("employee");
+ ts.add(cst);
+ tr.setStatus(ts);
+ trs.add(tr);
+ td.setTraveler(trs);
+ }
+
+
+
+
+
+ private static void populateExtensionSequence(SequenceOfExtensionData ed) {
+ ExtensionData ed1 = new ExtensionData();
+ ed1.setExtensionId("1");
+ byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
+ ed1.setExtensionData(ba1);
+ ExtensionData ed2 = new ExtensionData();
+ ed2.setExtensionId("2");
+ byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
+ ed2.setExtensionData(ba2);
+ ed.add(ed1);
+ ed.add(ed2);
+ }
+
+ private static void populate(ControlData controlDetail) {
+ controlDetail.infoText = "cd";
+ controlDetail.setAgeCheckRequired(false);
+ controlDetail.setIdentificationByIdCard(false);
+ controlDetail.setIdentificationByPassportId(false);
+ controlDetail.setOnlineValidationRequired(false);
+ controlDetail.setPassportValidationRequired(false);
+ controlDetail.setReductionCardCheckRequired(false);
+ controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
+ controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
+ }
+
+
+ private static CardReferenceType populateCardRefrence() {
+ CardReferenceType cr = new CardReferenceType();
+ cr.setTrailingCardIdNum(100L);
+ return cr;
+ }
+
+
+
+ }
diff --git a/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java b/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java
new file mode 100644
index 0000000..24b73d1
--- /dev/null
+++ b/src/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV3.java
@@ -0,0 +1,145 @@
+package org.uic.barcode.ticket.api.test.testtickets;
+
+import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.ControlData;
+import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.DocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.ExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.IssuingData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData;
+import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerData;
+import org.uic.barcode.ticket.api.asn.omv1.TravelerType;
+import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData;
+import org.uic.barcode.ticket.api.asn.omv1.VoucherData;
+
+ public class VoucherTestTicketV3 {
+
+ public static UicRailTicketData getUicTestTicket() {
+ UicRailTicketData ticket = new UicRailTicketData();
+ populateTicket(ticket);
+ return ticket;
+ }
+
+
+
+ private static void populateTicket(UicRailTicketData ticket) {
+
+ ticket.setControlDetail(new ControlData());
+ populate(ticket.getControlDetail());
+
+
+ ticket.setIssuingDetail(new IssuingData());
+ populateIssuingData(ticket.getIssuingDetail());
+
+ TravelerData td = new TravelerData();
+ populateTravelerData(td);
+ ticket.setTravelerDetail(td);
+
+ SequenceOfDocumentData ds = new SequenceOfDocumentData();
+
+
+ //FipTicket
+ DocumentData do1 = new DocumentData();
+ addTicket(do1);
+ ds.add(do1);
+
+
+ ticket.setTransportDocument(ds);
+
+ SequenceOfExtensionData ed = new SequenceOfExtensionData();
+ populateExtensionSequence(ed);
+ ticket.setExtension(ed);
+
+ }
+
+
+ //issue date: 04-03-2021 12:30 UTC
+ private static void populateIssuingData(IssuingData issuingDetail) {
+ issuingDetail.setIssuingYear(2021L);
+ issuingDetail.setIssuingTime(750L);
+ issuingDetail.setIssuingDay(63L);
+ issuingDetail.setIssuerPNR("issuerTestPNR");
+ issuingDetail.setSpecimen(true);
+ issuingDetail.setSecurePaperTicket(false);
+ issuingDetail.setActivated(true);
+ issuingDetail.setIssuedOnLine(12L);
+ }
+
+ private static void addTicket(DocumentData dd) {
+
+ TicketDetailData tdd = new TicketDetailData();
+ VoucherData ticket = new VoucherData();
+ ticket.setInfoText("coffee voucher");
+ ticket.setValidFromYear(2022L);
+ ticket.setValidFromDay(01L);
+ ticket.setValidUntilYear(2022L);
+ ticket.setValidUntilDay(01L);
+ ticket.setReferenceIA5("ACHE12345");
+ ticket.setProductOwnerIA5("COFFEEMACHINE");
+ ticket.setValue(500L);
+ tdd.setVoucher(ticket);
+ dd.setTicket(tdd);
+ }
+
+
+
+ private static void populateTravelerData(TravelerData td) {
+ SequenceOfTravelerType trs = new SequenceOfTravelerType();
+ TravelerType tr = new TravelerType();
+ tr.setIdCard("12345");
+ tr.setFirstName("John");
+ tr.setSecondName("Dow");
+ tr.setTicketHolder(true);
+ SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType();
+ CustomerStatusType cst = new CustomerStatusType();
+ cst.setCustomerStatusDescr("employee");
+ ts.add(cst);
+ tr.setStatus(ts);
+ trs.add(tr);
+ td.setTraveler(trs);
+ }
+
+
+
+
+
+ private static void populateExtensionSequence(SequenceOfExtensionData ed) {
+ ExtensionData ed1 = new ExtensionData();
+ ed1.setExtensionId("1");
+ byte[] ba1 = { (byte) 0x82, (byte) 0xDA };
+ ed1.setExtensionData(ba1);
+ ExtensionData ed2 = new ExtensionData();
+ ed2.setExtensionId("2");
+ byte[] ba2 = { (byte) 0x83, (byte) 0xDA };
+ ed2.setExtensionData(ba2);
+ ed.add(ed1);
+ ed.add(ed2);
+ }
+
+ private static void populate(ControlData controlDetail) {
+ controlDetail.infoText = "cd";
+ controlDetail.setAgeCheckRequired(false);
+ controlDetail.setIdentificationByIdCard(false);
+ controlDetail.setIdentificationByPassportId(false);
+ controlDetail.setOnlineValidationRequired(false);
+ controlDetail.setPassportValidationRequired(false);
+ controlDetail.setReductionCardCheckRequired(false);
+ controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType());
+ controlDetail.getIdentificationByCardReference().add(populateCardRefrence());
+ }
+
+
+ private static CardReferenceType populateCardRefrence() {
+ CardReferenceType cr = new CardReferenceType();
+ cr.setTrailingCardIdNum(100L);
+ return cr;
+ }
+
+
+
+ }