mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/asset/TestAssetMgrImpl.java
@Test
    public void testCreateConfiguration()
    {
        //load assets for one system
        Event getAssetsReponse = mockGetAssetsResponse(1);
        
        //this should render two assets for the system id
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        
        //verify assets added
        assertThat(m_SUT.getAssetsForControllerAsync(1).size(), is(2));
        
        List<ModifiablePropertyModel> configProps = new ArrayList<ModifiablePropertyModel>();
        
        ConfigPropModelImpl model = ModelFactory.createPropModel("id", "football");
        configProps.add(model);
        AssetModel assetModel = m_SUT.getAssetModelByUuid(uuid2, 1);
        m_SUT.createConfiguration(1, assetModel, configProps);
        
        ArgumentCaptor<Message> msgCaptor = ArgumentCaptor.forClass(Message.class);
        verify(m_MessageFactory).createAssetMessage(eq(AssetMessageType.SetPropertyRequest), msgCaptor.capture());
        
        SetPropertyRequestData data = (SetPropertyRequestData)msgCaptor.getValue();
        assertThat(data, notNullValue());
        assertThat(data.getUuid(), is(SharedMessageUtils.convertUUIDToProtoUUID(uuid2)));
        assertThat(data.getPropertiesCount(), is(1));
        
        SimpleTypesMapEntry type = data.getProperties(0);
        
        assertThat(type.getKey(), is("id"));
        assertThat(type.getValue().getStringValue(), is("football"));
    }
/**
     * Verify request is not sent out when no model exists.
     * Verify set asset property request is sent out for a model that is found.
     */
Verify request is not sent out when no model exists.
Verify set asset property request is sent out for a model that is found.
Verify request is not sent out when no model exists . Verify set asset property request is sent out for a model that is found .
@Test
    public void testCreateConfiguration()
    {
        Event getAssetsReponse = mockGetAssetsResponse(1);
        m_AssetDirHelper.handleEvent(getAssetsReponse);
        assertThat(m_SUT.getAssetsForControllerAsync(1).size(), is(2));
        List<ModifiablePropertyModel> configProps = new ArrayList<ModifiablePropertyModel>();
        ConfigPropModelImpl model = ModelFactory.createPropModel("id", "football");
        configProps.add(model);
        AssetModel assetModel = m_SUT.getAssetModelByUuid(uuid2, 1);
        m_SUT.createConfiguration(1, assetModel, configProps);
        ArgumentCaptor<Message> msgCaptor = ArgumentCaptor.forClass(Message.class);
        verify(m_MessageFactory).createAssetMessage(eq(AssetMessageType.SetPropertyRequest), msgCaptor.capture());
        SetPropertyRequestData data = (SetPropertyRequestData)msgCaptor.getValue();
        assertThat(data, notNullValue());
        assertThat(data.getUuid(), is(SharedMessageUtils.convertUUIDToProtoUUID(uuid2)));
        assertThat(data.getPropertiesCount(), is(1));
        SimpleTypesMapEntry type = data.getProperties(0);
        assertThat(type.getKey(), is("id"));
        assertThat(type.getValue().getStringValue(), is("football"));
    }
@ Test public void testCreateConfiguration ( ) { Event getAssetsReponse = mockGetAssetsResponse ( 1 ) ; m_AssetDirHelper . handleEvent ( getAssetsReponse ) ; assertThat ( m_SUT . getAssetsForControllerAsync ( 1 ) . size ( ) , is ( 2 ) ) ; List < ModifiablePropertyModel > configProps = new ArrayList < ModifiablePropertyModel > ( ) ; ConfigPropModelImpl model = ModelFactory . createPropModel ( "id" , "football" ) ; configProps . add ( model ) ; AssetModel assetModel = m_SUT . getAssetModelByUuid ( uuid2 , 1 ) ; m_SUT . createConfiguration ( 1 , assetModel , configProps ) ; ArgumentCaptor < Message > msgCaptor = ArgumentCaptor . forClass ( Message . class ) ; verify ( m_MessageFactory ) . createAssetMessage ( eq ( AssetMessageType . SetPropertyRequest ) , msgCaptor . capture ( ) ) ; SetPropertyRequestData data = ( SetPropertyRequestData ) msgCaptor . getValue ( ) ; assertThat ( data , notNullValue ( ) ) ; assertThat ( data . getUuid ( ) , is ( SharedMessageUtils . convertUUIDToProtoUUID ( uuid2 ) ) ) ; assertThat ( data . getPropertiesCount ( ) , is ( 1 ) ) ; SimpleTypesMapEntry type = data . getProperties ( 0 ) ; assertThat ( type . getKey ( ) , is ( "id" ) ) ; assertThat ( type . getValue ( ) . getStringValue ( ) , is ( "football" ) ) ; }
Verify request is not sent out when no model exists.
Verify request is not sent out when no model exists .
//load assets for one system //this should render two assets for the system id //verify assets added