mil.dod.th.ose.remote.integration/src/mil/dod/th/ose/remote/integration/namespace/TestConfigAdminNamespace.java
@Test
    public void testSetPropertyNonFactory() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        
        //register to listen for magic number event that will be posted when the configuration value is 25
        RemoteEventRegistration.regRemoteEventMessages(socket, "TOPIC_MAGICAL_UPDATE_EXAMPLECLASS");
        
        Multitype value = Multitype.newBuilder().setType(Type.INT32).setInt32Value(25).build();
        SimpleTypesMapEntry prop = SimpleTypesMapEntry.newBuilder()
                .setKey(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE).setValue(value).build();
        SetPropertyRequestData requestSet = SetPropertyRequestData.newBuilder().
            setPid(ExampleClass.CONFIG_PID).addProperties(prop).build();
        
        //create terra harvest message   
        TerraHarvestMessage thMessage = createConfigAdminMessage(ConfigAdminMessageType.SetPropertyRequest, requestSet);
                
        // send out message
        thMessage.writeDelimitedTo(socket.getOutputStream());
        
        //collect responses
        listener.waitForMessages(4500, 
                new BasicMessageMatcher(Namespace.ConfigAdmin, ConfigAdminMessageType.SetPropertyResponse),
                new EventMessageMatcher("TOPIC_MAGICAL_UPDATE_EXAMPLECLASS"));
        
        GetPropertyRequestData requestGet = GetPropertyRequestData.newBuilder().
                setPid(ExampleClass.CONFIG_PID).
                setKey(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE).build();
            
        //create terra harvest message   
        thMessage = createConfigAdminMessage(ConfigAdminMessageType.GetPropertyRequest, requestGet);

        // send out message
        thMessage.writeDelimitedTo(socket.getOutputStream());
        
        //wait
        ConfigAdminNamespace namespaceResponse = (ConfigAdminNamespace)listener.waitForMessage(
                Namespace.ConfigAdmin, ConfigAdminMessageType.GetPropertyResponse, 500);
        
        GetPropertyResponseData propData = GetPropertyResponseData.parseFrom(namespaceResponse.getData());
        assertThat(propData.getValue().getInt32Value(), is(25));
        assertThat(propData.getPid(), is(ExampleClass.CONFIG_PID));
        assertThat(propData.getKey(), is(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE));
    }
/**
     * Test setting a configuration value for a configuration that is not a factory.
     * Verify value is set.
     */
Test setting a configuration value for a configuration that is not a factory.
Verify value is set.
Test setting a configuration value for a configuration that is not a factory . Verify value is set .
@Test
    public void testSetPropertyNonFactory() throws IOException, InterruptedException
    {
        MessageListener listener = new MessageListener(socket);
        RemoteEventRegistration.regRemoteEventMessages(socket, "TOPIC_MAGICAL_UPDATE_EXAMPLECLASS");
        Multitype value = Multitype.newBuilder().setType(Type.INT32).setInt32Value(25).build();
        SimpleTypesMapEntry prop = SimpleTypesMapEntry.newBuilder()
                .setKey(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE).setValue(value).build();
        SetPropertyRequestData requestSet = SetPropertyRequestData.newBuilder().
            setPid(ExampleClass.CONFIG_PID).addProperties(prop).build();
        TerraHarvestMessage thMessage = createConfigAdminMessage(ConfigAdminMessageType.SetPropertyRequest, requestSet);
        thMessage.writeDelimitedTo(socket.getOutputStream());
        listener.waitForMessages(4500, 
                new BasicMessageMatcher(Namespace.ConfigAdmin, ConfigAdminMessageType.SetPropertyResponse),
                new EventMessageMatcher("TOPIC_MAGICAL_UPDATE_EXAMPLECLASS"));
        GetPropertyRequestData requestGet = GetPropertyRequestData.newBuilder().
                setPid(ExampleClass.CONFIG_PID).
                setKey(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE).build();
        thMessage = createConfigAdminMessage(ConfigAdminMessageType.GetPropertyRequest, requestGet);
        thMessage.writeDelimitedTo(socket.getOutputStream());
        ConfigAdminNamespace namespaceResponse = (ConfigAdminNamespace)listener.waitForMessage(
                Namespace.ConfigAdmin, ConfigAdminMessageType.GetPropertyResponse, 500);
        GetPropertyResponseData propData = GetPropertyResponseData.parseFrom(namespaceResponse.getData());
        assertThat(propData.getValue().getInt32Value(), is(25));
        assertThat(propData.getPid(), is(ExampleClass.CONFIG_PID));
        assertThat(propData.getKey(), is(ExampleClassConfig.CONFIG_PROP_EXAMPLE_CONFIG_VALUE));
    }
@ Test public void testSetPropertyNonFactory ( ) throws IOException , InterruptedException { MessageListener listener = new MessageListener ( socket ) ; RemoteEventRegistration . regRemoteEventMessages ( socket , "TOPIC_MAGICAL_UPDATE_EXAMPLECLASS" ) ; Multitype value = Multitype . newBuilder ( ) . setType ( Type . INT32 ) . setInt32Value ( 25 ) . build ( ) ; SimpleTypesMapEntry prop = SimpleTypesMapEntry . newBuilder ( ) . setKey ( ExampleClassConfig . CONFIG_PROP_EXAMPLE_CONFIG_VALUE ) . setValue ( value ) . build ( ) ; SetPropertyRequestData requestSet = SetPropertyRequestData . newBuilder ( ) . setPid ( ExampleClass . CONFIG_PID ) . addProperties ( prop ) . build ( ) ; TerraHarvestMessage thMessage = createConfigAdminMessage ( ConfigAdminMessageType . SetPropertyRequest , requestSet ) ; thMessage . writeDelimitedTo ( socket . getOutputStream ( ) ) ; listener . waitForMessages ( 4500 , new BasicMessageMatcher ( Namespace . ConfigAdmin , ConfigAdminMessageType . SetPropertyResponse ) , new EventMessageMatcher ( "TOPIC_MAGICAL_UPDATE_EXAMPLECLASS" ) ) ; GetPropertyRequestData requestGet = GetPropertyRequestData . newBuilder ( ) . setPid ( ExampleClass . CONFIG_PID ) . setKey ( ExampleClassConfig . CONFIG_PROP_EXAMPLE_CONFIG_VALUE ) . build ( ) ; thMessage = createConfigAdminMessage ( ConfigAdminMessageType . GetPropertyRequest , requestGet ) ; thMessage . writeDelimitedTo ( socket . getOutputStream ( ) ) ; ConfigAdminNamespace namespaceResponse = ( ConfigAdminNamespace ) listener . waitForMessage ( Namespace . ConfigAdmin , ConfigAdminMessageType . GetPropertyResponse , 500 ) ; GetPropertyResponseData propData = GetPropertyResponseData . parseFrom ( namespaceResponse . getData ( ) ) ; assertThat ( propData . getValue ( ) . getInt32Value ( ) , is ( 25 ) ) ; assertThat ( propData . getPid ( ) , is ( ExampleClass . CONFIG_PID ) ) ; assertThat ( propData . getKey ( ) , is ( ExampleClassConfig . CONFIG_PROP_EXAMPLE_CONFIG_VALUE ) ) ; }
Test setting a configuration value for a configuration that is not a factory.
Test setting a configuration value for a configuration that is not a factory .
//register to listen for magic number event that will be posted when the configuration value is 25 //create terra harvest message    // send out message //collect responses //create terra harvest message    // send out message //wait