@Test public void requiredRulesFor_emptyList() { replayAll(); assertEquals(ImmutableSet.<Netmask>of(), service().requiredRulesFor( ImmutableList.<CassandraInstance>of())); }
@VisibleForTesting Set<Netmask> requiredRulesFor(Collection<CassandraInstance> instances) { ImmutableSet.Builder<Netmask> permissions = ImmutableSet.builder(); for (CassandraInstance instance : instances) { Netmask netmask = Netmask.fromCidr(instance.getPublicIpAddress() + "/32"); if (netmask != null) { permissions.add(netmask); } } return permissions.build(); }
SecurityGroupUpdaterService extends AbstractScheduledService implements ScheduledServiceMBean { @VisibleForTesting Set<Netmask> requiredRulesFor(Collection<CassandraInstance> instances) { ImmutableSet.Builder<Netmask> permissions = ImmutableSet.builder(); for (CassandraInstance instance : instances) { Netmask netmask = Netmask.fromCidr(instance.getPublicIpAddress() + "/32"); if (netmask != null) { permissions.add(netmask); } } return permissions.build(); } }
SecurityGroupUpdaterService extends AbstractScheduledService implements ScheduledServiceMBean { @VisibleForTesting Set<Netmask> requiredRulesFor(Collection<CassandraInstance> instances) { ImmutableSet.Builder<Netmask> permissions = ImmutableSet.builder(); for (CassandraInstance instance : instances) { Netmask netmask = Netmask.fromCidr(instance.getPublicIpAddress() + "/32"); if (netmask != null) { permissions.add(netmask); } } return permissions.build(); } @Inject  SecurityGroupUpdaterService(
      CassandraRingService cassandraRingService,
      SecurityGroupService securityGroupService,
      @Named(SecurityGroupModule.SECURITY_GROUP_DATACENTERS_PROPERTY)
          Function<CassandraInstance, String> dataCenterTransformFunction,
      @Named(SecurityGroupModule.CASSANDRA_GOSSIP_PORT_PROPERTY) int listenPort,
      @Named(SecurityGroupModule.CASSANDRA_SSL_GOSSIP_PORT_PROPERTY) int sslListenPort,
      @Named(SecurityGroupModule.CASSANDRA_RING_SSL_ENABLED) Set<String> sslEnabledRings,
      @Named(SecurityGroupModule.SECURITY_GROUP_UPDATE_PERIOD_PROPERTY) Duration updatePeriod,
      @Named(SecurityGroupModule.SECURITY_GROUP_NAME_PREFIX_PROPERTY) String securityGroupNamePrefix); }
SecurityGroupUpdaterService extends AbstractScheduledService implements ScheduledServiceMBean { @VisibleForTesting Set<Netmask> requiredRulesFor(Collection<CassandraInstance> instances) { ImmutableSet.Builder<Netmask> permissions = ImmutableSet.builder(); for (CassandraInstance instance : instances) { Netmask netmask = Netmask.fromCidr(instance.getPublicIpAddress() + "/32"); if (netmask != null) { permissions.add(netmask); } } return permissions.build(); } @Inject  SecurityGroupUpdaterService(
      CassandraRingService cassandraRingService,
      SecurityGroupService securityGroupService,
      @Named(SecurityGroupModule.SECURITY_GROUP_DATACENTERS_PROPERTY)
          Function<CassandraInstance, String> dataCenterTransformFunction,
      @Named(SecurityGroupModule.CASSANDRA_GOSSIP_PORT_PROPERTY) int listenPort,
      @Named(SecurityGroupModule.CASSANDRA_SSL_GOSSIP_PORT_PROPERTY) int sslListenPort,
      @Named(SecurityGroupModule.CASSANDRA_RING_SSL_ENABLED) Set<String> sslEnabledRings,
      @Named(SecurityGroupModule.SECURITY_GROUP_UPDATE_PERIOD_PROPERTY) Duration updatePeriod,
      @Named(SecurityGroupModule.SECURITY_GROUP_NAME_PREFIX_PROPERTY) String securityGroupNamePrefix); @Override void runOneIteration(); }
SecurityGroupUpdaterService extends AbstractScheduledService implements ScheduledServiceMBean { @VisibleForTesting Set<Netmask> requiredRulesFor(Collection<CassandraInstance> instances) { ImmutableSet.Builder<Netmask> permissions = ImmutableSet.builder(); for (CassandraInstance instance : instances) { Netmask netmask = Netmask.fromCidr(instance.getPublicIpAddress() + "/32"); if (netmask != null) { permissions.add(netmask); } } return permissions.build(); } @Inject  SecurityGroupUpdaterService(
      CassandraRingService cassandraRingService,
      SecurityGroupService securityGroupService,
      @Named(SecurityGroupModule.SECURITY_GROUP_DATACENTERS_PROPERTY)
          Function<CassandraInstance, String> dataCenterTransformFunction,
      @Named(SecurityGroupModule.CASSANDRA_GOSSIP_PORT_PROPERTY) int listenPort,
      @Named(SecurityGroupModule.CASSANDRA_SSL_GOSSIP_PORT_PROPERTY) int sslListenPort,
      @Named(SecurityGroupModule.CASSANDRA_RING_SSL_ENABLED) Set<String> sslEnabledRings,
      @Named(SecurityGroupModule.SECURITY_GROUP_UPDATE_PERIOD_PROPERTY) Duration updatePeriod,
      @Named(SecurityGroupModule.SECURITY_GROUP_NAME_PREFIX_PROPERTY) String securityGroupNamePrefix); @Override void runOneIteration();  }