@Test public void removeUnneededRemoveRequests_noSubscription() { final Connector connector = createConnector(); final ChannelAddress address1 = new ChannelAddress( 1, 1, 1 ); final ArrayList<AreaOfInterestRequest> requests = new ArrayList<>(); final AreaOfInterestRequest request1 = new AreaOfInterestRequest( address1, AreaOfInterestRequest.Type.REMOVE, null ); requests.add( request1 ); final int requestId = newRequest( newConnection( connector ) ).getRequestId(); requests.forEach( r -> r.markAsInProgress( requestId ) ); final IllegalStateException exception = expectThrows( IllegalStateException.class, () -> safeAction( () -> connector.removeUnneededRemoveRequests( requests ) ) ); assertEquals( exception.getMessage(), "Replicant-0046: Request to unsubscribe from channel at address 1.1.1 but not subscribed to channel." ); }
@Action( verifyRequired = false ) void removeUnneededRemoveRequests( @Nonnull final List<AreaOfInterestRequest> requests ) { requests.removeIf( request -> { final ChannelAddress address = request.getAddress(); final Subscription subscription = getReplicantContext().findSubscription( address ); if ( Replicant.shouldCheckInvariants() ) { invariant( () -> null != subscription, () -> "Replicant-0046: Request to unsubscribe from channel at address " + address + " but not subscribed to channel." ); invariant( () -> null == subscription || subscription.isExplicitSubscription(), () -> "Replicant-0047: Request to unsubscribe from channel at address " + address + " but subscription is not an explicit subscription." ); } if ( null == subscription || !subscription.isExplicitSubscription() ) { request.markAsComplete(); return true; } else { return false; } } ); }
Connector extends ReplicantService { @Action( verifyRequired = false ) void removeUnneededRemoveRequests( @Nonnull final List<AreaOfInterestRequest> requests ) { requests.removeIf( request -> { final ChannelAddress address = request.getAddress(); final Subscription subscription = getReplicantContext().findSubscription( address ); if ( Replicant.shouldCheckInvariants() ) { invariant( () -> null != subscription, () -> "Replicant-0046: Request to unsubscribe from channel at address " + address + " but not subscribed to channel." ); invariant( () -> null == subscription || subscription.isExplicitSubscription(), () -> "Replicant-0047: Request to unsubscribe from channel at address " + address + " but subscription is not an explicit subscription." ); } if ( null == subscription || !subscription.isExplicitSubscription() ) { request.markAsComplete(); return true; } else { return false; } } ); } }
Connector extends ReplicantService { @Action( verifyRequired = false ) void removeUnneededRemoveRequests( @Nonnull final List<AreaOfInterestRequest> requests ) { requests.removeIf( request -> { final ChannelAddress address = request.getAddress(); final Subscription subscription = getReplicantContext().findSubscription( address ); if ( Replicant.shouldCheckInvariants() ) { invariant( () -> null != subscription, () -> "Replicant-0046: Request to unsubscribe from channel at address " + address + " but not subscribed to channel." ); invariant( () -> null == subscription || subscription.isExplicitSubscription(), () -> "Replicant-0047: Request to unsubscribe from channel at address " + address + " but subscription is not an explicit subscription." ); } if ( null == subscription || !subscription.isExplicitSubscription() ) { request.markAsComplete(); return true; } else { return false; } } ); } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); }
Connector extends ReplicantService { @Action( verifyRequired = false ) void removeUnneededRemoveRequests( @Nonnull final List<AreaOfInterestRequest> requests ) { requests.removeIf( request -> { final ChannelAddress address = request.getAddress(); final Subscription subscription = getReplicantContext().findSubscription( address ); if ( Replicant.shouldCheckInvariants() ) { invariant( () -> null != subscription, () -> "Replicant-0046: Request to unsubscribe from channel at address " + address + " but not subscribed to channel." ); invariant( () -> null == subscription || subscription.isExplicitSubscription(), () -> "Replicant-0047: Request to unsubscribe from channel at address " + address + " but subscription is not an explicit subscription." ); } if ( null == subscription || !subscription.isExplicitSubscription() ) { request.markAsComplete(); return true; } else { return false; } } ); } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString(); }
Connector extends ReplicantService { @Action( verifyRequired = false ) void removeUnneededRemoveRequests( @Nonnull final List<AreaOfInterestRequest> requests ) { requests.removeIf( request -> { final ChannelAddress address = request.getAddress(); final Subscription subscription = getReplicantContext().findSubscription( address ); if ( Replicant.shouldCheckInvariants() ) { invariant( () -> null != subscription, () -> "Replicant-0046: Request to unsubscribe from channel at address " + address + " but not subscribed to channel." ); invariant( () -> null == subscription || subscription.isExplicitSubscription(), () -> "Replicant-0047: Request to unsubscribe from channel at address " + address + " but subscription is not an explicit subscription." ); } if ( null == subscription || !subscription.isExplicitSubscription() ) { request.markAsComplete(); return true; } else { return false; } } ); } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString();  }