mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAssetDirectoryService.java
public void testRemoveObsWithLocation() throws InterruptedException, AssetException, 
        CommandExecutionException, IllegalArgumentException, IllegalStateException, FactoryException
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        assertThat(assetDirectoryService, is(notNullValue()));
        
        Asset asset = assetDirectoryService.createAsset(ExampleAsset.class.getName());
        
        //verify override if false as GPS is not available per caps, default is true if caps aren't available
        assertThat(asset.getConfig().pluginOverridesPosition(), is(false));
        
        EventHandlerSyncer dataSyncer = new EventHandlerSyncer(m_Context, PersistentDataStore.TOPIC_DATA_MERGED);
        
        //set location
        final Command setPos = new SetPositionCommand().withLocation(
            new Coordinates().
                withLongitude(
                    new LongitudeWgsDegrees().withValue(31)).
                withLatitude(
                    new LatitudeWgsDegrees().withValue(-15)));
        assertThat(setPos, is(notNullValue()));
        final SetPositionResponse setPTResponse = (SetPositionResponse)asset.executeCommand(setPos);
        dataSyncer.waitForEvent(10);
        assertThat("Position Response is null", setPTResponse, is(notNullValue()));
        
        //verify that observations can be removed with location data set
        EventHandlerSyncer obsSyncer = new EventHandlerSyncer(m_Context, Asset.TOPIC_DATA_CAPTURED,
                String.format("(%s=%s)", FactoryDescriptor.EVENT_PROP_OBJ_UUID, asset.getUuid().toString()));
        Observation observation1 = asset.captureData();
        Observation observation2 = asset.captureData();
        Observation observation3 = asset.captureData();
        obsSyncer.waitForEvent(10, 3, 2);
        
        ObservationStore observationStore = ServiceUtils.getService(m_Context, ObservationStore.class);
        observationStore.remove(observation1.getUuid());
        observationStore.remove(observation2.getUuid());
        observationStore.remove(observation3.getUuid());
    }
/**
     * Tests persistence and removal of observation location data for an asset.
     */
Tests persistence and removal of observation location data for an asset.
Tests persistence and removal of observation location data for an asset .
public void testRemoveObsWithLocation() throws InterruptedException, AssetException, 
        CommandExecutionException, IllegalArgumentException, IllegalStateException, FactoryException
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        assertThat(assetDirectoryService, is(notNullValue()));
        Asset asset = assetDirectoryService.createAsset(ExampleAsset.class.getName());
        assertThat(asset.getConfig().pluginOverridesPosition(), is(false));
        EventHandlerSyncer dataSyncer = new EventHandlerSyncer(m_Context, PersistentDataStore.TOPIC_DATA_MERGED);
        final Command setPos = new SetPositionCommand().withLocation(
            new Coordinates().
                withLongitude(
                    new LongitudeWgsDegrees().withValue(31)).
                withLatitude(
                    new LatitudeWgsDegrees().withValue(-15)));
        assertThat(setPos, is(notNullValue()));
        final SetPositionResponse setPTResponse = (SetPositionResponse)asset.executeCommand(setPos);
        dataSyncer.waitForEvent(10);
        assertThat("Position Response is null", setPTResponse, is(notNullValue()));
        EventHandlerSyncer obsSyncer = new EventHandlerSyncer(m_Context, Asset.TOPIC_DATA_CAPTURED,
                String.format("(%s=%s)", FactoryDescriptor.EVENT_PROP_OBJ_UUID, asset.getUuid().toString()));
        Observation observation1 = asset.captureData();
        Observation observation2 = asset.captureData();
        Observation observation3 = asset.captureData();
        obsSyncer.waitForEvent(10, 3, 2);
        ObservationStore observationStore = ServiceUtils.getService(m_Context, ObservationStore.class);
        observationStore.remove(observation1.getUuid());
        observationStore.remove(observation2.getUuid());
        observationStore.remove(observation3.getUuid());
    }
public void testRemoveObsWithLocation ( ) throws InterruptedException , AssetException , CommandExecutionException , IllegalArgumentException , IllegalStateException , FactoryException { AssetDirectoryService assetDirectoryService = ServiceUtils . getService ( m_Context , AssetDirectoryService . class ) ; assertThat ( assetDirectoryService , is ( notNullValue ( ) ) ) ; Asset asset = assetDirectoryService . createAsset ( ExampleAsset . class . getName ( ) ) ; assertThat ( asset . getConfig ( ) . pluginOverridesPosition ( ) , is ( false ) ) ; EventHandlerSyncer dataSyncer = new EventHandlerSyncer ( m_Context , PersistentDataStore . TOPIC_DATA_MERGED ) ; final Command setPos = new SetPositionCommand ( ) . withLocation ( new Coordinates ( ) . withLongitude ( new LongitudeWgsDegrees ( ) . withValue ( 31 ) ) . withLatitude ( new LatitudeWgsDegrees ( ) . withValue ( - 15 ) ) ) ; assertThat ( setPos , is ( notNullValue ( ) ) ) ; final SetPositionResponse setPTResponse = ( SetPositionResponse ) asset . executeCommand ( setPos ) ; dataSyncer . waitForEvent ( 10 ) ; assertThat ( "Position Response is null" , setPTResponse , is ( notNullValue ( ) ) ) ; EventHandlerSyncer obsSyncer = new EventHandlerSyncer ( m_Context , Asset . TOPIC_DATA_CAPTURED , String . format ( "(%s=%s)" , FactoryDescriptor . EVENT_PROP_OBJ_UUID , asset . getUuid ( ) . toString ( ) ) ) ; Observation observation1 = asset . captureData ( ) ; Observation observation2 = asset . captureData ( ) ; Observation observation3 = asset . captureData ( ) ; obsSyncer . waitForEvent ( 10 , 3 , 2 ) ; ObservationStore observationStore = ServiceUtils . getService ( m_Context , ObservationStore . class ) ; observationStore . remove ( observation1 . getUuid ( ) ) ; observationStore . remove ( observation2 . getUuid ( ) ) ; observationStore . remove ( observation3 . getUuid ( ) ) ; }
Tests persistence and removal of observation location data for an asset.
Tests persistence and removal of observation location data for an asset .
//verify override if false as GPS is not available per caps, default is true if caps aren't available //set location //verify that observations can be removed with location data set