mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestFactoryObjectLoaderImpl.java
@Test
    public void testProcessWithPhysicalLinks() throws InvalidSyntaxException
    {
        List<FactoryObjectConfig> factoryObjectConfigs = new ArrayList<FactoryObjectConfig>();
        
        for (PhysicalLinkTypeEnum type : PhysicalLinkTypeEnum.values())
        {
            FactoryObjectConfig physLink = new FactoryObjectConfig()
                .withFactoryType(FactoryTypeEnum.PHYSICAL_LINK)
                .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
                .withPhysicalLinkType(type)
                .withName( type.value() + "Link");
        
            factoryObjectConfigs.add(physLink);
        }
        
        // test with one that has null for physical link type
        FactoryObjectConfig physLink = new FactoryObjectConfig()
            .withFactoryType(FactoryTypeEnum.PHYSICAL_LINK)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
            .withPhysicalLinkType(null)
            .withName("Invalid-Link");
        factoryObjectConfigs.add(physLink);

        m_SUT.process(factoryObjectConfigs, true);

        // Post factory object loaded events
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);

        verify(m_Context, times(4)).addServiceListener(any(ServiceListener.class), anyString());
    }
/**
    * Verify that all types of physical links add service trackers correctly
    */
Verify that all types of physical links add service trackers correctly
Verify that all types of physical links add service trackers correctly
@Test
    public void testProcessWithPhysicalLinks() throws InvalidSyntaxException
    {
        List<FactoryObjectConfig> factoryObjectConfigs = new ArrayList<FactoryObjectConfig>();
        for (PhysicalLinkTypeEnum type : PhysicalLinkTypeEnum.values())
        {
            FactoryObjectConfig physLink = new FactoryObjectConfig()
                .withFactoryType(FactoryTypeEnum.PHYSICAL_LINK)
                .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
                .withPhysicalLinkType(type)
                .withName( type.value() + "Link");
            factoryObjectConfigs.add(physLink);
        }
        FactoryObjectConfig physLink = new FactoryObjectConfig()
            .withFactoryType(FactoryTypeEnum.PHYSICAL_LINK)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
            .withPhysicalLinkType(null)
            .withName("Invalid-Link");
        factoryObjectConfigs.add(physLink);
        m_SUT.process(factoryObjectConfigs, true);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        m_EventAdmin.postEvent(m_FactoryObjectEvent);
        verify(m_Context, times(4)).addServiceListener(any(ServiceListener.class), anyString());
    }
@ Test public void testProcessWithPhysicalLinks ( ) throws InvalidSyntaxException { List < FactoryObjectConfig > factoryObjectConfigs = new ArrayList < FactoryObjectConfig > ( ) ; for ( PhysicalLinkTypeEnum type : PhysicalLinkTypeEnum . values ( ) ) { FactoryObjectConfig physLink = new FactoryObjectConfig ( ) . withFactoryType ( FactoryTypeEnum . PHYSICAL_LINK ) . withCreatePolicy ( CreatePolicyEnum . FIRST_RUN ) . withPhysicalLinkType ( type ) . withName ( type . value ( ) + "Link" ) ; factoryObjectConfigs . add ( physLink ) ; } FactoryObjectConfig physLink = new FactoryObjectConfig ( ) . withFactoryType ( FactoryTypeEnum . PHYSICAL_LINK ) . withCreatePolicy ( CreatePolicyEnum . FIRST_RUN ) . withPhysicalLinkType ( null ) . withName ( "Invalid-Link" ) ; factoryObjectConfigs . add ( physLink ) ; m_SUT . process ( factoryObjectConfigs , true ) ; m_EventAdmin . postEvent ( m_FactoryObjectEvent ) ; m_EventAdmin . postEvent ( m_FactoryObjectEvent ) ; m_EventAdmin . postEvent ( m_FactoryObjectEvent ) ; m_EventAdmin . postEvent ( m_FactoryObjectEvent ) ; m_EventAdmin . postEvent ( m_FactoryObjectEvent ) ; verify ( m_Context , times ( 4 ) ) . addServiceListener ( any ( ServiceListener . class ) , anyString ( ) ) ; }
Verify that all types of physical links add service trackers correctly
Verify that all types of physical links add service trackers correctly
// test with one that has null for physical link type // Post factory object loaded events