ConnectionManagerCache implements ConnectionManager { @Override public List<BusinessEntity> getAllBusinessEntities() throws ConnectionManagerException { List<BusinessEntity> allEntities = new ArrayList<>(); ConnectionManagerCacheHelper helper = new ConnectionManagerCacheHelper(); checkLoaded(); for (BusinessEntity internalEntity : m_hInternalConnectInfo.values()) { if (NullChecker.isNotNullish(helper.getCommunityId(internalEntity))) { allEntities.add(internalEntity); } } for (BusinessEntity uddiEntity : m_hUDDIConnectInfo.values()) { String homeCommunityId = helper.getCommunityId(uddiEntity); if (NullChecker.isNotNullish(homeCommunityId)) { BusinessEntity oExistingEntity = helper.extractBusinessEntity(allEntities, homeCommunityId); if (oExistingEntity != null) { helper.replaceBusinessEntity(allEntities, helper.mergeBusinessEntityServices(oExistingEntity, uddiEntity)); } else { allEntities.add(uddiEntity); } } } return allEntities; } ConnectionManagerCache();  ConnectionManagerCache(PropertyAccessor accessor); static ConnectionManagerCache getInstance(); void setCommunityId(BusinessEntity businessEntity, String newId); void forceRefreshUDDICache(); void forceRefreshInternalConnectCache(); @Override List<BusinessEntity> getAllBusinessEntities(); @Override BusinessEntity getBusinessEntity(String sHomeCommunityId); @Override String getBusinessEntityName(String homeCommunityId); @Override Set<BusinessEntity> getBusinessEntitySet(List<String> saHomeCommunityId); @Override BusinessEntity getBusinessEntityByServiceName(String sHomeCommunityId, String sUniformServiceName); @Override BusinessEntity getBusinessEntityByHCID(String sHomeCommunityId); @Override Set<BusinessEntity> getBusinessEntitySetByServiceName(List<String> saHomeCommunityId,
        String sUniformServiceName); @Override Set<BusinessEntity> getAllBusinessEntitySetByServiceName(String sUniformServiceName); @Override List<UDDI_SPEC_VERSION> getSpecVersions(String homeCommunityId,
        NhincConstants.NHIN_SERVICE_NAMES serviceName); @Override String getAdapterEndpointURL(String sHomeCommunityId, String sServiceName, ADAPTER_API_LEVEL level); @Override String getAdapterEndpointURL(String sServiceName, ADAPTER_API_LEVEL level); @Override String getDefaultEndpointURLByServiceName(String sHomeCommunityId, String sUniformServiceName); @Override String getEndpointURLByServiceNameSpecVersion(String sHomeCommunityId, String sUniformServiceName,
        UDDI_SPEC_VERSION version); @Override String getInternalEndpointURLByServiceName(String sUniformServiceName); @Override String getEndpointURLFromNhinTarget(NhinTargetSystemType targetSystem, String serviceName); @Override List<UrlInfo> getEndpointURLFromNhinTargetCommunities(NhinTargetCommunitiesType targets, String serviceName); boolean updateInternalServiceUrl(String serviceName, String url);  }
@Test public void testGetAllCommunities_EmptyBusinessDetail() { try { ConnectionManagerCache connectionManager = createConnectionManager_Empty(); assertTrue(connectionManager.getAllBusinessEntities().isEmpty()); } catch (Throwable t) { t.printStackTrace(); fail("Error running testGetAllCommunities_EmptyBusinessDetail test: " + t.getMessage()); } }
@Test public void testGetAllCommunities_EmptyBusinessEntity() { try { ConnectionManagerCache connectionManager = createConnectionManager_EmptyBusinessEntity(); assertTrue(connectionManager.getAllBusinessEntities().isEmpty()); } catch (Throwable t) { t.printStackTrace(); fail("Error running testGetAllCommunities_EmptyBusinessEntity test: " + t.getMessage()); } }
@Test public void testGetAllCommunities() { try { ConnectionManagerCache connectionManager = createConnectionManager(); assertEquals(2, connectionManager.getAllBusinessEntities().size()); } catch (Throwable t) { t.printStackTrace(); fail("Error running testGetAllCommunities test: " + t.getMessage()); } }
@Test public void testGetAllBusinessEntities() { try { ConnectionManagerCache connectionManager = createConnectionManager(); List<BusinessEntity> entities = connectionManager.getAllBusinessEntities(); assertEquals(2, entities.size()); connectionManager = createConnectionManager_Override(); entities = connectionManager.getAllBusinessEntities(); assertEquals(3, entities.size()); BusinessEntity businessEntity = connectionManager.getBusinessEntity("1.1"); assertEquals(3, businessEntity.getBusinessServices().getBusinessService().size()); connectionManager = createConnectionManager_Merge(); entities = connectionManager.getAllBusinessEntities(); assertEquals(2, entities.size()); businessEntity = connectionManager.getBusinessEntity("1.1"); assertEquals(3, businessEntity.getBusinessServices().getBusinessService().size()); String url = connectionManager.getDefaultEndpointURLByServiceName("1.1", QUERY_FOR_DOCUMENTS_NAME); assertTrue(url.equals("https: businessEntity = connectionManager.getBusinessEntity("2.2"); assertEquals(1, businessEntity.getBusinessServices().getBusinessService().size()); url = connectionManager.getDefaultEndpointURLByServiceName("2.2", QUERY_FOR_DOCUMENTS_NAME); assertTrue(url.equals("https: } catch (Throwable t) { t.printStackTrace(); fail("Error running testGetAllBusinessEntities test: " + t.getMessage()); } }