mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageFactoryImpl.java
@Test
    public void testQueueEncryptionInfoMessage() throws IOException
    {
        byte[] fakeBytes = {10, 10, 20, 30};
        ByteString fakeByteString = ByteString.copyFrom(fakeBytes);
        Message fakeMessage = mock(Message.class);
        
        when(fakeMessage.toByteString()).thenReturn(fakeByteString);
        
        MessageWrapperAutoEncryption request = m_SUT.createEncryptionInfoMessage(
                EncryptionInfoMessageType.GetEncryptionTypeRequest, fakeMessage);
        
        // request sending and verify namespace
        ByteString namespaceMessage = confirmWrapperNoEncryptionTrySend(request, Namespace.EncryptionInfo, 1);
        
        // verify namespace message
        EncryptionInfoNamespace nameMessageResponse = EncryptionInfoNamespace.parseFrom(namespaceMessage);
        assertThat(nameMessageResponse.getType(), is(EncryptionInfoMessageType.GetEncryptionTypeRequest));
        
        //verify data message
        assertThat(nameMessageResponse.getData(), is(fakeMessage.toByteString()));
        
        //--send again with null for the data message--//
        request = m_SUT.createEncryptionInfoMessage(EncryptionInfoMessageType.GetEncryptionTypeRequest, 
                null);
        
        // request sending and verify namespace
        namespaceMessage = confirmWrapperNoEncryptionTrySend(request, Namespace.EncryptionInfo, 2);

        // verify namespace message
        nameMessageResponse = EncryptionInfoNamespace.parseFrom(namespaceMessage);
        assertThat(nameMessageResponse.getType(), is(EncryptionInfoMessageType.GetEncryptionTypeRequest));
        
        //verify data message
        assertThat(nameMessageResponse.hasData(), is(false));
    }
/**
     * Verify the message wrapper returned contains the expected encryption information contents.
     */
Verify the message wrapper returned contains the expected encryption information contents.
Verify the message wrapper returned contains the expected encryption information contents .
@Test
    public void testQueueEncryptionInfoMessage() throws IOException
    {
        byte[] fakeBytes = {10, 10, 20, 30};
        ByteString fakeByteString = ByteString.copyFrom(fakeBytes);
        Message fakeMessage = mock(Message.class);
        when(fakeMessage.toByteString()).thenReturn(fakeByteString);
        MessageWrapperAutoEncryption request = m_SUT.createEncryptionInfoMessage(
                EncryptionInfoMessageType.GetEncryptionTypeRequest, fakeMessage);
        ByteString namespaceMessage = confirmWrapperNoEncryptionTrySend(request, Namespace.EncryptionInfo, 1);
        EncryptionInfoNamespace nameMessageResponse = EncryptionInfoNamespace.parseFrom(namespaceMessage);
        assertThat(nameMessageResponse.getType(), is(EncryptionInfoMessageType.GetEncryptionTypeRequest));
        assertThat(nameMessageResponse.getData(), is(fakeMessage.toByteString()));
        request = m_SUT.createEncryptionInfoMessage(EncryptionInfoMessageType.GetEncryptionTypeRequest, 
                null);
        namespaceMessage = confirmWrapperNoEncryptionTrySend(request, Namespace.EncryptionInfo, 2);
        nameMessageResponse = EncryptionInfoNamespace.parseFrom(namespaceMessage);
        assertThat(nameMessageResponse.getType(), is(EncryptionInfoMessageType.GetEncryptionTypeRequest));
        assertThat(nameMessageResponse.hasData(), is(false));
    }
@ Test public void testQueueEncryptionInfoMessage ( ) throws IOException { byte [ ] fakeBytes = { 10 , 10 , 20 , 30 } ; ByteString fakeByteString = ByteString . copyFrom ( fakeBytes ) ; Message fakeMessage = mock ( Message . class ) ; when ( fakeMessage . toByteString ( ) ) . thenReturn ( fakeByteString ) ; MessageWrapperAutoEncryption request = m_SUT . createEncryptionInfoMessage ( EncryptionInfoMessageType . GetEncryptionTypeRequest , fakeMessage ) ; ByteString namespaceMessage = confirmWrapperNoEncryptionTrySend ( request , Namespace . EncryptionInfo , 1 ) ; EncryptionInfoNamespace nameMessageResponse = EncryptionInfoNamespace . parseFrom ( namespaceMessage ) ; assertThat ( nameMessageResponse . getType ( ) , is ( EncryptionInfoMessageType . GetEncryptionTypeRequest ) ) ; assertThat ( nameMessageResponse . getData ( ) , is ( fakeMessage . toByteString ( ) ) ) ; request = m_SUT . createEncryptionInfoMessage ( EncryptionInfoMessageType . GetEncryptionTypeRequest , null ) ; namespaceMessage = confirmWrapperNoEncryptionTrySend ( request , Namespace . EncryptionInfo , 2 ) ; nameMessageResponse = EncryptionInfoNamespace . parseFrom ( namespaceMessage ) ; assertThat ( nameMessageResponse . getType ( ) , is ( EncryptionInfoMessageType . GetEncryptionTypeRequest ) ) ; assertThat ( nameMessageResponse . hasData ( ) , is ( false ) ) ; }
Verify the message wrapper returned contains the expected encryption information contents.
Verify the message wrapper returned contains the expected encryption information contents .
// request sending and verify namespace // verify namespace message //verify data message //--send again with null for the data message--// // request sending and verify namespace // verify namespace message //verify data message