@Test public void testCollectPrefixLists() { Region region = testRegion(); Map<PrefixList, IpSpace> prefixListIpSpaceMap = IpPermissions.collectPrefixLists(region, ImmutableList.of(PL_ID, PL_ID)); assertThat( prefixListIpSpaceMap, equalTo( ImmutableMap.of( region.getPrefixLists().get(PL_ID), IpWildcardSetIpSpace.builder() .including(IpWildcard.parse("1.1.1.0/24"), IpWildcard.parse("2.2.2.0/24")) .build()))); }
@VisibleForTesting static Map<PrefixList, IpSpace> collectPrefixLists(Region region, List<String> prefixLists) { return prefixLists.stream() .distinct() .map(plId -> region.getPrefixLists().get(plId)) .filter(Objects::nonNull) .collect( ImmutableMap.toImmutableMap(Function.identity(), IpPermissions::prefixListToIpSpace)); }
IpPermissions implements Serializable { @VisibleForTesting static Map<PrefixList, IpSpace> collectPrefixLists(Region region, List<String> prefixLists) { return prefixLists.stream() .distinct() .map(plId -> region.getPrefixLists().get(plId)) .filter(Objects::nonNull) .collect( ImmutableMap.toImmutableMap(Function.identity(), IpPermissions::prefixListToIpSpace)); } }
IpPermissions implements Serializable { @VisibleForTesting static Map<PrefixList, IpSpace> collectPrefixLists(Region region, List<String> prefixLists) { return prefixLists.stream() .distinct() .map(plId -> region.getPrefixLists().get(plId)) .filter(Objects::nonNull) .collect( ImmutableMap.toImmutableMap(Function.identity(), IpPermissions::prefixListToIpSpace)); } IpPermissions(
      String ipProtocol,
      @Nullable Integer fromPort,
      @Nullable Integer toPort,
      List<IpRange> ipRanges,
      List<String> prefixList,
      List<UserIdGroupPair> userIdGroupPairs); }
IpPermissions implements Serializable { @VisibleForTesting static Map<PrefixList, IpSpace> collectPrefixLists(Region region, List<String> prefixLists) { return prefixLists.stream() .distinct() .map(plId -> region.getPrefixLists().get(plId)) .filter(Objects::nonNull) .collect( ImmutableMap.toImmutableMap(Function.identity(), IpPermissions::prefixListToIpSpace)); } IpPermissions(
      String ipProtocol,
      @Nullable Integer fromPort,
      @Nullable Integer toPort,
      List<IpRange> ipRanges,
      List<String> prefixList,
      List<UserIdGroupPair> userIdGroupPairs); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Nullable Integer getFromPort(); @Nonnull String getIpProtocol(); @Nonnull List<IpRange> getIpRanges(); @Nonnull List<String> getPrefixList(); @Nonnull List<UserIdGroupPair> getUserIdGroupPairs(); @Nullable Integer getToPort(); }
IpPermissions implements Serializable { @VisibleForTesting static Map<PrefixList, IpSpace> collectPrefixLists(Region region, List<String> prefixLists) { return prefixLists.stream() .distinct() .map(plId -> region.getPrefixLists().get(plId)) .filter(Objects::nonNull) .collect( ImmutableMap.toImmutableMap(Function.identity(), IpPermissions::prefixListToIpSpace)); } IpPermissions(
      String ipProtocol,
      @Nullable Integer fromPort,
      @Nullable Integer toPort,
      List<IpRange> ipRanges,
      List<String> prefixList,
      List<UserIdGroupPair> userIdGroupPairs); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Nullable Integer getFromPort(); @Nonnull String getIpProtocol(); @Nonnull List<IpRange> getIpRanges(); @Nonnull List<String> getPrefixList(); @Nonnull List<UserIdGroupPair> getUserIdGroupPairs(); @Nullable Integer getToPort();  }