@Test public void resolve() { ReferenceBook book = ReferenceBook.builder("book1") .setAddressGroups( ImmutableList.of( new AddressGroup( ImmutableSortedSet.of("1.1.1.1", "2.2.2.2:0.0.0.8"), "group1"))) .build(); MockSpecifierContext ctxt = MockSpecifierContext.builder().setReferenceBooks(ImmutableSortedSet.of(book)).build(); ReferenceAddressGroupIpSpaceSpecifier specifier = new ReferenceAddressGroupIpSpaceSpecifier("group1", "book1"); IpSpace resolvedSpace = AclIpSpace.union( specifier.resolve(ImmutableSet.of(), ctxt).getEntries().stream() .map(e -> e.getIpSpace()) .collect(ImmutableSet.toImmutableSet())); assertThat( resolvedSpace, equalTo( AclIpSpace.union( IpWildcard.parse("1.1.1.1").toIpSpace(), IpWildcard.parse("2.2.2.2:0.0.0.8").toIpSpace()))); }
@Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { IpSpace ipSpace = computeIpSpace(_addressGroupName, _bookName, ctxt); return IpSpaceAssignment.builder().assign(locations, ipSpace).build(); }
ReferenceAddressGroupIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { IpSpace ipSpace = computeIpSpace(_addressGroupName, _bookName, ctxt); return IpSpaceAssignment.builder().assign(locations, ipSpace).build(); } }
ReferenceAddressGroupIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { IpSpace ipSpace = computeIpSpace(_addressGroupName, _bookName, ctxt); return IpSpaceAssignment.builder().assign(locations, ipSpace).build(); } ReferenceAddressGroupIpSpaceSpecifier(String addressGroupName, String bookName); }
ReferenceAddressGroupIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { IpSpace ipSpace = computeIpSpace(_addressGroupName, _bookName, ctxt); return IpSpaceAssignment.builder().assign(locations, ipSpace).build(); } ReferenceAddressGroupIpSpaceSpecifier(String addressGroupName, String bookName); @Override boolean equals(Object o); @Override int hashCode(); @Override IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt); @Nonnull static IpSpace computeIpSpace(
      String addressGroupName, String bookName, SpecifierContext ctxt); @Override String toString(); }
ReferenceAddressGroupIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt) { IpSpace ipSpace = computeIpSpace(_addressGroupName, _bookName, ctxt); return IpSpaceAssignment.builder().assign(locations, ipSpace).build(); } ReferenceAddressGroupIpSpaceSpecifier(String addressGroupName, String bookName); @Override boolean equals(Object o); @Override int hashCode(); @Override IpSpaceAssignment resolve(Set<Location> locations, SpecifierContext ctxt); @Nonnull static IpSpace computeIpSpace(
      String addressGroupName, String bookName, SpecifierContext ctxt); @Override String toString();  }