@Test void getComponentLocationWhenPrimaryGatewayIsTheOnlyNodeWithinGroup() { Stack stack = TestUtil.stack(); Map<String, List<String>> result = underTest.getComponentLocation(stack); InstanceMetaData primaryGatewayInstance = stack.getPrimaryGatewayInstance(); Assertions.assertFalse(result.containsKey(primaryGatewayInstance.getInstanceGroupName()), "Result should not contain primary gateway's group name"); Assertions.assertFalse(resultContainsInstanceMetadata(primaryGatewayInstance, result), "Result should not contain primary gateway's instance metadata"); }
@Override protected Map<String, List<String>> getComponentLocation(Stack stack) { InstanceMetaData primaryGatewayInstance = stack.getPrimaryGatewayInstance(); Function<InstanceGroup, List<String>> notTerminatedAndPrimaryGatewayInstances = ig -> ig.getNotTerminatedInstanceMetaDataSet() .stream() .filter(im -> !im.getDiscoveryFQDN().equals(primaryGatewayInstance.getDiscoveryFQDN())) .map(InstanceMetaData::getDiscoveryFQDN) .collect(Collectors.toList()); return stack.getInstanceGroups() .stream() .filter(ig -> !(ig.getNotTerminatedInstanceMetaDataSet().contains(primaryGatewayInstance) && ig.getNodeCount() == GROUP_WITH_SINGLE_NODE)) .collect(Collectors.toMap(InstanceGroup::getGroupName, notTerminatedAndPrimaryGatewayInstances)); }
AllHostPublicDnsEntryService extends BaseDnsEntryService { @Override protected Map<String, List<String>> getComponentLocation(Stack stack) { InstanceMetaData primaryGatewayInstance = stack.getPrimaryGatewayInstance(); Function<InstanceGroup, List<String>> notTerminatedAndPrimaryGatewayInstances = ig -> ig.getNotTerminatedInstanceMetaDataSet() .stream() .filter(im -> !im.getDiscoveryFQDN().equals(primaryGatewayInstance.getDiscoveryFQDN())) .map(InstanceMetaData::getDiscoveryFQDN) .collect(Collectors.toList()); return stack.getInstanceGroups() .stream() .filter(ig -> !(ig.getNotTerminatedInstanceMetaDataSet().contains(primaryGatewayInstance) && ig.getNodeCount() == GROUP_WITH_SINGLE_NODE)) .collect(Collectors.toMap(InstanceGroup::getGroupName, notTerminatedAndPrimaryGatewayInstances)); } }
AllHostPublicDnsEntryService extends BaseDnsEntryService { @Override protected Map<String, List<String>> getComponentLocation(Stack stack) { InstanceMetaData primaryGatewayInstance = stack.getPrimaryGatewayInstance(); Function<InstanceGroup, List<String>> notTerminatedAndPrimaryGatewayInstances = ig -> ig.getNotTerminatedInstanceMetaDataSet() .stream() .filter(im -> !im.getDiscoveryFQDN().equals(primaryGatewayInstance.getDiscoveryFQDN())) .map(InstanceMetaData::getDiscoveryFQDN) .collect(Collectors.toList()); return stack.getInstanceGroups() .stream() .filter(ig -> !(ig.getNotTerminatedInstanceMetaDataSet().contains(primaryGatewayInstance) && ig.getNodeCount() == GROUP_WITH_SINGLE_NODE)) .collect(Collectors.toMap(InstanceGroup::getGroupName, notTerminatedAndPrimaryGatewayInstances)); }  }
AllHostPublicDnsEntryService extends BaseDnsEntryService { @Override protected Map<String, List<String>> getComponentLocation(Stack stack) { InstanceMetaData primaryGatewayInstance = stack.getPrimaryGatewayInstance(); Function<InstanceGroup, List<String>> notTerminatedAndPrimaryGatewayInstances = ig -> ig.getNotTerminatedInstanceMetaDataSet() .stream() .filter(im -> !im.getDiscoveryFQDN().equals(primaryGatewayInstance.getDiscoveryFQDN())) .map(InstanceMetaData::getDiscoveryFQDN) .collect(Collectors.toList()); return stack.getInstanceGroups() .stream() .filter(ig -> !(ig.getNotTerminatedInstanceMetaDataSet().contains(primaryGatewayInstance) && ig.getNodeCount() == GROUP_WITH_SINGLE_NODE)) .collect(Collectors.toMap(InstanceGroup::getGroupName, notTerminatedAndPrimaryGatewayInstances)); }   }
AllHostPublicDnsEntryService extends BaseDnsEntryService { @Override protected Map<String, List<String>> getComponentLocation(Stack stack) { InstanceMetaData primaryGatewayInstance = stack.getPrimaryGatewayInstance(); Function<InstanceGroup, List<String>> notTerminatedAndPrimaryGatewayInstances = ig -> ig.getNotTerminatedInstanceMetaDataSet() .stream() .filter(im -> !im.getDiscoveryFQDN().equals(primaryGatewayInstance.getDiscoveryFQDN())) .map(InstanceMetaData::getDiscoveryFQDN) .collect(Collectors.toList()); return stack.getInstanceGroups() .stream() .filter(ig -> !(ig.getNotTerminatedInstanceMetaDataSet().contains(primaryGatewayInstance) && ig.getNodeCount() == GROUP_WITH_SINGLE_NODE)) .collect(Collectors.toMap(InstanceGroup::getGroupName, notTerminatedAndPrimaryGatewayInstances)); }    }