Repository: qpid-jms Updated Branches: refs/heads/master 731faac98 -> 96eeecde3
Add an initial test for the URI pool, more tests needed. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/96eeecde Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/96eeecde Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/96eeecde Branch: refs/heads/master Commit: 96eeecde379cb15ff686d5ac375c0b63da64129c Parents: 731faac Author: Timothy Bish <[email protected]> Authored: Thu Feb 5 17:39:39 2015 -0500 Committer: Timothy Bish <[email protected]> Committed: Thu Feb 5 17:39:39 2015 -0500 ---------------------------------------------------------------------- .../provider/failover/FailoverUriPoolTest.java | 62 ++++++++++++++++++++ 1 file changed, 62 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/96eeecde/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java new file mode 100644 index 0000000..d678f8f --- /dev/null +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/failover/FailoverUriPoolTest.java @@ -0,0 +1,62 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.apache.qpid.jms.provider.failover; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +/** + * Test for the behavior of the FailoverUriPool + */ +public class FailoverUriPoolTest { + + private List<URI> uris; + + @Before + public void setUp() throws Exception { + List<URI> uris = new ArrayList<URI>(); + + uris.add(new URI("tcp://192.168.2.1:5672")); + uris.add(new URI("tcp://192.168.2.2:5672")); + uris.add(new URI("tcp://192.168.2.3:5672")); + uris.add(new URI("tcp://192.168.2.4:5672")); + } + + @Test + public void testCreateEmptyPool() { + FailoverUriPool pool = new FailoverUriPool(); + assertEquals(FailoverUriPool.DEFAULT_RANDOMIZE_ENABLED, pool.isRandomize()); + } + + @Test + public void testCreateEmptyPoolWithURIs() throws URISyntaxException { + FailoverUriPool pool = new FailoverUriPool(uris.toArray(new URI[1]), null); + assertEquals(FailoverUriPool.DEFAULT_RANDOMIZE_ENABLED, pool.isRandomize()); + + assertNotNull(pool.getNestedOptions()); + assertTrue(pool.getNestedOptions().isEmpty()); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
