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