mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAssetDirectoryService.java
public void testScan() throws Exception
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        assertThat(assetDirectoryService, is(notNullValue()));
        
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context, 
                AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS_COMPLETE, 
                String.format("(!(%s=*))", FactoryDescriptor.EVENT_PROP_OBJ_TYPE));
        
        assetDirectoryService.scanForNewAssets();
        
        syncer.waitForEvent(20);
        
        Set<Asset> assets = assetDirectoryService.getAssets();
        assertThat("Scanning did not create assets", assets.size() > 0);
        
        Set<Asset> exampleAssets = assetDirectoryService.getAssetsByType(ExampleAsset.class.getName());
        assertThat(exampleAssets.size(), is(1));
        
        Asset exampleAsset = exampleAssets.iterator().next();
        
        //Verify that name is set to a none default.
        assertThat(exampleAsset.getName(), is(ExampleAssetScanner.ASSET_NAME));
        Map<String, Object> props = exampleAsset.getProperties();
        assertThat((String)props.get(ExampleAssetAttributes.CONFIG_PROP_DEVICE_POWER_NAME), is("exampleB"));

        AssetUtils.activateAsset(m_Context, exampleAsset, 5);

        AssetUtils.deactivateAsset(m_Context, exampleAsset);
    }
/**
     * Verify the asset scan will pick up assets if scanner is enabled.
     */
Verify the asset scan will pick up assets if scanner is enabled.
Verify the asset scan will pick up assets if scanner is enabled .
public void testScan() throws Exception
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        assertThat(assetDirectoryService, is(notNullValue()));
        EventHandlerSyncer syncer = new EventHandlerSyncer(m_Context, 
                AssetDirectoryService.TOPIC_SCANNING_FOR_ASSETS_COMPLETE, 
                String.format("(!(%s=*))", FactoryDescriptor.EVENT_PROP_OBJ_TYPE));
        assetDirectoryService.scanForNewAssets();
        syncer.waitForEvent(20);
        Set<Asset> assets = assetDirectoryService.getAssets();
        assertThat("Scanning did not create assets", assets.size() > 0);
        Set<Asset> exampleAssets = assetDirectoryService.getAssetsByType(ExampleAsset.class.getName());
        assertThat(exampleAssets.size(), is(1));
        Asset exampleAsset = exampleAssets.iterator().next();
        assertThat(exampleAsset.getName(), is(ExampleAssetScanner.ASSET_NAME));
        Map<String, Object> props = exampleAsset.getProperties();
        assertThat((String)props.get(ExampleAssetAttributes.CONFIG_PROP_DEVICE_POWER_NAME), is("exampleB"));
        AssetUtils.activateAsset(m_Context, exampleAsset, 5);
        AssetUtils.deactivateAsset(m_Context, exampleAsset);
    }
public void testScan ( ) throws Exception { AssetDirectoryService assetDirectoryService = ServiceUtils . getService ( m_Context , AssetDirectoryService . class ) ; assertThat ( assetDirectoryService , is ( notNullValue ( ) ) ) ; EventHandlerSyncer syncer = new EventHandlerSyncer ( m_Context , AssetDirectoryService . TOPIC_SCANNING_FOR_ASSETS_COMPLETE , String . format ( "(!(%s=*))" , FactoryDescriptor . EVENT_PROP_OBJ_TYPE ) ) ; assetDirectoryService . scanForNewAssets ( ) ; syncer . waitForEvent ( 20 ) ; Set < Asset > assets = assetDirectoryService . getAssets ( ) ; assertThat ( "Scanning did not create assets" , assets . size ( ) > 0 ) ; Set < Asset > exampleAssets = assetDirectoryService . getAssetsByType ( ExampleAsset . class . getName ( ) ) ; assertThat ( exampleAssets . size ( ) , is ( 1 ) ) ; Asset exampleAsset = exampleAssets . iterator ( ) . next ( ) ; assertThat ( exampleAsset . getName ( ) , is ( ExampleAssetScanner . ASSET_NAME ) ) ; Map < String , Object > props = exampleAsset . getProperties ( ) ; assertThat ( ( String ) props . get ( ExampleAssetAttributes . CONFIG_PROP_DEVICE_POWER_NAME ) , is ( "exampleB" ) ) ; AssetUtils . activateAsset ( m_Context , exampleAsset , 5 ) ; AssetUtils . deactivateAsset ( m_Context , exampleAsset ) ; }
Verify the asset scan will pick up assets if scanner is enabled.
Verify the asset scan will pick up assets if scanner is enabled .
//Verify that name is set to a none default.