use of java.math.BigDecimal in project camel by apache.
the class BindySimpleCsvMarshallDslTest method generateModel.
public List<Map<String, Object>> generateModel() {
Map<String, Object> modelObjects = new HashMap<String, Object>();
Order order = new Order();
order.setOrderNr(1);
order.setOrderType("BUY");
order.setClientNr("B2");
order.setFirstName("Keira");
order.setLastName("Knightley");
order.setAmount(new BigDecimal("450.45").setScale(2));
order.setInstrumentCode("ISIN");
order.setInstrumentNumber("XX23456789");
order.setInstrumentType("Share");
order.setCurrency("EUR");
Calendar calendar = new GregorianCalendar();
calendar.set(2009, 0, 14);
order.setOrderDate(calendar.getTime());
calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
// 4 hour shift
// 17-05-2010 23:21:59 by GMT+4
calendar.set(2010, 4, 17, 19, 21, 59);
order.setOrderDateTime(calendar.getTime());
modelObjects.put(order.getClass().getName(), order);
models.add(modelObjects);
return models;
}
use of java.math.BigDecimal in project camel by apache.
the class BindySimpleCsvMarshallTest method generateModel.
public List<Map<String, Object>> generateModel() {
Map<String, Object> modelObjects = new HashMap<String, Object>();
Order order = new Order();
order.setOrderNr(1);
order.setOrderType("BUY");
order.setClientNr("B2");
order.setFirstName("Keira");
order.setLastName("Knightley");
order.setAmount(new BigDecimal("400.25"));
order.setInstrumentCode("ISIN");
order.setInstrumentNumber("XX23456789");
order.setInstrumentType("Share");
order.setCurrency("EUR");
Calendar calendar = new GregorianCalendar();
calendar.set(2009, 0, 14);
order.setOrderDate(calendar.getTime());
calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
// 4 hour shift
// 17-02-2011 23:21:59 by GMT+4
calendar.set(2011, 1, 17, 19, 21, 59);
order.setOrderDateTime(calendar.getTime());
modelObjects.put(order.getClass().getName(), order);
models.add(modelObjects);
return models;
}
use of java.math.BigDecimal 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 java.math.BigDecimal in project camel by apache.
the class BindySimpleFixedLengthMarshallTest method generateModel.
public List<Map<String, Object>> generateModel() {
Map<String, Object> modelObjects = new HashMap<String, Object>();
Order order = new Order();
order.setOrderNr(10);
order.setOrderType("BUY");
order.setClientNr("A9");
order.setFirstName("Pauline");
order.setLastName("M");
order.setAmount(new BigDecimal("2500.45"));
order.setInstrumentCode("ISIN");
order.setInstrumentNumber("XD12345678");
order.setInstrumentType("Share");
order.setCurrency("USD");
Calendar calendar = new GregorianCalendar();
calendar.set(2009, 7, 1);
order.setOrderDate(calendar.getTime());
modelObjects.put(order.getClass().getName(), order);
models.add(modelObjects);
return models;
}
use of java.math.BigDecimal in project camel by apache.
the class BindyCsvClassTypeAsStringTest method testUnmarshallMessage.
@Test
public void testUnmarshallMessage() throws Exception {
String data = "1,B2,Keira,Knightley,ISIN,XX23456789,BUY,Share,400.25,EUR,14-01-2009,03-02-2010 23:21:59\r\n";
getMockEndpoint("mock:out").expectedMessageCount(1);
getMockEndpoint("mock:out").message(0).body().isInstanceOf(Order.class);
template.sendBody("direct:out", data);
assertMockEndpointsSatisfied();
Order order = getMockEndpoint("mock:out").getReceivedExchanges().get(0).getIn().getBody(Order.class);
assertEquals(1, order.getOrderNr());
assertEquals("BUY", order.getOrderType());
assertEquals("B2", order.getClientNr());
assertEquals("Keira", order.getFirstName());
assertEquals("Knightley", order.getLastName());
assertEquals(new BigDecimal("400.25"), order.getAmount());
assertEquals("ISIN", order.getInstrumentCode());
assertEquals("XX23456789", order.getInstrumentNumber());
assertEquals("Share", order.getInstrumentType());
assertEquals("EUR", order.getCurrency());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
// 4 hour shift
// 03-02-2010 23:21:59 by GMT+4
calendar.set(2010, 1, 3, 19, 21, 59);
calendar.set(Calendar.MILLISECOND, 0);
assertEquals(calendar.getTime(), order.getOrderDateTime());
}
Aggregations