use of java.util.GregorianCalendar in project camel by apache.
the class BindyFixedLengthDynamicFieldTest method testMarshallMessage.
@Test
public void testMarshallMessage() throws Exception {
BindyFixedLengthDynamicFieldTest.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.setInstrumentNumberLen(10);
order.setInstrumentNumber("XD12345678");
order.setInstrumentType("Share");
order.setCurrency("USD");
Calendar calendar = new GregorianCalendar();
calendar.set(2009, 7, 1);
order.setOrderDate(calendar.getTime());
marshallResult.expectedMessageCount(1);
marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { TEST_RECORD }));
template.sendBody(URI_DIRECT_MARSHALL, order);
marshallResult.assertIsSatisfied();
}
use of java.util.GregorianCalendar in project camel by apache.
the class BindySimpleFixedLengthHeaderFooterTest method testMarshallMessageWithIndirectHeaderAndFooterInput.
/**
* Verifies that header & footer provided via message headers are marshalled successfully
*/
@Test
public void testMarshallMessageWithIndirectHeaderAndFooterInput() throws Exception {
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, 0, 0, 0);
order.setOrderDate(calendar.getTime());
List<Map<String, Object>> input = new ArrayList<Map<String, Object>>();
Map<String, Object> bodyRow = new HashMap<String, Object>();
bodyRow.put(Order.class.getName(), order);
input.add(bodyRow);
Map<String, Object> headers = new HashMap<String, Object>();
headers.put(BindyFixedLengthDataFormat.CAMEL_BINDY_FIXED_LENGTH_HEADER, createHeaderRow());
headers.put(BindyFixedLengthDataFormat.CAMEL_BINDY_FIXED_LENGTH_FOOTER, createFooterRow());
marshallResult.reset();
marshallResult.expectedMessageCount(1);
StringBuffer buff = new StringBuffer();
buff.append(TEST_HEADER).append(TEST_RECORD).append(TEST_FOOTER);
marshallResult.expectedBodiesReceived(Arrays.asList(new String[] { buff.toString() }));
template.sendBodyAndHeaders(URI_DIRECT_MARSHALL, input, headers);
marshallResult.assertIsSatisfied();
}
use of java.util.GregorianCalendar in project camel by apache.
the class BindyPojoSimpleCsvMarshallTest method generateModel.
public Object generateModel() {
// just use the order POJO directly
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
// 16-02-2010 23:21:59 by GMT+4
calendar.set(2010, 1, 17, 19, 27, 59);
calendar.set(Calendar.MILLISECOND, 0);
order.setOrderDateTime(calendar.getTime());
return order;
}
use of java.util.GregorianCalendar 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.util.GregorianCalendar 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;
}
Aggregations