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
|
@ -262,7 +262,7 @@ 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) {
|
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,
|
// 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.
|
// 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();
|
final NiFiUser user = NiFiUserUtils.getNiFiUser();
|
||||||
if (user != null && !user.isAnonymous()) {
|
if (user != null && !user.isAnonymous()) {
|
||||||
final String proxiedEntitiesChain = ProxiedEntitiesUtils.buildProxiedEntitiesChainString(user);
|
final String proxiedEntitiesChain = ProxiedEntitiesUtils.buildProxiedEntitiesChainString(user);
|
||||||
|
@ -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
|
// 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,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||||
final Map<String, String> headers) {
|
final NodeIdentifier nodeId, final String method,
|
||||||
|
final URI uri, final String requestId,
|
||||||
|
final Map<String, String> headers) {
|
||||||
final ClientResponse clientResponse;
|
final ClientResponse clientResponse;
|
||||||
final long startNanos = System.nanoTime();
|
final long startNanos = System.nanoTime();
|
||||||
logger.debug("Replicating request to {} {}, request ID = {}, headers = {}", method, uri, requestId, headers);
|
logger.debug("Replicating request to {} {}, request ID = {}, headers = {}", method, uri, requestId, headers);
|
||||||
|
|
|
@ -164,8 +164,10 @@ public class TestThreadPoolRequestReplicator {
|
||||||
final ThreadPoolRequestReplicator replicator
|
final ThreadPoolRequestReplicator replicator
|
||||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||||
@Override
|
@Override
|
||||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||||
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
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.
|
// 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 OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
||||||
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
||||||
|
@ -286,8 +288,10 @@ public class TestThreadPoolRequestReplicator {
|
||||||
final ThreadPoolRequestReplicator replicator
|
final ThreadPoolRequestReplicator replicator
|
||||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||||
@Override
|
@Override
|
||||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||||
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
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.
|
// 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 OutBoundHeaders headers = (OutBoundHeaders) Whitebox.getInternalState(resourceBuilder, "metadata");
|
||||||
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
final Object expectsHeader = headers.getFirst(ThreadPoolRequestReplicator.REQUEST_VALIDATION_HTTP_HEADER);
|
||||||
|
@ -329,8 +333,10 @@ public class TestThreadPoolRequestReplicator {
|
||||||
final ThreadPoolRequestReplicator replicator
|
final ThreadPoolRequestReplicator replicator
|
||||||
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
= new ThreadPoolRequestReplicator(2, new Client(), coordinator, "1 sec", "1 sec", null, null, NiFiProperties.createBasicNiFiProperties(null, null)) {
|
||||||
@Override
|
@Override
|
||||||
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder, final NodeIdentifier nodeId, final String method,
|
protected NodeResponse replicateRequest(final WebResource.Builder resourceBuilder,
|
||||||
final URI uri, final String requestId, Map<String, String> givenHeaders) {
|
final NodeIdentifier nodeId, final String method,
|
||||||
|
final URI uri, final String requestId,
|
||||||
|
Map<String, String> givenHeaders) {
|
||||||
if (delayMillis > 0L) {
|
if (delayMillis > 0L) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(delayMillis);
|
Thread.sleep(delayMillis);
|
||||||
|
|
Loading…
Reference in New Issue