@Test public void testNoLocations() { MockSpecifierContext ctxt = MockSpecifierContext.builder().build(); IpSpaceSpecifier specifier = new LocationIpSpaceSpecifier(new MockLocationSpecifier(ImmutableSet.of())); assertThat( specifier.resolve(ImmutableSet.of(), ctxt), equalTo( IpSpaceAssignment.of( ImmutableList.of(new Entry(EmptyIpSpace.INSTANCE, ImmutableSet.of()))))); }
@Override public IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt) { Set<Location> locations = _locationSpecifier.resolve(ctxt); return IpSpaceAssignment.builder().assign(key, computeIpSpace(locations, ctxt)).build(); }
LocationIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt) { Set<Location> locations = _locationSpecifier.resolve(ctxt); return IpSpaceAssignment.builder().assign(key, computeIpSpace(locations, ctxt)).build(); } }
LocationIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt) { Set<Location> locations = _locationSpecifier.resolve(ctxt); return IpSpaceAssignment.builder().assign(key, computeIpSpace(locations, ctxt)).build(); } LocationIpSpaceSpecifier(@Nonnull LocationSpecifier locationSpecifier); }
LocationIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt) { Set<Location> locations = _locationSpecifier.resolve(ctxt); return IpSpaceAssignment.builder().assign(key, computeIpSpace(locations, ctxt)).build(); } LocationIpSpaceSpecifier(@Nonnull LocationSpecifier locationSpecifier); @Override boolean equals(Object o); @Override int hashCode(); @Override IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt); @Nonnull static IpSpace computeIpSpace(Set<Location> locations, SpecifierContext ctxt); }
LocationIpSpaceSpecifier implements IpSpaceSpecifier { @Override public IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt) { Set<Location> locations = _locationSpecifier.resolve(ctxt); return IpSpaceAssignment.builder().assign(key, computeIpSpace(locations, ctxt)).build(); } LocationIpSpaceSpecifier(@Nonnull LocationSpecifier locationSpecifier); @Override boolean equals(Object o); @Override int hashCode(); @Override IpSpaceAssignment resolve(Set<Location> key, SpecifierContext ctxt); @Nonnull static IpSpace computeIpSpace(Set<Location> locations, SpecifierContext ctxt);  }