mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAssetDirectoryService.java
public void testCaptureDataInvalidObs() throws Exception
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        ObservationStore obsStore = ServiceUtils.getService(m_Context, ObservationStore.class);

        Asset asset = assetDirectoryService.createAsset(ExampleObsExAsset.class.getName());
        AssetUtils.activateAsset(m_Context, asset, 5);

        // Capture initial observation
        final Observation captured = asset.captureData();
        try
        {
            // Try to capture again using duplicate data
            obsStore.remove(asset.captureData());

            fail("Expected exception for captureData with invalid Observation");
        }
        catch (final AssetException ex)
        {
            // Expected
        }
        finally
        {
            // Should be able to remove the observation that was successfully persisted with duplicate data between
            // different fields
            obsStore.remove(captured);

            AssetUtils.deactivateAsset(m_Context, asset);
        }
    }
/**
     * Verify exception is thrown when invalid Observation is captured from an asset.
     */
Verify exception is thrown when invalid Observation is captured from an asset.
Verify exception is thrown when invalid Observation is captured from an asset .
public void testCaptureDataInvalidObs() throws Exception
    {
        AssetDirectoryService assetDirectoryService = ServiceUtils.getService(m_Context, AssetDirectoryService.class);
        ObservationStore obsStore = ServiceUtils.getService(m_Context, ObservationStore.class);
        Asset asset = assetDirectoryService.createAsset(ExampleObsExAsset.class.getName());
        AssetUtils.activateAsset(m_Context, asset, 5);
        final Observation captured = asset.captureData();
        try
        {
            obsStore.remove(asset.captureData());
            fail("Expected exception for captureData with invalid Observation");
        }
        catch (final AssetException ex)
        {
        }
        finally
        {
            obsStore.remove(captured);
            AssetUtils.deactivateAsset(m_Context, asset);
        }
    }
public void testCaptureDataInvalidObs ( ) throws Exception { AssetDirectoryService assetDirectoryService = ServiceUtils . getService ( m_Context , AssetDirectoryService . class ) ; ObservationStore obsStore = ServiceUtils . getService ( m_Context , ObservationStore . class ) ; Asset asset = assetDirectoryService . createAsset ( ExampleObsExAsset . class . getName ( ) ) ; AssetUtils . activateAsset ( m_Context , asset , 5 ) ; final Observation captured = asset . captureData ( ) ; try { obsStore . remove ( asset . captureData ( ) ) ; fail ( "Expected exception for captureData with invalid Observation" ) ; } catch ( final AssetException ex ) { } finally { obsStore . remove ( captured ) ; AssetUtils . deactivateAsset ( m_Context , asset ) ; } }
Verify exception is thrown when invalid Observation is captured from an asset.
Verify exception is thrown when invalid Observation is captured from an asset .
// Capture initial observation // Try to capture again using duplicate data // Expected // Should be able to remove the observation that was successfully persisted with duplicate data between // different fields