mil.dod.th.ose.integration/src/mil/dod/th/ose/controller/integration/utils/AssetTestUtils.java
public static void waitForStatusChange(final Asset asset, final SummaryStatusEnum status, final int timeout) 
        throws InterruptedException
    {
        //syncer for status
        final EventHandlerSyncer statusChangeSyncer = new EventHandlerSyncer(
                Asset.TOPIC_STATUS_CHANGED, String.format("(&(%s=%s)(%s=%s))", 
                    FactoryDescriptor.EVENT_PROP_OBJ_UUID, asset.getUuid().toString(),
                    Asset.EVENT_PROP_ASSET_STATUS_SUMMARY, status.toString()));

        final Observation statusObs = asset.getLastStatus();
        if (statusObs.getStatus().getSummaryStatus().getSummary() != status)
        {
            statusChangeSyncer.waitForEvent(timeout);
            
            //verify the status
            final Observation postStatusObs = asset.getLastStatus();
            assertThat(postStatusObs, is(notNullValue()));
            assertThat(postStatusObs.getStatus().getSummaryStatus().getSummary(), is(status));
        }
    }
/**
     * Wait for a specified amount of time for the specified status change event. Will only wait if the status
     * is not the specified status. (The current status is checked.)
     * @param asset
     *      the asset to expect the status change from
     * @param status
     *      the status to wait for the asset to change to
     * @param timeout
     *      the length of time to wait
     */
Wait for a specified amount of time for the specified status change event. Will only wait if the status
is not the specified status. (The current status is checked.)
@param asset
the asset to expect the status change from
@param status
the status to wait for the asset to change to
@param timeout
the length of time to wait
Wait for a specified amount of time for the specified status change event . Will only wait if the status is not the specified status . ( The current status is checked . ) @param asset the asset to expect the status change from @param status the status to wait for the asset to change to @param timeout the length of time to wait
public static void waitForStatusChange(final Asset asset, final SummaryStatusEnum status, final int timeout) 
        throws InterruptedException
    {
        final EventHandlerSyncer statusChangeSyncer = new EventHandlerSyncer(
                Asset.TOPIC_STATUS_CHANGED, String.format("(&(%s=%s)(%s=%s))", 
                    FactoryDescriptor.EVENT_PROP_OBJ_UUID, asset.getUuid().toString(),
                    Asset.EVENT_PROP_ASSET_STATUS_SUMMARY, status.toString()));
        final Observation statusObs = asset.getLastStatus();
        if (statusObs.getStatus().getSummaryStatus().getSummary() != status)
        {
            statusChangeSyncer.waitForEvent(timeout);
            final Observation postStatusObs = asset.getLastStatus();
            assertThat(postStatusObs, is(notNullValue()));
            assertThat(postStatusObs.getStatus().getSummaryStatus().getSummary(), is(status));
        }
    }
public static void waitForStatusChange ( final Asset asset , final SummaryStatusEnum status , final int timeout ) throws InterruptedException { final EventHandlerSyncer statusChangeSyncer = new EventHandlerSyncer ( Asset . TOPIC_STATUS_CHANGED , String . format ( "(&(%s=%s)(%s=%s))" , FactoryDescriptor . EVENT_PROP_OBJ_UUID , asset . getUuid ( ) . toString ( ) , Asset . EVENT_PROP_ASSET_STATUS_SUMMARY , status . toString ( ) ) ) ; final Observation statusObs = asset . getLastStatus ( ) ; if ( statusObs . getStatus ( ) . getSummaryStatus ( ) . getSummary ( ) != status ) { statusChangeSyncer . waitForEvent ( timeout ) ; final Observation postStatusObs = asset . getLastStatus ( ) ; assertThat ( postStatusObs , is ( notNullValue ( ) ) ) ; assertThat ( postStatusObs . getStatus ( ) . getSummaryStatus ( ) . getSummary ( ) , is ( status ) ) ; } }
Wait for a specified amount of time for the specified status change event.
Wait for a specified amount of time for the specified status change event .
//syncer for status //verify the status