@Test public void onSuccess() { final SystemSchema schema = newSchema(); newConnection( createConnector( schema ) ); final int schemaId = schema.getId(); final ReplicantContext context = Replicant.context(); context.request( schemaId, ValueUtil.randomString(), () -> { final Request r = context.currentRequest( schemaId ); final RequestBuilder rb = mock( RequestBuilder.class ); final RequestCallback chainedCallback = mock( RequestCallback.class ); new ReplicantRpcRequestBuilder( ValueUtil.randomString(), schemaId ).doSetCallback( rb, chainedCallback ); verify( rb ).setCallback( any( ReplicantRequestCallback.class ) ); verify( rb ).setHeader( eq( SharedConstants.CONNECTION_ID_HEADER ), eq( r.getConnectionId() ) ); verify( rb ).setHeader( eq( SharedConstants.REQUEST_ID_HEADER ), eq( String.valueOf( r.getRequestId() ) ) ); } ); }
@Override protected void doSetCallback( final RequestBuilder rb, final RequestCallback callback ) { final ReplicantContext context = Replicant.context(); if ( context.hasCurrentRequest( _schemaId ) ) { final Request request = context.currentRequest( _schemaId ); rb.setHeader( SharedConstants.CONNECTION_ID_HEADER, request.getConnectionId() ); rb.setHeader( SharedConstants.REQUEST_ID_HEADER, String.valueOf( request.getRequestId() ) ); rb.setCallback( new ReplicantRequestCallback( request, callback ) ); } else { super.doSetCallback( rb, callback ); } }
ReplicantRpcRequestBuilder extends RpcRequestBuilder { @Override protected void doSetCallback( final RequestBuilder rb, final RequestCallback callback ) { final ReplicantContext context = Replicant.context(); if ( context.hasCurrentRequest( _schemaId ) ) { final Request request = context.currentRequest( _schemaId ); rb.setHeader( SharedConstants.CONNECTION_ID_HEADER, request.getConnectionId() ); rb.setHeader( SharedConstants.REQUEST_ID_HEADER, String.valueOf( request.getRequestId() ) ); rb.setCallback( new ReplicantRequestCallback( request, callback ) ); } else { super.doSetCallback( rb, callback ); } } }
ReplicantRpcRequestBuilder extends RpcRequestBuilder { @Override protected void doSetCallback( final RequestBuilder rb, final RequestCallback callback ) { final ReplicantContext context = Replicant.context(); if ( context.hasCurrentRequest( _schemaId ) ) { final Request request = context.currentRequest( _schemaId ); rb.setHeader( SharedConstants.CONNECTION_ID_HEADER, request.getConnectionId() ); rb.setHeader( SharedConstants.REQUEST_ID_HEADER, String.valueOf( request.getRequestId() ) ); rb.setCallback( new ReplicantRequestCallback( request, callback ) ); } else { super.doSetCallback( rb, callback ); } } ReplicantRpcRequestBuilder( @Nonnull final String baseUrl, final int schemaId ); }
ReplicantRpcRequestBuilder extends RpcRequestBuilder { @Override protected void doSetCallback( final RequestBuilder rb, final RequestCallback callback ) { final ReplicantContext context = Replicant.context(); if ( context.hasCurrentRequest( _schemaId ) ) { final Request request = context.currentRequest( _schemaId ); rb.setHeader( SharedConstants.CONNECTION_ID_HEADER, request.getConnectionId() ); rb.setHeader( SharedConstants.REQUEST_ID_HEADER, String.valueOf( request.getRequestId() ) ); rb.setCallback( new ReplicantRequestCallback( request, callback ) ); } else { super.doSetCallback( rb, callback ); } } ReplicantRpcRequestBuilder( @Nonnull final String baseUrl, final int schemaId );  }
ReplicantRpcRequestBuilder extends RpcRequestBuilder { @Override protected void doSetCallback( final RequestBuilder rb, final RequestCallback callback ) { final ReplicantContext context = Replicant.context(); if ( context.hasCurrentRequest( _schemaId ) ) { final Request request = context.currentRequest( _schemaId ); rb.setHeader( SharedConstants.CONNECTION_ID_HEADER, request.getConnectionId() ); rb.setHeader( SharedConstants.REQUEST_ID_HEADER, String.valueOf( request.getRequestId() ) ); rb.setCallback( new ReplicantRequestCallback( request, callback ) ); } else { super.doSetCallback( rb, callback ); } } ReplicantRpcRequestBuilder( @Nonnull final String baseUrl, final int schemaId );   }