mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestCustomCommsService.java
public void testSetPhysicalLinkName() throws IllegalArgumentException, IOException, InterruptedException, 
        CCommException, IllegalStateException, FactoryException, PersistenceFailedException
    {
        CustomCommsService customCommsService = ServiceUtils.getService(m_Context, CustomCommsService.class);
        assertThat(customCommsService, is(notNullValue()));
        
        EventHandlerSyncer syncer = 
            new EventHandlerSyncer(m_Context, FactoryDescriptor.TOPIC_FACTORY_OBJ_NAME_UPDATED, 
                    "(obj.name=testResetNamePhys)");
        
        //set the name at creation
        UUID uuid = customCommsService.tryCreatePhysicalLink(PhysicalLinkTypeEnum.I_2_C, "testSetNamePhys");
        PhysicalLink link = customCommsService.requestPhysicalLink(uuid);
        //add to list for cleanup
        assertThat(link.getName(), is("testSetNamePhys"));
        
        //duplicate name exception should not be thrown
        link.setName("testResetNamePhys");
        
        //wait for expected event
        syncer.waitForEvent(5);
        
        //release the link
        link.release();
        
        //replay
        PhysicalLink link2 = customCommsService.createPhysicalLink(PhysicalLinkTypeEnum.I_2_C);
        //add to list for cleanup
        try
        {
            link2.setName("testResetNamePhys");
            fail("Should have thrown exception");
        }
        catch (IllegalArgumentException e)
        {
            
        }
        
        assertThat(link.getName(), is("testResetNamePhys"));
        assertThat(link2.getName(), is(not("testResetNamePhys")));
    }
/**
     * Test setting a physical link layer's name. 
     * Verify that the name cannot be duplicated.
     */
Test setting a physical link layer's name.
Verify that the name cannot be duplicated.
Test setting a physical link layer ' s name . Verify that the name cannot be duplicated .
public void testSetPhysicalLinkName() throws IllegalArgumentException, IOException, InterruptedException, 
        CCommException, IllegalStateException, FactoryException, PersistenceFailedException
    {
        CustomCommsService customCommsService = ServiceUtils.getService(m_Context, CustomCommsService.class);
        assertThat(customCommsService, is(notNullValue()));
        EventHandlerSyncer syncer = 
            new EventHandlerSyncer(m_Context, FactoryDescriptor.TOPIC_FACTORY_OBJ_NAME_UPDATED, 
                    "(obj.name=testResetNamePhys)");
        UUID uuid = customCommsService.tryCreatePhysicalLink(PhysicalLinkTypeEnum.I_2_C, "testSetNamePhys");
        PhysicalLink link = customCommsService.requestPhysicalLink(uuid);
        assertThat(link.getName(), is("testSetNamePhys"));
        link.setName("testResetNamePhys");
        syncer.waitForEvent(5);
        link.release();
        PhysicalLink link2 = customCommsService.createPhysicalLink(PhysicalLinkTypeEnum.I_2_C);
        try
        {
            link2.setName("testResetNamePhys");
            fail("Should have thrown exception");
        }
        catch (IllegalArgumentException e)
        {
        }
        assertThat(link.getName(), is("testResetNamePhys"));
        assertThat(link2.getName(), is(not("testResetNamePhys")));
    }
public void testSetPhysicalLinkName ( ) throws IllegalArgumentException , IOException , InterruptedException , CCommException , IllegalStateException , FactoryException , PersistenceFailedException { CustomCommsService customCommsService = ServiceUtils . getService ( m_Context , CustomCommsService . class ) ; assertThat ( customCommsService , is ( notNullValue ( ) ) ) ; EventHandlerSyncer syncer = new EventHandlerSyncer ( m_Context , FactoryDescriptor . TOPIC_FACTORY_OBJ_NAME_UPDATED , "(obj.name=testResetNamePhys)" ) ; UUID uuid = customCommsService . tryCreatePhysicalLink ( PhysicalLinkTypeEnum . I_2_C , "testSetNamePhys" ) ; PhysicalLink link = customCommsService . requestPhysicalLink ( uuid ) ; assertThat ( link . getName ( ) , is ( "testSetNamePhys" ) ) ; link . setName ( "testResetNamePhys" ) ; syncer . waitForEvent ( 5 ) ; link . release ( ) ; PhysicalLink link2 = customCommsService . createPhysicalLink ( PhysicalLinkTypeEnum . I_2_C ) ; try { link2 . setName ( "testResetNamePhys" ) ; fail ( "Should have thrown exception" ) ; } catch ( IllegalArgumentException e ) { } assertThat ( link . getName ( ) , is ( "testResetNamePhys" ) ) ; assertThat ( link2 . getName ( ) , is ( not ( "testResetNamePhys" ) ) ) ; }
Test setting a physical link layer's name.
Test setting a physical link layer ' s name .
//set the name at creation //add to list for cleanup //duplicate name exception should not be thrown //wait for expected event //release the link //replay //add to list for cleanup