mil.dod.th.ose.core.integration/src/mil/dod/th/ose/core/integration/TestAddressManagerService.java
public void testGetOrCreateAddressNoDuplication() throws Exception
    {
        // wait until all factories have been registered, at that point all layers must be restored
        AddressManagerService addressMgrSvc = ServiceUtils.getService(m_Context, AddressManagerService.class);
            
        // Create a new address
        Address a1 = addressMgrSvc.getOrCreateAddress("Example:5");        
        
        // Ensure the address is now in the service
        List<String> addressStringsAfterAdding = addressMgrSvc.getAddressDescriptiveStrings();
        assertThat(addressStringsAfterAdding, hasItem("Example:5"));
        
        // Now request the address again. No new address should be created.
        Address a2 = addressMgrSvc.getOrCreateAddress("Example:5");        
        assertThat(a2.getUuid(), is(a1.getUuid()));
        // List should be the same size
        assertThat(addressMgrSvc.getAddressDescriptiveStrings().size(), is(addressStringsAfterAdding.size()));
        
        // Request another address that is different.  New address should be created.
        Address a3 = addressMgrSvc.getOrCreateAddress("Example:10");
        assertThat(a2.getUuid(), is(not(a3.getUuid())));
        // List should increase by one
        assertThat(addressMgrSvc.getAddressDescriptiveStrings().size(), is(addressStringsAfterAdding.size() + 1));
    }
/**
     * Ensure that an existing address that can be found is not duplicated. The service should return the found
     * address. 
     */
Ensure that an existing address that can be found is not duplicated. The service should return the found
address.
Ensure that an existing address that can be found is not duplicated . The service should return the found address .
public void testGetOrCreateAddressNoDuplication() throws Exception
    {
        AddressManagerService addressMgrSvc = ServiceUtils.getService(m_Context, AddressManagerService.class);
        Address a1 = addressMgrSvc.getOrCreateAddress("Example:5");        
        List<String> addressStringsAfterAdding = addressMgrSvc.getAddressDescriptiveStrings();
        assertThat(addressStringsAfterAdding, hasItem("Example:5"));
        Address a2 = addressMgrSvc.getOrCreateAddress("Example:5");        
        assertThat(a2.getUuid(), is(a1.getUuid()));
        assertThat(addressMgrSvc.getAddressDescriptiveStrings().size(), is(addressStringsAfterAdding.size()));
        Address a3 = addressMgrSvc.getOrCreateAddress("Example:10");
        assertThat(a2.getUuid(), is(not(a3.getUuid())));
        assertThat(addressMgrSvc.getAddressDescriptiveStrings().size(), is(addressStringsAfterAdding.size() + 1));
    }
public void testGetOrCreateAddressNoDuplication ( ) throws Exception { AddressManagerService addressMgrSvc = ServiceUtils . getService ( m_Context , AddressManagerService . class ) ; Address a1 = addressMgrSvc . getOrCreateAddress ( "Example:5" ) ; List < String > addressStringsAfterAdding = addressMgrSvc . getAddressDescriptiveStrings ( ) ; assertThat ( addressStringsAfterAdding , hasItem ( "Example:5" ) ) ; Address a2 = addressMgrSvc . getOrCreateAddress ( "Example:5" ) ; assertThat ( a2 . getUuid ( ) , is ( a1 . getUuid ( ) ) ) ; assertThat ( addressMgrSvc . getAddressDescriptiveStrings ( ) . size ( ) , is ( addressStringsAfterAdding . size ( ) ) ) ; Address a3 = addressMgrSvc . getOrCreateAddress ( "Example:10" ) ; assertThat ( a2 . getUuid ( ) , is ( not ( a3 . getUuid ( ) ) ) ) ; assertThat ( addressMgrSvc . getAddressDescriptiveStrings ( ) . size ( ) , is ( addressStringsAfterAdding . size ( ) + 1 ) ) ; }
Ensure that an existing address that can be found is not duplicated.
Ensure that an existing address that can be found is not duplicated .
// wait until all factories have been registered, at that point all layers must be restored // Create a new address // Ensure the address is now in the service // Now request the address again. No new address should be created. // List should be the same size // Request another address that is different.  New address should be created. // List should increase by one