use of org.talend.esb.sam._2011._03.common.MessageInfoType in project tesb-rt-se by Talend.
the class EventTypeMapperTest method testEmpty.
/**
* Test with empty eventType parts to check for Nullpointer exceptions
*/
@Test
public void testEmpty() {
EventType eventType = new EventType();
EventTypeMapper.map(eventType);
eventType.setCustomInfo(new CustomInfoType());
EventTypeMapper.map(eventType);
eventType.setMessageInfo(new MessageInfoType());
EventTypeMapper.map(eventType);
eventType.setOriginator(new OriginatorType());
EventTypeMapper.map(eventType);
}
use of org.talend.esb.sam._2011._03.common.MessageInfoType in project tesb-rt-se by Talend.
the class MonitoringServiceFullTest method testSendEvents.
// @Before
// public void setUp() throws Exception {
// executeSqlScript("create.sql", true);
// }
@Test
public void testSendEvents() throws PutEventsFault, MalformedURLException, URISyntaxException {
Client client = ClientProxy.getClient(monitoringService);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy clientConfig = new HTTPClientPolicy();
clientConfig.setReceiveTimeout(100000);
conduit.setClient(clientConfig);
jdbcTemplate.update("delete from EVENTS");
List<EventType> events = new ArrayList<EventType>();
EventType eventType = new EventType();
eventType.setEventType(EventEnumType.REQ_OUT);
URL messageContentFile = this.getClass().getResource("/testmessage.xml").toURI().toURL();
eventType.setContent(new DataHandler(messageContentFile));
CustomInfoType ciType = new CustomInfoType();
CustomInfoType.Item prop1 = new CustomInfoType.Item();
prop1.setKey("mykey1");
prop1.setValue("myValue1");
ciType.getItem().add(prop1);
CustomInfoType.Item prop2 = new CustomInfoType.Item();
prop2.setKey("mykey2");
prop2.setValue("myValue2");
ciType.getItem().add(prop2);
eventType.setCustomInfo(ciType);
MessageInfoType mit = new MessageInfoType();
mit.setFlowId("uuid");
eventType.setMessageInfo(mit);
events.add(eventType);
String result = monitoringService.putEvents(events);
Assert.assertEquals("success", result);
long id = jdbcTemplate.queryForObject("select id from EVENTS", Long.class);
Event readEvent = eventRepository.readEvent(id);
Assert.assertEquals(EventTypeEnum.REQ_OUT, readEvent.getEventType());
Map<String, String> customInfo = readEvent.getCustomInfo();
Assert.assertEquals("myValue1", customInfo.get("mykey1"));
Assert.assertEquals("myValue2", customInfo.get("mykey2"));
}
use of org.talend.esb.sam._2011._03.common.MessageInfoType in project tesb-rt-se by Talend.
the class EventMapper method map.
/**
* convert Event bean to EventType manually.
*
* @param event the event
* @return the event type
*/
public static EventType map(Event event) {
EventType eventType = new EventType();
eventType.setTimestamp(Converter.convertDate(event.getTimestamp()));
eventType.setEventType(convertEventType(event.getEventType()));
OriginatorType origType = mapOriginator(event.getOriginator());
eventType.setOriginator(origType);
MessageInfoType miType = mapMessageInfo(event.getMessageInfo());
eventType.setMessageInfo(miType);
eventType.setCustomInfo(convertCustomInfo(event.getCustomInfo()));
eventType.setContentCut(event.isContentCut());
if (event.getContent() != null) {
DataHandler datHandler = getDataHandlerForString(event);
eventType.setContent(datHandler);
}
return eventType;
}
use of org.talend.esb.sam._2011._03.common.MessageInfoType in project tesb-rt-se by Talend.
the class EventMapper method mapMessageInfo.
/**
* Mapping message info.
*
* @param messageInfo the message info
* @return the message info type
*/
private static MessageInfoType mapMessageInfo(MessageInfo messageInfo) {
if (messageInfo == null) {
return null;
}
MessageInfoType miType = new MessageInfoType();
miType.setMessageId(messageInfo.getMessageId());
miType.setFlowId(messageInfo.getFlowId());
miType.setPorttype(convertString(messageInfo.getPortType()));
miType.setOperationName(messageInfo.getOperationName());
miType.setTransport(messageInfo.getTransportType());
return miType;
}
Aggregations