mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/MessageDualListener.java
public List<Message> assertMessagesReceivedByType(Namespace expectedNamespace, ProtocolMessageEnum expectedType, 
        boolean additionalSocket) 
        throws InvalidProtocolBufferException
    {
        List<String> messageTypes = new ArrayList<String>();
        List<Message> namespaceMessages = new ArrayList<Message>();
        List<TerraHarvestMessage> responses = additionalSocket ? m_AdditionalResponses : m_Responses;
        for (TerraHarvestMessage response : responses)
        {
            TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());

            Message namespaceMessage;
            ProtocolMessageEnum messageType;
            
            switch (payload.getNamespace())
            {
                case Base:
                    BaseNamespace baseMessage = BaseNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = baseMessage;
                    messageType = baseMessage.getType();
                    break;

                case EventAdmin:
                    EventAdminNamespace eventMessage = EventAdminNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = eventMessage;
                    messageType = eventMessage.getType();
                    break;

                case ConfigAdmin:
                    ConfigAdminNamespace configMessage = ConfigAdminNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = configMessage;
                    messageType = configMessage.getType();
                    break;

                case MetaType:
                    MetaTypeNamespace metaTypeMessage = MetaTypeNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = metaTypeMessage;
                    messageType = metaTypeMessage.getType();
                    break;

                case Bundle:
                    BundleNamespace bundleMessage = BundleNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = bundleMessage;
                    messageType = bundleMessage.getType();
                    break;

                case MissionProgramming:
                    MissionProgrammingNamespace mpMessage = MissionProgrammingNamespace.
                        parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = mpMessage;
                    messageType = mpMessage.getType();
                    break;
                    
                case Asset:
                    AssetNamespace assetMessage = AssetNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = assetMessage;
                    messageType = assetMessage.getType();
                    break; 

                case AssetDirectoryService:
                    AssetDirectoryServiceNamespace adsMessage = 
                        AssetDirectoryServiceNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = adsMessage;
                    messageType = adsMessage.getType();
                    break;
                
                case CustomComms:
                    CustomCommsNamespace commsMessage = CustomCommsNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = commsMessage;
                    messageType = commsMessage.getType();
                    break;
                    
                case PhysicalLink:
                    PhysicalLinkNamespace pLinkMessage = PhysicalLinkNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = pLinkMessage;
                    messageType = pLinkMessage.getType();
                    break;
                
                case LinkLayer:
                    LinkLayerNamespace lLayerMessage = LinkLayerNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = lLayerMessage;
                    messageType = lLayerMessage.getType();
                    break;
                
                case TransportLayer:
                    TransportLayerNamespace tLayerMessage = 
                        TransportLayerNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = tLayerMessage;
                    messageType = tLayerMessage.getType();
                    break;
               
                case ObservationStore:
                    ObservationStoreNamespace obsMessage = ObservationStoreNamespace.parseFrom(
                            payload.getNamespaceMessage());
                    namespaceMessage = obsMessage;
                    messageType = obsMessage.getType();
                    break;
                
                default:
                    throw new UnsupportedOperationException("Cannot complete operation: " + payload.getNamespace() 
                            + " namespace has no implementation.");
            }
                
            namespaceMessages.add(namespaceMessage);
            messageTypes.add(payload.getNamespace() + ":" + messageType);
        }

        assertThat("Expected message type is received", messageTypes, hasItem(expectedNamespace + ":" + expectedType));
        List<Message> messageMatch = new ArrayList<Message>();
        for(int i = 0; i < messageTypes.size(); i++)
        {
            if(messageTypes.get(i).equals(expectedNamespace + ":" + expectedType))
            {
                messageMatch.add(namespaceMessages.get(i));
            }
        }
        return messageMatch;
    }
/**
     * Method asserts that a response of a specific message type has been received.  In addition, the method 
     * returns an array list of messages that match the input type.  This is in case
     * any further assertions need to be made on data appended to the message.
     * @param expectedNamespace
     *      Namespace of remote interface message type. 
     * @param expectedType
     *      Specific type of message expected to be received.
     * @param additionalSocket
     *      True if this request is to check the additional socket responses
     * @return
     *      a list of messages matching the input message type.
     * @throws InvalidProtocolBufferException 
     *      if message cannot be properly parsed
     */
Method asserts that a response of a specific message type has been received.  In addition, the method
returns an array list of messages that match the input type.  This is in case
any further assertions need to be made on data appended to the message.
@param expectedNamespace
Namespace of remote interface message type.
@param expectedType
Specific type of message expected to be received.
@param additionalSocket
True if this request is to check the additional socket responses
@return
a list of messages matching the input message type.
@throws InvalidProtocolBufferException
if message cannot be properly parsed
Method asserts that a response of a specific message type has been received . In addition the method returns an array list of messages that match the input type . This is in case any further assertions need to be made on data appended to the message . @param expectedNamespace Namespace of remote interface message type . @param expectedType Specific type of message expected to be received . @param additionalSocket True if this request is to check the additional socket responses @return a list of messages matching the input message type . @throws InvalidProtocolBufferException if message cannot be properly parsed
public List<Message> assertMessagesReceivedByType(Namespace expectedNamespace, ProtocolMessageEnum expectedType, 
        boolean additionalSocket) 
        throws InvalidProtocolBufferException
    {
        List<String> messageTypes = new ArrayList<String>();
        List<Message> namespaceMessages = new ArrayList<Message>();
        List<TerraHarvestMessage> responses = additionalSocket ? m_AdditionalResponses : m_Responses;
        for (TerraHarvestMessage response : responses)
        {
            TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(response.getTerraHarvestPayload());
            Message namespaceMessage;
            ProtocolMessageEnum messageType;
            switch (payload.getNamespace())
            {
                case Base:
                    BaseNamespace baseMessage = BaseNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = baseMessage;
                    messageType = baseMessage.getType();
                    break;
                case EventAdmin:
                    EventAdminNamespace eventMessage = EventAdminNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = eventMessage;
                    messageType = eventMessage.getType();
                    break;
                case ConfigAdmin:
                    ConfigAdminNamespace configMessage = ConfigAdminNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = configMessage;
                    messageType = configMessage.getType();
                    break;
                case MetaType:
                    MetaTypeNamespace metaTypeMessage = MetaTypeNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = metaTypeMessage;
                    messageType = metaTypeMessage.getType();
                    break;
                case Bundle:
                    BundleNamespace bundleMessage = BundleNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = bundleMessage;
                    messageType = bundleMessage.getType();
                    break;
                case MissionProgramming:
                    MissionProgrammingNamespace mpMessage = MissionProgrammingNamespace.
                        parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = mpMessage;
                    messageType = mpMessage.getType();
                    break;
                case Asset:
                    AssetNamespace assetMessage = AssetNamespace.parseFrom(payload.getNamespaceMessage()); 
                    namespaceMessage = assetMessage;
                    messageType = assetMessage.getType();
                    break; 
                case AssetDirectoryService:
                    AssetDirectoryServiceNamespace adsMessage = 
                        AssetDirectoryServiceNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = adsMessage;
                    messageType = adsMessage.getType();
                    break;
                case CustomComms:
                    CustomCommsNamespace commsMessage = CustomCommsNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = commsMessage;
                    messageType = commsMessage.getType();
                    break;
                case PhysicalLink:
                    PhysicalLinkNamespace pLinkMessage = PhysicalLinkNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = pLinkMessage;
                    messageType = pLinkMessage.getType();
                    break;
                case LinkLayer:
                    LinkLayerNamespace lLayerMessage = LinkLayerNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = lLayerMessage;
                    messageType = lLayerMessage.getType();
                    break;
                case TransportLayer:
                    TransportLayerNamespace tLayerMessage = 
                        TransportLayerNamespace.parseFrom(payload.getNamespaceMessage());
                    namespaceMessage = tLayerMessage;
                    messageType = tLayerMessage.getType();
                    break;
                case ObservationStore:
                    ObservationStoreNamespace obsMessage = ObservationStoreNamespace.parseFrom(
                            payload.getNamespaceMessage());
                    namespaceMessage = obsMessage;
                    messageType = obsMessage.getType();
                    break;
                default:
                    throw new UnsupportedOperationException("Cannot complete operation: " + payload.getNamespace() 
                            + " namespace has no implementation.");
            }
            namespaceMessages.add(namespaceMessage);
            messageTypes.add(payload.getNamespace() + ":" + messageType);
        }
        assertThat("Expected message type is received", messageTypes, hasItem(expectedNamespace + ":" + expectedType));
        List<Message> messageMatch = new ArrayList<Message>();
        for(int i = 0; i < messageTypes.size(); i++)
        {
            if(messageTypes.get(i).equals(expectedNamespace + ":" + expectedType))
            {
                messageMatch.add(namespaceMessages.get(i));
            }
        }
        return messageMatch;
    }
public List < Message > assertMessagesReceivedByType ( Namespace expectedNamespace , ProtocolMessageEnum expectedType , boolean additionalSocket ) throws InvalidProtocolBufferException { List < String > messageTypes = new ArrayList < String > ( ) ; List < Message > namespaceMessages = new ArrayList < Message > ( ) ; List < TerraHarvestMessage > responses = additionalSocket ? m_AdditionalResponses : m_Responses ; for ( TerraHarvestMessage response : responses ) { TerraHarvestPayload payload = TerraHarvestPayload . parseFrom ( response . getTerraHarvestPayload ( ) ) ; Message namespaceMessage ; ProtocolMessageEnum messageType ; switch ( payload . getNamespace ( ) ) { case Base : BaseNamespace baseMessage = BaseNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = baseMessage ; messageType = baseMessage . getType ( ) ; break ; case EventAdmin : EventAdminNamespace eventMessage = EventAdminNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = eventMessage ; messageType = eventMessage . getType ( ) ; break ; case ConfigAdmin : ConfigAdminNamespace configMessage = ConfigAdminNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = configMessage ; messageType = configMessage . getType ( ) ; break ; case MetaType : MetaTypeNamespace metaTypeMessage = MetaTypeNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = metaTypeMessage ; messageType = metaTypeMessage . getType ( ) ; break ; case Bundle : BundleNamespace bundleMessage = BundleNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = bundleMessage ; messageType = bundleMessage . getType ( ) ; break ; case MissionProgramming : MissionProgrammingNamespace mpMessage = MissionProgrammingNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = mpMessage ; messageType = mpMessage . getType ( ) ; break ; case Asset : AssetNamespace assetMessage = AssetNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = assetMessage ; messageType = assetMessage . getType ( ) ; break ; case AssetDirectoryService : AssetDirectoryServiceNamespace adsMessage = AssetDirectoryServiceNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = adsMessage ; messageType = adsMessage . getType ( ) ; break ; case CustomComms : CustomCommsNamespace commsMessage = CustomCommsNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = commsMessage ; messageType = commsMessage . getType ( ) ; break ; case PhysicalLink : PhysicalLinkNamespace pLinkMessage = PhysicalLinkNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = pLinkMessage ; messageType = pLinkMessage . getType ( ) ; break ; case LinkLayer : LinkLayerNamespace lLayerMessage = LinkLayerNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = lLayerMessage ; messageType = lLayerMessage . getType ( ) ; break ; case TransportLayer : TransportLayerNamespace tLayerMessage = TransportLayerNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = tLayerMessage ; messageType = tLayerMessage . getType ( ) ; break ; case ObservationStore : ObservationStoreNamespace obsMessage = ObservationStoreNamespace . parseFrom ( payload . getNamespaceMessage ( ) ) ; namespaceMessage = obsMessage ; messageType = obsMessage . getType ( ) ; break ; default : throw new UnsupportedOperationException ( "Cannot complete operation: " + payload . getNamespace ( ) + " namespace has no implementation." ) ; } namespaceMessages . add ( namespaceMessage ) ; messageTypes . add ( payload . getNamespace ( ) + ":" + messageType ) ; } assertThat ( "Expected message type is received" , messageTypes , hasItem ( expectedNamespace + ":" + expectedType ) ) ; List < Message > messageMatch = new ArrayList < Message > ( ) ; for ( int i = 0 ; i < messageTypes . size ( ) ; i ++ ) { if ( messageTypes . get ( i ) . equals ( expectedNamespace + ":" + expectedType ) ) { messageMatch . add ( namespaceMessages . get ( i ) ) ; } } return messageMatch ; }
Method asserts that a response of a specific message type has been received.
Method asserts that a response of a specific message type has been received .