@Test public void removeOrphanSubscriptions_whenConnectorDisconnected() { final Connector connector = createConnector(); final ChannelAddress address = new ChannelAddress( 1, 0 ); safeAction( () -> { createSubscription( address, null, true ); connector.setState( ConnectorState.DISCONNECTED ); final TestSpyEventHandler handler = registerTestSpyEventHandler(); Replicant.context().getConverger().removeOrphanSubscriptions(); handler.assertEventCount( 0 ); } ); }
@arez.annotations.Action void removeOrphanSubscriptions() { final HashSet<ChannelAddress> expected = new HashSet<>(); getReplicantContext().getAreasOfInterest().forEach( aoi -> expected.add( aoi.getAddress() ) ); final SubscriptionService subscriptionService = getReplicantContext().getSubscriptionService(); removeOrphanSubscriptions( subscriptionService.getTypeSubscriptions(), expected ); removeOrphanSubscriptions( subscriptionService.getInstanceSubscriptions(), expected ); }
Converger extends ReplicantService { @arez.annotations.Action void removeOrphanSubscriptions() { final HashSet<ChannelAddress> expected = new HashSet<>(); getReplicantContext().getAreasOfInterest().forEach( aoi -> expected.add( aoi.getAddress() ) ); final SubscriptionService subscriptionService = getReplicantContext().getSubscriptionService(); removeOrphanSubscriptions( subscriptionService.getTypeSubscriptions(), expected ); removeOrphanSubscriptions( subscriptionService.getInstanceSubscriptions(), expected ); } }
Converger extends ReplicantService { @arez.annotations.Action void removeOrphanSubscriptions() { final HashSet<ChannelAddress> expected = new HashSet<>(); getReplicantContext().getAreasOfInterest().forEach( aoi -> expected.add( aoi.getAddress() ) ); final SubscriptionService subscriptionService = getReplicantContext().getSubscriptionService(); removeOrphanSubscriptions( subscriptionService.getTypeSubscriptions(), expected ); removeOrphanSubscriptions( subscriptionService.getInstanceSubscriptions(), expected ); } Converger( @Nullable final ReplicantContext context ); }
Converger extends ReplicantService { @arez.annotations.Action void removeOrphanSubscriptions() { final HashSet<ChannelAddress> expected = new HashSet<>(); getReplicantContext().getAreasOfInterest().forEach( aoi -> expected.add( aoi.getAddress() ) ); final SubscriptionService subscriptionService = getReplicantContext().getSubscriptionService(); removeOrphanSubscriptions( subscriptionService.getTypeSubscriptions(), expected ); removeOrphanSubscriptions( subscriptionService.getInstanceSubscriptions(), expected ); } Converger( @Nullable final ReplicantContext context );  }
Converger extends ReplicantService { @arez.annotations.Action void removeOrphanSubscriptions() { final HashSet<ChannelAddress> expected = new HashSet<>(); getReplicantContext().getAreasOfInterest().forEach( aoi -> expected.add( aoi.getAddress() ) ); final SubscriptionService subscriptionService = getReplicantContext().getSubscriptionService(); removeOrphanSubscriptions( subscriptionService.getTypeSubscriptions(), expected ); removeOrphanSubscriptions( subscriptionService.getInstanceSubscriptions(), expected ); } Converger( @Nullable final ReplicantContext context );   }