Skip to content

Commit

Permalink
add test for desadv with Setup_Place_No
Browse files Browse the repository at this point in the history
  • Loading branch information
metas-ts committed Jan 21, 2021
1 parent ce2cce3 commit 99b535c
Show file tree
Hide file tree
Showing 3 changed files with 210 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@

import de.metas.edi.esb.commons.Constants;
import de.metas.edi.esb.commons.processor.feedback.helper.EDIXmlFeedbackHelper;
import de.metas.edi.esb.jaxb.metasfresh.EDIExpDesadvType;
import de.metas.edi.esb.jaxb.metasfresh.ObjectFactory;
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Test;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import java.io.File;
import java.io.IOException;
import java.math.BigInteger;
import java.util.Properties;
Expand Down Expand Up @@ -101,4 +106,31 @@ void empty_desadv() throws Exception
+ " <EDI_ExportStatus>S</EDI_ExportStatus>\n"
+ "</EDI_Desadv_Feedback>");
}

@Test
void nonEmpty_desadv() throws Exception
{
// given
final var inputStr = EcosioDesadvRouteTest.class.getResourceAsStream("/de/metas/edi/esb/desadvexport/ecosio/DESADV_1023358_1611220554035.xml");
assertThat(inputStr).isNotNull();

final JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
final JAXBElement<EDIExpDesadvType> inputXml = (JAXBElement) unmarshaller.unmarshal(inputStr);

// when
template.sendBodyAndHeader(
EcosioDesadvRoute.EP_EDI_METASFRESH_XML_DESADV_CONSUMER /*endpoint-URI*/,
inputXml.getValue() /*actual inputStr*/,

EDIXmlFeedbackHelper.HEADER_OriginalXMLBody, inputXml.getValue() // this header is otherwise set by the preceeding generic route
);

// then
fileOutputEndpoint.expectedMessageCount(1);
fileOutputEndpoint.assertIsSatisfied(1000);
final var desadvOutput = fileOutputEndpoint.getExchanges().get(0).getIn().getBody(String.class);
assertThat(desadvOutput)
.isXmlEqualToContentOf(new File("./src/test/resources/de/metas/edi/esb/desadvexport/ecosio/DESADV_1023358_1611220554035_expected_output.xml"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ #%L
~ de-metas-camel-edi
~ %%
~ Copyright (C) 2021 metas GmbH
~ %%
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as
~ published by the Free Software Foundation, either version 2 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public
~ License along with this program. If not, see
~ <http://www.gnu.org/licenses/gpl-2.0.html>.
~ #L%
-->

<EDI_Exp_Desadv AD_Client_Value="InterCheese AG" ReplicationMode="1" ReplicationType="M" Version="*" SequenceNo="1017175" TrxName="">
<C_BPartner_ID>
<EdiRecipientGLN>1234567890123</EdiRecipientGLN>
<Name>BuyerName</Name>
<Value>12345</Value>
</C_BPartner_ID>
<C_BPartner_Location_ID>
<GLN>1234567890124</GLN>
<Name>BuyerName EDI-GLN</Name>
</C_BPartner_Location_ID>
<DateOrdered>2021-01-19+01:00</DateOrdered>
<DocumentNo>9999999</DocumentNo>
<EDI_Desadv_ID>1016956</EDI_Desadv_ID>
<EDI_ExportStatus>D</EDI_ExportStatus>
<MovementDate>2021-01-20+01:00</MovementDate>
<POReference>6666666666</POReference>
<EDI_Exp_DesadvLine>
<C_UOM_ID>
<Name>Kollo</Name>
<UOMSymbol>Kollo</UOMSymbol>
<X12DE355>COLI</X12DE355>
</C_UOM_ID>
<EDI_Exp_DesadvLine_Pack>
<IPA_SSCC18>123456789012345678</IPA_SSCC18>
<LotNumber>19</LotNumber>
<QtyCU>1</QtyCU>
<QtyCUsPerLU>1</QtyCUsPerLU>
<QtyTU>1</QtyTU>
<BestBeforeDate>2021-03-10+01:00</BestBeforeDate>
<M_HU_PackagingCode_LU_Text>ISO1</M_HU_PackagingCode_LU_Text>
<M_HU_PackagingCode_TU_Text>COLI</M_HU_PackagingCode_TU_Text>
<C_UOM_ID>
<Name>Kollo</Name>
<UOMSymbol>Kollo</UOMSymbol>
<X12DE355>COLI</X12DE355>
</C_UOM_ID>
</EDI_Exp_DesadvLine_Pack>
<Line>100</Line>
<M_Product_ID>
<Name>ProductName</Name>
<Value>123457</Value>
<Volume>0</Volume>
<Weight>5.00</Weight>
</M_Product_ID>
<ProductDescription>ProductDescription</ProductDescription>
<ProductNo>ProductNo</ProductNo>
<QtyEntered>1.00</QtyEntered>
<IsSubsequentDeliveryPlanned>N</IsSubsequentDeliveryPlanned>
<GTIN>1234567890125</GTIN>
<PriceActual>19.900</PriceActual>
<EanCom_Invoice_UOM>KGM</EanCom_Invoice_UOM>
<InvoicableQtyBasedOn>CatchWeight</InvoicableQtyBasedOn>
<OrderPOReference>6666666666</OrderPOReference>
<QtyDeliveredInInvoiceUOM>5.16</QtyDeliveredInInvoiceUOM>
<QtyDeliveredInUOM>1</QtyDeliveredInUOM>
<OrderLine>100</OrderLine>
</EDI_Exp_DesadvLine>
<Bill_Location_ID>
<GLN>1234567890126</GLN>
<Name>InvoiceTo-Name EDI-GLN</Name>
</Bill_Location_ID>
<C_Currency_ID>
<CurSymbol>CHF</CurSymbol>
<ISO_4217Numeric>756</ISO_4217Numeric>
<ISO_Code>CHF</ISO_Code>
</C_Currency_ID>
<HandOver_Location_ID>
<GLN>1234567890127</GLN>
<Name>HandOver-Name</Name>
</HandOver_Location_ID>
<DropShip_Location_ID>
<GLN>1234567890128</GLN>
<Name>DropShip-Name</Name>
<Setup_Place_No>1234</Setup_Place_No>
</DropShip_Location_ID>
<InvoicableQtyBasedOn>CatchWeight</InvoicableQtyBasedOn>
</EDI_Exp_Desadv>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EDI_Exp_Desadv AD_Client_Value="InterCheese AG" ReplicationMode="1" ReplicationType="M" Version="*" SequenceNo="1017175" TrxName="">
<C_BPartner_ID>
<EdiRecipientGLN>1234567890123</EdiRecipientGLN>
<Name>BuyerName</Name>
<Value>12345</Value>
</C_BPartner_ID>
<C_BPartner_Location_ID>
<GLN>1234567890124</GLN>
<Name>BuyerName EDI-GLN</Name>
</C_BPartner_Location_ID>
<DateOrdered>2021-01-19+01:00</DateOrdered>
<DocumentNo>9999999</DocumentNo>
<EDI_Desadv_ID>1016956</EDI_Desadv_ID>
<EDI_ExportStatus>D</EDI_ExportStatus>
<MovementDate>2021-01-20+01:00</MovementDate>
<POReference>6666666666</POReference>
<EDI_Exp_DesadvLine>
<C_UOM_ID>
<Name>Kollo</Name>
<UOMSymbol>Kollo</UOMSymbol>
<X12DE355>COLI</X12DE355>
</C_UOM_ID>
<EDI_Exp_DesadvLine_Pack>
<IPA_SSCC18>123456789012345678</IPA_SSCC18>
<LotNumber>19</LotNumber>
<QtyCU>1</QtyCU>
<QtyCUsPerLU>1</QtyCUsPerLU>
<QtyTU>1</QtyTU>
<BestBeforeDate>2021-03-10+01:00</BestBeforeDate>
<M_HU_PackagingCode_LU_Text>ISO1</M_HU_PackagingCode_LU_Text>
<M_HU_PackagingCode_TU_Text>COLI</M_HU_PackagingCode_TU_Text>
<C_UOM_ID>
<Name>Kollo</Name>
<UOMSymbol>Kollo</UOMSymbol>
<X12DE355>COLI</X12DE355>
</C_UOM_ID>
</EDI_Exp_DesadvLine_Pack>
<Line>100</Line>
<M_Product_ID>
<Name>ProductName</Name>
<Value>123457</Value>
<Volume>0</Volume>
<Weight>5.00</Weight>
</M_Product_ID>
<ProductDescription>ProductDescription</ProductDescription>
<ProductNo>ProductNo</ProductNo>
<QtyEntered>1.00</QtyEntered>
<IsSubsequentDeliveryPlanned>N</IsSubsequentDeliveryPlanned>
<GTIN>1234567890125</GTIN>
<PriceActual>19.900</PriceActual>
<EanCom_Invoice_UOM>KGM</EanCom_Invoice_UOM>
<InvoicableQtyBasedOn>CatchWeight</InvoicableQtyBasedOn>
<OrderPOReference>6666666666</OrderPOReference>
<QtyDeliveredInInvoiceUOM>5.16</QtyDeliveredInInvoiceUOM>
<QtyDeliveredInUOM>1</QtyDeliveredInUOM>
<OrderLine>100</OrderLine>
</EDI_Exp_DesadvLine>
<Bill_Location_ID>
<GLN>1234567890126</GLN>
<Name>InvoiceTo-Name EDI-GLN</Name>
</Bill_Location_ID>
<C_Currency_ID>
<CurSymbol>CHF</CurSymbol>
<ISO_4217Numeric>756</ISO_4217Numeric>
<ISO_Code>CHF</ISO_Code>
</C_Currency_ID>
<HandOver_Location_ID>
<GLN>1234567890127</GLN>
<Name>HandOver-Name</Name>
</HandOver_Location_ID>
<DropShip_Location_ID>
<GLN>1234567890128</GLN>
<Name>DropShip-Name</Name>
<Setup_Place_No>1234</Setup_Place_No>
</DropShip_Location_ID>
<InvoicableQtyBasedOn>CatchWeight</InvoicableQtyBasedOn>
</EDI_Exp_Desadv>

0 comments on commit 99b535c

Please sign in to comment.