mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testHandleGetAssetsEventOneAssetRemoved()
    {
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        
        //this should render two assets for the system id
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        
        //verify request for asset info
        verify(m_MessageFactory, times(2)).createAssetMessage(
                eq(AssetMessageType.GetNameRequest),
                Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));
        
        verify(m_MessageFactory, times(2)).createAssetMessage(
            eq(AssetMessageType.GetActiveStatusRequest), 
            Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));

        //verify assets added
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));

        //replay, this event will represent a get asset response with one of the
        //previously associated assets no long returned, asset with uuid2 is the one not returned
        getAssetsReponse = mockGetAssetsResponseOneRemovedAsset(systemId1);
        
        //this should render two assets for the system id
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        
        //verify asset is no longer associated
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(1));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).get(0).getUuid(), is(uuid1));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).get(0).getType(), is(Asset.class.getName()));
    }
/**
     * Test the handling of get assets event.
     * Verify assets are added.
     * Verify that if an additional response for get assets is received and an asset is no longer
     * associated with the system that it is removed.
     */
Test the handling of get assets event.
Verify assets are added.
Verify that if an additional response for get assets is received and an asset is no longer
associated with the system that it is removed.
Test the handling of get assets event . Verify assets are added . Verify that if an additional response for get assets is received and an asset is no longer associated with the system that it is removed .
@Test
    public void testHandleGetAssetsEventOneAssetRemoved()
    {
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        verify(m_MessageFactory, times(2)).createAssetMessage(
                eq(AssetMessageType.GetNameRequest),
                Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));
        verify(m_MessageFactory, times(2)).createAssetMessage(
            eq(AssetMessageType.GetActiveStatusRequest), 
            Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));
        getAssetsReponse = mockGetAssetsResponseOneRemovedAsset(systemId1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(1));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).get(0).getUuid(), is(uuid1));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).get(0).getType(), is(Asset.class.getName()));
    }
@ Test public void testHandleGetAssetsEventOneAssetRemoved ( ) { Event getAssetsReponse = mockGetAssetsResponse ( systemId1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; verify ( m_MessageFactory , times ( 2 ) ) . createAssetMessage ( eq ( AssetMessageType . GetNameRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper , times ( 7 ) ) . queue ( eq ( systemId1 ) , ( ResponseHandler ) eq ( null ) ) ; verify ( m_MessageFactory , times ( 2 ) ) . createAssetMessage ( eq ( AssetMessageType . GetActiveStatusRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper , times ( 7 ) ) . queue ( eq ( systemId1 ) , ( ResponseHandler ) eq ( null ) ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . size ( ) , is ( 2 ) ) ; getAssetsReponse = mockGetAssetsResponseOneRemovedAsset ( systemId1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . size ( ) , is ( 1 ) ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . get ( 0 ) . getUuid ( ) , is ( uuid1 ) ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . get ( 0 ) . getType ( ) , is ( Asset . class . getName ( ) ) ) ; }
Test the handling of get assets event.
Test the handling of get assets event .
//this should render two assets for the system id //verify request for asset info //verify assets added //replay, this event will represent a get asset response with one of the //previously associated assets no long returned, asset with uuid2 is the one not returned //this should render two assets for the system id //verify asset is no longer associated