@Test public void testGetServiceAddressByStackOnly() throws Exception { when(stacksDAO.getAllStackPaths()).thenReturn(getStackPaths("/po/poc1/1.50/xreGuide")); when(stacksDAO.getHostsByStackOnlyPath(any(XreStackPath.class))) .thenReturn(Arrays.asList(new HostIPs("ipv4", "ipv6"), new HostIPs("ipv4_2", "ipv6_2"))); HostIPsListWrapper result = testee.getHostsForStackOnlyAndService("/po/poc1", "xreGuide"); Assert.assertEquals(new HostIPs("ipv4", "ipv6"), result.getHostIPsList().get(0)); Assert.assertEquals(new HostIPs("ipv4_2", "ipv6_2"), result.getHostIPsList().get(1)); }
@Override public HostIPsListWrapper getHostsForStackOnlyAndService(String stackName, String serviceName) { HostIPsListWrapper result = new HostIPsListWrapper(); List<String> args = Splitter.on(DELIMETER).trimResults().omitEmptyStrings().splitToList(stackName); result.getHostIPsList().addAll(getNodesAddressesFromStackOnly(new XreStackPath(args.get(0), args.get(1), null, serviceName))); return result; }
StacksService implements IStacksService { @Override public HostIPsListWrapper getHostsForStackOnlyAndService(String stackName, String serviceName) { HostIPsListWrapper result = new HostIPsListWrapper(); List<String> args = Splitter.on(DELIMETER).trimResults().omitEmptyStrings().splitToList(stackName); result.getHostIPsList().addAll(getNodesAddressesFromStackOnly(new XreStackPath(args.get(0), args.get(1), null, serviceName))); return result; } }
StacksService implements IStacksService { @Override public HostIPsListWrapper getHostsForStackOnlyAndService(String stackName, String serviceName) { HostIPsListWrapper result = new HostIPsListWrapper(); List<String> args = Splitter.on(DELIMETER).trimResults().omitEmptyStrings().splitToList(stackName); result.getHostIPsList().addAll(getNodesAddressesFromStackOnly(new XreStackPath(args.get(0), args.get(1), null, serviceName))); return result; }  }
StacksService implements IStacksService { @Override public HostIPsListWrapper getHostsForStackOnlyAndService(String stackName, String serviceName) { HostIPsListWrapper result = new HostIPsListWrapper(); List<String> args = Splitter.on(DELIMETER).trimResults().omitEmptyStrings().splitToList(stackName); result.getHostIPsList().addAll(getNodesAddressesFromStackOnly(new XreStackPath(args.get(0), args.get(1), null, serviceName))); return result; }  @PostConstruct void init(); @Override ServicePaths getStacksForService(String serviceName); @Override ServicePaths updateStacksForService(String serviceName, ServicePaths servicePaths, Whitelisted whitelisted); @Override Set<String> getAllServiceNames(); @Override Boolean isServiceExists(String serviceName); @Override ServicePaths getStacksForAllServices(); @Override Set<PathItem> getActiveStacksAndFlavors(String serviceName); Set<PathItem> getActiveStacksAndFlavors(String serviceName, ServicePaths servicePaths); @Override HostIPsListWrapper getHostsForStackOnlyAndService(String stackName, String serviceName); @Override HostIPsListWrapper getRandomHostForStackOnlyAndService(String stackOnlyPath, String serviceName); @Override HostIPsListWrapper getHostsForStackAndService(String stackName, String serviceName); @Override HostIPsListWrapper getRandomHostForStackAndService(String stackName, String serviceName); @Override HostIPsListWrapper getHostsForFlavorAndService(String flavorName, String serviceName); @Override HostIPsListWrapper getRandomHostForFlavorAndService(String flavorName, String serviceName); @Override Set<StackData> getAllStacksAndHosts(String serviceName); Boolean isStackNameWithoutFlavor(String stackName); @Override HostIPsListWrapper getAddressByStackOrFlavor(String appName, String stackName, String flavorName); @Override HostIPsListWrapper getRandomAddressByStackOrFlavor(String serviceName, String stackName, String flavorName); @Override void deleteStack(String serviceName, String dataCenter, String availabilityZone, String flavor); @Override synchronized void deleteStacks(Paths paths); void setWhiteListService(IWhiteListService whiteListService); void setInitialDelay(long initialDelay); void setRefreshDelay(long refreshDelay); }
StacksService implements IStacksService { @Override public HostIPsListWrapper getHostsForStackOnlyAndService(String stackName, String serviceName) { HostIPsListWrapper result = new HostIPsListWrapper(); List<String> args = Splitter.on(DELIMETER).trimResults().omitEmptyStrings().splitToList(stackName); result.getHostIPsList().addAll(getNodesAddressesFromStackOnly(new XreStackPath(args.get(0), args.get(1), null, serviceName))); return result; }  @PostConstruct void init(); @Override ServicePaths getStacksForService(String serviceName); @Override ServicePaths updateStacksForService(String serviceName, ServicePaths servicePaths, Whitelisted whitelisted); @Override Set<String> getAllServiceNames(); @Override Boolean isServiceExists(String serviceName); @Override ServicePaths getStacksForAllServices(); @Override Set<PathItem> getActiveStacksAndFlavors(String serviceName); Set<PathItem> getActiveStacksAndFlavors(String serviceName, ServicePaths servicePaths); @Override HostIPsListWrapper getHostsForStackOnlyAndService(String stackName, String serviceName); @Override HostIPsListWrapper getRandomHostForStackOnlyAndService(String stackOnlyPath, String serviceName); @Override HostIPsListWrapper getHostsForStackAndService(String stackName, String serviceName); @Override HostIPsListWrapper getRandomHostForStackAndService(String stackName, String serviceName); @Override HostIPsListWrapper getHostsForFlavorAndService(String flavorName, String serviceName); @Override HostIPsListWrapper getRandomHostForFlavorAndService(String flavorName, String serviceName); @Override Set<StackData> getAllStacksAndHosts(String serviceName); Boolean isStackNameWithoutFlavor(String stackName); @Override HostIPsListWrapper getAddressByStackOrFlavor(String appName, String stackName, String flavorName); @Override HostIPsListWrapper getRandomAddressByStackOrFlavor(String serviceName, String stackName, String flavorName); @Override void deleteStack(String serviceName, String dataCenter, String availabilityZone, String flavor); @Override synchronized void deleteStacks(Paths paths); void setWhiteListService(IWhiteListService whiteListService); void setInitialDelay(long initialDelay); void setRefreshDelay(long refreshDelay);  }