mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAddressManagerService.java
public void testDuplicateAddressPrefix() throws Exception
    {
        URL url = m_Context.getBundle().getResource("example.ccomm.duplicates.jar");
        Bundle dupBundle = m_Context.installBundle(url.toString());
        
        try
        {
            // should be null as service should not register descriptor for plug-in with a duplicate prefix
            ServiceReference<FactoryDescriptor> descriptor = 
                    FactoryUtils.getFactoryDescriptorReference(m_Context, 
                            "example.ccomms.duplicates.ExampleAddressDuplicate", 5000);
            assertThat(descriptor, is(nullValue()));
            
            // now make sure we have the right name of the product type by finding the actual class resource with the 
            // same package and class name, if the class is ever moved or renamed, this test will fail here, signaling 
            // the reference above to be updated as well
            URL productTypeFile = dupBundle.getResource("example/ccomms/duplicates/ExampleAddressDuplicate.class");
            assertThat(productTypeFile, is(notNullValue()));
            
            // Ensure address is the correct product type, not duplicate type
            AddressManagerService addressManagerService = 
                    ServiceUtils.getService(m_Context, AddressManagerService.class);
            Address addr = addressManagerService.getOrCreateAddress("Example:600", "NonDuplicateProductTypeAddr");
            assertThat(addr.getFactory().getProductType(), is(ExampleAddress.class.getName()));
        }
        finally
        {
            dupBundle.uninstall();
        }
    }
/**
     * Verify a plug-in providing the same prefix is not registered.
     */
Verify a plug-in providing the same prefix is not registered.
Verify a plug - in providing the same prefix is not registered .
public void testDuplicateAddressPrefix() throws Exception
    {
        URL url = m_Context.getBundle().getResource("example.ccomm.duplicates.jar");
        Bundle dupBundle = m_Context.installBundle(url.toString());
        try
        {
            ServiceReference<FactoryDescriptor> descriptor = 
                    FactoryUtils.getFactoryDescriptorReference(m_Context, 
                            "example.ccomms.duplicates.ExampleAddressDuplicate", 5000);
            assertThat(descriptor, is(nullValue()));
            URL productTypeFile = dupBundle.getResource("example/ccomms/duplicates/ExampleAddressDuplicate.class");
            assertThat(productTypeFile, is(notNullValue()));
            AddressManagerService addressManagerService = 
                    ServiceUtils.getService(m_Context, AddressManagerService.class);
            Address addr = addressManagerService.getOrCreateAddress("Example:600", "NonDuplicateProductTypeAddr");
            assertThat(addr.getFactory().getProductType(), is(ExampleAddress.class.getName()));
        }
        finally
        {
            dupBundle.uninstall();
        }
    }
public void testDuplicateAddressPrefix ( ) throws Exception { URL url = m_Context . getBundle ( ) . getResource ( "example.ccomm.duplicates.jar" ) ; Bundle dupBundle = m_Context . installBundle ( url . toString ( ) ) ; try { ServiceReference < FactoryDescriptor > descriptor = FactoryUtils . getFactoryDescriptorReference ( m_Context , "example.ccomms.duplicates.ExampleAddressDuplicate" , 5000 ) ; assertThat ( descriptor , is ( nullValue ( ) ) ) ; URL productTypeFile = dupBundle . getResource ( "example/ccomms/duplicates/ExampleAddressDuplicate.class" ) ; assertThat ( productTypeFile , is ( notNullValue ( ) ) ) ; AddressManagerService addressManagerService = ServiceUtils . getService ( m_Context , AddressManagerService . class ) ; Address addr = addressManagerService . getOrCreateAddress ( "Example:600" , "NonDuplicateProductTypeAddr" ) ; assertThat ( addr . getFactory ( ) . getProductType ( ) , is ( ExampleAddress . class . getName ( ) ) ) ; } finally { dupBundle . uninstall ( ) ; } }
Verify a plug-in providing the same prefix is not registered.
Verify a plug - in providing the same prefix is not registered .
// should be null as service should not register descriptor for plug-in with a duplicate prefix // now make sure we have the right name of the product type by finding the actual class resource with the  // same package and class name, if the class is ever moved or renamed, this test will fail here, signaling  // the reference above to be updated as well // Ensure address is the correct product type, not duplicate type