mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestAssetNamespace.java
@Test
    public final void testGetStatus() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        
        //activate the asset
        AssetNamespaceUtils.activateAsset(socket, testUuid);
        
        //Build get status request message
        GetLastStatusRequestData request = GetLastStatusRequestData.newBuilder().
                setUuid(testUuid).build();    
        
        TerraHarvestMessage message = AssetNamespaceUtils.createAssetMessage(
                AssetMessageType.GetLastStatusRequest, request);        
        message.writeDelimitedTo(socket.getOutputStream());
        
        //listen for messages for a specific time interval
        AssetNamespace response;
        try
        {
            response = (AssetNamespace)listener.waitForMessage(Namespace.Asset, 
                    AssetMessageType.GetLastStatusResponse, 500);
            GetLastStatusResponseData getStatusResponse = GetLastStatusResponseData.parseFrom(response.getData());

            ObservationGen.Observation obs = getStatusResponse.getStatusObservationNative();
            assertThat(obs.getStatus().getSummaryStatus().getSummary(), 
                    is(StatusTypesGen.SummaryStatus.Enum.GOOD));
            assertThat(obs.getStatus().getSummaryStatus().getDescription(), 
                    is("Asset Activated"));
            assertThat(getStatusResponse.getAssetUuid(), is(testUuid));
        }
        finally
        {
            // cleanup
            AssetNamespaceUtils.deactivateAsset(socket, testUuid);
        }
    }
/**
     * Verifies ability of system to remotely get the status of a single asset 
     */
Verifies ability of system to remotely get the status of a single asset
Verifies ability of system to remotely get the status of a single asset
@Test
    public final void testGetStatus() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        AssetNamespaceUtils.activateAsset(socket, testUuid);
        GetLastStatusRequestData request = GetLastStatusRequestData.newBuilder().
                setUuid(testUuid).build();    
        TerraHarvestMessage message = AssetNamespaceUtils.createAssetMessage(
                AssetMessageType.GetLastStatusRequest, request);        
        message.writeDelimitedTo(socket.getOutputStream());
        AssetNamespace response;
        try
        {
            response = (AssetNamespace)listener.waitForMessage(Namespace.Asset, 
                    AssetMessageType.GetLastStatusResponse, 500);
            GetLastStatusResponseData getStatusResponse = GetLastStatusResponseData.parseFrom(response.getData());
            ObservationGen.Observation obs = getStatusResponse.getStatusObservationNative();
            assertThat(obs.getStatus().getSummaryStatus().getSummary(), 
                    is(StatusTypesGen.SummaryStatus.Enum.GOOD));
            assertThat(obs.getStatus().getSummaryStatus().getDescription(), 
                    is("Asset Activated"));
            assertThat(getStatusResponse.getAssetUuid(), is(testUuid));
        }
        finally
        {
            AssetNamespaceUtils.deactivateAsset(socket, testUuid);
        }
    }
@ Test public final void testGetStatus ( ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; AssetNamespaceUtils . activateAsset ( socket , testUuid ) ; GetLastStatusRequestData request = GetLastStatusRequestData . newBuilder ( ) . setUuid ( testUuid ) . build ( ) ; TerraHarvestMessage message = AssetNamespaceUtils . createAssetMessage ( AssetMessageType . GetLastStatusRequest , request ) ; message . writeDelimitedTo ( socket . getOutputStream ( ) ) ; AssetNamespace response ; try { response = ( AssetNamespace ) listener . waitForMessage ( Namespace . Asset , AssetMessageType . GetLastStatusResponse , 500 ) ; GetLastStatusResponseData getStatusResponse = GetLastStatusResponseData . parseFrom ( response . getData ( ) ) ; ObservationGen . Observation obs = getStatusResponse . getStatusObservationNative ( ) ; assertThat ( obs . getStatus ( ) . getSummaryStatus ( ) . getSummary ( ) , is ( StatusTypesGen . SummaryStatus . Enum . GOOD ) ) ; assertThat ( obs . getStatus ( ) . getSummaryStatus ( ) . getDescription ( ) , is ( "Asset Activated" ) ) ; assertThat ( getStatusResponse . getAssetUuid ( ) , is ( testUuid ) ) ; } finally { AssetNamespaceUtils . deactivateAsset ( socket , testUuid ) ; } }
Verifies ability of system to remotely get the status of a single asset
Verifies ability of system to remotely get the status of a single asset
//activate the asset //Build get status request message //listen for messages for a specific time interval // cleanup