use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method getNonUniqueIdsRequest.
@Override
public void getNonUniqueIdsRequest(@Observes @GetNonUniqueIdsRequestEvent EventMessage message) {
log.info(GOT_JMS_INSIDE_ACTIVITY_TO_GET + "Non Matching Ids of different Tables : ");
try {
log.debug(message.getJmsMessage().getText());
GetNonUniqueIdsRequest getNonUniqueIdsRequest = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), GetNonUniqueIdsRequest.class);
GetNonUniqueIdsResponse faCatchSummaryReportResponse = matchingIdsService.getMatchingIdsResponse(getNonUniqueIdsRequest.getActivityUniquinessLists());
String response = JAXBMarshaller.marshallJaxBObjectToString(faCatchSummaryReportResponse);
producer.sendResponseMessageToSender(message.getJmsMessage(), response);
} catch (ActivityModelMarshallException | JMSException | MessageException e) {
sendError(message, e);
}
}
use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEventServiceBean method deleteDuplicatedReportsFromXMLDocument.
private void deleteDuplicatedReportsFromXMLDocument(FLUXFAReportMessage repMsg) {
GetNonUniqueIdsRequest getNonUniqueIdsRequest = null;
try {
getNonUniqueIdsRequest = ActivityModuleRequestMapper.mapToGetNonUniqueIdRequestObject(collectAllIdsFromMessage(repMsg));
} catch (ActivityModelMarshallException e) {
log.error("[ERROR] Error while trying to get the unique ids from FaReportDocumentIdentifiers table...");
}
GetNonUniqueIdsResponse matchingIdsResponse = matchingIdsService.getMatchingIdsResponse(getNonUniqueIdsRequest.getActivityUniquinessLists());
List<ActivityUniquinessList> activityUniquinessLists = matchingIdsResponse.getActivityUniquinessLists();
final List<FAReportDocument> faReportDocuments = repMsg.getFAReportDocuments();
if (CollectionUtils.isNotEmpty(activityUniquinessLists)) {
for (ActivityUniquinessList unique : activityUniquinessLists) {
deleteBranchesThatMatchWithTheIdsList(unique.getIds(), faReportDocuments);
}
}
}
use of eu.europa.ec.fisheries.uvms.activity.model.schemas.GetNonUniqueIdsRequest 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));
}
Aggregations