mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageSenderImpl.java
@Test
    public void testQueueBaseMessageRemoteEncryptionService() throws IOException
    {
      //set the service
        m_SUT.setRemoteSystemEncryption(m_RemoteSystemEncryption);
        when(m_RemoteSystemEncryption.getEncryptType(m_RemoteId)).thenReturn(EncryptType.AES_ECDH_ECDSA);
        when(m_RemoteSettings.getEncryptionMode()).thenReturn(EncryptionMode.AES_ECDH_ECDSA);

        // construct data message to send
        ControllerInfoData systemInfoData = ControllerInfoData.newBuilder().setName("blah").build();
        
        TerraHarvestMessage request = 
                createMessageWithDestSource(m_LocalId, m_RemoteId, 0 , Namespace.Base, systemInfoData);
        
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(request.getTerraHarvestPayload());
        
        when(m_EncryptService.encryptMessage(Mockito.any(Builder.class), Mockito.any(TerraHarvestPayload.class))).
            thenReturn(request);
        
        m_SUT.queueMessage(m_RemoteId, payload, null);
        
        //capture the message being sent to the encryption service
        ArgumentCaptor<TerraHarvestMessage.Builder> builderCaptor = 
                ArgumentCaptor.forClass(TerraHarvestMessage.Builder.class);
        verify(m_EncryptService).encryptMessage(builderCaptor.capture(), eq(payload));
        assertThat(builderCaptor.getValue().getEncryptType(), is(EncryptType.AES_ECDH_ECDSA));
    }
/**
     * Verifies that the queue remote base message method will pass the correct message.  
     *  
     * Verifies message is properly encrypted based upon data returned from the remote encryption service.
     */
Verifies that the queue remote base message method will pass the correct message.

Verifies message is properly encrypted based upon data returned from the remote encryption service.
Verifies that the queue remote base message method will pass the correct message . Verifies message is properly encrypted based upon data returned from the remote encryption service .
@Test
    public void testQueueBaseMessageRemoteEncryptionService() throws IOException
    {
        m_SUT.setRemoteSystemEncryption(m_RemoteSystemEncryption);
        when(m_RemoteSystemEncryption.getEncryptType(m_RemoteId)).thenReturn(EncryptType.AES_ECDH_ECDSA);
        when(m_RemoteSettings.getEncryptionMode()).thenReturn(EncryptionMode.AES_ECDH_ECDSA);
        ControllerInfoData systemInfoData = ControllerInfoData.newBuilder().setName("blah").build();
        TerraHarvestMessage request = 
                createMessageWithDestSource(m_LocalId, m_RemoteId, 0 , Namespace.Base, systemInfoData);
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(request.getTerraHarvestPayload());
        when(m_EncryptService.encryptMessage(Mockito.any(Builder.class), Mockito.any(TerraHarvestPayload.class))).
            thenReturn(request);
        m_SUT.queueMessage(m_RemoteId, payload, null);
        ArgumentCaptor<TerraHarvestMessage.Builder> builderCaptor = 
                ArgumentCaptor.forClass(TerraHarvestMessage.Builder.class);
        verify(m_EncryptService).encryptMessage(builderCaptor.capture(), eq(payload));
        assertThat(builderCaptor.getValue().getEncryptType(), is(EncryptType.AES_ECDH_ECDSA));
    }
@ Test public void testQueueBaseMessageRemoteEncryptionService ( ) throws IOException { m_SUT . setRemoteSystemEncryption ( m_RemoteSystemEncryption ) ; when ( m_RemoteSystemEncryption . getEncryptType ( m_RemoteId ) ) . thenReturn ( EncryptType . AES_ECDH_ECDSA ) ; when ( m_RemoteSettings . getEncryptionMode ( ) ) . thenReturn ( EncryptionMode . AES_ECDH_ECDSA ) ; ControllerInfoData systemInfoData = ControllerInfoData . newBuilder ( ) . setName ( "blah" ) . build ( ) ; TerraHarvestMessage request = createMessageWithDestSource ( m_LocalId , m_RemoteId , 0 , Namespace . Base , systemInfoData ) ; TerraHarvestPayload payload = TerraHarvestPayload . parseFrom ( request . getTerraHarvestPayload ( ) ) ; when ( m_EncryptService . encryptMessage ( Mockito . any ( Builder . class ) , Mockito . any ( TerraHarvestPayload . class ) ) ) . thenReturn ( request ) ; m_SUT . queueMessage ( m_RemoteId , payload , null ) ; ArgumentCaptor < TerraHarvestMessage . Builder > builderCaptor = ArgumentCaptor . forClass ( TerraHarvestMessage . Builder . class ) ; verify ( m_EncryptService ) . encryptMessage ( builderCaptor . capture ( ) , eq ( payload ) ) ; assertThat ( builderCaptor . getValue ( ) . getEncryptType ( ) , is ( EncryptType . AES_ECDH_ECDSA ) ) ; }
Verifies that the queue remote base message method will pass the correct message.
Verifies that the queue remote base message method will pass the correct message .
//set the service // construct data message to send //capture the message being sent to the encryption service