parent
2325fb9cb3
commit
7f1784e9f9
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.gateway;
|
||||
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.cluster.routing.allocation.FailedShard;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.gateway.GatewayAllocator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An allocator used for tests that doesn't do anything
|
||||
*/
|
||||
public class NoopGatewayAllocator extends GatewayAllocator {
|
||||
|
||||
public static final NoopGatewayAllocator INSTANCE = new NoopGatewayAllocator();
|
||||
|
||||
@Override
|
||||
public void applyStartedShards(RoutingAllocation allocation, List<ShardRouting> startedShards) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFailedShards(RoutingAllocation allocation, List<FailedShard> failedShards) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allocateUnassigned(RoutingAllocation allocation) {
|
||||
// noop
|
||||
}
|
||||
}
|
|
@ -237,13 +237,6 @@ public final class MockTransportService extends TransportService {
|
|||
addFailToSendNoConnectRule(transportService, new HashSet<>(Arrays.asList(blockedActions)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a rule that will cause matching operations to throw ConnectTransportExceptions
|
||||
*/
|
||||
public void addFailToSendNoConnectRule(TransportAddress transportAddress, final String... blockedActions) {
|
||||
addFailToSendNoConnectRule(transportAddress, new HashSet<>(Arrays.asList(blockedActions)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a rule that will cause matching operations to throw ConnectTransportExceptions
|
||||
*/
|
||||
|
@ -413,16 +406,6 @@ public final class MockTransportService extends TransportService {
|
|||
return transport().addSendBehavior(transportAddress, sendBehavior);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a send behavior that is the default send behavior.
|
||||
*
|
||||
* @return {@code true} if no default send behavior was registered
|
||||
*/
|
||||
public boolean addSendBehavior(StubbableTransport.SendRequestBehavior behavior) {
|
||||
return transport().setDefaultSendBehavior(behavior);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a new connect behavior that is used for creating connections with the given delegate service.
|
||||
*
|
||||
|
@ -445,19 +428,6 @@ public final class MockTransportService extends TransportService {
|
|||
return transport().addConnectBehavior(transportAddress, connectBehavior);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new get connection behavior that is used for communication with the given delegate service.
|
||||
*
|
||||
* @return {@code true} if no other get connection behavior was registered for any of the addresses bound by delegate service.
|
||||
*/
|
||||
public boolean addGetConnectionBehavior(TransportService transportService, StubbableConnectionManager.GetConnectionBehavior behavior) {
|
||||
boolean noRegistered = true;
|
||||
for (TransportAddress transportAddress : extractTransportAddresses(transportService)) {
|
||||
noRegistered &= addGetConnectionBehavior(transportAddress, behavior);
|
||||
}
|
||||
return noRegistered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a get connection behavior that is used for communication with the given delegate address.
|
||||
*
|
||||
|
@ -476,19 +446,6 @@ public final class MockTransportService extends TransportService {
|
|||
return connectionManager().setDefaultGetConnectionBehavior(behavior);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a node connected behavior that is used for the given delegate service.
|
||||
*
|
||||
* @return {@code true} if no other node connected behavior was registered for any of the addresses bound by delegate service.
|
||||
*/
|
||||
public boolean addNodeConnectedBehavior(TransportService transportService, StubbableConnectionManager.NodeConnectedBehavior behavior) {
|
||||
boolean noRegistered = true;
|
||||
for (TransportAddress transportAddress : extractTransportAddresses(transportService)) {
|
||||
noRegistered &= addNodeConnectedBehavior(transportAddress, behavior);
|
||||
}
|
||||
return noRegistered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a node connected behavior that is used for the given delegate address.
|
||||
*
|
||||
|
@ -538,10 +495,6 @@ public final class MockTransportService extends TransportService {
|
|||
activeTracers.add(tracer);
|
||||
}
|
||||
|
||||
public boolean removeTracer(Tracer tracer) {
|
||||
return activeTracers.remove(tracer);
|
||||
}
|
||||
|
||||
public void clearTracers() {
|
||||
activeTracers.clear();
|
||||
}
|
||||
|
|
|
@ -55,12 +55,6 @@ public final class StubbableTransport implements Transport {
|
|||
this.delegate = transport;
|
||||
}
|
||||
|
||||
boolean setDefaultSendBehavior(SendRequestBehavior sendBehavior) {
|
||||
SendRequestBehavior prior = defaultSendRequest;
|
||||
defaultSendRequest = sendBehavior;
|
||||
return prior == null;
|
||||
}
|
||||
|
||||
public boolean setDefaultConnectBehavior(OpenConnectionBehavior openConnectionBehavior) {
|
||||
OpenConnectionBehavior prior = this.defaultConnectBehavior;
|
||||
this.defaultConnectBehavior = openConnectionBehavior;
|
||||
|
|
Loading…
Reference in New Issue