mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetTypesMgrImpl.java
@Test
    public void testGetAssetTypesMultiControllers()
    {
        //load assets for system id
        Event getTypes = mockMessageGetAssetTypesResponse(systemId1);
        
        //this should render two asset types for the system id
        m_AssetHelper.handleEvent(getTypes);
        
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId1).size(), is(2));

        //collect all the names
        Set<String> types = new HashSet<String>();
        for (AssetFactoryModel model : m_SUT.getAssetFactoriesForControllerAsync(systemId1))
        {
            types.add(model.getFullyQualifiedAssetType());
        }
        //verify the FQCNs were found
        assertThat(types, hasItem("super.awesome.OutOfThisWorld"));
        assertThat(types, hasItem("sometimes.youfeellikeanut.SometimesYouDont"));
        
        //verify that the new system id to be used does not return any models
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId2).isEmpty(), is(true));
        
        //check using different controller id
        getTypes = mockMessageGetAssetTypesUpdateResponse(systemId2);
        
        //this should render two assets for the system id
        m_AssetHelper.handleEvent(getTypes);
        
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId2).size(), is(4));
        
        //collect all the names
        types = new HashSet<String>();
        for (AssetFactoryModel model : m_SUT.getAssetFactoriesForControllerAsync(systemId2))
        {
            types.add(model.getFullyQualifiedAssetType());
        }
        //verify the FQCNs were found
        assertThat(types, hasItem("super.amazing.Stuff"));
        assertThat(types, hasItem("bza.ret.plkjds"));
        
        //get controller removed event
        Event removedController = mockControllerRemovedEvent(systemId1);
        m_ControllerRemoved.handleEvent(removedController);
        
        //verify that the system id is not longer known
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId1).isEmpty(), is(true));
    }
/**
     * Test the handling of the get asset types for multiple controllers.
     * Verify that the product types are correctly added.
     * Verify that the removed controller event removes the correct controller. 
     */
Test the handling of the get asset types for multiple controllers.
Verify that the product types are correctly added.
Verify that the removed controller event removes the correct controller.
Test the handling of the get asset types for multiple controllers . Verify that the product types are correctly added . Verify that the removed controller event removes the correct controller .
@Test
    public void testGetAssetTypesMultiControllers()
    {
        Event getTypes = mockMessageGetAssetTypesResponse(systemId1);
        m_AssetHelper.handleEvent(getTypes);
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId1).size(), is(2));
        Set<String> types = new HashSet<String>();
        for (AssetFactoryModel model : m_SUT.getAssetFactoriesForControllerAsync(systemId1))
        {
            types.add(model.getFullyQualifiedAssetType());
        }
        assertThat(types, hasItem("super.awesome.OutOfThisWorld"));
        assertThat(types, hasItem("sometimes.youfeellikeanut.SometimesYouDont"));
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId2).isEmpty(), is(true));
        getTypes = mockMessageGetAssetTypesUpdateResponse(systemId2);
        m_AssetHelper.handleEvent(getTypes);
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId2).size(), is(4));
        types = new HashSet<String>();
        for (AssetFactoryModel model : m_SUT.getAssetFactoriesForControllerAsync(systemId2))
        {
            types.add(model.getFullyQualifiedAssetType());
        }
        assertThat(types, hasItem("super.amazing.Stuff"));
        assertThat(types, hasItem("bza.ret.plkjds"));
        Event removedController = mockControllerRemovedEvent(systemId1);
        m_ControllerRemoved.handleEvent(removedController);
        assertThat(m_SUT.getAssetFactoriesForControllerAsync(systemId1).isEmpty(), is(true));
    }
@ Test public void testGetAssetTypesMultiControllers ( ) { Event getTypes = mockMessageGetAssetTypesResponse ( systemId1 ) ; m_AssetHelper . handleEvent ( getTypes ) ; assertThat ( m_SUT . getAssetFactoriesForControllerAsync ( systemId1 ) . size ( ) , is ( 2 ) ) ; Set < String > types = new HashSet < String > ( ) ; for ( AssetFactoryModel model : m_SUT . getAssetFactoriesForControllerAsync ( systemId1 ) ) { types . add ( model . getFullyQualifiedAssetType ( ) ) ; } assertThat ( types , hasItem ( "super.awesome.OutOfThisWorld" ) ) ; assertThat ( types , hasItem ( "sometimes.youfeellikeanut.SometimesYouDont" ) ) ; assertThat ( m_SUT . getAssetFactoriesForControllerAsync ( systemId2 ) . isEmpty ( ) , is ( true ) ) ; getTypes = mockMessageGetAssetTypesUpdateResponse ( systemId2 ) ; m_AssetHelper . handleEvent ( getTypes ) ; assertThat ( m_SUT . getAssetFactoriesForControllerAsync ( systemId2 ) . size ( ) , is ( 4 ) ) ; types = new HashSet < String > ( ) ; for ( AssetFactoryModel model : m_SUT . getAssetFactoriesForControllerAsync ( systemId2 ) ) { types . add ( model . getFullyQualifiedAssetType ( ) ) ; } assertThat ( types , hasItem ( "super.amazing.Stuff" ) ) ; assertThat ( types , hasItem ( "bza.ret.plkjds" ) ) ; Event removedController = mockControllerRemovedEvent ( systemId1 ) ; m_ControllerRemoved . handleEvent ( removedController ) ; assertThat ( m_SUT . getAssetFactoriesForControllerAsync ( systemId1 ) . isEmpty ( ) , is ( true ) ) ; }
Test the handling of the get asset types for multiple controllers.
Test the handling of the get asset types for multiple controllers .
//load assets for system id //this should render two asset types for the system id //collect all the names //verify the FQCNs were found //verify that the new system id to be used does not return any models //check using different controller id //this should render two assets for the system id //collect all the names //verify the FQCNs were found //get controller removed event //verify that the system id is not longer known