List of usage examples for javax.jms ObjectMessage getObject
Serializable getObject() throws JMSException;
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.PublicLightingResumeScheduleRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing public lighting resume schedule request message"); String correlationUid = null; String domain = null;// w w w .jav a 2s . c om String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; try { correlationUid = message.getJMSCorrelationID(); domain = message.getStringProperty(Constants.DOMAIN); domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); ipAddress = message.getStringProperty(Constants.IP_ADDRESS); retryCount = message.getIntProperty(Constants.RETRY_COUNT); isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false; } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("domain: {}", domain); LOGGER.debug("domainVersion: {}", domainVersion); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("ipAddress: {}", ipAddress); return; } try { final ResumeScheduleMessageDataContainerDto resumeScheduleMessageDataContainer = (ResumeScheduleMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final ResumeScheduleDeviceRequest deviceRequest = new ResumeScheduleDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, resumeScheduleMessageDataContainer, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.resumeSchedule(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.CommonSetEventNotificationsRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing common set event notifications request message"); String correlationUid = null; String domain = null;/*from w ww. j a v a 2s. c o m*/ String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; int retryCount = 0; boolean isScheduled = false; try { correlationUid = message.getJMSCorrelationID(); domain = message.getStringProperty(Constants.DOMAIN); domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); ipAddress = message.getStringProperty(Constants.IP_ADDRESS); retryCount = message.getIntProperty(Constants.RETRY_COUNT); isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false; } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("domain: {}", domain); LOGGER.debug("domainVersion: {}", domainVersion); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("ipAddress: {}", ipAddress); return; } try { final EventNotificationMessageDataContainerDto eventNotificationMessageDataContainer = (EventNotificationMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final SetEventNotificationsDeviceRequest deviceRequest = new SetEventNotificationsDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, eventNotificationMessageDataContainer, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.setEventNotifications(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.PublicLightingGetPowerUsageHistoryRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing public lighting get power usage history request message"); String correlationUid = null; String domain = null;/*from w ww.j a v a2 s. c o m*/ String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; Boolean isScheduled = null; int retryCount = 0; try { correlationUid = message.getJMSCorrelationID(); domain = message.getStringProperty(Constants.DOMAIN); domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); ipAddress = message.getStringProperty(Constants.IP_ADDRESS); isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED); retryCount = message.getIntProperty(Constants.RETRY_COUNT); } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("domain: {}", domain); LOGGER.debug("domainVersion: {}", domainVersion); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("ipAddress: {}", ipAddress); LOGGER.debug("scheduled: {}", isScheduled); return; } try { final PowerUsageHistoryMessageDataContainerDto powerUsageHistoryMessageDataContainerDto = (PowerUsageHistoryMessageDataContainerDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final GetPowerUsageHistoryDeviceRequest deviceRequest = new GetPowerUsageHistoryDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, powerUsageHistoryMessageDataContainerDto, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.getPowerUsageHistory(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.processors.CommonUpdateDeviceSslCertificationRequestMessageProcessor.java
@Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing common update device ssl certification message"); String correlationUid = null; String domain = null;/*from www . j av a 2 s .com*/ String domainVersion = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String ipAddress = null; Boolean isScheduled = null; int retryCount = 0; try { correlationUid = message.getJMSCorrelationID(); domain = message.getStringProperty(Constants.DOMAIN); domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); ipAddress = message.getStringProperty(Constants.IP_ADDRESS); isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false; retryCount = message.getIntProperty(Constants.RETRY_COUNT); } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("domain: {}", domain); LOGGER.debug("domainVersion: {}", domainVersion); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("ipAddress: {}", ipAddress); LOGGER.debug("scheduled: {}", isScheduled); return; } try { final com.alliander.osgp.dto.valueobjects.CertificationDto certification = (com.alliander.osgp.dto.valueobjects.CertificationDto) message .getObject(); LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion); final UpdateDeviceSslCertificationDeviceRequest deviceRequest = new UpdateDeviceSslCertificationDeviceRequest( organisationIdentification, deviceIdentification, correlationUid, certification, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled); this.deviceService.updateDeviceSslCertification(deviceRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, domain, domainVersion, messageType, retryCount); } }
From source file:com.alliander.osgp.acceptancetests.adhocmanagement.GetStatusSteps.java
@DomainStep("a get status response message for domainType (.*) with correlationId (.*), deviceId (.*), qresult (.*), qdescription (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*) is found in the queue (.*)") public void givenAGetStatusResponseMessageIsFoundInQueue(final String domainType, final String correlationId, final String deviceId, final String qresult, final String qdescription, final String preferredLinkType, final String actualLinkType, final String lightType, final String eventNotifications, final String index, final String on, final String dimValue, final Boolean isFound) { LOGGER.info(// w w w .ja va 2 s . c o m "GIVEN: \"a get status response message for domainType {} with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".", domainType, correlationId, deviceId, qresult, qdescription, isFound); if (isFound) { final ObjectMessage messageMock = mock(ObjectMessage.class); try { when(messageMock.getJMSCorrelationID()).thenReturn(correlationId); when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID); when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId); final LinkType prefLinkType = StringUtils.isBlank(preferredLinkType) ? null : Enum.valueOf(LinkType.class, preferredLinkType); final LinkType actLinkType = StringUtils.isBlank(actualLinkType) ? null : Enum.valueOf(LinkType.class, actualLinkType); final LightType lt = StringUtils.isBlank(lightType) ? null : Enum.valueOf(LightType.class, lightType); // EventNotificationTypes int mask = 0; if (StringUtils.isNotBlank(eventNotifications)) { for (final String event : eventNotifications.split(",")) { mask += (Enum.valueOf(EventNotificationType.class, event)).getValue(); } } final ResponseMessage message; final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult); Serializable dataObject = null; if (result.equals(ResponseMessageResultType.NOT_OK)) { dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.UNKNOWN, new ValidationException()); message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId, result, (OsgpException) dataObject, dataObject); } else { if (domainType.equals(DomainType.PUBLIC_LIGHTING.name())) { // DomainType.PUBLIC_LIGHTING dataObject = new DeviceStatus(null, prefLinkType, actLinkType, lt, mask); } else { // DomainType.TARIFF_SWITCHING dataObject = new DeviceStatusMapped(null, null, prefLinkType, actLinkType, lt, mask); } message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId, result, null, dataObject); } when(messageMock.getObject()).thenReturn(message); } catch (final JMSException e) { e.printStackTrace(); } when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))) .thenReturn(messageMock); } else { when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(null); } }
From source file:com.alliander.osgp.acceptancetests.devicemonitoring.GetPowerUsageHistorySteps.java
@DomainStep("a get power usage history response message with correlationId (.*), deviceId (.*), qresult (.*), qdescription (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*) is found in the queue (.*)") public void givenAGetPowerUsageHistoryResponseMessageIsFoundInQueue(final String correlationId, final String deviceId, final String qresult, final String qdescription, final String fromDate, final String untilDate, final String recordTime, final String meterType, final String totalConsumedEnergy, final String actualConsumedPower, final String psldDataTotalLightHours, final String actualCurrent1, final String actualCurrent2, final String actualCurrent3, final String actualPower1, final String actualPower2, final String actualPower3, final String averagePowerFactor1, final String averagePowerFactor2, final String averagePowerFactor3, final String relayData1Index, final String relayData1LightingMinutes, final String relayData2Index, final String relayData2LightingMinutes, final Boolean isFound) throws ParseException { LOGGER.info(// ww w. j a v a 2s .c om "GIVEN: \"a get power usage history response message with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".", correlationId, deviceId, qresult, qdescription, isFound); if (isFound) { final ObjectMessage messageMock = mock(ObjectMessage.class); try { when(messageMock.getJMSCorrelationID()).thenReturn(correlationId); when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID); when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId); final MeterType metertype = StringUtils.isBlank(meterType) ? null : Enum.valueOf(MeterType.class, meterType); DateTime dateTime = null; if (!recordTime.equals("")) { final Date date = new SimpleDateFormat("yyyyMMddHHmmss").parse(recordTime); dateTime = new DateTime(date); } final com.alliander.osgp.domain.core.valueobjects.PowerUsageData powerUsageData = new com.alliander.osgp.domain.core.valueobjects.PowerUsageData( dateTime, metertype, Long.parseLong(totalConsumedEnergy), Long.parseLong(actualConsumedPower)); final List<com.alliander.osgp.domain.core.valueobjects.RelayData> list = new ArrayList<>(); list.add(new com.alliander.osgp.domain.core.valueobjects.RelayData(Integer.valueOf(relayData1Index), Integer.valueOf(relayData1LightingMinutes))); list.add(new com.alliander.osgp.domain.core.valueobjects.RelayData(Integer.valueOf(relayData2Index), Integer.valueOf(relayData2LightingMinutes))); final com.alliander.osgp.domain.core.valueobjects.SsldData ssldData = new com.alliander.osgp.domain.core.valueobjects.SsldData( Integer.valueOf(actualCurrent1), Integer.valueOf(actualCurrent2), Integer.valueOf(actualCurrent3), Integer.valueOf(actualPower1), Integer.valueOf(actualPower2), Integer.valueOf(actualPower3), Integer.valueOf(averagePowerFactor1), Integer.valueOf(averagePowerFactor2), Integer.valueOf(averagePowerFactor3), list); powerUsageData.setSsldData(ssldData); final List<com.alliander.osgp.domain.core.valueobjects.PowerUsageData> powerUsageDatas = new ArrayList<com.alliander.osgp.domain.core.valueobjects.PowerUsageData>(); powerUsageDatas.add(powerUsageData); final com.alliander.osgp.domain.core.valueobjects.PowerUsageHistoryResponse powerUsageHistoryResponse = new com.alliander.osgp.domain.core.valueobjects.PowerUsageHistoryResponse( powerUsageDatas); final ResponseMessage message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId, ResponseMessageResultType.valueOf(qresult), null, powerUsageHistoryResponse); when(messageMock.getObject()).thenReturn(message); } catch (final JMSException e) { LOGGER.error("JMSException", e); } when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))) .thenReturn(messageMock); } else { when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(null); } }
From source file:com.alliander.osgp.acceptancetests.configurationmanagement.GetConfigurationDataSteps.java
@DomainStep("a get configuration response message with correlationId (.*), deviceId (.*), qresult (.*), qdescription (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*) is found in the queue (.*)") public void givenAGetConfigurationResponseMessageIsFoundInQueue(final String correlationId, final String deviceId, final String qresult, final String qdescription, final String lightType, final String dcLights, final String dcMap, final String rcType, final String rcMap, final String shortInterval, final String preferredLinkType, final String meterType, final String longInterval, final String longIntervalType, final Boolean isFound) { LOGGER.info(/* ww w . j av a 2 s . c o m*/ "GIVEN: \"a get configuration response message with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".", correlationId, deviceId, qresult, qdescription, isFound); if (isFound) { final ObjectMessage messageMock = mock(ObjectMessage.class); try { when(messageMock.getJMSCorrelationID()).thenReturn(correlationId); when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID); when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId); final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult); Serializable dataObject = null; OsgpException exception = null; if (result.equals(ResponseMessageResultType.NOT_OK)) { dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.UNKNOWN, new ValidationException()); exception = (OsgpException) dataObject; } else { final com.alliander.osgp.domain.core.valueobjects.LightType lighttype = StringUtils .isBlank(lightType) ? null : Enum.valueOf(com.alliander.osgp.domain.core.valueobjects.LightType.class, lightType); final Map<Integer, Integer> indexAddressMap = new HashMap<Integer, Integer>(); final com.alliander.osgp.domain.core.valueobjects.DaliConfiguration daliconfiguration = new com.alliander.osgp.domain.core.valueobjects.DaliConfiguration( 22, indexAddressMap); final List<com.alliander.osgp.domain.core.valueobjects.RelayMap> relayMap = new ArrayList<>(); final com.alliander.osgp.domain.core.valueobjects.RelayConfiguration relayConf = new com.alliander.osgp.domain.core.valueobjects.RelayConfiguration( relayMap); final MeterType metertype = StringUtils.isBlank(meterType) ? null : Enum.valueOf(MeterType.class, meterType); final LongTermIntervalType longtermintervalType = StringUtils.isBlank(longIntervalType) ? null : Enum.valueOf(LongTermIntervalType.class, longIntervalType); final Integer shortinterval = StringUtils.isBlank(shortInterval) ? 0 : Integer.valueOf(shortInterval); final Integer longinterval = StringUtils.isBlank(longInterval) ? 0 : Integer.valueOf(longInterval); // construct new Configuration dataObject = new com.alliander.osgp.domain.core.valueobjects.Configuration(lighttype, daliconfiguration, relayConf, shortinterval, LinkType.ETHERNET, metertype, longinterval, longtermintervalType); } final ResponseMessage message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId, result, exception, dataObject); when(messageMock.getObject()).thenReturn(message); } catch (final JMSException e) { e.printStackTrace(); } when(this.commonResponsesJmsTemplateMock.receiveSelected(any(String.class))).thenReturn(messageMock); } else { when(this.commonResponsesJmsTemplateMock.receiveSelected(any(String.class))).thenReturn(null); } }
From source file:com.alliander.osgp.acceptancetests.devicemonitoring.GetActualPowerUsageSteps.java
@DomainStep("a get actual power usage response message with correlationId (.*), deviceId (.*), qresult (.*), qdescription (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*), (.*) is found in the queue (.*)") public void givenAGetActualPowerUsageResponseMessageIsFoundInQueue(final String correlationId, final String deviceId, final String qresult, final String qdescription, final String recordTime, final String meterType, final String totalConsumedEnergy, final String actualConsumedPower, final String psldDataTotalLightHours, final String actualCurrent1, final String actualCurrent2, final String actualCurrent3, final String actualPower1, final String actualPower2, final String actualPower3, final String averagePowerFactor1, final String averagePowerFactor2, final String averagePowerFactor3, final String relayData1Index, final String relayData1LightingMinutes, final String relayData2Index, final String relayData2LightingMinutes, final Boolean isFound) { LOGGER.info(//from w w w . j a va 2s. c om "GIVEN: \"a get actual power usage response message with correlationId {}, deviceId {}, qresult {} and qdescription {} is found {}\".", correlationId, deviceId, qresult, qdescription, isFound); if (isFound) { final ObjectMessage messageMock = mock(ObjectMessage.class); try { when(messageMock.getJMSCorrelationID()).thenReturn(correlationId); when(messageMock.getStringProperty("OrganisationIdentification")).thenReturn(ORGANISATION_ID); when(messageMock.getStringProperty("DeviceIdentification")).thenReturn(deviceId); final ResponseMessageResultType result = ResponseMessageResultType.valueOf(qresult); Serializable dataObject = null; OsgpException exception = null; if (result.equals(ResponseMessageResultType.NOT_OK)) { dataObject = new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.UNKNOWN, new ValidationException()); exception = (OsgpException) dataObject; } else { final MeterType metertype = StringUtils.isBlank(meterType) ? null : Enum.valueOf(MeterType.class, meterType); DateTime dateTime = null; if (!recordTime.equals("")) { final Date date = new SimpleDateFormat("yyyyMMddHHmmss").parse(recordTime); dateTime = new DateTime(date); } PowerUsageData powerUsageData = null; if (!totalConsumedEnergy.equals("") && !actualConsumedPower.equals("")) { powerUsageData = new PowerUsageData(dateTime, metertype, Long.parseLong(totalConsumedEnergy), Long.parseLong(actualConsumedPower)); final PsldData psldData = new PsldData(Integer.valueOf(psldDataTotalLightHours)); final List<RelayData> relayDataList = new ArrayList<RelayData>(); // Create RelayData instances for relay indexes and // minutes // lighting time. relayDataList.add(new RelayData(Integer.parseInt(relayData1Index), Integer.parseInt(relayData1LightingMinutes))); relayDataList.add(new RelayData(Integer.parseInt(relayData2Index), Integer.parseInt(relayData2LightingMinutes))); // Construct SsldData using the list of RelayData. final SsldData ssldData = new SsldData(Integer.valueOf(actualCurrent1), Integer.valueOf(actualCurrent2), Integer.valueOf(actualCurrent3), Integer.valueOf(actualPower1), Integer.valueOf(actualPower2), Integer.valueOf(actualPower3), Integer.valueOf(averagePowerFactor1), Integer.valueOf(averagePowerFactor2), Integer.valueOf(averagePowerFactor3), relayDataList); powerUsageData.setPsldData(psldData); powerUsageData.setSsldData(ssldData); dataObject = powerUsageData; } } final ResponseMessage message = new ResponseMessage(correlationId, ORGANISATION_ID, deviceId, result, exception, dataObject); when(messageMock.getObject()).thenReturn(message); } catch (final JMSException e) { LOGGER.error("JMSException", e); } catch (final ParseException e) { LOGGER.error("ParseException", e); } when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))) .thenReturn(messageMock); } else { when(this.publicLightingResponsesJmsTemplate.receiveSelected(any(String.class))).thenReturn(null); } }
From source file:nl.nn.adapterframework.jms.JmsTransactionalStorage.java
public Object browseMessage(String messageId) throws ListenerException { try {/*from w ww. ja va2s. c om*/ ObjectMessage msg = (ObjectMessage) super.browseMessage(messageId); return msg.getObject(); } catch (JMSException e) { throw new ListenerException(e); } }
From source file:nl.nn.adapterframework.jms.JmsTransactionalStorage.java
public Object getMessage(String messageId) throws ListenerException { try {/*from ww w . j ava2s . c o m*/ ObjectMessage msg = (ObjectMessage) super.getMessage(messageId); return msg.getObject(); } catch (JMSException e) { throw new ListenerException(e); } }