mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/TestLinkLayerRegistryCallback.java
@Test
    public void testPreObjectInitializeUpdated() throws FactoryException, ConfigurationException
    {
        LinkLayerInternal linkInternal = mock(LinkLayerInternal.class);
        String physObjName = "name";
        LinkLayerAttributes attrs = mock(LinkLayerAttributes.class);
        when(linkInternal.getConfig()).thenReturn(attrs);
        when(attrs.physicalLinkName()).thenReturn(physObjName);
        
        //grab phys link from comms
        PhysicalLinkInternal physInternal = mock(PhysicalLinkInternal.class);
        when(m_FactPhysInternal.getObjectByName(physObjName)).thenReturn(physInternal);
        
        when(physInternal.isInUse()).thenReturn(false);
        when(physInternal.getOwner()).thenReturn(null);

        m_SUT.preObjectInitialize(linkInternal);
        
        verify(m_CcommService).requestPhysicalLink(physObjName);
        
        // make sure updated does the same
        m_SUT.preObjectUpdated(linkInternal);
        
        verify(m_CcommService, times(2)).requestPhysicalLink(physObjName);
    }
/**
     * Verify callback retrieves the physical link and requests ownership before initialization and updating.
     */
Verify callback retrieves the physical link and requests ownership before initialization and updating.
Verify callback retrieves the physical link and requests ownership before initialization and updating .
@Test
    public void testPreObjectInitializeUpdated() throws FactoryException, ConfigurationException
    {
        LinkLayerInternal linkInternal = mock(LinkLayerInternal.class);
        String physObjName = "name";
        LinkLayerAttributes attrs = mock(LinkLayerAttributes.class);
        when(linkInternal.getConfig()).thenReturn(attrs);
        when(attrs.physicalLinkName()).thenReturn(physObjName);
        PhysicalLinkInternal physInternal = mock(PhysicalLinkInternal.class);
        when(m_FactPhysInternal.getObjectByName(physObjName)).thenReturn(physInternal);
        when(physInternal.isInUse()).thenReturn(false);
        when(physInternal.getOwner()).thenReturn(null);
        m_SUT.preObjectInitialize(linkInternal);
        verify(m_CcommService).requestPhysicalLink(physObjName);
        m_SUT.preObjectUpdated(linkInternal);
        verify(m_CcommService, times(2)).requestPhysicalLink(physObjName);
    }
@ Test public void testPreObjectInitializeUpdated ( ) throws FactoryException , ConfigurationException { LinkLayerInternal linkInternal = mock ( LinkLayerInternal . class ) ; String physObjName = "name" ; LinkLayerAttributes attrs = mock ( LinkLayerAttributes . class ) ; when ( linkInternal . getConfig ( ) ) . thenReturn ( attrs ) ; when ( attrs . physicalLinkName ( ) ) . thenReturn ( physObjName ) ; PhysicalLinkInternal physInternal = mock ( PhysicalLinkInternal . class ) ; when ( m_FactPhysInternal . getObjectByName ( physObjName ) ) . thenReturn ( physInternal ) ; when ( physInternal . isInUse ( ) ) . thenReturn ( false ) ; when ( physInternal . getOwner ( ) ) . thenReturn ( null ) ; m_SUT . preObjectInitialize ( linkInternal ) ; verify ( m_CcommService ) . requestPhysicalLink ( physObjName ) ; m_SUT . preObjectUpdated ( linkInternal ) ; verify ( m_CcommService , times ( 2 ) ) . requestPhysicalLink ( physObjName ) ; }
Verify callback retrieves the physical link and requests ownership before initialization and updating.
Verify callback retrieves the physical link and requests ownership before initialization and updating .
//grab phys link from comms // make sure updated does the same