Repository: nifi Updated Branches: refs/heads/master 5bdb7cf6e -> 39556e351
http://git-wip-us.apache.org/repos/asf/nifi/blob/39556e35/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestChannel.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestChannel.java b/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestChannel.java index f793084..4ed4eeb 100644 --- a/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestChannel.java +++ b/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestChannel.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeoutException; @@ -37,14 +38,19 @@ import com.rabbitmq.client.AMQP.Queue.PurgeOk; import com.rabbitmq.client.AMQP.Tx.CommitOk; import com.rabbitmq.client.AMQP.Tx.RollbackOk; import com.rabbitmq.client.AMQP.Tx.SelectOk; +import com.rabbitmq.client.BuiltinExchangeType; +import com.rabbitmq.client.CancelCallback; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Command; +import com.rabbitmq.client.ConfirmCallback; import com.rabbitmq.client.ConfirmListener; import com.rabbitmq.client.Connection; import com.rabbitmq.client.Consumer; -import com.rabbitmq.client.FlowListener; +import com.rabbitmq.client.ConsumerShutdownSignalCallback; +import com.rabbitmq.client.DeliverCallback; import com.rabbitmq.client.GetResponse; import com.rabbitmq.client.Method; +import com.rabbitmq.client.ReturnCallback; import com.rabbitmq.client.ReturnListener; import com.rabbitmq.client.ShutdownListener; import com.rabbitmq.client.ShutdownSignalException; @@ -55,19 +61,12 @@ import com.rabbitmq.client.ShutdownSignalException; class TestChannel implements Channel { private final ExecutorService executorService; - private final Map<String, BlockingQueue<GetResponse>> enqueuedMessages; - private final Map<String, List<String>> routingKeyToQueueMappings; - private final Map<String, String> exchangeToRoutingKeyMappings; - private final List<ReturnListener> returnListeners; - private boolean open; - private boolean corrupted; - private Connection connection; public TestChannel(Map<String, String> exchangeToRoutingKeyMappings, @@ -97,28 +96,24 @@ class TestChannel implements Channel { @Override public void addShutdownListener(ShutdownListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void removeShutdownListener(ShutdownListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public ShutdownSignalException getCloseReason() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void notifyListeners() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @@ -129,8 +124,7 @@ class TestChannel implements Channel { @Override public int getChannelNumber() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override @@ -145,28 +139,19 @@ class TestChannel implements Channel { @Override public void close(int closeCode, String closeMessage) throws IOException, TimeoutException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); - - } + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); - @Override - public boolean flowBlocked() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); } @Override public void abort() throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void abort(int closeCode, String closeMessage) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @@ -177,88 +162,58 @@ class TestChannel implements Channel { @Override public boolean removeReturnListener(ReturnListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void clearReturnListeners() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); - - } - - @Override - public void addFlowListener(FlowListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); - - } - - @Override - public boolean removeFlowListener(FlowListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); - } - - @Override - public void clearFlowListeners() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void addConfirmListener(ConfirmListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public boolean removeConfirmListener(ConfirmListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void clearConfirmListeners() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public Consumer getDefaultConsumer() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void setDefaultConsumer(Consumer consumer) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void basicQos(int prefetchSize, int prefetchCount, boolean global) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void basicQos(int prefetchCount, boolean global) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void basicQos(int prefetchCount) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @@ -329,198 +284,169 @@ class TestChannel implements Channel { @Override public void basicPublish(String exchange, String routingKey, boolean mandatory, boolean immediate, BasicProperties props, byte[] body) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public DeclareOk exchangeDeclare(String exchange, String type) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public DeclareOk exchangeDeclare(String exchange, String type, boolean durable) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public DeclareOk exchangeDeclare(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void exchangeDeclareNoWait(String exchange, String type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public DeclareOk exchangeDeclarePassive(String name) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public DeleteOk exchangeDelete(String exchange, boolean ifUnused) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void exchangeDeleteNoWait(String exchange, boolean ifUnused) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public DeleteOk exchangeDelete(String exchange) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public BindOk exchangeBind(String destination, String source, String routingKey) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public BindOk exchangeBind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void exchangeBindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public UnbindOk exchangeUnbind(String destination, String source, String routingKey) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public UnbindOk exchangeUnbind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void exchangeUnbindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare() throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void queueDeclareNoWait(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclarePassive(String queue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.DeleteOk queueDelete(String queue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.DeleteOk queueDelete(String queue, boolean ifUnused, boolean ifEmpty) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void queueDeleteNoWait(String queue, boolean ifUnused, boolean ifEmpty) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.BindOk queueBind(String queue, String exchange, String routingKey) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.BindOk queueBind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void queueBindNoWait(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Queue.UnbindOk queueUnbind(String queue, String exchange, String routingKey, Map<String, Object> arguments) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public PurgeOk queuePurge(String queue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override @@ -535,156 +461,254 @@ class TestChannel implements Channel { @Override public void basicAck(long deliveryTag, boolean multiple) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void basicNack(long deliveryTag, boolean multiple, boolean requeue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void basicReject(long deliveryTag, boolean requeue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public String basicConsume(String queue, Consumer callback) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public String basicConsume(String queue, boolean autoAck, Consumer callback) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, Consumer callback) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public String basicConsume(String queue, boolean autoAck, String consumerTag, Consumer callback) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, Consumer callback) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void basicCancel(String consumerTag) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public RecoverOk basicRecover() throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public RecoverOk basicRecover(boolean requeue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public SelectOk txSelect() throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public CommitOk txCommit() throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public RollbackOk txRollback() throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public com.rabbitmq.client.AMQP.Confirm.SelectOk confirmSelect() throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public long getNextPublishSeqNo() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public boolean waitForConfirms() throws InterruptedException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public boolean waitForConfirms(long timeout) throws InterruptedException, TimeoutException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void waitForConfirmsOrDie() throws IOException, InterruptedException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void waitForConfirmsOrDie(long timeout) throws IOException, InterruptedException, TimeoutException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void asyncRpc(Method method) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public Command rpc(Method method) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public long messageCount(String queue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public long consumerCount(String queue) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public ReturnListener addReturnListener(ReturnCallback returnCallback) { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public ConfirmListener addConfirmListener(ConfirmCallback ackCallback, ConfirmCallback nackCallback) { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, Map<String, Object> arguments) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public void exchangeDeclareNoWait(String exchange, BuiltinExchangeType type, boolean durable, boolean autoDelete, boolean internal, Map<String, Object> arguments) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) + throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) + throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, + ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) + throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, + CancelCallback cancelCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, + ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, + CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public CompletableFuture<Command> asyncCompletableRpc(Method method) throws IOException { + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } } http://git-wip-us.apache.org/repos/asf/nifi/blob/39556e35/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestConnection.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestConnection.java b/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestConnection.java index cb29478..d47ac92 100644 --- a/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestConnection.java +++ b/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/TestConnection.java @@ -21,12 +21,14 @@ import java.net.InetAddress; import java.util.List; import java.util.Map; +import com.rabbitmq.client.BlockedCallback; import com.rabbitmq.client.BlockedListener; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ExceptionHandler; import com.rabbitmq.client.ShutdownListener; import com.rabbitmq.client.ShutdownSignalException; +import com.rabbitmq.client.UnblockedCallback; /** * Implementation of {@link Connection} to be used for testing. Will return the @@ -42,11 +44,10 @@ import com.rabbitmq.client.ShutdownSignalException; class TestConnection implements Connection { private final TestChannel channel; - private boolean open; + private String id; - public TestConnection(Map<String, String> exchangeToRoutingKeyMappings, - Map<String, List<String>> routingKeyToQueueMappings) { + public TestConnection(Map<String, String> exchangeToRoutingKeyMappings, Map<String, List<String>> routingKeyToQueueMappings) { this.channel = new TestChannel(exchangeToRoutingKeyMappings, routingKeyToQueueMappings); this.channel.setConnection(this); this.open = true; @@ -54,26 +55,22 @@ class TestConnection implements Connection { @Override public void addShutdownListener(ShutdownListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void removeShutdownListener(ShutdownListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public ShutdownSignalException getCloseReason() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void notifyListeners() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override @@ -92,38 +89,32 @@ class TestConnection implements Connection { @Override public int getPort() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public int getChannelMax() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public int getFrameMax() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public int getHeartbeat() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public Map<String, Object> getClientProperties() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public Map<String, Object> getServerProperties() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override @@ -133,8 +124,7 @@ class TestConnection implements Connection { @Override public Channel createChannel(int channelNumber) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override @@ -149,67 +139,76 @@ class TestConnection implements Connection { @Override public void close(int closeCode, String closeMessage) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void close(int timeout) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void close(int closeCode, String closeMessage, int timeout) throws IOException { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void abort() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void abort(int closeCode, String closeMessage) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void abort(int timeout) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void abort(int closeCode, String closeMessage, int timeout) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void addBlockedListener(BlockedListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public boolean removeBlockedListener(BlockedListener listener) { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public void clearBlockedListeners() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); } @Override public ExceptionHandler getExceptionHandler() { - throw new UnsupportedOperationException( - "This method is not currently supported as it is not used by current API in testing"); + throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); + } + + @Override + public String getClientProvidedName() { + return "unit-test"; + } + + @Override + public BlockedListener addBlockedListener(BlockedCallback blockedCallback, UnblockedCallback unblockedCallback) { + return null; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; } }
