Search in sources :

Example 16 with DirtiesContext

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"));
}
Also used : Order(org.apache.camel.dataformat.bindy.model.fix.tab.Order) Test(org.junit.Test) CommonBindyTest(org.apache.camel.dataformat.bindy.CommonBindyTest) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 17 with DirtiesContext

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();
}
Also used : BigDecimal(java.math.BigDecimal) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 18 with DirtiesContext

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();
}
Also used : FixedLengthRecord(org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord) BigDecimal(java.math.BigDecimal) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 19 with DirtiesContext

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);
}
Also used : Exchange(org.apache.camel.Exchange) FixedLengthRecord(org.apache.camel.dataformat.bindy.annotation.FixedLengthRecord) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Example 20 with DirtiesContext

use of org.springframework.test.annotation.DirtiesContext in project camel by apache.

the class BindyNumberTest method testMarshall.

// *************************************************************************
// TEST
// *************************************************************************
@Test
@DirtiesContext
public void testMarshall() throws Exception {
    DataModel rec = new DataModel();
    rec.field1 = new BigDecimal(123.45);
    rec.field2 = new BigDecimal(10.00);
    rec.field3 = new BigDecimal(10.00);
    rec.field4 = new Double(10.00);
    rec.field5 = new Double(10.00);
    mresult.expectedBodiesReceived("1234510.00   1010.00   10\r\n");
    mtemplate.sendBody(rec);
    mresult.assertIsSatisfied();
}
Also used : BigDecimal(java.math.BigDecimal) Test(org.junit.Test) DirtiesContext(org.springframework.test.annotation.DirtiesContext)

Aggregations

DirtiesContext (org.springframework.test.annotation.DirtiesContext)86 Test (org.junit.Test)83 Exchange (org.apache.camel.Exchange)21 Event (org.opennms.netmgt.xml.event.Event)19 Processor (org.apache.camel.Processor)11 DroolsCorrelationEngine (org.opennms.netmgt.correlation.drools.DroolsCorrelationEngine)10 IOException (java.io.IOException)9 NCSComponent (org.opennms.netmgt.model.ncs.NCSComponent)9 ProducerTemplate (org.apache.camel.ProducerTemplate)7 Ignore (org.junit.Ignore)7 SnmpValue (org.opennms.netmgt.snmp.SnmpValue)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 LinkedHashMap (java.util.LinkedHashMap)5 CommonBindyTest (org.apache.camel.dataformat.bindy.CommonBindyTest)5 FactHandle (org.kie.api.runtime.rule.FactHandle)5 SnmpValueFactory (org.opennms.netmgt.snmp.SnmpValueFactory)5 Message (org.apache.camel.Message)4 BigDecimal (java.math.BigDecimal)3 Registration (org.opennms.core.soa.Registration)3