mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAddressManagerService.java
public void testSamePropertiesDifferentAddressType() 
            throws CCommException, IllegalArgumentException
    {
        AddressManagerService addressManagerService = ServiceUtils.getService(m_Context, AddressManagerService.class);
        
        //Create a common property to use for both addresses
        Map<String,Object> props = new HashMap<String,Object>();
        props.put("a",42);
        
        //Create a new address of type "Fake", with the common properties
        Address fakeAddress1 = 
                addressManagerService.getOrCreateAddress(FakeAddress.class.getName(),"Addr1",props);
        
        //Create a new address of type "Example", with the common properties
        Address exampleAddress1 = 
                addressManagerService.getOrCreateAddress(ExampleAddress.class.getName(),"Addr2",props);
    
        assertThat(fakeAddress1.getUuid(), is(not(exampleAddress1.getUuid())));
    
        //Ensure that the address now exist
        assertThat(addressManagerService.checkAddressAlreadyExists("Example:42"),is(true));
        assertThat(addressManagerService.checkAddressAlreadyExists("Fake:42"),is(true));
        
        //Try to get or create new addresses with existing types and properties
        Address fakeAddress2 = addressManagerService.getOrCreateAddress("Fake:42");
        Address exampleAddress2 = addressManagerService.getOrCreateAddress("Example:42");
        
        //Check to make sure returns the already existing address
        assertThat(fakeAddress2, is(fakeAddress1));
        assertThat(exampleAddress2, is(exampleAddress1));
    }
/**
     * Verify that only address of the same type are checked against when creating a new address 
     * or checking if one already exists. Tests both getOrCreateAddress() and checkAddressAlreadyExists()
     */
Verify that only address of the same type are checked against when creating a new address
or checking if one already exists.
Verify that only address of the same type are checked against when creating a new address or checking if one already exists .
public void testSamePropertiesDifferentAddressType() 
            throws CCommException, IllegalArgumentException
    {
        AddressManagerService addressManagerService = ServiceUtils.getService(m_Context, AddressManagerService.class);
        Map<String,Object> props = new HashMap<String,Object>();
        props.put("a",42);
        Address fakeAddress1 = 
                addressManagerService.getOrCreateAddress(FakeAddress.class.getName(),"Addr1",props);
        Address exampleAddress1 = 
                addressManagerService.getOrCreateAddress(ExampleAddress.class.getName(),"Addr2",props);
        assertThat(fakeAddress1.getUuid(), is(not(exampleAddress1.getUuid())));
        assertThat(addressManagerService.checkAddressAlreadyExists("Example:42"),is(true));
        assertThat(addressManagerService.checkAddressAlreadyExists("Fake:42"),is(true));
        Address fakeAddress2 = addressManagerService.getOrCreateAddress("Fake:42");
        Address exampleAddress2 = addressManagerService.getOrCreateAddress("Example:42");
        assertThat(fakeAddress2, is(fakeAddress1));
        assertThat(exampleAddress2, is(exampleAddress1));
    }
public void testSamePropertiesDifferentAddressType ( ) throws CCommException , IllegalArgumentException { AddressManagerService addressManagerService = ServiceUtils . getService ( m_Context , AddressManagerService . class ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( "a" , 42 ) ; Address fakeAddress1 = addressManagerService . getOrCreateAddress ( FakeAddress . class . getName ( ) , "Addr1" , props ) ; Address exampleAddress1 = addressManagerService . getOrCreateAddress ( ExampleAddress . class . getName ( ) , "Addr2" , props ) ; assertThat ( fakeAddress1 . getUuid ( ) , is ( not ( exampleAddress1 . getUuid ( ) ) ) ) ; assertThat ( addressManagerService . checkAddressAlreadyExists ( "Example:42" ) , is ( true ) ) ; assertThat ( addressManagerService . checkAddressAlreadyExists ( "Fake:42" ) , is ( true ) ) ; Address fakeAddress2 = addressManagerService . getOrCreateAddress ( "Fake:42" ) ; Address exampleAddress2 = addressManagerService . getOrCreateAddress ( "Example:42" ) ; assertThat ( fakeAddress2 , is ( fakeAddress1 ) ) ; assertThat ( exampleAddress2 , is ( exampleAddress1 ) ) ; }
Verify that only address of the same type are checked against when creating a new address
 or checking if one already exists.
Verify that only address of the same type are checked against when creating a new address or checking if one already exists .
//Create a common property to use for both addresses //Create a new address of type "Fake", with the common properties //Create a new address of type "Example", with the common properties //Ensure that the address now exist //Try to get or create new addresses with existing types and properties //Check to make sure returns the already existing address