mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestCustomCommsService.java
public void testSetTransportLayerName() throws CCommException, FactoryException, InterruptedException, 
        PersistenceFailedException, IllegalArgumentException, IOException
    {
        CustomCommsService customCommsService = ServiceUtils.getService(m_Context, CustomCommsService.class);
        assertThat(customCommsService, is(notNullValue()));
        
        ConfigurationAdmin configAdmin = ServiceUtils.getService(m_Context, ConfigurationAdmin.class);
        assertThat(configAdmin, is(notNullValue()));
        
        //set the transport layer name at creation
        TransportLayer layer = customCommsService.createTransportLayer(EchoTransport.class.getName(), "tl-2", 
                (String)null);
        assertThat(customCommsService.isTransportLayerCreated("tl-2"), is(true));
        
        layer.setName("test-tl");
          
        assertThat(customCommsService.isTransportLayerCreated("test-tl"), is(true));
        
        TransportLayer layer2 = customCommsService.createTransportLayer(EchoTransport.class.getName(), "tl-3", 
                (String)null);

        try
        {
            layer2.setName("test-tl");
            fail("expecting exception");
        }
        catch (Exception e)
        {
            
        }
        
        assertThat(layer.getName(), is("test-tl"));
        assertThat(layer2.getName(), is(not("test-tl")));
        
        assertThat(customCommsService.isTransportLayerCreated("test-tl"), is(true));
        assertThat(customCommsService.isTransportLayerCreated("tl-3"), is(true));
    }
/**
     * Test setting the link layer's name. The name should only be set if it is unique.
     */
Test setting the link layer's name. The name should only be set if it is unique.
Test setting the link layer ' s name . The name should only be set if it is unique .
public void testSetTransportLayerName() throws CCommException, FactoryException, InterruptedException, 
        PersistenceFailedException, IllegalArgumentException, IOException
    {
        CustomCommsService customCommsService = ServiceUtils.getService(m_Context, CustomCommsService.class);
        assertThat(customCommsService, is(notNullValue()));
        ConfigurationAdmin configAdmin = ServiceUtils.getService(m_Context, ConfigurationAdmin.class);
        assertThat(configAdmin, is(notNullValue()));
        TransportLayer layer = customCommsService.createTransportLayer(EchoTransport.class.getName(), "tl-2", 
                (String)null);
        assertThat(customCommsService.isTransportLayerCreated("tl-2"), is(true));
        layer.setName("test-tl");
        assertThat(customCommsService.isTransportLayerCreated("test-tl"), is(true));
        TransportLayer layer2 = customCommsService.createTransportLayer(EchoTransport.class.getName(), "tl-3", 
                (String)null);
        try
        {
            layer2.setName("test-tl");
            fail("expecting exception");
        }
        catch (Exception e)
        {
        }
        assertThat(layer.getName(), is("test-tl"));
        assertThat(layer2.getName(), is(not("test-tl")));
        assertThat(customCommsService.isTransportLayerCreated("test-tl"), is(true));
        assertThat(customCommsService.isTransportLayerCreated("tl-3"), is(true));
    }
public void testSetTransportLayerName ( ) throws CCommException , FactoryException , InterruptedException , PersistenceFailedException , IllegalArgumentException , IOException { CustomCommsService customCommsService = ServiceUtils . getService ( m_Context , CustomCommsService . class ) ; assertThat ( customCommsService , is ( notNullValue ( ) ) ) ; ConfigurationAdmin configAdmin = ServiceUtils . getService ( m_Context , ConfigurationAdmin . class ) ; assertThat ( configAdmin , is ( notNullValue ( ) ) ) ; TransportLayer layer = customCommsService . createTransportLayer ( EchoTransport . class . getName ( ) , "tl-2" , ( String ) null ) ; assertThat ( customCommsService . isTransportLayerCreated ( "tl-2" ) , is ( true ) ) ; layer . setName ( "test-tl" ) ; assertThat ( customCommsService . isTransportLayerCreated ( "test-tl" ) , is ( true ) ) ; TransportLayer layer2 = customCommsService . createTransportLayer ( EchoTransport . class . getName ( ) , "tl-3" , ( String ) null ) ; try { layer2 . setName ( "test-tl" ) ; fail ( "expecting exception" ) ; } catch ( Exception e ) { } assertThat ( layer . getName ( ) , is ( "test-tl" ) ) ; assertThat ( layer2 . getName ( ) , is ( not ( "test-tl" ) ) ) ; assertThat ( customCommsService . isTransportLayerCreated ( "test-tl" ) , is ( true ) ) ; assertThat ( customCommsService . isTransportLayerCreated ( "tl-3" ) , is ( true ) ) ; }
Test setting the link layer's name.
Test setting the link layer ' s name .
//set the transport layer name at creation