From jboss-remoting-commits at lists.jboss.org Sun Dec 20 21:24:04 2009 Content-Type: multipart/mixed; boundary="===============8435307334371574885==" MIME-Version: 1.0 From: jboss-remoting-commits at lists.jboss.org To: jboss-remoting-commits at lists.jboss.org Subject: [jboss-remoting-commits] JBoss Remoting SVN: r5621 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/ipv6. Date: Sun, 20 Dec 2009 21:24:03 -0500 Message-ID: <200912210224.nBL2O39C025374@svn01.web.mwc.hst.phx2.redhat.com> --===============8435307334371574885== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2009-12-20 21:24:03 -0500 (Sun, 20 Dec 2009) New Revision: 5621 Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/ipv6/IPv6HostWi= thNoBracketsTestCase.java Log: JBREM-1164: New unit tests. Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/ipv6/IPv6Ho= stWithNoBracketsTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/ipv6/IPv6HostW= ithNoBracketsTestCase.java (rev 0) +++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/ipv6/IPv6HostW= ithNoBracketsTestCase.java 2009-12-21 02:24:03 UTC (rev 5621) @@ -0,0 +1,245 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.test.remoting.ipv6; + +import java.io.ByteArrayInputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; + +import javax.management.MBeanServer; +import javax.xml.parsers.DocumentBuilderFactory; + +import junit.framework.TestCase; + +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; +import org.jboss.remoting.InvocationRequest; +import org.jboss.remoting.InvokerLocator; +import org.jboss.remoting.ServerInvocationHandler; +import org.jboss.remoting.ServerInvoker; +import org.jboss.remoting.callback.InvokerCallbackHandler; +import org.jboss.remoting.transport.Connector; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + + +/** + * Unit tests for JBREM-1164. + * = + * @author Ben Clare + * @author Ron Sigal + * = + * @version $Rev$ + *
+ * Copyright Dec 20, 2009 + *
+ */ +public class IPv6HostWithNoBracketsTestCase extends TestCase +{ + private static Logger log =3D Logger.getLogger(IPv6HostWithNoBracketsTe= stCase.class); + private static boolean firstTime =3D true; + private static int port =3D 8080; + + + public void setUp() throws Exception + { + if (firstTime) + { + firstTime =3D false; + Logger.getLogger("org.jboss.remoting").setLevel(Level.INFO); + Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO); + String pattern =3D "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n"; + PatternLayout layout =3D new PatternLayout(pattern); + ConsoleAppender consoleAppender =3D new ConsoleAppender(layout); + Logger.getRootLogger().addAppender(consoleAppender); = + } + } + + + public void tearDown() + { + } + + + public void testXMLWithoutBrackets() throws Throwable + { + log.info("entering " + getName()); + + assertTrue(doXMLTest("::", ++port)); + assertTrue(doXMLTest("::1", ++port)); + assertTrue(doXMLTest("0:0:0:0:0:0:0:1", ++port)); + assertTrue(doXMLTest("0:0:0:0:0:0:127.0.0.1", ++port)); + assertTrue(doXMLTest("3ffe:1900:4545:3:200:f8ff:fe21:67cf", ++port)); + assertTrue(doXMLTest("3ffe:1900:4545:3:200:f8ff:fe21:67cf%5", ++port= )); + + log.info(getName() + " PASSES"); + } + + + public void testXMLWithBrackets() throws Throwable + { + log.info("entering " + getName()); + + assertTrue(doXMLTest("[::]", ++port)); + assertTrue(doXMLTest("[::1]", ++port)); + assertTrue(doXMLTest("[0:0:0:0:0:0:0:1]", ++port)); + assertTrue(doXMLTest("[0:0:0:0:0:0:127.0.0.1]", ++port)); + assertTrue(doXMLTest("[3ffe:1900:4545:3:200:f8ff:fe21:67cf]", ++port= )); + assertTrue(doXMLTest("[3ffe:1900:4545:3:200:f8ff:fe21:67cf%5]", ++po= rt)); + + log.info(getName() + " PASSES"); + } + + + public void testXMLWithoutHost() throws Exception + { + log.info("entering " + getName()); + + String xml =3D new StringBuffer() + .append("