mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetImpl.java
@Test
    public void testExecuteGetPositionCommand() throws CommandExecutionException, ValidationFailedException,
            InterruptedException, IOException, ConfigurationException
    {
        Dictionary<String, Object> propsUsedForNewProp = new Hashtable<>();
        propsUsedForNewProp.put(AssetAttributes.CONFIG_PROP_PLUGIN_OVERRIDES_POSITION, true);
        when(m_Configuration.getProperties()).thenReturn(propsUsedForNewProp);
        when(m_ConfigAdmin.getConfiguration(eq(OBJ_PID), Mockito.any(String.class))).thenReturn(m_Configuration);
        // update props
        m_SUT.blockingPropsUpdate(new HashMap<String, Object>());

        GetPositionResponse response = mock(GetPositionResponse.class);
        when(m_Proxy.onExecuteCommand(Mockito.any(Command.class))).thenReturn(response);

        GetPositionCommand command = mock(GetPositionCommand.class);
        m_SUT.executeCommand(command);

        verify(m_Proxy).onExecuteCommand(command);
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();

        Map<String, Object> props = new HashMap<>();
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE, response.getClass().getName());
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, response);
        EventAdminVerifier.assertLastEvent(m_EventAdmin, Asset.TOPIC_COMMAND_RESPONSE, props);
    }
/**
     * Verify execute getposition command works as intended.
     */
Verify execute getposition command works as intended.
Verify execute getposition command works as intended .
@Test
    public void testExecuteGetPositionCommand() throws CommandExecutionException, ValidationFailedException,
            InterruptedException, IOException, ConfigurationException
    {
        Dictionary<String, Object> propsUsedForNewProp = new Hashtable<>();
        propsUsedForNewProp.put(AssetAttributes.CONFIG_PROP_PLUGIN_OVERRIDES_POSITION, true);
        when(m_Configuration.getProperties()).thenReturn(propsUsedForNewProp);
        when(m_ConfigAdmin.getConfiguration(eq(OBJ_PID), Mockito.any(String.class))).thenReturn(m_Configuration);
        m_SUT.blockingPropsUpdate(new HashMap<String, Object>());
        GetPositionResponse response = mock(GetPositionResponse.class);
        when(m_Proxy.onExecuteCommand(Mockito.any(Command.class))).thenReturn(response);
        GetPositionCommand command = mock(GetPositionCommand.class);
        m_SUT.executeCommand(command);
        verify(m_Proxy).onExecuteCommand(command);
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
        Map<String, Object> props = new HashMap<>();
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE, response.getClass().getName());
        props.put(Asset.EVENT_PROP_ASSET_COMMAND_RESPONSE, response);
        EventAdminVerifier.assertLastEvent(m_EventAdmin, Asset.TOPIC_COMMAND_RESPONSE, props);
    }
@ Test public void testExecuteGetPositionCommand ( ) throws CommandExecutionException , ValidationFailedException , InterruptedException , IOException , ConfigurationException { Dictionary < String , Object > propsUsedForNewProp = new Hashtable < > ( ) ; propsUsedForNewProp . put ( AssetAttributes . CONFIG_PROP_PLUGIN_OVERRIDES_POSITION , true ) ; when ( m_Configuration . getProperties ( ) ) . thenReturn ( propsUsedForNewProp ) ; when ( m_ConfigAdmin . getConfiguration ( eq ( OBJ_PID ) , Mockito . any ( String . class ) ) ) . thenReturn ( m_Configuration ) ; m_SUT . blockingPropsUpdate ( new HashMap < String , Object > ( ) ) ; GetPositionResponse response = mock ( GetPositionResponse . class ) ; when ( m_Proxy . onExecuteCommand ( Mockito . any ( Command . class ) ) ) . thenReturn ( response ) ; GetPositionCommand command = mock ( GetPositionCommand . class ) ; m_SUT . executeCommand ( command ) ; verify ( m_Proxy ) . onExecuteCommand ( command ) ; verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; Map < String , Object > props = new HashMap < > ( ) ; props . put ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE_TYPE , response . getClass ( ) . getName ( ) ) ; props . put ( Asset . EVENT_PROP_ASSET_COMMAND_RESPONSE , response ) ; EventAdminVerifier . assertLastEvent ( m_EventAdmin , Asset . TOPIC_COMMAND_RESPONSE , props ) ; }
Verify execute getposition command works as intended.
Verify execute getposition command works as intended .
// update props