@Test public void getEventBroker() { ReplicantTestUtil.enableEvents(); ReplicantTestUtil.resetState(); final ReplicantContext context = Replicant.context(); assertFalse( context.willPropagateApplicationEvents() ); final ApplicationEventBroker broker = context.getEventBroker(); broker.addApplicationEventHandler( new TestApplicationEventHandler() ); assertTrue( broker.willPropagateApplicationEvents() ); assertTrue( context.willPropagateApplicationEvents() ); ReplicantTestUtil.disableEvents(); assertFalse( broker.willPropagateApplicationEvents() ); assertFalse( context.willPropagateApplicationEvents() ); }
@Nonnull public ApplicationEventBroker getEventBroker() { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( Replicant::areEventsEnabled, () -> "Replicant-0092: Attempting to get ApplicationEventBroker but events are not enabled." ); } assert null != _eventBroker; return _eventBroker; }
ReplicantContext { @Nonnull public ApplicationEventBroker getEventBroker() { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( Replicant::areEventsEnabled, () -> "Replicant-0092: Attempting to get ApplicationEventBroker but events are not enabled." ); } assert null != _eventBroker; return _eventBroker; } }
ReplicantContext { @Nonnull public ApplicationEventBroker getEventBroker() { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( Replicant::areEventsEnabled, () -> "Replicant-0092: Attempting to get ApplicationEventBroker but events are not enabled." ); } assert null != _eventBroker; return _eventBroker; } ReplicantContext(); }
ReplicantContext { @Nonnull public ApplicationEventBroker getEventBroker() { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( Replicant::areEventsEnabled, () -> "Replicant-0092: Attempting to get ApplicationEventBroker but events are not enabled." ); } assert null != _eventBroker; return _eventBroker; } ReplicantContext(); void setAuthToken( @Nullable final String authToken ); @Nullable String getAuthToken(); @Nonnull Disposable registerConnector( @Nonnull final SystemSchema schema, @Nonnull final Transport transport ); @Nonnull List<AreaOfInterest> getAreasOfInterest(); @Nullable AreaOfInterest findAreaOfInterestByAddress( @Nonnull final ChannelAddress address ); @Nonnull AreaOfInterest createOrUpdateAreaOfInterest( @Nonnull final ChannelAddress address,
                                                      @Nullable final Object filter ); @Nullable Entity findEntityByTypeAndId( @Nonnull final Class<?> type, final int id ); @Nonnull List<Entity> findAllEntitiesByType( @Nonnull final Class<?> type ); @Nonnull Collection<Class<?>> findAllEntityTypes(); @Nonnull List<Subscription> getTypeSubscriptions(); @Nonnull Collection<Subscription> getInstanceSubscriptions(); @Nonnull Set<Integer> getInstanceSubscriptionIds( final int systemId, final int channelId ); @Nullable Subscription findSubscription( @Nonnull final ChannelAddress address ); @Nonnull Collection<SystemSchema> getSchemas(); @Nullable SystemSchema findSchemaById( final int schemaId ); @Nonnull SystemSchema getSchemaById( final int schemaId ); @Nonnull Spy getSpy(); @Nonnull ApplicationEventBroker getEventBroker(); @Nonnull EntityChangeBroker getChangeBroker(); @Nonnull EntityChangeEmitter getChangeEmitter(); void setPreConvergeAction( @Nullable final SafeProcedure preConvergeAction ); @Nullable SafeProcedure getPreConvergeAction(); void setConvergeCompleteAction( @Nullable final SafeProcedure convergeCompleteAction ); @Nullable SafeProcedure getConvergeCompleteAction(); void activate(); void deactivate(); boolean isActive(); RuntimeState getState(); void setConnectorRequired( final int schemaId, final boolean required ); @Nullable String findConnectionId( final int schemaId ); void request( final int schemaId, @Nullable final String name, @Nonnull final SafeProcedure callback ); @Nonnull Request currentRequest( final int schemaId ); boolean hasCurrentRequest( final int schemaId ); @Nullable CacheService getCacheService(); void setCacheService( @Nullable final CacheService cacheService ); }
ReplicantContext { @Nonnull public ApplicationEventBroker getEventBroker() { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( Replicant::areEventsEnabled, () -> "Replicant-0092: Attempting to get ApplicationEventBroker but events are not enabled." ); } assert null != _eventBroker; return _eventBroker; } ReplicantContext(); void setAuthToken( @Nullable final String authToken ); @Nullable String getAuthToken(); @Nonnull Disposable registerConnector( @Nonnull final SystemSchema schema, @Nonnull final Transport transport ); @Nonnull List<AreaOfInterest> getAreasOfInterest(); @Nullable AreaOfInterest findAreaOfInterestByAddress( @Nonnull final ChannelAddress address ); @Nonnull AreaOfInterest createOrUpdateAreaOfInterest( @Nonnull final ChannelAddress address,
                                                      @Nullable final Object filter ); @Nullable Entity findEntityByTypeAndId( @Nonnull final Class<?> type, final int id ); @Nonnull List<Entity> findAllEntitiesByType( @Nonnull final Class<?> type ); @Nonnull Collection<Class<?>> findAllEntityTypes(); @Nonnull List<Subscription> getTypeSubscriptions(); @Nonnull Collection<Subscription> getInstanceSubscriptions(); @Nonnull Set<Integer> getInstanceSubscriptionIds( final int systemId, final int channelId ); @Nullable Subscription findSubscription( @Nonnull final ChannelAddress address ); @Nonnull Collection<SystemSchema> getSchemas(); @Nullable SystemSchema findSchemaById( final int schemaId ); @Nonnull SystemSchema getSchemaById( final int schemaId ); @Nonnull Spy getSpy(); @Nonnull ApplicationEventBroker getEventBroker(); @Nonnull EntityChangeBroker getChangeBroker(); @Nonnull EntityChangeEmitter getChangeEmitter(); void setPreConvergeAction( @Nullable final SafeProcedure preConvergeAction ); @Nullable SafeProcedure getPreConvergeAction(); void setConvergeCompleteAction( @Nullable final SafeProcedure convergeCompleteAction ); @Nullable SafeProcedure getConvergeCompleteAction(); void activate(); void deactivate(); boolean isActive(); RuntimeState getState(); void setConnectorRequired( final int schemaId, final boolean required ); @Nullable String findConnectionId( final int schemaId ); void request( final int schemaId, @Nullable final String name, @Nonnull final SafeProcedure callback ); @Nonnull Request currentRequest( final int schemaId ); boolean hasCurrentRequest( final int schemaId ); @Nullable CacheService getCacheService(); void setCacheService( @Nullable final CacheService cacheService );  }