mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAssetDirectoryService.java
public final void testAssetCapabilities() throws UnmarshalException
    {
        AssetFactory testFactory = null;
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        
        for (AssetFactory factory : assetDirectoryService.getAssetFactories())
        {
            if (factory.getProductType().equals(ExampleAsset.class.getName()))
            {
                testFactory = factory;
            }
        }
        
        assertThat("Example asset factory was not found", testFactory, is(notNullValue()));
        
        StatusCapabilities statusCaps = testFactory.getAssetCapabilities().getStatusCapabilities();
        assertThat("Status capabilities not found", statusCaps, is(notNullValue()));
        
        assertThat(statusCaps.getAvailableComponentStatuses().size(), is(2));
        assertThat(statusCaps.getAvailableComponentStatuses(), 
                hasItem(new ComponentType().withType(ComponentTypeEnum.CPU)));
        assertThat(statusCaps.getAvailableComponentStatuses(), 
                hasItem(new ComponentType(ComponentTypeEnum.OTHER, "blah")));
        assertThat(statusCaps.isSensorFovAvailable(), is(false));
        assertThat(statusCaps.isSensorRangeAvailable(), is(true));
        assertThat(statusCaps.isAnalogAnalogVoltageAvailable(), is(false));
        assertThat(statusCaps.isAnalogDigitalVoltargeAvailable(), is(false));
        assertThat(statusCaps.isAnalogMagVoltageAvailable(), is(false));
        assertThat(statusCaps.isAssetOnTimeAvailable(), is(false));
        assertThat(statusCaps.isBatteryChargeLevelAvailable(), is(false));
        assertThat(statusCaps.isBatteryVoltageAvailable(), is(false));
        assertThat(statusCaps.isPowerConsumptionAvailable(), is(false));
        assertThat(statusCaps.isTemperatureAvailable(), is(true));
        
        AudioCapabilities audioCaps = testFactory.getAssetCapabilities().getAudioCapabilities();
        assertThat("Audio capabilities not found", audioCaps, is(notNullValue()));
        
        assertThat(audioCaps.getRecorders().size(), is(1));
        assertThat(audioCaps.getRecorders(), hasItem(new AudioRecorder(AudioRecorderEnum.MICROPHONE, "none", null)));
        assertThat("Audio sample rate not equal to 14.4",
                   DoubleMath.fuzzyEquals(audioCaps.getSampleRatesKHz().get(0).doubleValue(), 14.4, 0.00001));
    }
/**
     * Test that status capabilities are available as filled out in the ExampleAsset capability XML.  Must be updated
     * to match capability file for any further changes.
     */
Test that status capabilities are available as filled out in the ExampleAsset capability XML.  Must be updated
to match capability file for any further changes.
Test that status capabilities are available as filled out in the ExampleAsset capability XML . Must be updated to match capability file for any further changes .
public final void testAssetCapabilities() throws UnmarshalException
    {
        AssetFactory testFactory = null;
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        for (AssetFactory factory : assetDirectoryService.getAssetFactories())
        {
            if (factory.getProductType().equals(ExampleAsset.class.getName()))
            {
                testFactory = factory;
            }
        }
        assertThat("Example asset factory was not found", testFactory, is(notNullValue()));
        StatusCapabilities statusCaps = testFactory.getAssetCapabilities().getStatusCapabilities();
        assertThat("Status capabilities not found", statusCaps, is(notNullValue()));
        assertThat(statusCaps.getAvailableComponentStatuses().size(), is(2));
        assertThat(statusCaps.getAvailableComponentStatuses(), 
                hasItem(new ComponentType().withType(ComponentTypeEnum.CPU)));
        assertThat(statusCaps.getAvailableComponentStatuses(), 
                hasItem(new ComponentType(ComponentTypeEnum.OTHER, "blah")));
        assertThat(statusCaps.isSensorFovAvailable(), is(false));
        assertThat(statusCaps.isSensorRangeAvailable(), is(true));
        assertThat(statusCaps.isAnalogAnalogVoltageAvailable(), is(false));
        assertThat(statusCaps.isAnalogDigitalVoltargeAvailable(), is(false));
        assertThat(statusCaps.isAnalogMagVoltageAvailable(), is(false));
        assertThat(statusCaps.isAssetOnTimeAvailable(), is(false));
        assertThat(statusCaps.isBatteryChargeLevelAvailable(), is(false));
        assertThat(statusCaps.isBatteryVoltageAvailable(), is(false));
        assertThat(statusCaps.isPowerConsumptionAvailable(), is(false));
        assertThat(statusCaps.isTemperatureAvailable(), is(true));
        AudioCapabilities audioCaps = testFactory.getAssetCapabilities().getAudioCapabilities();
        assertThat("Audio capabilities not found", audioCaps, is(notNullValue()));
        assertThat(audioCaps.getRecorders().size(), is(1));
        assertThat(audioCaps.getRecorders(), hasItem(new AudioRecorder(AudioRecorderEnum.MICROPHONE, "none", null)));
        assertThat("Audio sample rate not equal to 14.4",
                   DoubleMath.fuzzyEquals(audioCaps.getSampleRatesKHz().get(0).doubleValue(), 14.4, 0.00001));
    }
public final void testAssetCapabilities ( ) throws UnmarshalException { AssetFactory testFactory = null ; AssetDirectoryService assetDirectoryService = ServiceUtils . getService ( m_Context , AssetDirectoryService . class ) ; for ( AssetFactory factory : assetDirectoryService . getAssetFactories ( ) ) { if ( factory . getProductType ( ) . equals ( ExampleAsset . class . getName ( ) ) ) { testFactory = factory ; } } assertThat ( "Example asset factory was not found" , testFactory , is ( notNullValue ( ) ) ) ; StatusCapabilities statusCaps = testFactory . getAssetCapabilities ( ) . getStatusCapabilities ( ) ; assertThat ( "Status capabilities not found" , statusCaps , is ( notNullValue ( ) ) ) ; assertThat ( statusCaps . getAvailableComponentStatuses ( ) . size ( ) , is ( 2 ) ) ; assertThat ( statusCaps . getAvailableComponentStatuses ( ) , hasItem ( new ComponentType ( ) . withType ( ComponentTypeEnum . CPU ) ) ) ; assertThat ( statusCaps . getAvailableComponentStatuses ( ) , hasItem ( new ComponentType ( ComponentTypeEnum . OTHER , "blah" ) ) ) ; assertThat ( statusCaps . isSensorFovAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isSensorRangeAvailable ( ) , is ( true ) ) ; assertThat ( statusCaps . isAnalogAnalogVoltageAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isAnalogDigitalVoltargeAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isAnalogMagVoltageAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isAssetOnTimeAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isBatteryChargeLevelAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isBatteryVoltageAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isPowerConsumptionAvailable ( ) , is ( false ) ) ; assertThat ( statusCaps . isTemperatureAvailable ( ) , is ( true ) ) ; AudioCapabilities audioCaps = testFactory . getAssetCapabilities ( ) . getAudioCapabilities ( ) ; assertThat ( "Audio capabilities not found" , audioCaps , is ( notNullValue ( ) ) ) ; assertThat ( audioCaps . getRecorders ( ) . size ( ) , is ( 1 ) ) ; assertThat ( audioCaps . getRecorders ( ) , hasItem ( new AudioRecorder ( AudioRecorderEnum . MICROPHONE , "none" , null ) ) ) ; assertThat ( "Audio sample rate not equal to 14.4" , DoubleMath . fuzzyEquals ( audioCaps . getSampleRatesKHz ( ) . get ( 0 ) . doubleValue ( ) , 14.4 , 0.00001 ) ) ; }
Test that status capabilities are available as filled out in the ExampleAsset capability XML.
Test that status capabilities are available as filled out in the ExampleAsset capability XML .