ConnectionManagerCache implements ConnectionManager { @Override public BusinessEntity getBusinessEntityByHCID(String sHomeCommunityId) throws ConnectionManagerException { ConnectionManagerCacheHelper helper = new ConnectionManagerCacheHelper(); checkLoaded(); if (sHomeCommunityId == null || sHomeCommunityId.length() <= 0) { return null; } String sHomeCommunityIDwithoutPrefix = HomeCommunityMap.formatHomeCommunityId(sHomeCommunityId); String sHomeCommunityIDWithPrefix = HomeCommunityMap.getHomeCommunityIdWithPrefix(sHomeCommunityId); BusinessEntity internalBusinessEntity = null; BusinessEntity oUDDIEntity = null; if (m_hInternalConnectInfo.containsKey(sHomeCommunityIDWithPrefix)) { internalBusinessEntity = m_hInternalConnectInfo.get(sHomeCommunityIDWithPrefix); } if (m_hInternalConnectInfo.containsKey(sHomeCommunityIDwithoutPrefix)) { internalBusinessEntity = m_hInternalConnectInfo.get(sHomeCommunityIDwithoutPrefix); } if (m_hUDDIConnectInfo.containsKey(sHomeCommunityIDWithPrefix)) { oUDDIEntity = m_hUDDIConnectInfo.get(sHomeCommunityIDWithPrefix); } else if (m_hUDDIConnectInfo.containsKey(sHomeCommunityIDwithoutPrefix)) { oUDDIEntity = m_hUDDIConnectInfo.get(sHomeCommunityIDwithoutPrefix); } BusinessEntity oCombinedEntity; if (internalBusinessEntity != null && oUDDIEntity != null) { oCombinedEntity = helper.mergeBusinessEntityServices(internalBusinessEntity, oUDDIEntity); } else if (internalBusinessEntity != null) { oCombinedEntity = internalBusinessEntity; } else if (oUDDIEntity != null) { oCombinedEntity = oUDDIEntity; } else { return null; } return oCombinedEntity; } 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 testGetBusinessEntityByHCID() { try { ConnectionManagerCache connectionManager = createConnectionManager(); assertNotNull(connectionManager.getBusinessEntityByHCID(HCID_1)); assertNotNull(connectionManager.getBusinessEntityByHCID(HCID_2)); } catch (Throwable t) { t.printStackTrace(); fail("Error running getBusinessEntityByHCID test: " + t.getMessage()); } }