|
| 1 | +// The contents of this file are subject to the Mozilla Public License |
| 2 | +// Version 1.1 (the "License"); you may not use this file except in |
| 3 | +// compliance with the License. You may obtain a copy of the License |
| 4 | +// at http://www.mozilla.org/MPL/ |
| 5 | +// |
| 6 | +// Software distributed under the License is distributed on an "AS IS" |
| 7 | +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See |
| 8 | +// the License for the specific language governing rights and |
| 9 | +// limitations under the License. |
| 10 | +// |
| 11 | +// The Original Code is RabbitMQ. |
| 12 | +// |
| 13 | +// The Initial Developer of the Original Code is VMware, Inc. |
| 14 | +// Copyright (c) 2007-2011 VMware, Inc. All rights reserved. |
| 15 | +// |
| 16 | + |
| 17 | +package com.rabbitmq.client.test.functional; |
| 18 | + |
| 19 | +import com.rabbitmq.client.AMQP; |
| 20 | +import com.rabbitmq.client.test.BrokerTestCase; |
| 21 | + |
| 22 | +import java.io.IOException; |
| 23 | +import java.util.HashMap; |
| 24 | +import java.util.Map; |
| 25 | + |
| 26 | +/** |
| 27 | + * Most tests are in rabbitmq-ha-tests but we want to check at least declaration here |
| 28 | + */ |
| 29 | +public class HAQueues extends BrokerTestCase { |
| 30 | + Map<String,Object> all = new HashMap<String,Object>(); |
| 31 | + |
| 32 | + public HAQueues() |
| 33 | + { |
| 34 | + super(); |
| 35 | + all.put("x-ha-policy", "all"); |
| 36 | + } |
| 37 | + |
| 38 | + public void testRedeclare1() |
| 39 | + throws IOException, InterruptedException |
| 40 | + { |
| 41 | + failRedeclare("ha-all", all, null); |
| 42 | + } |
| 43 | + |
| 44 | + public void testRedeclare2() |
| 45 | + throws IOException, InterruptedException |
| 46 | + { |
| 47 | + failRedeclare("ha-all", null, all); |
| 48 | + } |
| 49 | + |
| 50 | + private void failRedeclare(String name, Map<String,Object> args1, Map<String,Object> args2) throws IOException { |
| 51 | + channel.queueDeclare(name, true, true, false, args1); |
| 52 | + try { |
| 53 | + channel.queueDeclare(name, true, true, false, args2); |
| 54 | + fail(); |
| 55 | + } |
| 56 | + catch (IOException ie) { |
| 57 | + checkShutdownSignal(AMQP.PRECONDITION_FAILED, ie); |
| 58 | + } |
| 59 | + } |
| 60 | +} |
0 commit comments