mirror of https://github.com/apache/nifi.git
NIFI-2662 - Fix checkstyle violations introduced by NIFI-2635
Signed-off-by: Matt Burgess <mattyb149@apache.org> This closes #940
This commit is contained in:
parent
e210172d93
commit
6fd1c17ca4
|
@ -110,10 +110,10 @@ public interface RequestReplicator {
|
|||
*/
|
||||
AsyncClusterResponse replicate(Set<NodeIdentifier> nodeIds, String method, URI uri, Object entity, Map<String, String> headers, boolean indicateReplicated, boolean performVerification);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Forwards a request to the Cluster Coordinator so that it is able to replicate the request to all nodes in the cluster.
|
||||
*
|
||||
*
|
||||
* @param coordinatorNodeId the node identifier of the Cluster Coordinator
|
||||
* @param method the HTTP method (e.g., POST, PUT)
|
||||
* @param uri the base request URI (up to, but not including, the query string)
|
||||
|
@ -123,7 +123,7 @@ public interface RequestReplicator {
|
|||
* @return an AsyncClusterResponse that indicates the current status of the request and provides an identifier for obtaining an updated response later
|
||||
*/
|
||||
AsyncClusterResponse forwardToCoordinator(NodeIdentifier coordinatorNodeId, String method, URI uri, Object entity, Map<String, String> headers);
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Returns an AsyncClusterResponse that provides the most up-to-date status of the request with the given identifier.
|
||||
|
|
|
@ -262,16 +262,16 @@ public class ThreadPoolRequestReplicator implements RequestReplicator {
|
|||
public AsyncClusterResponse forwardToCoordinator(final NodeIdentifier coordinatorNodeId, final String method, final URI uri, final Object entity, final Map<String, String> headers) {
|
||||
// If the user is authenticated, add them as a proxied entity so that when the receiving NiFi receives the request,
|
||||
// it knows that we are acting as a proxy on behalf of the current user.
|
||||
final Map<String, String> updatedHeaders = new HashMap<>(headers);
|
||||
final Map<String, String> updatedHeaders = new HashMap<>(headers);
|
||||
final NiFiUser user = NiFiUserUtils.getNiFiUser();
|
||||
if (user != null && !user.isAnonymous()) {
|
||||
final String proxiedEntitiesChain = ProxiedEntitiesUtils.buildProxiedEntitiesChainString(user);
|
||||
updatedHeaders.put(ProxiedEntitiesUtils.PROXY_ENTITIES_CHAIN, proxiedEntitiesChain);
|
||||
}
|
||||
|
||||
|
||||
return replicate(Collections.singleton(coordinatorNodeId), method, uri, entity, updatedHeaders, false, null, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replicates the request to all nodes in the given set of node identifiers
|
||||
*
|
||||
|
@ -516,8 +516,10 @@ public class ThreadPoolRequestReplicator implements RequestReplicator {
|
|||
}
|
||||
|
||||
// Visible for testing - overriding this method makes it easy to verify behavior without actually making any web requests
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method, final URI uri, final String requestId,
|
||||
final Map<String, String> headers) {
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||
final NodeIdentifier nodeId, final String method,
|
||||
final URI uri, final String requestId,
|
||||
final Map<String, String> headers) {
|
||||
final ClientResponse clientResponse;
|
||||
final long startNanos = System.nanoTime();
|
||||
logger.debug("Replicating request to {} {}, request ID = {}, headers = {}", method, uri, requestId, headers);
|
||||
|
|
|
@ -164,8 +164,10 @@ public class TestThreadPoolRequestReplicator {
|
|||
final ThreadPoolRequestReplicator replicator
|
||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||
@Override
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
||||
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||
final NodeIdentifier nodeId, final String method,
|
||||
final URI uri, final String requestId,
|
||||
Map<String, String> givenHeaders) {
|
||||
// the resource builder will not expose its headers to us, so we are using Mockito's Whitebox class to extract them.
|
||||
final OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
||||
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
||||
|
@ -286,8 +288,10 @@ public class TestThreadPoolRequestReplicator {
|
|||
final ThreadPoolRequestReplicator replicator
|
||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||
@Override
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
||||
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||
final NodeIdentifier nodeId, final String method,
|
||||
final URI uri, final String requestId,
|
||||
Map<String, String> givenHeaders) {
|
||||
// the resource builder will not expose its headers to us, so we are using Mockito's Whitebox class to extract them.
|
||||
final OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
||||
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
||||
|
@ -329,8 +333,10 @@ public class TestThreadPoolRequestReplicator {
|
|||
final ThreadPoolRequestReplicator replicator
|
||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||
@Override
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
||||
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||
final NodeIdentifier nodeId, final String method,
|
||||
final URI uri, final String requestId,
|
||||
Map<String, String> givenHeaders) {
|
||||
if (delayMillis > 0L) {
|
||||
try {
|
||||
Thread.sleep(delayMillis);
|
||||
|
|
Loading…
Reference in New Issue