@Test public void shouldObtainDefaultPool() throws OpenStackException, IOException { String region = "RegionOne2"; OpenStackAccess openStackAccess = new OpenStackAccess(); openStackAccess.setToken("1234567891234567989"); openStackAccess.setTenantId("08bed031f6c54c9d9b35b42aa06b51c0"); when(openStackRegion.getTokenAdmin()).thenReturn(openStackAccess); when(openOperationUtil.executeNovaRequest(any(HttpUriRequest.class))).thenReturn(CONTENT_NETWORKS); String net = openStackUtil.getPublicFloatingPool(paasManagerUser, region); assertNotNull(net); assertEquals(net, "public-ext-net-01"); }
public String getPublicFloatingPool(PaasManagerUser user, String region) throws OpenStackException { String type = "floating"; log.debug("Obtain public admin network"); String networkId = regionCache.getUrl(region, type); if (networkId != null) { return networkId; } NetworkInstance net = getPublicAdmin(user, region); if (net != null) { regionCache.putUrl(region, type, net.getNetworkName()); return net.getNetworkName(); } return null; }
OpenStackConfigUtilImpl implements OpenStackConfigUtil { public String getPublicFloatingPool(PaasManagerUser user, String region) throws OpenStackException { String type = "floating"; log.debug("Obtain public admin network"); String networkId = regionCache.getUrl(region, type); if (networkId != null) { return networkId; } NetworkInstance net = getPublicAdmin(user, region); if (net != null) { regionCache.putUrl(region, type, net.getNetworkName()); return net.getNetworkName(); } return null; } }
OpenStackConfigUtilImpl implements OpenStackConfigUtil { public String getPublicFloatingPool(PaasManagerUser user, String region) throws OpenStackException { String type = "floating"; log.debug("Obtain public admin network"); String networkId = regionCache.getUrl(region, type); if (networkId != null) { return networkId; } NetworkInstance net = getPublicAdmin(user, region); if (net != null) { regionCache.putUrl(region, type, net.getNetworkName()); return net.getNetworkName(); } return null; } OpenStackConfigUtilImpl(); }
OpenStackConfigUtilImpl implements OpenStackConfigUtil { public String getPublicFloatingPool(PaasManagerUser user, String region) throws OpenStackException { String type = "floating"; log.debug("Obtain public admin network"); String networkId = regionCache.getUrl(region, type); if (networkId != null) { return networkId; } NetworkInstance net = getPublicAdmin(user, region); if (net != null) { regionCache.putUrl(region, type, net.getNetworkName()); return net.getNetworkName(); } return null; } OpenStackConfigUtilImpl(); HttpClientConnectionManager getHttpConnectionManager(); void setHttpConnectionManager(HttpClientConnectionManager httpConnectionManager); String getPublicAdminNetwork(PaasManagerUser user, String region); String getPublicFloatingPool(PaasManagerUser user, String region); NetworkInstance getPublicAdmin(PaasManagerUser user, String region); String getPublicRouter(PaasManagerUser user, String region, String publicNetworkId); String getPublicRouterId(String response, String vdc, String publicNetworkId); OpenStackRegion getOpenStackRegion(); void setOpenStackRegion(OpenStackRegion openStackRegion); void setOpenOperationUtil(OpenOperationUtil openOperationUtil); }
OpenStackConfigUtilImpl implements OpenStackConfigUtil { public String getPublicFloatingPool(PaasManagerUser user, String region) throws OpenStackException { String type = "floating"; log.debug("Obtain public admin network"); String networkId = regionCache.getUrl(region, type); if (networkId != null) { return networkId; } NetworkInstance net = getPublicAdmin(user, region); if (net != null) { regionCache.putUrl(region, type, net.getNetworkName()); return net.getNetworkName(); } return null; } OpenStackConfigUtilImpl(); HttpClientConnectionManager getHttpConnectionManager(); void setHttpConnectionManager(HttpClientConnectionManager httpConnectionManager); String getPublicAdminNetwork(PaasManagerUser user, String region); String getPublicFloatingPool(PaasManagerUser user, String region); NetworkInstance getPublicAdmin(PaasManagerUser user, String region); String getPublicRouter(PaasManagerUser user, String region, String publicNetworkId); String getPublicRouterId(String response, String vdc, String publicNetworkId); OpenStackRegion getOpenStackRegion(); void setOpenStackRegion(OpenStackRegion openStackRegion); void setOpenOperationUtil(OpenOperationUtil openOperationUtil);  }