use of org.apache.activemq.artemis.jms.client.ActiveMQTextMessage in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBeanTest method setUp.
@Before
@SneakyThrows
public void setUp() {
nonUniqueIdsMessage = new ActiveMQTextMessage(session);
Whitebox.setInternalState(nonUniqueIdsMessage, "text", new SimpleString(getStrRequest1()));
Whitebox.setInternalState(nonUniqueIdsMessage, "jmsCorrelationID", "SomeCorrId");
nonUniqueIdsMessageEventMessage = new EventMessage(nonUniqueIdsMessage);
faAndTripIdsFromTripIdsMessage = new ActiveMQTextMessage(session);
Whitebox.setInternalState(faAndTripIdsFromTripIdsMessage, "text", new SimpleString(getStrRequest2()));
Whitebox.setInternalState(faAndTripIdsFromTripIdsMessage, "jmsCorrelationID", "SomeCorrId");
faAndTripIdsFromTripIdsEventMessage = new EventMessage(faAndTripIdsFromTripIdsMessage);
getNonUniqueIdsResponse = JAXBMarshaller.unmarshallTextMessage(getResponseStr1(), GetNonUniqueIdsResponse.class);
getFishingActivitiesForTripResponse = JAXBMarshaller.unmarshallTextMessage(getResponseStr2(), GetFishingActivitiesForTripResponse.class);
}
use of org.apache.activemq.artemis.jms.client.ActiveMQTextMessage in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityMessageConsumerBeanTest method testOnMessageMethod.
@Test
@SneakyThrows
public void testOnMessageMethod() {
mockStatic(MappedDiagnosticContext.class);
PowerMockito.doNothing().when(MappedDiagnosticContext.class, "addMessagePropertiesToThreadMappedDiagnosticContext", Mockito.any(TextMessage.class));
for (ActivityModuleMethod moduleMethod : ActivityModuleMethod.values()) {
GetNonUniqueIdsRequest request = new GetNonUniqueIdsRequest();
request.setMethod(moduleMethod);
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(mapToSubscriptionRequest, times(1)).fire(any(EventMessage.class));
verify(receiveFishingActivityEvent, times(2)).fire(any(EventMessage.class));
verify(getFishingTripListEvent, times(1)).fire(any(EventMessage.class));
verify(getFACatchSummaryReportEvent, times(1)).fire(any(EventMessage.class));
verify(getNonUniqueIdsRequest, times(1)).fire(any(EventMessage.class));
}
use of org.apache.activemq.artemis.jms.client.ActiveMQTextMessage 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