@Test public void testGetStructureNames() { String nodeName = "nodeName"; String asPathAccessListName = "asPathAccessList"; String authenticationKeyChainName = "authenticationKeyChain"; String communityListName = "communityList"; String ikePhase1KeyName = "ikePhase1Key"; String ikePhase1PolicyName = "ikePhase1Policy"; String ikePhase1ProposalName = "ikePhase1Proposal"; String ipAccessListName = "ipAccessList"; String ip6AccessListName = "ip6AccessList"; String ipsecPhase2PolicyName = "ipsecPhase2Policy"; String ipsecPhase2ProposalName = "ipsecPhase2Proposal"; String ipsecPeerConfigName = "ipsecPeerConfig"; String routeFilterListName = "routeFilterList"; String route6FilterListName = "route6FilterList"; String routingPolicyName = "routingPolicyName"; String vrfName = "vrf"; String zoneName = "zone"; Map<String, Configuration> configs = new HashMap<>(); Configuration config = createTestConfiguration(nodeName, ConfigurationFormat.HOST); config.setAsPathAccessLists( ImmutableSortedMap.of( asPathAccessListName, new AsPathAccessList(asPathAccessListName, null))); config.setAuthenticationKeyChains( ImmutableSortedMap.of( authenticationKeyChainName, new AuthenticationKeyChain(authenticationKeyChainName))); config.setCommunityLists( ImmutableSortedMap.of( communityListName, new CommunityList(communityListName, ImmutableList.of(), true))); config.setIkePhase1Keys(ImmutableSortedMap.of(ikePhase1KeyName, new IkePhase1Key())); config.setIkePhase1Policies( ImmutableSortedMap.of(ikePhase1PolicyName, new IkePhase1Policy(ikePhase1PolicyName))); config.setIkePhase1Proposals( ImmutableSortedMap.of(ikePhase1ProposalName, new IkePhase1Proposal(ikePhase1ProposalName))); config.setIpAccessLists( ImmutableSortedMap.of( ipAccessListName, IpAccessList.builder().setName(ipAccessListName).build())); config.setIp6AccessLists( ImmutableSortedMap.of(ip6AccessListName, new Ip6AccessList(ip6AccessListName))); config.setIpsecPhase2Policies( ImmutableSortedMap.of(ipsecPhase2PolicyName, new IpsecPhase2Policy())); config.setIpsecPhase2Proposals( ImmutableSortedMap.of(ipsecPhase2ProposalName, new IpsecPhase2Proposal())); config.setIpsecPeerConfigs( ImmutableSortedMap.of(ipsecPeerConfigName, IpsecStaticPeerConfig.builder().build())); config.setRouteFilterLists( ImmutableSortedMap.of(routeFilterListName, new RouteFilterList(routeFilterListName))); config.setRoute6FilterLists( ImmutableSortedMap.of(route6FilterListName, new Route6FilterList(route6FilterListName))); config.setRoutingPolicies( ImmutableSortedMap.of(routingPolicyName, new RoutingPolicy(routingPolicyName, null))); config.setVrfs(ImmutableSortedMap.of(vrfName, new Vrf(vrfName))); config.setZones(ImmutableSortedMap.of(zoneName, new Zone(zoneName))); configs.put(nodeName, config); assertThat( getStructureNames(configs), equalTo( ImmutableSet.of( asPathAccessListName, authenticationKeyChainName, communityListName, ikePhase1KeyName, ikePhase1PolicyName, ikePhase1ProposalName, ipAccessListName, ip6AccessListName, ipsecPhase2PolicyName, ipsecPhase2ProposalName, ipsecPeerConfigName, routeFilterListName, route6FilterListName, routingPolicyName, vrfName, zoneName))); }
public static Set<String> getStructureNames(Map<String, Configuration> configurations) { ImmutableSet.Builder<String> structureNames = ImmutableSet.builder(); configurations .values() .forEach( configuration -> NamedStructurePropertySpecifier.JAVA_MAP .values() .forEach( type -> { Object namedStructuresMap = type.getGetter().apply(configuration); if (namedStructuresMap instanceof Map<?, ?>) { ((Map<?, ?>) namedStructuresMap) .keySet() .forEach( key -> { if (key instanceof String) { structureNames.add((String) key); } }); } })); return structureNames.build(); }
CompletionMetadataUtils { public static Set<String> getStructureNames(Map<String, Configuration> configurations) { ImmutableSet.Builder<String> structureNames = ImmutableSet.builder(); configurations .values() .forEach( configuration -> NamedStructurePropertySpecifier.JAVA_MAP .values() .forEach( type -> { Object namedStructuresMap = type.getGetter().apply(configuration); if (namedStructuresMap instanceof Map<?, ?>) { ((Map<?, ?>) namedStructuresMap) .keySet() .forEach( key -> { if (key instanceof String) { structureNames.add((String) key); } }); } })); return structureNames.build(); } }
CompletionMetadataUtils { public static Set<String> getStructureNames(Map<String, Configuration> configurations) { ImmutableSet.Builder<String> structureNames = ImmutableSet.builder(); configurations .values() .forEach( configuration -> NamedStructurePropertySpecifier.JAVA_MAP .values() .forEach( type -> { Object namedStructuresMap = type.getGetter().apply(configuration); if (namedStructuresMap instanceof Map<?, ?>) { ((Map<?, ?>) namedStructuresMap) .keySet() .forEach( key -> { if (key instanceof String) { structureNames.add((String) key); } }); } })); return structureNames.build(); } private  CompletionMetadataUtils(); }
CompletionMetadataUtils { public static Set<String> getStructureNames(Map<String, Configuration> configurations) { ImmutableSet.Builder<String> structureNames = ImmutableSet.builder(); configurations .values() .forEach( configuration -> NamedStructurePropertySpecifier.JAVA_MAP .values() .forEach( type -> { Object namedStructuresMap = type.getGetter().apply(configuration); if (namedStructuresMap instanceof Map<?, ?>) { ((Map<?, ?>) namedStructuresMap) .keySet() .forEach( key -> { if (key instanceof String) { structureNames.add((String) key); } }); } })); return structureNames.build(); } private  CompletionMetadataUtils(); static Set<String> getFilterNames(Map<String, Configuration> configurations); static Set<NodeInterfacePair> getInterfaces(Map<String, Configuration> configurations); static Map<Ip, IpCompletionMetadata> getIps(Map<String, Configuration> configurations); static Set<String> getMlagIds(Map<String, Configuration> configurations); static Map<String, NodeCompletionMetadata> getNodes(
      Map<String, Configuration> configurations); static Set<String> getPrefixes(Map<String, Configuration> configurations); static Set<String> getRoutingPolicyNames(Map<String, Configuration> configurations); static Set<Location> getSourceLocationsWithSrcIps(
      Map<Location, LocationInfo> locationInfo); static Set<String> getStructureNames(Map<String, Configuration> configurations); static Set<String> getVrfs(Map<String, Configuration> configurations); static Set<String> getZones(Map<String, Configuration> configurations); }
CompletionMetadataUtils { public static Set<String> getStructureNames(Map<String, Configuration> configurations) { ImmutableSet.Builder<String> structureNames = ImmutableSet.builder(); configurations .values() .forEach( configuration -> NamedStructurePropertySpecifier.JAVA_MAP .values() .forEach( type -> { Object namedStructuresMap = type.getGetter().apply(configuration); if (namedStructuresMap instanceof Map<?, ?>) { ((Map<?, ?>) namedStructuresMap) .keySet() .forEach( key -> { if (key instanceof String) { structureNames.add((String) key); } }); } })); return structureNames.build(); } private  CompletionMetadataUtils(); static Set<String> getFilterNames(Map<String, Configuration> configurations); static Set<NodeInterfacePair> getInterfaces(Map<String, Configuration> configurations); static Map<Ip, IpCompletionMetadata> getIps(Map<String, Configuration> configurations); static Set<String> getMlagIds(Map<String, Configuration> configurations); static Map<String, NodeCompletionMetadata> getNodes(
      Map<String, Configuration> configurations); static Set<String> getPrefixes(Map<String, Configuration> configurations); static Set<String> getRoutingPolicyNames(Map<String, Configuration> configurations); static Set<Location> getSourceLocationsWithSrcIps(
      Map<Location, LocationInfo> locationInfo); static Set<String> getStructureNames(Map<String, Configuration> configurations); static Set<String> getVrfs(Map<String, Configuration> configurations); static Set<String> getZones(Map<String, Configuration> configurations); static Map<Ip, String> WELL_KNOWN_IPS; }