use of eu.europa.ec.fisheries.schema.exchange.module.v1.ReceiveSalesReportRequest in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method receiveSalesReport.
@Override
public void receiveSalesReport(@Observes @ReceiveSalesReportEvent ExchangeMessageEvent event) {
try {
ReceiveSalesReportRequest request = JAXBMarshaller.unmarshallTextMessage(event.getJmsMessage(), ReceiveSalesReportRequest.class);
log.info("Receive sales report in Exchange module:{}", request);
String report = request.getReport();
PluginType plugin = request.getPluginType();
String sender = request.getSenderOrReceiver();
String messageGuid = request.getMessageGuid();
ExchangeLogType log = exchangeLog.log(request, LogType.RECEIVE_SALES_REPORT, ExchangeLogStatusTypeType.ISSUED, TypeRefType.SALES_REPORT, report, true);
forwardToRules(RulesModuleRequestMapper.createReceiveSalesReportRequest(report, messageGuid, plugin.name(), log.getGuid(), sender, request.getOnValue()));
} catch (ExchangeModelMarshallException e) {
try {
String errorMessage = "Couldn't map to SetSalesReportRequest when processing sales report from plugin. The event was " + event.getJmsMessage().getText();
firePluginFault(event, errorMessage, e);
} catch (JMSException e1) {
firePluginFault(event, "Couldn't map to SetSalesReportRequest when processing sales report from plugin.", e);
}
} catch (ExchangeLogException e) {
firePluginFault(event, "Could not log the incoming sales report.", e);
} catch (RulesModelMarshallException e) {
firePluginFault(event, "Could not create a request for the Rules module for an incoming sales report.", e);
}
}
use of eu.europa.ec.fisheries.schema.exchange.module.v1.ReceiveSalesReportRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityMessageConsumerBeanTest method testThrowing.
@Test
@SneakyThrows
public void testThrowing() {
mockStatic(MappedDiagnosticContext.class);
PowerMockito.doNothing().when(MappedDiagnosticContext.class, "addMessagePropertiesToThreadMappedDiagnosticContext", Mockito.any(TextMessage.class));
ReceiveSalesReportRequest request = new ReceiveSalesReportRequest();
request.setMethod(ExchangeModuleMethod.RECEIVE_SALES_REPORT);
ActiveMQTextMessage textMessage = new ActiveMQTextMessage(session);
final String strReq = JAXBMarshaller.marshallJaxBObjectToString(request);
Whitebox.setInternalState(textMessage, "text", new SimpleString(strReq));
consumer.onMessage(textMessage);
PowerMockito.verifyStatic();
MappedDiagnosticContext.addMessagePropertiesToThreadMappedDiagnosticContext(textMessage);
verify(errorEvent, times(1)).fire(any(EventMessage.class));
}
Aggregations