mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/encryption/TestEncryptInfoMessageService.java
@Test
    public void testEncryptionInfoErrorResponse() throws IOException
    {
        EncryptionInfoErrorResponseData errorResponse = EncryptionInfoErrorResponseData.newBuilder().setError(
                EncryptionErrorCode.INVALID_ENCRYPTION_LEVEL).setErrorDescription("the system was too lazy to decrypt " 
                        + "your message... sorry").setType(EncryptType.AES_ECDH_ECDSA).build();
        EncryptionInfoNamespace namepsaceMessage = EncryptionInfoNamespace.newBuilder().setType(
                EncryptionInfoMessageType.EncryptionInfoErrorResponse).setData(errorResponse.toByteString()).build();
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(0, 5, 
                Namespace.EncryptionInfo, 225, namepsaceMessage);
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(thMessage.getTerraHarvestPayload());
        
        m_SUT.handleMessage(thMessage, payload, m_RemoteChannel);
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        
        Event postedEvent = eventCaptor.getValue();
        assertThat((String)postedEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE), 
                is(EncryptionInfoMessageType.EncryptionInfoErrorResponse.toString()));
        assertThat((TerraHarvestPayload)postedEvent.getProperty(RemoteConstants.EVENT_PROP_PAYLOAD), is(payload));
    }
/**
     * Verify that the encryption error response message is handled appropriately.
     */
Verify that the encryption error response message is handled appropriately.
Verify that the encryption error response message is handled appropriately .
@Test
    public void testEncryptionInfoErrorResponse() throws IOException
    {
        EncryptionInfoErrorResponseData errorResponse = EncryptionInfoErrorResponseData.newBuilder().setError(
                EncryptionErrorCode.INVALID_ENCRYPTION_LEVEL).setErrorDescription("the system was too lazy to decrypt " 
                        + "your message... sorry").setType(EncryptType.AES_ECDH_ECDSA).build();
        EncryptionInfoNamespace namepsaceMessage = EncryptionInfoNamespace.newBuilder().setType(
                EncryptionInfoMessageType.EncryptionInfoErrorResponse).setData(errorResponse.toByteString()).build();
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(0, 5, 
                Namespace.EncryptionInfo, 225, namepsaceMessage);
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(thMessage.getTerraHarvestPayload());
        m_SUT.handleMessage(thMessage, payload, m_RemoteChannel);
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event postedEvent = eventCaptor.getValue();
        assertThat((String)postedEvent.getProperty(RemoteConstants.EVENT_PROP_MESSAGE_TYPE), 
                is(EncryptionInfoMessageType.EncryptionInfoErrorResponse.toString()));
        assertThat((TerraHarvestPayload)postedEvent.getProperty(RemoteConstants.EVENT_PROP_PAYLOAD), is(payload));
    }
@ Test public void testEncryptionInfoErrorResponse ( ) throws IOException { EncryptionInfoErrorResponseData errorResponse = EncryptionInfoErrorResponseData . newBuilder ( ) . setError ( EncryptionErrorCode . INVALID_ENCRYPTION_LEVEL ) . setErrorDescription ( "the system was too lazy to decrypt " + "your message... sorry" ) . setType ( EncryptType . AES_ECDH_ECDSA ) . build ( ) ; EncryptionInfoNamespace namepsaceMessage = EncryptionInfoNamespace . newBuilder ( ) . setType ( EncryptionInfoMessageType . EncryptionInfoErrorResponse ) . setData ( errorResponse . toByteString ( ) ) . build ( ) ; TerraHarvestMessage thMessage = TerraHarvestMessageHelper . createTerraHarvestMessage ( 0 , 5 , Namespace . EncryptionInfo , 225 , namepsaceMessage ) ; TerraHarvestPayload payload = TerraHarvestPayload . parseFrom ( thMessage . getTerraHarvestPayload ( ) ) ; m_SUT . handleMessage ( thMessage , payload , m_RemoteChannel ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event postedEvent = eventCaptor . getValue ( ) ; assertThat ( ( String ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_MESSAGE_TYPE ) , is ( EncryptionInfoMessageType . EncryptionInfoErrorResponse . toString ( ) ) ) ; assertThat ( ( TerraHarvestPayload ) postedEvent . getProperty ( RemoteConstants . EVENT_PROP_PAYLOAD ) , is ( payload ) ) ; }
Verify that the encryption error response message is handled appropriately.
Verify that the encryption error response message is handled appropriately .