mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testHandleRemoteEventStatusChanged()
    {
        //load assets for one system
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        
        //this should render two assets for the system id
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        
        //verify assets added
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));
                
        //mock event that an asset status event for asset with uuid2
        Event assetStatus = mockEventStatusChange(systemId1);
        
        m_EventHelper.handleEvent(assetStatus);
        
        List<AssetModel>models = m_SUT.getAssetsForControllerAsync(systemId1);
        //variable to hold boolean verifying the value was indeed checked
        boolean checked = false;
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid2))
            {
                assertThat(model.getSummaryStatus(), is(SummaryStatusEnum.DEGRADED));
                assertThat(model.getSummaryDescription(), is("message"));
                checked = true;
            }
        }
        assertThat(checked, is(true));
        
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        
        Event firstPushEvent = eventCaptor.getValue();
        assertThat(firstPushEvent, notNullValue());
        assertThat(firstPushEvent.getTopic(), is(AssetMgr.TOPIC_ASSET_STATUS_UPDATED));
        assertThat((String)firstPushEvent.getProperty(Asset.EVENT_PROP_ASSET_STATUS_SUMMARY), 
                is(SummaryStatusEnum.DEGRADED.toString()));
        assertThat((String)firstPushEvent.getProperty(Asset.EVENT_PROP_ASSET_STATUS_DESCRIPTION), 
                is("message"));
        assertThat((String)firstPushEvent.getProperty(AssetModel.EVENT_PROP_UUID), is(uuid2.toString()));
    }
/**
     * Test the handling of an asset status change with a message.
     */
Test the handling of an asset status change with a message.
Test the handling of an asset status change with a message .
@Test
    public void testHandleRemoteEventStatusChanged()
    {
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));
        Event assetStatus = mockEventStatusChange(systemId1);
        m_EventHelper.handleEvent(assetStatus);
        List<AssetModel>models = m_SUT.getAssetsForControllerAsync(systemId1);
        boolean checked = false;
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid2))
            {
                assertThat(model.getSummaryStatus(), is(SummaryStatusEnum.DEGRADED));
                assertThat(model.getSummaryDescription(), is("message"));
                checked = true;
            }
        }
        assertThat(checked, is(true));
        ArgumentCaptor<Event> eventCaptor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(eventCaptor.capture());
        Event firstPushEvent = eventCaptor.getValue();
        assertThat(firstPushEvent, notNullValue());
        assertThat(firstPushEvent.getTopic(), is(AssetMgr.TOPIC_ASSET_STATUS_UPDATED));
        assertThat((String)firstPushEvent.getProperty(Asset.EVENT_PROP_ASSET_STATUS_SUMMARY), 
                is(SummaryStatusEnum.DEGRADED.toString()));
        assertThat((String)firstPushEvent.getProperty(Asset.EVENT_PROP_ASSET_STATUS_DESCRIPTION), 
                is("message"));
        assertThat((String)firstPushEvent.getProperty(AssetModel.EVENT_PROP_UUID), is(uuid2.toString()));
    }
@ Test public void testHandleRemoteEventStatusChanged ( ) { Event getAssetsReponse = mockGetAssetsResponse ( systemId1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . size ( ) , is ( 2 ) ) ; Event assetStatus = mockEventStatusChange ( systemId1 ) ; m_EventHelper . handleEvent ( assetStatus ) ; List < AssetModel > models = m_SUT . getAssetsForControllerAsync ( systemId1 ) ; boolean checked = false ; for ( AssetModel model : models ) { if ( model . getUuid ( ) . equals ( uuid2 ) ) { assertThat ( model . getSummaryStatus ( ) , is ( SummaryStatusEnum . DEGRADED ) ) ; assertThat ( model . getSummaryDescription ( ) , is ( "message" ) ) ; checked = true ; } } assertThat ( checked , is ( true ) ) ; ArgumentCaptor < Event > eventCaptor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( eventCaptor . capture ( ) ) ; Event firstPushEvent = eventCaptor . getValue ( ) ; assertThat ( firstPushEvent , notNullValue ( ) ) ; assertThat ( firstPushEvent . getTopic ( ) , is ( AssetMgr . TOPIC_ASSET_STATUS_UPDATED ) ) ; assertThat ( ( String ) firstPushEvent . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_SUMMARY ) , is ( SummaryStatusEnum . DEGRADED . toString ( ) ) ) ; assertThat ( ( String ) firstPushEvent . getProperty ( Asset . EVENT_PROP_ASSET_STATUS_DESCRIPTION ) , is ( "message" ) ) ; assertThat ( ( String ) firstPushEvent . getProperty ( AssetModel . EVENT_PROP_UUID ) , is ( uuid2 . toString ( ) ) ) ; }
Test the handling of an asset status change with a message.
Test the handling of an asset status change with a message .
//load assets for one system //this should render two assets for the system id //verify assets added //mock event that an asset status event for asset with uuid2 //variable to hold boolean verifying the value was indeed checked