@Test public void onSubscribeStarted() { final Connector connector = createConnector(); final ChannelAddress address = new ChannelAddress( 1, 0 ); final AreaOfInterest areaOfInterest = safeAction( () -> Replicant.context().createOrUpdateAreaOfInterest( address, null ) ); assertEquals( areaOfInterest.getStatus(), AreaOfInterest.Status.NOT_ASKED ); safeAction( () -> assertNull( areaOfInterest.getSubscription() ) ); safeAction( () -> assertNull( areaOfInterest.getError() ) ); final TestSpyEventHandler handler = registerTestSpyEventHandler(); connector.onSubscribeStarted( address ); assertEquals( areaOfInterest.getStatus(), AreaOfInterest.Status.LOADING ); safeAction( () -> assertNull( areaOfInterest.getSubscription() ) ); safeAction( () -> assertNull( areaOfInterest.getError() ) ); handler.assertEventCount( 2 ); handler.assertNextEvent( AreaOfInterestStatusUpdatedEvent.class, e -> assertEquals( e.getAreaOfInterest(), areaOfInterest ) ); handler.assertNextEvent( SubscribeStartedEvent.class, e -> { assertEquals( e.getSchemaId(), connector.getSchema().getId() ); assertEquals( e.getAddress(), address ); } ); }
@Action void onSubscribeStarted( @Nonnull final ChannelAddress address ) { updateAreaOfInterest( address, AreaOfInterest.Status.LOADING ); if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.SubscribeStartedEvent( schema.getId(), address ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new SubscribeStartedEvent( getSchema().getId(), getSchema().getName(), address ) ); } }
Connector extends ReplicantService { @Action void onSubscribeStarted( @Nonnull final ChannelAddress address ) { updateAreaOfInterest( address, AreaOfInterest.Status.LOADING ); if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.SubscribeStartedEvent( schema.getId(), address ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new SubscribeStartedEvent( getSchema().getId(), getSchema().getName(), address ) ); } } }
Connector extends ReplicantService { @Action void onSubscribeStarted( @Nonnull final ChannelAddress address ) { updateAreaOfInterest( address, AreaOfInterest.Status.LOADING ); if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.SubscribeStartedEvent( schema.getId(), address ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new SubscribeStartedEvent( getSchema().getId(), getSchema().getName(), address ) ); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); }
Connector extends ReplicantService { @Action void onSubscribeStarted( @Nonnull final ChannelAddress address ) { updateAreaOfInterest( address, AreaOfInterest.Status.LOADING ); if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.SubscribeStartedEvent( schema.getId(), address ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new SubscribeStartedEvent( getSchema().getId(), getSchema().getName(), address ) ); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString(); }
Connector extends ReplicantService { @Action void onSubscribeStarted( @Nonnull final ChannelAddress address ) { updateAreaOfInterest( address, AreaOfInterest.Status.LOADING ); if ( Replicant.areEventsEnabled() && getReplicantContext().willPropagateApplicationEvents() ) { final SystemSchema schema = getSchema(); getReplicantContext().getEventBroker() .reportApplicationEvent( new replicant.events.SubscribeStartedEvent( schema.getId(), address ) ); } if ( Replicant.areSpiesEnabled() && getReplicantContext().getSpy().willPropagateSpyEvents() ) { getReplicantContext().getSpy() .reportSpyEvent( new SubscribeStartedEvent( getSchema().getId(), getSchema().getName(), address ) ); } } Connector( @Nullable final ReplicantContext context,
             @Nonnull final SystemSchema schema,
             @Nonnull final Transport transport ); @Override String toString();  }