mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/util/TestRemotePropertyConverter.java
@Test
    public final void testComplexTypesMapToMap_CommandResponseEvent() throws Exception
    {
        // mock
        Map<String, Object> props = new HashMap<String, Object>();
        GetVersionResponse versionResponse = new GetVersionResponse(null, null, "version");
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE, GetVersionResponse.class.getName());
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, versionResponse);
        
        //command converter mocking
        JaxbProtoObjectConverter converter = mock(JaxbProtoObjectConverter.class);
        m_SUT.setJaxbProtoObjectConverter(converter);
        GetVersionResponseGen.GetVersionResponse protoVersion = 
                GetVersionResponseGen.GetVersionResponse.newBuilder().setCurrentVersion("piggies")
                .setBase(Response.getDefaultInstance()).build();
        when(converter.convertToProto(versionResponse)).thenReturn(protoVersion);
        when(m_CommandConverter.getCommandResponseEnumFromClassName(GetVersionResponse.class.getName())).
            thenReturn(CommandResponseEnum.GET_VERSION_RESPONSE);

        List<ComplexTypesMapEntry> convertStringProps = m_SUT.mapToComplexTypesMap(props, null);
        
        //command converter mocking
        when(m_CommandConverter.getJavaResponseType(protoVersion.toByteArray(), 
                CommandResponseEnum.GET_VERSION_RESPONSE)).thenReturn(versionResponse);
        
        Map<String, Object> propsAfterConv = m_SUT.complexTypesMapToMap(convertStringProps);
        assertThat(propsAfterConv, rawMapHasEntry(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE, 
                GetVersionResponse.class.getName()));
        assertThat(propsAfterConv, rawMapHasEntry(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, versionResponse));
    }
/**
     * Test creating a java map equivalent of a proto property map which was a command response event.
     * 
     * Verify expected values are converted and verify interactions with command converter.
     */
Test creating a java map equivalent of a proto property map which was a command response event.

Verify expected values are converted and verify interactions with command converter.
Test creating a java map equivalent of a proto property map which was a command response event . Verify expected values are converted and verify interactions with command converter .
@Test
    public final void testComplexTypesMapToMap_CommandResponseEvent() throws Exception
    {
        Map<String, Object> props = new HashMap<String, Object>();
        GetVersionResponse versionResponse = new GetVersionResponse(null, null, "version");
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE, GetVersionResponse.class.getName());
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, versionResponse);
        JaxbProtoObjectConverter converter = mock(JaxbProtoObjectConverter.class);
        m_SUT.setJaxbProtoObjectConverter(converter);
        GetVersionResponseGen.GetVersionResponse protoVersion = 
                GetVersionResponseGen.GetVersionResponse.newBuilder().setCurrentVersion("piggies")
                .setBase(Response.getDefaultInstance()).build();
        when(converter.convertToProto(versionResponse)).thenReturn(protoVersion);
        when(m_CommandConverter.getCommandResponseEnumFromClassName(GetVersionResponse.class.getName())).
            thenReturn(CommandResponseEnum.GET_VERSION_RESPONSE);
        List<ComplexTypesMapEntry> convertStringProps = m_SUT.mapToComplexTypesMap(props, null);
        when(m_CommandConverter.getJavaResponseType(protoVersion.toByteArray(), 
                CommandResponseEnum.GET_VERSION_RESPONSE)).thenReturn(versionResponse);
        Map<String, Object> propsAfterConv = m_SUT.complexTypesMapToMap(convertStringProps);
        assertThat(propsAfterConv, rawMapHasEntry(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE, 
                GetVersionResponse.class.getName()));
        assertThat(propsAfterConv, rawMapHasEntry(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, versionResponse));
    }
@ Test public final void testComplexTypesMapToMap_CommandResponseEvent ( ) throws Exception { Map < String , Object > props = new HashMap < String , Object > ( ) ; GetVersionResponse versionResponse = new GetVersionResponse ( null , null , "version" ) ; props . put ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE , GetVersionResponse . class . getName ( ) ) ; props . put ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE , versionResponse ) ; JaxbProtoObjectConverter converter = mock ( JaxbProtoObjectConverter . class ) ; m_SUT . setJaxbProtoObjectConverter ( converter ) ; GetVersionResponseGen . GetVersionResponse protoVersion = GetVersionResponseGen . GetVersionResponse . newBuilder ( ) . setCurrentVersion ( "piggies" ) . setBase ( Response . getDefaultInstance ( ) ) . build ( ) ; when ( converter . convertToProto ( versionResponse ) ) . thenReturn ( protoVersion ) ; when ( m_CommandConverter . getCommandResponseEnumFromClassName ( GetVersionResponse . class . getName ( ) ) ) . thenReturn ( CommandResponseEnum . GET_VERSION_RESPONSE ) ; List < ComplexTypesMapEntry > convertStringProps = m_SUT . mapToComplexTypesMap ( props , null ) ; when ( m_CommandConverter . getJavaResponseType ( protoVersion . toByteArray ( ) , CommandResponseEnum . GET_VERSION_RESPONSE ) ) . thenReturn ( versionResponse ) ; Map < String , Object > propsAfterConv = m_SUT . complexTypesMapToMap ( convertStringProps ) ; assertThat ( propsAfterConv , rawMapHasEntry ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE , GetVersionResponse . class . getName ( ) ) ) ; assertThat ( propsAfterConv , rawMapHasEntry ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE , versionResponse ) ) ; }
Test creating a java map equivalent of a proto property map which was a command response event.
Test creating a java map equivalent of a proto property map which was a command response event .
// mock //command converter mocking //command converter mocking