Author: borges
Date: 2011-07-01 08:23:16 -0400 (Fri, 01 Jul 2011)
New Revision: 10904
Removed:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/TransportConfigurationTest.java
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
Log:
Remove utility method from public API class.
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java 2011-06-30
05:53:02 UTC (rev 10903)
+++
trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java 2011-07-01
12:23:16 UTC (rev 10904)
@@ -53,27 +53,6 @@
private static final byte TYPE_STRING = 3;
/**
- * Utility method for splitting a comma separated list of hosts
- *
- * @param commaSeparatedHosts the comma separated host string
- * @return the hosts
- */
- public static String[] splitHosts(final String commaSeparatedHosts)
- {
- if (commaSeparatedHosts == null)
- {
- return new String[0];
- }
- String[] hosts = commaSeparatedHosts.split(",");
-
- for (int i = 0; i < hosts.length; i++)
- {
- hosts[i] = hosts[i].trim();
- }
- return hosts;
- }
-
- /**
* Creates a default TransportConfiguration with no configured transport.
*/
public TransportConfiguration()
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java
===================================================================
---
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java 2011-06-30
05:53:02 UTC (rev 10903)
+++
trunk/hornetq-core/src/main/java/org/hornetq/core/remoting/impl/netty/NettyAcceptor.java 2011-07-01
12:23:16 UTC (rev 10904)
@@ -32,7 +32,6 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.NotificationType;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.stomp.WebSocketServerHandler;
@@ -467,7 +466,7 @@
private void startServerChannels()
{
- String[] hosts = TransportConfiguration.splitHosts(host);
+ String[] hosts = NettyAcceptor.splitHosts(host);
for (String h : hosts)
{
SocketAddress address;
@@ -613,6 +612,27 @@
// Inner classes
-----------------------------------------------------------------------------
+ /**
+ * Utility method for splitting a comma separated list of hosts
+ *
+ * @param commaSeparatedHosts the comma separated host string
+ * @return the hosts
+ */
+ public static String[] splitHosts(final String commaSeparatedHosts)
+ {
+ if (commaSeparatedHosts == null)
+ {
+ return new String[0];
+ }
+ String[] hosts = commaSeparatedHosts.split(",");
+
+ for (int i = 0; i < hosts.length; i++)
+ {
+ hosts[i] = hosts[i].trim();
+ }
+ return hosts;
+ }
+
private final class HornetQServerChannelHandler extends HornetQChannelHandler
{
HornetQServerChannelHandler(final ChannelGroup group,
Deleted:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/TransportConfigurationTest.java
===================================================================
---
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/TransportConfigurationTest.java 2011-06-30
05:53:02 UTC (rev 10903)
+++
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/config/impl/TransportConfigurationTest.java 2011-07-01
12:23:16 UTC (rev 10904)
@@ -1,79 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat 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.hornetq.tests.unit.core.config.impl;
-
-import junit.framework.Assert;
-
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.tests.util.UnitTestCase;
-
-/**
- * A TransportConfigurationTest
- *
- * @author jmesnil
- *
- * Created 20 janv. 2009 14:46:35
- *
- *
- */
-public class TransportConfigurationTest extends UnitTestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testSplitNullAddress() throws Exception
- {
- String[] addresses = TransportConfiguration.splitHosts(null);
-
- Assert.assertNotNull(addresses);
- Assert.assertEquals(0, addresses.length);
- }
-
- public void testSplitSingleAddress() throws Exception
- {
- String[] addresses = TransportConfiguration.splitHosts("localhost");
-
- Assert.assertNotNull(addresses);
- Assert.assertEquals(1, addresses.length);
- Assert.assertEquals("localhost", addresses[0]);
- }
-
- public void testSplitManyAddresses() throws Exception
- {
- String[] addresses = TransportConfiguration.splitHosts("localhost, 127.0.0.1,
192.168.0.10");
-
- Assert.assertNotNull(addresses);
- Assert.assertEquals(3, addresses.length);
- Assert.assertEquals("localhost", addresses[0]);
- Assert.assertEquals("127.0.0.1", addresses[1]);
- Assert.assertEquals("192.168.0.10", addresses[2]);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Modified:
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
===================================================================
---
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2011-06-30
05:53:02 UTC (rev 10903)
+++
trunk/tests/unit-tests/src/test/java/org/hornetq/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java 2011-07-01
12:23:16 UTC (rev 10904)
@@ -83,7 +83,7 @@
public void connectionCreated(final Connection connection, final ProtocolType
protocol)
{
}
-
+
public void connectionReadyForWrites(Object connectionID, boolean ready)
{
}
@@ -108,12 +108,40 @@
acceptor.stop();
Assert.assertFalse(acceptor.isStarted());
UnitTestCase.checkFreePort(TransportConstants.DEFAULT_PORT);
-
+
pool1.shutdown();
pool2.shutdown();
-
+
pool1.awaitTermination(1, TimeUnit.SECONDS);
pool2.awaitTermination(1, TimeUnit.SECONDS);
}
+ public void testSplitNullAddress() throws Exception
+ {
+ String[] addresses = NettyAcceptor.splitHosts(null);
+
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(0, addresses.length);
+ }
+
+ public void testSplitSingleAddress() throws Exception
+ {
+ String[] addresses = NettyAcceptor.splitHosts("localhost");
+
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(1, addresses.length);
+ Assert.assertEquals("localhost", addresses[0]);
+ }
+
+ public void testSplitManyAddresses() throws Exception
+ {
+ String[] addresses = NettyAcceptor.splitHosts("localhost, 127.0.0.1,
192.168.0.10");
+
+ Assert.assertNotNull(addresses);
+ Assert.assertEquals(3, addresses.length);
+ Assert.assertEquals("localhost", addresses[0]);
+ Assert.assertEquals("127.0.0.1", addresses[1]);
+ Assert.assertEquals("192.168.0.10", addresses[2]);
+ }
+
}