use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class BindyComplexOneToManyKeyValuePairUnMarshallTest method testUnMarshallMessage.
@Test
@DirtiesContext
public void testUnMarshallMessage() throws Exception {
String message = "8=FIX 4.19=2034=135=049=INVMGR56=BRKR" + "1=BE.CHM.00111=CHM0001-0158=this is a camel - bindy test" + "22=448=BE000124567854=1" + "22=548=BE000987654354=2" + "22=648=BE000999999954=3" + "10=220";
String message2 = "8=FIX 4.19=2034=135=049=INVMGR56=BRKR" + "1=BE.CHM.00111=CHM0001-0158=this is a camel - bindy test10=220";
result.expectedMessageCount(2);
template.sendBody(message);
template.sendBody(message2);
result.assertIsSatisfied();
Order order1 = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
Order order2 = result.getReceivedExchanges().get(1).getIn().getBody(Order.class);
Assert.assertTrue(order1.toString().contains("BE.CHM.001, 11: CHM0001-01, 58: this is a camel - bindy test"));
Assert.assertTrue(order1.getSecurities().get(0).toString().contains("22: 4, 48: BE0001245678, 54: 1"));
Assert.assertTrue(order1.getSecurities().get(1).toString().contains("22: 5, 48: BE0009876543, 54: 2"));
Assert.assertTrue(order1.getSecurities().get(2).toString().contains("22: 6, 48: BE0009999999, 54: 3"));
Assert.assertTrue(order2.getHeader().toString().contains("FIX 4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
Assert.assertTrue(order2.getTrailer().toString().contains("10: 220"));
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class BindySimpleKeyValuePairTabUnmarshallTest method testUnMarshallMessage.
@Test
@DirtiesContext
public void testUnMarshallMessage() throws Exception {
result.expectedMessageCount(1);
result.assertIsSatisfied();
Order order = result.getReceivedExchanges().get(0).getIn().getBody(Order.class);
Assert.assertTrue(order.getHeader().toString().contains("FIX.4.1, 9: 20, 34: 1 , 35: 0, 49: INVMGR, 56: BRKR"));
Assert.assertTrue(order.toString().contains("BE.CHM.001, 11: CHM0001-01, 22: 4, 48: BE0001245678, 54: 1, 58: this is a camel - bindy test"));
Assert.assertTrue(order.getTrailer().toString().contains("10: 220"));
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class BindySimpleCsvIntegerMarshallTest method testMarshallMessage.
@Test
@DirtiesContext
public void testMarshallMessage() throws Exception {
MyOrder order = new MyOrder();
order.setInstrument("XX23456789");
order.setQuantity(12345678);
order.setPrice(new BigDecimal("400.25"));
result.expectedBodiesReceived("XX23456789,12345678,400.25\r\n");
template.sendBody(order);
result.assertIsSatisfied();
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class BindyImpliedTest method testMarshall.
// *************************************************************************
// TEST
// *************************************************************************
@Test
@DirtiesContext
public void testMarshall() throws Exception {
Record rec = new Record();
rec.setField1(123.45);
rec.setField2(67.89);
rec.setField3(11.24F);
rec.setField4(33.45F);
rec.setField5(new BigDecimal(60.52));
rec.setField6(new BigDecimal(70.62));
mresult.expectedBodiesReceived("1234567.89 112433.45 605270.62\r\n");
mtemplate.sendBody(rec);
mresult.assertIsSatisfied();
}
use of org.springframework.test.annotation.DirtiesContext in project camel by apache.
the class BindyImpliedTest method testUnMarshall.
@Test
@DirtiesContext
public void testUnMarshall() throws Exception {
utemplate.sendBody("1234567.89 112433.45 605270.62");
uresult.expectedMessageCount(1);
uresult.assertIsSatisfied();
// check the model
Exchange exc = uresult.getReceivedExchanges().get(0);
Record data = exc.getIn().getBody(Record.class);
Assert.assertEquals(123.45D, data.getField1(), 0D);
Assert.assertEquals(67.89D, data.getField2(), 0D);
Assert.assertEquals(11.24F, data.getField3(), 0.001);
Assert.assertEquals(33.45F, data.getField4(), 0.001);
Assert.assertEquals(60.52D, data.getField5().doubleValue(), 0.001);
Assert.assertEquals(70.62D, data.getField6().doubleValue(), 0.001);
}
Aggregations