mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/advanced/configuration/TestSystemConfigurationImpl.java
@Test
    public void testConfigurationAdminEventHandler() throws SecurityException, IllegalArgumentException, 
        NoSuchFieldException, IllegalAccessException
    {
        setupConfigurations();
        
        CreateFactoryConfigurationResponseData responseCreate = 
                CreateFactoryConfigurationResponseData.newBuilder().setPid("some-pid").build();
        ConfigAdminNamespace namepsace = 
                ConfigAdminNamespace.newBuilder().setType(ConfigAdminMessageType.CreateFactoryConfigurationResponse).
                setData(responseCreate.toByteString()).build();
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(25, 0, 
                Namespace.EventAdmin, 500, namepsace);
        
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(RemoteConstants.EVENT_PROP_MESSAGE, thMessage);
        props.put(RemoteConstants.EVENT_PROP_DATA_MESSAGE, responseCreate);
        props.put(RemoteConstants.EVENT_PROP_MESSAGE_TYPE, 
                ConfigAdminMessageType.CreateFactoryConfigurationResponse.toString());
        Event event = new Event(RemoteConstants.TOPIC_MESSAGE_RECEIVED, props);
        
        //Replay factory config created message received.
        m_ConfigAdminHandler.handleEvent(event);
        
        //Argument captor used to capture configuration info request.
        ArgumentCaptor<GetConfigurationInfoRequestData> infoRequestCaptor = 
                ArgumentCaptor.forClass(GetConfigurationInfoRequestData.class);
        
        //Verify the remote message sender was called.
        verify(m_MessageFactory).createConfigAdminMessage(eq(ConfigAdminMessageType.GetConfigurationInfoRequest), 
                infoRequestCaptor.capture());
        verify(m_MessageWrapper).queue(eq(25), Mockito.any(ResponseHandler.class));
        
        //Verify the filter in the configuration info request message.
        assertThat(infoRequestCaptor.getValue().getFilter(), is("(service.pid=some-pid)"));
    }
/**
     * Test the configuration admin event handlers handle event method.
     * Verify that the handler handles creating factory configurations and removing configuration appropriately.
     */
Test the configuration admin event handlers handle event method.
Verify that the handler handles creating factory configurations and removing configuration appropriately.
Test the configuration admin event handlers handle event method . Verify that the handler handles creating factory configurations and removing configuration appropriately .
@Test
    public void testConfigurationAdminEventHandler() throws SecurityException, IllegalArgumentException, 
        NoSuchFieldException, IllegalAccessException
    {
        setupConfigurations();
        CreateFactoryConfigurationResponseData responseCreate = 
                CreateFactoryConfigurationResponseData.newBuilder().setPid("some-pid").build();
        ConfigAdminNamespace namepsace = 
                ConfigAdminNamespace.newBuilder().setType(ConfigAdminMessageType.CreateFactoryConfigurationResponse).
                setData(responseCreate.toByteString()).build();
        TerraHarvestMessage thMessage = TerraHarvestMessageHelper.createTerraHarvestMessage(25, 0, 
                Namespace.EventAdmin, 500, namepsace);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(RemoteConstants.EVENT_PROP_MESSAGE, thMessage);
        props.put(RemoteConstants.EVENT_PROP_DATA_MESSAGE, responseCreate);
        props.put(RemoteConstants.EVENT_PROP_MESSAGE_TYPE, 
                ConfigAdminMessageType.CreateFactoryConfigurationResponse.toString());
        Event event = new Event(RemoteConstants.TOPIC_MESSAGE_RECEIVED, props);
        m_ConfigAdminHandler.handleEvent(event);
        ArgumentCaptor<GetConfigurationInfoRequestData> infoRequestCaptor = 
                ArgumentCaptor.forClass(GetConfigurationInfoRequestData.class);
        verify(m_MessageFactory).createConfigAdminMessage(eq(ConfigAdminMessageType.GetConfigurationInfoRequest), 
                infoRequestCaptor.capture());
        verify(m_MessageWrapper).queue(eq(25), Mockito.any(ResponseHandler.class));
        assertThat(infoRequestCaptor.getValue().getFilter(), is("(service.pid=some-pid)"));
    }
@ Test public void testConfigurationAdminEventHandler ( ) throws SecurityException , IllegalArgumentException , NoSuchFieldException , IllegalAccessException { setupConfigurations ( ) ; CreateFactoryConfigurationResponseData responseCreate = CreateFactoryConfigurationResponseData . newBuilder ( ) . setPid ( "some-pid" ) . build ( ) ; ConfigAdminNamespace namepsace = ConfigAdminNamespace . newBuilder ( ) . setType ( ConfigAdminMessageType . CreateFactoryConfigurationResponse ) . setData ( responseCreate . toByteString ( ) ) . build ( ) ; TerraHarvestMessage thMessage = TerraHarvestMessageHelper . createTerraHarvestMessage ( 25 , 0 , Namespace . EventAdmin , 500 , namepsace ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( RemoteConstants . EVENT_PROP_MESSAGE , thMessage ) ; props . put ( RemoteConstants . EVENT_PROP_DATA_MESSAGE , responseCreate ) ; props . put ( RemoteConstants . EVENT_PROP_MESSAGE_TYPE , ConfigAdminMessageType . CreateFactoryConfigurationResponse . toString ( ) ) ; Event event = new Event ( RemoteConstants . TOPIC_MESSAGE_RECEIVED , props ) ; m_ConfigAdminHandler . handleEvent ( event ) ; ArgumentCaptor < GetConfigurationInfoRequestData > infoRequestCaptor = ArgumentCaptor . forClass ( GetConfigurationInfoRequestData . class ) ; verify ( m_MessageFactory ) . createConfigAdminMessage ( eq ( ConfigAdminMessageType . GetConfigurationInfoRequest ) , infoRequestCaptor . capture ( ) ) ; verify ( m_MessageWrapper ) . queue ( eq ( 25 ) , Mockito . any ( ResponseHandler . class ) ) ; assertThat ( infoRequestCaptor . getValue ( ) . getFilter ( ) , is ( "(service.pid=some-pid)" ) ) ; }
Test the configuration admin event handlers handle event method.
Test the configuration admin event handlers handle event method .
//Replay factory config created message received. //Argument captor used to capture configuration info request. //Verify the remote message sender was called. //Verify the filter in the configuration info request message.