@Test public void activate() { final SystemSchema schema1 = newSchema(); final ReplicantRuntime runtime = Replicant.context().getRuntime(); final Connector service1 = createConnector( schema1 ); final ConnectorEntry entry1 = runtime.getConnectorEntryBySchemaId( service1.getSchema().getId() ); final Disposable schedulerLock1 = pauseScheduler(); runtime.deactivate(); reset( service1.getTransport() ); safeAction( () -> service1.setState( ConnectorState.DISCONNECTED ) ); entry1.getRateLimiter().fillBucket(); runtime.activate(); schedulerLock1.dispose(); verify( service1.getTransport(), times( 1 ) ) .requestConnect( any( TransportContext.class ) ); reset( service1.getTransport() ); final Disposable schedulerLock2 = pauseScheduler(); runtime.deactivate(); safeAction( () -> service1.setState( ConnectorState.CONNECTING ) ); entry1.getRateLimiter().fillBucket(); runtime.activate(); schedulerLock2.dispose(); verify( service1.getTransport(), never() ).requestConnect( any( TransportContext.class ) ); runtime.deactivate(); safeAction( () -> service1.setState( ConnectorState.DISCONNECTING ) ); entry1.getRateLimiter().fillBucket(); runtime.activate(); verify( service1.getTransport(), never() ) .requestConnect( any( TransportContext.class ) ); final Disposable schedulerLock3 = pauseScheduler(); runtime.deactivate(); newConnection( service1 ); safeAction( () -> service1.setState( ConnectorState.CONNECTED ) ); entry1.getRateLimiter().fillBucket(); runtime.activate(); schedulerLock3.dispose(); verify( service1.getTransport(), never() ).requestConnect( any( TransportContext.class ) ); final Disposable schedulerLock4 = pauseScheduler(); runtime.deactivate(); safeAction( () -> service1.setState( ConnectorState.DISCONNECTED ) ); entry1.getRateLimiter().setTokenCount( 0 ); runtime.activate(); schedulerLock4.dispose(); verify( service1.getTransport(), never() ) .requestConnect( any( TransportContext.class ) ); final Disposable schedulerLock5 = pauseScheduler(); runtime.deactivate(); safeAction( () -> service1.setState( ConnectorState.DISCONNECTED ) ); entry1.getRateLimiter().fillBucket(); runtime.activate(); schedulerLock5.dispose(); verify( service1.getTransport(), times( 1 ) ) .requestConnect( any( TransportContext.class ) ); }
@Action void activate() { setActive( true ); }
ReplicantRuntime { @Action void activate() { setActive( true ); } }
ReplicantRuntime { @Action void activate() { setActive( true ); }  }
ReplicantRuntime { @Action void activate() { setActive( true ); }  @Action( verifyRequired = false, reportParameters = false ) void setAuthToken( @Nullable final String authToken ); }
ReplicantRuntime { @Action void activate() { setActive( true ); }  @Action( verifyRequired = false, reportParameters = false ) void setAuthToken( @Nullable final String authToken );  }