mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testHandleGetAssetsEventMoreThanOneController()
    {

        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.GetActiveStatusRequest),
            Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));
        
        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 assets added to the controller id
        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
        assertThat(models.size(), is(2));
        
        //replay
        getAssetsReponse = mockGetAssetsResponse(systemId2);
        
        //this should render two assets for the system id
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        
        //verify request for asset info
        verify(m_MessageFactory, times(4)).createAssetMessage(
            eq(AssetMessageType.GetActiveStatusRequest), 
            Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId2), (ResponseHandler) eq(null));
        
        verify(m_MessageFactory, times(4)).createAssetMessage(
                eq(AssetMessageType.GetNameRequest),
                Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));

        //verify assets added, remember this will return all assets known
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId2).size(), is(2));

        //verify assets added to the controller id
        models = m_SUT.getAssetsForControllerAsync(systemId2);
        assertThat(models.size(), is(2));
        
        //verify the integrity of the models
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid1))
            {
                assertThat(model.getPid(), is(pid1));
            }
            else
            {
                assertThat(model.getUuid(), is(uuid2));
                assertThat(model.getPid(), is(pid2));
            }
        }
    }
/**
     * Test the handling of get assets event for multiple controllers.
     * Verify assets are added to appropriate system id.
     * Verify additional requests for information are sent.
     */
Test the handling of get assets event for multiple controllers.
Verify assets are added to appropriate system id.
Verify additional requests for information are sent.
Test the handling of get assets event for multiple controllers . Verify assets are added to appropriate system id . Verify additional requests for information are sent .
@Test
    public void testHandleGetAssetsEventMoreThanOneController()
    {
        Event getAssetsReponse = mockGetAssetsResponse(systemId1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        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(m_MessageFactory, times(2)).createAssetMessage(
                eq(AssetMessageType.GetNameRequest),
                Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));
        List<AssetModel> models = m_SUT.getAssetsForControllerAsync(systemId1);
        assertThat(models.size(), is(2));
        getAssetsReponse = mockGetAssetsResponse(systemId2);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        verify(m_MessageFactory, times(4)).createAssetMessage(
            eq(AssetMessageType.GetActiveStatusRequest), 
            Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId2), (ResponseHandler) eq(null));
        verify(m_MessageFactory, times(4)).createAssetMessage(
                eq(AssetMessageType.GetNameRequest),
                Mockito.any(Message.class));
        verify(m_MessageWrapper, times(7)).queue(eq(systemId1), (ResponseHandler) eq(null));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId1).size(), is(2));
        assertThat(m_SUT.getAssetsForControllerAsync(systemId2).size(), is(2));
        models = m_SUT.getAssetsForControllerAsync(systemId2);
        assertThat(models.size(), is(2));
        for (AssetModel model : models)
        {
            if (model.getUuid().equals(uuid1))
            {
                assertThat(model.getPid(), is(pid1));
            }
            else
            {
                assertThat(model.getUuid(), is(uuid2));
                assertThat(model.getPid(), is(pid2));
            }
        }
    }
@ Test public void testHandleGetAssetsEventMoreThanOneController ( ) { Event getAssetsReponse = mockGetAssetsResponse ( systemId1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; 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 ( m_MessageFactory , times ( 2 ) ) . createAssetMessage ( eq ( AssetMessageType . GetNameRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper , times ( 7 ) ) . queue ( eq ( systemId1 ) , ( ResponseHandler ) eq ( null ) ) ; List < AssetModel > models = m_SUT . getAssetsForControllerAsync ( systemId1 ) ; assertThat ( models . size ( ) , is ( 2 ) ) ; getAssetsReponse = mockGetAssetsResponse ( systemId2 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; verify ( m_MessageFactory , times ( 4 ) ) . createAssetMessage ( eq ( AssetMessageType . GetActiveStatusRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper , times ( 7 ) ) . queue ( eq ( systemId2 ) , ( ResponseHandler ) eq ( null ) ) ; verify ( m_MessageFactory , times ( 4 ) ) . createAssetMessage ( eq ( AssetMessageType . GetNameRequest ) , Mockito . any ( Message . class ) ) ; verify ( m_MessageWrapper , times ( 7 ) ) . queue ( eq ( systemId1 ) , ( ResponseHandler ) eq ( null ) ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId1 ) . size ( ) , is ( 2 ) ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( systemId2 ) . size ( ) , is ( 2 ) ) ; models = m_SUT . getAssetsForControllerAsync ( systemId2 ) ; assertThat ( models . size ( ) , is ( 2 ) ) ; for ( AssetModel model : models ) { if ( model . getUuid ( ) . equals ( uuid1 ) ) { assertThat ( model . getPid ( ) , is ( pid1 ) ) ; } else { assertThat ( model . getUuid ( ) , is ( uuid2 ) ) ; assertThat ( model . getPid ( ) , is ( pid2 ) ) ; } } }
Test the handling of get assets event for multiple controllers.
Test the handling of get assets event for multiple controllers .
//this should render two assets for the system id //verify request for asset info //verify assets added to the controller id //replay //this should render two assets for the system id //verify request for asset info //verify assets added, remember this will return all assets known //verify assets added to the controller id //verify the integrity of the models