From jboss-remoting-commits at lists.jboss.org Tue Jun 15 04:37:06 2010 Content-Type: multipart/mixed; boundary="===============0434705659302855630==" 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: r5869 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/management. Date: Tue, 15 Jun 2010 04:37:06 -0400 Message-ID: <201006150837.o5F8b6Ic018785@svn01.web.mwc.hst.phx2.redhat.com> --===============0434705659302855630== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: trustin Date: 2010-06-15 04:37:05 -0400 (Tue, 15 Jun 2010) New Revision: 5869 Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/managem= ent/ConnectionMXBean.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/managem= ent/Counters.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/managem= ent/EndpointMXBean.java remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/managem= ent/ServiceMXBean.java Log: * Javadoc (forgot to check in last week) * Renamed getRequestCounters() to getInboundRequestCounters() or getOutboun= dRequestCounters() * Split EndpointMXBean.getRequestCounters() into the inbound version and th= e outbound version Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= management/ConnectionMXBean.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 --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/ConnectionMXBean.java 2010-05-28 15:52:52 UTC (rev 5868) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/ConnectionMXBean.java 2010-06-15 08:37:05 UTC (rev 5869) @@ -23,13 +23,42 @@ = import javax.management.ObjectName; = +import org.jboss.remoting3.Client; +import org.jboss.remoting3.Connection; + +/** + * Statistics and management information for a {@link Connection}. + * + * @author Trustin Lee + * @version $Rev$, $Date$ + */ public interface ConnectionMXBean { = + /** + * Returns the {@link ObjectName} of the {@link EndpointMXBean} which + * created the {@link Connection}. + */ ObjectName getEndpoint(); = - Counters getRequestCounters(); + /** + * Returns the statistics information of the outbound requests handled + * (or being handled) by the {@link Connection}. + */ + Counters getOutboundRequestCounters(); + + /** + * Returns the statistics information of the {@link Client}s created b= y the + * the {@link Connection}. + */ Counters getClientCounters(); = + /** + * Closes all open {@link Client}s created by the {@link Connection}. + */ void close(); + + /** + * Closes all open {@link Client}s created by the {@link Connection} f= orcibly. + */ void forceClose(); } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= management/Counters.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 --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/Counters.java 2010-05-28 15:52:52 UTC (rev 5868) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/Counters.java 2010-06-15 08:37:05 UTC (rev 5869) @@ -23,11 +23,25 @@ = import java.beans.ConstructorProperties; = +/** + * Provides the number of the currently running (or in-progress) activitie= s and + * the cumulative number of the succeeded or failed activities so far. + * + * @author Trustin Lee + * @version $Rev$, $Date$ + */ public class Counters { private final long active; private final long success; private final long failure; = + /** + * Creates a new instance. + * + * @param active the number of the currently running (or in-progress)= activities + * @param success the cumulative number of the succeeded activities so= far + * @param failure the cumulative number of the failed activities so far + */ @ConstructorProperties({"active", "success", "failure"}) public Counters(long active, long success, long failure) { this.active =3D active; @@ -35,14 +49,23 @@ this.failure =3D failure; } = + /** + * Returns the number of the currently running (or in-progress) activi= ties. + */ public long getActive() { return active; } = + /** + * Returns the cumulative number of the succeeded activities so far. + */ public long getSuccess() { return success; } = + /** + * Returns the cumulative number of the failed activities so far. + */ public long getFailure() { return failure; } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= management/EndpointMXBean.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 --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/EndpointMXBean.java 2010-05-28 15:52:52 UTC (rev 5868) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/EndpointMXBean.java 2010-06-15 08:37:05 UTC (rev 5869) @@ -25,13 +25,51 @@ = import javax.management.ObjectName; = +import org.jboss.remoting3.Client; +import org.jboss.remoting3.Connection; +import org.jboss.remoting3.Endpoint; = +/** + * Statistics and management information for an {@link Endpoint}. + * + * @author Trustin Lee + * @version $Rev$, $Date$ + */ public interface EndpointMXBean { = + /** + * Returns the {@link ObjectName}s of all {@link ServiceMXBean}s where + * the services they represent are registered to the {@link Endpoint}. + */ List getServices(); + + /** + * Returns the {@link ObjectName}s of all {@link ConnectionMXBean}s wh= ere + * the {@link Connection}s they represent are created by the {@link En= dpoint}. + */ List getConnections(); = - Counters getRequestCounters(); + /** + * Returns the statistics information of the inbound requests handled + * (or being handled) by the services registered to the {@link Endpoin= t}. + */ + Counters getInboundRequestCounters(); + + /** + * Returns the statistics information of the outbound requests made by + * the {@link Connection}s created by the {@link Endpoint}. + */ + Counters getOutboundRequestCounters(); + + /** + * Returns the statistics information of the {@link Connection}s creat= ed by + * the {@link Endpoint}. + */ Counters getConnectionCounters(); + + /** + * Returns the statistics information of the {@link Client}s created b= y the + * {@link Endpoint}. + */ Counters getClientCounters(); } Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/= management/ServiceMXBean.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 --- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/ServiceMXBean.java 2010-05-28 15:52:52 UTC (rev 5868) +++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/manage= ment/ServiceMXBean.java 2010-06-15 08:37:05 UTC (rev 5869) @@ -25,15 +25,55 @@ = import javax.management.ObjectName; = +import org.jboss.remoting3.Endpoint; + +/** + * Statistics and management information for the service registered to an + * {@link Endpoint}. + * + * @author Trustin Lee + * @version $Rev$, $Date$ + */ public interface ServiceMXBean { = + /** + * Returns the {@link ObjectName} of the {@link EndpointMXBean} where = the + * service is registered to. + */ ObjectName getEndpoint(); = + /** + * Returns the instance name of the service. + */ String getInstanceName(); + + /** + * Returns the service type string which follows the convention for Ja= va + * package names (reversed domain names). + */ String getServiceType(); + + /** + * Returns the expected fully qualified class name of the request obje= ct + * handled by the service. + */ String getRequestType(); + + /** + * Returns the expected fully qualified class name of the reply object + * returned by the service. + */ String getReplyType(); + + /** + * Returns the additional configuration options provided when the serv= ice + * was created. + */ Map getOptions(); = - Counters getRequestCounters(); + /** + * Returns the statistics information of the inbound requests handled + * (or being handled) by the service. + */ + Counters getInboundRequestCounters(); } --===============0434705659302855630==-- From jboss-remoting-commits at lists.jboss.org Tue Jun 15 15:10:28 2010 Content-Type: multipart/mixed; boundary="===============8043691175927882151==" 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: r5870 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Tue, 15 Jun 2010 15:10:28 -0400 Message-ID: <201006151910.o5FJASP8026434@svn01.web.mwc.hst.phx2.redhat.com> --===============8043691175927882151== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-15 15:10:28 -0400 (Tue, 15 Jun 2010) New Revision: 5870 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java Log: JBREM-1229: Prints old and new locator when InvokerLocator.validateLocator(= ) results in changes. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.= 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/main/org/jboss/remoting/ServerInvoker.java 2= 010-06-15 08:37:05 UTC (rev 5869) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2= 010-06-15 19:10:28 UTC (rev 5870) @@ -1199,6 +1199,10 @@ // need to check invoker locator to see if need to provide binding a= ddress (in the case 0.0.0.0 was used) InvokerLocator originalLocator =3D locator; locator =3D InvokerLocator.validateLocator(locator); + if (!locator.getLocatorURI().equals(originalLocator.getLocatorURI())= ) { + log.debug(this + " original locator: " + originalLocator); + log.debug(this + " new locator: " + locator); + } = // need to update the locator key used in the invoker registry InvokerRegistry.updateServerInvokerLocator(originalLocator, locator); --===============8043691175927882151==-- From jboss-remoting-commits at lists.jboss.org Tue Jun 15 15:13:31 2010 Content-Type: multipart/mixed; boundary="===============3576705744260651183==" 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: r5871 - remoting2/branches/2.x/src/main/org/jboss/remoting. Date: Tue, 15 Jun 2010 15:13:31 -0400 Message-ID: <201006151913.o5FJDVJl026509@svn01.web.mwc.hst.phx2.redhat.com> --===============3576705744260651183== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-15 15:13:31 -0400 (Tue, 15 Jun 2010) New Revision: 5871 Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java Log: JBREM-1229: Prints old and new locator when InvokerLocator.validateLocator(= ) results in changes. Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.= 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.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 010-06-15 19:10:28 UTC (rev 5870) +++ remoting2/branches/2.x/src/main/org/jboss/remoting/ServerInvoker.java 2= 010-06-15 19:13:31 UTC (rev 5871) @@ -1160,6 +1160,10 @@ // need to check invoker locator to see if need to provide binding a= ddress (in the case 0.0.0.0 was used) InvokerLocator originalLocator =3D locator; locator =3D InvokerLocator.validateLocator(locator); + if (!locator.getLocatorURI().equals(originalLocator.getLocatorURI())= ) { + log.debug(this + " original locator: " + originalLocator); + log.debug(this + " new locator: " + locator); + } = // need to update the locator key used in the invoker registry InvokerRegistry.updateServerInvokerLocator(originalLocator, locator); --===============3576705744260651183==-- From jboss-remoting-commits at lists.jboss.org Tue Jun 15 15:14:37 2010 Content-Type: multipart/mixed; boundary="===============2578261845659371133==" 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: r5872 - remoting2/branches/2.2/src/main/org/jboss/remoting. Date: Tue, 15 Jun 2010 15:14:37 -0400 Message-ID: <201006151914.o5FJEb8n026533@svn01.web.mwc.hst.phx2.redhat.com> --===============2578261845659371133== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-15 15:14:36 -0400 (Tue, 15 Jun 2010) New Revision: 5872 Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java Log: JBREM-1229: Fixed alignment of locator display. Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.= 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/main/org/jboss/remoting/ServerInvoker.java 2= 010-06-15 19:13:31 UTC (rev 5871) +++ remoting2/branches/2.2/src/main/org/jboss/remoting/ServerInvoker.java 2= 010-06-15 19:14:36 UTC (rev 5872) @@ -1201,7 +1201,7 @@ locator =3D InvokerLocator.validateLocator(locator); if (!locator.getLocatorURI().equals(originalLocator.getLocatorURI())= ) { log.debug(this + " original locator: " + originalLocator); - log.debug(this + " new locator: " + locator); + log.debug(this + " new locator: " + locator); } = // need to update the locator key used in the invoker registry --===============2578261845659371133==-- From jboss-remoting-commits at lists.jboss.org Tue Jun 22 16:28:31 2010 Content-Type: multipart/mixed; boundary="===============5065459952221902756==" 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: r5873 - in remoting3/trunk/jboss-remoting/src: test/java/org/jboss/remoting3/test and 1 other directories. Date: Tue, 22 Jun 2010 16:28:31 -0400 Message-ID: <201006222028.o5MKSV9I007297@svn01.web.mwc.hst.phx2.redhat.com> --===============5065459952221902756== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-22 16:28:30 -0400 (Tue, 22 Jun 2010) New Revision: 5873 Added: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.= jboss.marshalling.ProviderDescriptor remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/En= dpointConfigurationTestCase.java remoting3/trunk/jboss-remoting/src/test/resources/protocols.test.remotin= g.properties Log: JBREM-1228: Added unit tests for Endpoint configuration. Added: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/= org.jboss.marshalling.ProviderDescriptor =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 --- remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.marshalling.ProviderDescriptor (rev 0) +++ remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.marshalling.ProviderDescriptor 2010-06-22 20:28:30 UTC (rev 5873) @@ -0,0 +1,5 @@ +# +# MockMarshaller provider descriptor +# + +org.jboss.remoting3.test.EndpointConfigurationTestCase$MockMarshallerProvi= derDescriptor Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/tes= t/EndpointConfigurationTestCase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/E= ndpointConfigurationTestCase.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/E= ndpointConfigurationTestCase.java 2010-06-22 20:28:30 UTC (rev 5873) @@ -0,0 +1,395 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.remoting3.test; + +import static org.testng.Assert.assertSame; +import static org.testng.Assert.assertTrue; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.net.URI; +import java.util.Properties; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import javax.security.auth.callback.CallbackHandler; + +import org.jboss.marshalling.ClassExternalizerFactory; +import org.jboss.marshalling.ClassResolver; +import org.jboss.marshalling.ClassTable; +import org.jboss.marshalling.Externalizer; +import org.jboss.marshalling.Marshaller; +import org.jboss.marshalling.MarshallerFactory; +import org.jboss.marshalling.ObjectResolver; +import org.jboss.marshalling.ObjectTable; +import org.jboss.marshalling.ProviderDescriptor; +import org.jboss.marshalling.Unmarshaller; +import org.jboss.remoting3.Endpoint; +import org.jboss.remoting3.Registration; +import org.jboss.remoting3.Remoting; +import org.jboss.remoting3.spi.ConnectionHandlerFactory; +import org.jboss.remoting3.spi.ConnectionProvider; +import org.jboss.remoting3.spi.ConnectionProviderContext; +import org.jboss.remoting3.spi.ConnectionProviderFactory; +import org.jboss.remoting3.spi.ProtocolServiceType; +import org.jboss.remoting3.spi.RemotingServiceDescriptor; +import org.jboss.xnio.Cancellable; +import org.jboss.xnio.OptionMap; +import org.jboss.xnio.Result; +import org.jboss.xnio.log.Logger; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +/** + * EndpointConfigurationTestCase tests various ways of configuring an Endp= oint with transport protocols + * and marshalling components. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright Jun 21, 2010 + */ +(a)Test(suiteName =3D "EndpointConfiguration") +public class EndpointConfigurationTestCase { + + private static final Logger log =3D Logger.getLogger(EndpointConfigurat= ionTestCase.class); + + static void enter() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Entering: %s#%s", e.getClassName(), e.getMethodName()); + } + + static void exit() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Exiting: %s#%s", e.getClassName(), e.getMethodName()); + log.info("----------------------------------------------------------= ---"); + } + + @BeforeMethod + public void setUp() { + System.clearProperty("remoting.property.file"); + try { + Field configuredEndpoint =3D Remoting.class.getDeclaredField("con= figuredEndpoint"); + configuredEndpoint.setAccessible(true); + configuredEndpoint.set(null, null); + System.out.println(configuredEndpoint.get(null)); + } catch (NoSuchFieldException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + @AfterMethod + public void tearDown() throws IOException { + } + + /** + * Tests configuration of Endpoint by programmatically adding a transpo= rt and marshalling components. + */ + @Test + public void testProgrammaticConfiguration() throws Exception { + enter(); + Endpoint endpoint =3D null; + Registration regConnectionProvider =3D null; + Registration regMarshallerProvider =3D null; + Registration regClassExternalizerFactoryProvider =3D null; + Registration regClassResolverProvider =3D null; + Registration regClassTableProvider =3D null; + Registration regObjectResolverProvider =3D null; + Registration regObjectTableProvider =3D null; + = + ProviderDescriptor marshallerProviderDescriptor =3D new MockMarshall= erProviderDescriptor(); + MockClassExternalizerFactory mockClassExternalizerFactory =3D new Mo= ckClassExternalizerFactory(); + MockClassResolver mockClassResolver =3D new MockClassResolver(); + MockClassTable mockClassTable =3D new MockClassTable(); + MockObjectResolver mockObjectResolver =3D new MockObjectResolver(); + MockObjectTable mockObjectTable =3D new MockObjectTable(); + = + try { + Executor executor =3D new ThreadPoolExecutor(8, 64, 30, TimeUnit.= SECONDS, new ArrayBlockingQueue(64)); + endpoint =3D Remoting.createEndpoint("endpoint", executor, Option= Map.EMPTY); + regConnectionProvider =3D endpoint.addConnectionProvider("mockTra= nsport", new MockConnectionProviderFactory()); + regMarshallerProvider =3D endpoint.addProtocolService(ProtocolSer= viceType.MARSHALLER_PROVIDER_DESCRIPTOR, "mockMarshaller", marshallerProvid= erDescriptor); + regClassExternalizerFactoryProvider =3D endpoint.addProtocolServi= ce(ProtocolServiceType.CLASS_EXTERNALIZER_FACTORY, "mockClassExternalizerFa= ctory", mockClassExternalizerFactory); + regClassResolverProvider =3D endpoint.addProtocolService(Protocol= ServiceType.CLASS_RESOLVER, "mockClassResolver", mockClassResolver); + regClassTableProvider =3D endpoint.addProtocolService(ProtocolSer= viceType.CLASS_TABLE, "mockClassTable", mockClassTable); + regObjectResolverProvider =3D endpoint.addProtocolService(Protoco= lServiceType.OBJECT_RESOLVER, "mockObjectResolver", mockObjectResolver); + regObjectTableProvider =3D endpoint.addProtocolService(ProtocolSe= rviceType.OBJECT_TABLE, "mockObjectTable", mockObjectTable); + + assertSame(MockConnectionProviderFactory.providerInterface, endpo= int.getConnectionProviderInterface("mockTransport", MockConnectionProviderF= actory.MockProviderInterface.class)); + ConnectionProviderContext context =3D MockConnectionProviderFacto= ry.context; + assertSame(marshallerProviderDescriptor, context.getProtocolServi= ceProvider(ProtocolServiceType.MARSHALLER_PROVIDER_DESCRIPTOR, "mockMarshal= ler")); + assertSame(mockClassExternalizerFactory, context.getProtocolServi= ceProvider(ProtocolServiceType.CLASS_EXTERNALIZER_FACTORY, "mockClassExtern= alizerFactory")); + assertSame(mockClassResolver, context.getProtocolServiceProvider(= ProtocolServiceType.CLASS_RESOLVER, "mockClassResolver")); + assertSame(mockClassTable, context.getProtocolServiceProvider(Pro= tocolServiceType.CLASS_TABLE, "mockClassTable")); + assertSame(mockObjectResolver, context.getProtocolServiceProvider= (ProtocolServiceType.OBJECT_RESOLVER, "mockObjectResolver")); + assertSame(mockObjectTable, context.getProtocolServiceProvider(Pr= otocolServiceType.OBJECT_TABLE, "mockObjectTable")); + log.info("testProgrammaticConfiguration() PASSES"); + = + } finally { + if (regClassExternalizerFactoryProvider !=3D null) { + regClassExternalizerFactoryProvider.close(); + } + if (regClassResolverProvider !=3D null) { + regClassResolverProvider.close(); + } + if (regClassTableProvider !=3D null) { + regClassTableProvider.close(); + } + if (regObjectResolverProvider !=3D null) { + regObjectResolverProvider.close(); + } + if (regObjectTableProvider !=3D null) { + regObjectTableProvider.close(); + } + if (regMarshallerProvider !=3D null) { + regMarshallerProvider.close(); + } + if (regConnectionProvider !=3D null) { + regConnectionProvider.close(); + } + if (endpoint !=3D null) { + endpoint.close(); + } + exit(); + } + } + = + /** + * Tests configuration of Endpoint by listing transport and marshalling= components descriptions in a RemotingServiceDescriptor file. + */ + @Test + public void testConfigurationByServiceDescriptorFile() throws Exception= { + enter(); + = + try { + Endpoint endpoint =3D Remoting.getConfiguredEndpoint(); + assertSame(MockConnectionProviderFactory.providerInterface, endpo= int.getConnectionProviderInterface("mockTransport", MockConnectionProviderF= actory.MockProviderInterface.class)); + ConnectionProviderContext context =3D MockConnectionProviderFacto= ry.context; + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .CLASS_EXTERNALIZER_FACTORY, "mockClassExternalizerFactory_sd") instanceof = MockClassExternalizerFactory); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .CLASS_RESOLVER, "mockClassResolver_sd") instanceof MockClassResolver); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .CLASS_TABLE, "mockClassTable_sd") instanceof MockClassTable); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_RESOLVER, "mockObjectResolver_sd") instanceof MockObjectResolver); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_TABLE, "mockObjectTable_sd") instanceof MockObjectTable); + log.info("testConfigurationByServiceDescriptorFile() PASSES"); + } finally { + exit(); + } + } + = + /** + * Tests configuration of Endpoint by listing transport and marshalling= components descriptions in a properties file. + * Note that the properties file includes examples of multiple instance= s in the object table list. + */ + @Test + public void testConfigurationByPropertiesFile() throws Exception { + enter(); + = + try { + System.setProperty("remoting.property.file", "protocols.test.remo= ting.properties"); + @SuppressWarnings("unused") + Endpoint endpoint =3D Remoting.getConfiguredEndpoint(); + ConnectionProviderContext context =3D MockConnectionProviderFacto= ry.context; + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .CLASS_EXTERNALIZER_FACTORY, "mockClassExternalizerFactory_pf") instanceof = MockClassExternalizerFactory); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .CLASS_RESOLVER, "mockClassResolver_pf") instanceof MockClassResolver); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .CLASS_TABLE, "mockClassTable_pf") instanceof MockClassTable); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_RESOLVER, "mockObjectResolver_pf") instanceof MockObjectResolver); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_TABLE, "mockObjectTable_pf") instanceof MockObjectTable); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_TABLE, "mockObjectTable_pf1") instanceof MockObjectTable); + assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_TABLE, "mockObjectTable_pf2") instanceof MockObjectTable2); + log.info("testConfigurationByPropertiesFile() PASSES"); + } finally { + exit(); + } + } + = + /** + * This class is used to gain access to the Endpoint's ConnectionProvid= erContext. + */ + public static class MockConnectionProviderFactory implements Connection= ProviderFactory { + public static ConnectionProviderContext context; + public interface MockProviderInterface {}; + public static MockProviderInterface providerInterface =3D new MockPr= oviderInterface() {}; + = + public ConnectionProvider createInstance(ConnectionProviderContext c= ontext) { + MockConnectionProviderFactory.context =3D context; + return new ConnectionProvider() { + public Cancellable connect(URI uri, OptionMap connectOptions, = Result result, CallbackHandler callbackHandler) t= hrows IllegalArgumentException { + return null; + } + public Object getProviderInterface() { + return providerInterface; + } + }; + } = + } + = + public static class MockProtocolDescriptor implements RemotingServiceDe= scriptor { + public Class getType() { + return ConnectionProviderFactory.class; + } + public String getName() { + return "mockTransport"; + } + public ConnectionProviderFactory getService(final Properties propert= ies) throws IOException { + return new MockConnectionProviderFactory(); + } + } + = + public static class MockMarshallerProviderDescriptor implements Provide= rDescriptor { + public MarshallerFactory getMarshallerFactory() { + return null; + } + public String getName() { + return "mockMarshaller"; + } + public int[] getSupportedVersions() { + return new int[]{0}; + } + } + + public static class MockClassExternalizerFactory implements ClassExtern= alizerFactory { + public Externalizer getExternalizer(Class type) { + return null; + } + } + = + public static class MockClassResolver implements ClassResolver { + public void annotateClass(Marshaller marshaller, Class clazz) thr= ows IOException { = + } + public void annotateProxyClass(Marshaller marshaller, Class proxy= Class) throws IOException { = + } + public String getClassName(Class clazz) throws IOException { + return null; + } + public String[] getProxyInterfaces(Class proxyClass) throws IOExc= eption { + return null; + } + public Class resolveClass(Unmarshaller unmarshaller, String name,= long serialVersionUID) throws IOException, ClassNotFoundException { + return null; + } + public Class resolveProxyClass(Unmarshaller unmarshaller, String[= ] interfaces) throws IOException, ClassNotFoundException { + return null; + } + } + = + public static class MockClassTable implements ClassTable { + public Writer getClassWriter(Class clazz) throws IOException { + return null; + } + public Class readClass(Unmarshaller unmarshaller) throws IOExcept= ion, ClassNotFoundException { + return null; + } + } + = + public static class MockObjectResolver implements ObjectResolver { + public Object readResolve(Object replacement) { + return null; + } + public Object writeReplace(Object original) { + return null; + } + } + = + public static class MockObjectTable implements ObjectTable { + public Writer getObjectWriter(Object object) throws IOException { + return null; + } + public Object readObject(Unmarshaller unmarshaller) throws IOExcepti= on, ClassNotFoundException { + return null; + } = + } + = + public static class MockObjectTable2 implements ObjectTable { + public Writer getObjectWriter(Object object) throws IOException { + return null; + } + public Object readObject(Unmarshaller unmarshaller) throws IOExcepti= on, ClassNotFoundException { + return null; + } = + } + = + public static class MockClassExternalizerFactoryServiceDescriptor imple= ments RemotingServiceDescriptor { + public Class getType() { + return ClassExternalizerFactory.class; + } + public String getName() { + return "mockClassExternalizerFactory_sd"; + } + public ClassExternalizerFactory getService(final Properties properti= es) throws IOException { + return new MockClassExternalizerFactory(); + } + } + = + public static class MockClassResolverServiceDescriptor implements Remot= ingServiceDescriptor { + public Class getType() { + return ClassResolver.class; + } + public String getName() { + return "mockClassResolver_sd"; + } + public ClassResolver getService(final Properties properties) throws = IOException { + return new MockClassResolver(); + } + } + = + public static class MockClassTableServiceDescriptor implements Remoting= ServiceDescriptor { + public Class getType() { + return ClassTable.class; + } + public String getName() { + return "mockClassTable_sd"; + } + public ClassTable getService(final Properties properties) throws IOE= xception { + return new MockClassTable(); + } + } + = + public static class MockObjectResolverServiceDescriptor implements Remo= tingServiceDescriptor { + public Class getType() { + return ObjectResolver.class; + } + public String getName() { + return "mockObjectResolver_sd"; + } + public ObjectResolver getService(final Properties properties) throws= IOException { + return new MockObjectResolver(); + } + } + = + public static class MockObjectTableServiceDescriptor implements Remotin= gServiceDescriptor { + public Class getType() { + return ObjectTable.class; + } + public String getName() { + return "mockObjectTable_sd"; + } + public ObjectTable getService(final Properties properties) throws IO= Exception { + return new MockObjectTable(); + } + } +} Added: remoting3/trunk/jboss-remoting/src/test/resources/protocols.test.rem= oting.properties =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 --- remoting3/trunk/jboss-remoting/src/test/resources/protocols.test.remoti= ng.properties (rev 0) +++ remoting3/trunk/jboss-remoting/src/test/resources/protocols.test.remoti= ng.properties 2010-06-22 20:28:30 UTC (rev 5873) @@ -0,0 +1,36 @@ +# +# JBoss, Home of Professional Open Source +# Copyright 2010, 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. +# + +endpoint.name=3Dprotocols.test +protocols.test.class_externalizer_factory_list=3DmockClassExternalizerFact= ory_pf +protocols.test.class_resolver_list=3DmockClassResolver_pf +protocols.test.class_table_list=3DmockClassTable_pf +protocols.test.object_resolver_list=3DmockObjectResolver_pf +protocols.test.object_table_list=3DmockObjectTable_pf,mockObjectTable_pf1,= mockObjectTable_pf2 + +mockClassExternalizerFactory_pf.class_externalizer_factory.mockClassExtern= alizerFactory_pf.class=3Dorg.jboss.remoting3.test.EndpointConfigurationTest= Case$MockClassExternalizerFactory +mockClassResolver_pf.class_resolver.mockClassResolver_pf.class=3Dorg.jboss= .remoting3.test.EndpointConfigurationTestCase$MockClassResolver +mockClassTable_pf.class_table.mockClassTable_pf.class=3Dorg.jboss.remoting= 3.test.EndpointConfigurationTestCase$MockClassTable +mockObjectResolver_pf.object_resolver.mockObjectResolver_pf.class=3Dorg.jb= oss.remoting3.test.EndpointConfigurationTestCase$MockObjectResolver +mockObjectTable_pf.object_table.mockObjectTable_pf.class=3Dorg.jboss.remot= ing3.test.EndpointConfigurationTestCase$MockObjectTable +mockObjectTable_pf1.object_table.mockObjectTable_pf1.class=3Dorg.jboss.rem= oting3.test.EndpointConfigurationTestCase$MockObjectTable +mockObjectTable_pf2.object_table.mockObjectTable_pf2.class=3Dorg.jboss.rem= oting3.test.EndpointConfigurationTestCase$MockObjectTable2 \ No newline at end of file --===============5065459952221902756==-- From jboss-remoting-commits at lists.jboss.org Tue Jun 22 16:29:58 2010 Content-Type: multipart/mixed; boundary="===============3433118405482743363==" 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: r5874 - remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test. Date: Tue, 22 Jun 2010 16:29:57 -0400 Message-ID: <201006222029.o5MKTvPc007309@svn01.web.mwc.hst.phx2.redhat.com> --===============3433118405482743363== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-22 16:29:57 -0400 (Tue, 22 Jun 2010) New Revision: 5874 Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/Cl= ientServerRemoteConfigurationTestCase.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/Cl= ientServerRemoteSSLConfigurationTestCase.java Log: JBREM-1228: Added unit tests for a variety of shared and unshared component= s. Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/tes= t/ClientServerRemoteConfigurationTestCase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/C= lientServerRemoteConfigurationTestCase.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/C= lientServerRemoteConfigurationTestCase.java 2010-06-22 20:29:57 UTC (rev 58= 74) @@ -0,0 +1,771 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.remoting3.test; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotSame; +import static org.testng.Assert.assertSame; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashSet; +import java.util.Properties; +import java.util.ServiceLoader; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import org.jboss.marshalling.river.RiverProviderDescriptor; +import org.jboss.remoting3.Client; +import org.jboss.remoting3.ClientContext; +import org.jboss.remoting3.ClientListener; +import org.jboss.remoting3.CloseHandler; +import org.jboss.remoting3.Connection; +import org.jboss.remoting3.Endpoint; +import org.jboss.remoting3.Registration; +import org.jboss.remoting3.RemoteExecutionException; +import org.jboss.remoting3.Remoting; +import org.jboss.remoting3.RequestContext; +import org.jboss.remoting3.RequestListener; +import org.jboss.remoting3.Endpoint.ServiceBuilder; +import org.jboss.remoting3.remote.RemoteProtocolDescriptor; +import org.jboss.remoting3.security.SimpleServerAuthenticationProvider; +import org.jboss.remoting3.spi.ConnectionProviderFactory; +import org.jboss.remoting3.spi.NetworkServerProvider; +import org.jboss.remoting3.spi.ProtocolServiceType; +import org.jboss.remoting3.spi.RemotingServiceDescriptor; +import org.jboss.xnio.AcceptingServer; +import org.jboss.xnio.ChannelListener; +import org.jboss.xnio.IoFuture; +import org.jboss.xnio.OptionMap; +import org.jboss.xnio.Options; +import org.jboss.xnio.TcpServer; +import org.jboss.xnio.Xnio; +import org.jboss.xnio.IoFuture.Status; +import org.jboss.xnio.channels.BoundChannel; +import org.jboss.xnio.channels.ConnectedStreamChannel; +import org.jboss.xnio.log.Logger; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +/** + * Tests various Client and Connection configurations to various + * server configurations of Executors, Endpoints, Xnio's, TcpServers, and = RequestListeners. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright Jun 7, 2010 + */ +(a)Test(suiteName =3D "ClientServerRemoteConfiguration") +public class ClientServerRemoteConfigurationTestCase { + + private static final Logger log =3D Logger.getLogger(ClientServerRemote= ConfigurationTestCase.class); + + private static int counter; + + static void enter() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Entering: %s#%s", e.getClassName(), e.getMethodName()); + } + + static void exit() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Exiting: %s#%s", e.getClassName(), e.getMethodName()); + log.info("----------------------------------------------------------= ---"); + } + = + static T getFutureResult(IoFuture future, String errorMessage) t= hrows IOException { + Status status =3D null; + switch (status =3D future.await(5000, TimeUnit.MILLISECONDS)) { + case DONE: { + return future.get(); + } + case FAILED: { + log.error(errorMessage); + throw future.getException(); + } + default: { + throw new RuntimeException("unexpected future state: " + statu= s); + } + } + } + + @BeforeMethod + public void setUp() { + ServiceLoader.load(RemotingServiceDescriptor.class); + } + + @AfterMethod + public void tearDown() throws IOException { + } + = + /** + * Distinct Executors, Endpoints, Xnio's, TcpServers, RequestListeners. = + * One instance of one service in each Endpoint. + * Two Connections per TcpServer, two Clients per Connection. + */ + @Test + public void testAllDistinct() throws Exception { + enter(); + ServerPackage sp0 =3D null; + ServerPackage sp1 =3D null; + ConnectionSet connections =3D new ConnectionSet(); + ClientSet clients =3D new ClientSet(); + = + try { + int id0 =3D counter++; + int id1 =3D counter++; + = + // Set up services. + sp0 =3D setupServer(null, id0, null, "test", "test", 4444); + sp1 =3D setupServer(null, id1, null, "test", "test", 5555); + = + // Verify configuration. + assertNotSame(sp0.executor, sp1.executor, "Should be distinct"); + assertNotSame(sp0.endpoint, sp1.endpoint, "Should be distinct"); + assertNotSame(sp0.xnio, sp1.xnio, "Should be distinct"); + assertNotSame(sp0.tcpServer, sp1.tcpServer, "Should be distinct"); + assertNotSame(sp0.requestListener, sp1.requestListener, "Should b= e distinct"); + = + // Set up connections and clients. + Connection connection00 =3D setupConnection(4444); connections.ad= d(connection00); + Connection connection01 =3D setupConnection(4444); connections.ad= d(connection01); + Connection connection10 =3D setupConnection(5555); connections.ad= d(connection10); + Connection connection11 =3D setupConnection(5555); connections.ad= d(connection11); + Client client000 =3D setupClient(connection00, "t= est", "test"); clients.add(client000); + Client client001 =3D setupClient(connection00, "t= est", "test"); clients.add(client001); + Client client010 =3D setupClient(connection01, "t= est", "test"); clients.add(client010); + Client client011 =3D setupClient(connection01, "t= est", "test"); clients.add(client011); + Client client100 =3D setupClient(connection10, "t= est", "test"); clients.add(client100); + Client client101 =3D setupClient(connection10, "t= est", "test"); clients.add(client101); + Client client110 =3D setupClient(connection11, "t= est", "test"); clients.add(client110); + Client client111 =3D setupClient(connection11, "t= est", "test"); clients.add(client111); + = + // Test invocations. + for (int i =3D 0; i < 5; i++) { + assertEquals(id0, client000.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client001.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client010.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client011.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client100.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client101.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client110.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client111.invoke("dummy"), "Should be equal"= ); + } + assertEquals(20, sp0.requestListener.counter, "Should be equal"); + assertEquals(20, sp1.requestListener.counter, "Should be equal"); + log.info("testAllDistinct() PASSES"); + } finally { + clients.close(); + connections.close(); + sp0.close(); + sp1.close(); + exit(); + } + } + + /** + * Distinct Endpoints, Xnio's, TcpServers, RequestListeners. + * One instance of one service in each Endpoint. + * Two Connections per TcpServer, two Clients per Connection. + */ + @Test + public void testSharedExecutor() throws Exception { + enter(); + ServerPackage sp0 =3D null; + ServerPackage sp1 =3D null; + ConnectionSet connections =3D new ConnectionSet(); + ClientSet clients =3D new ClientSet(); + = + try { + int id0 =3D counter++; + int id1 =3D counter++; + String serviceType0 =3D "test" + id0; + String instanceName0 =3D serviceType0; + String serviceType1 =3D "test" + id1; + String instanceName1 =3D serviceType1; + = + // Set up services. + sp0 =3D setupServer(null, id0, null, serviceType0, instanceName0,= 0); + sp1 =3D new ServerPackage(sp0.executor, null, null, null, null, n= ull, -1); + setupServer(sp1, id1, null, serviceType1, instanceName1, 0); + = + // Verify configuration. + assertSame(sp0.executor, sp1.executor, "Should be same"); + assertNotSame(sp0.endpoint, sp1.endpoint, "Should be distinct"); + assertNotSame(sp0.xnio, sp1.xnio, "Should be distinct"); + assertNotSame(sp0.tcpServer, sp1.tcpServer, "Should be distinct"); + assertNotSame(sp0.requestListener, sp1.requestListener, "Should b= e distinct"); + = + // Set up connections and clients. + Connection connection00 =3D setupConnection(sp0.port); connection= s.add(connection00); + Connection connection01 =3D setupConnection(sp0.port); connection= s.add(connection01); + Connection connection10 =3D setupConnection(sp1.port); connection= s.add(connection10); + Connection connection11 =3D setupConnection(sp1.port); connection= s.add(connection11); + Client client000 =3D setupClient(connection00, se= rviceType0, instanceName0); clients.add(client000); + Client client001 =3D setupClient(connection00, se= rviceType0, instanceName0); clients.add(client001); + Client client010 =3D setupClient(connection01, se= rviceType0, instanceName0); clients.add(client010); + Client client011 =3D setupClient(connection01, se= rviceType0, instanceName0); clients.add(client011); + Client client100 =3D setupClient(connection10, se= rviceType1, instanceName1); clients.add(client100); + Client client101 =3D setupClient(connection10, se= rviceType1, instanceName1); clients.add(client101); + Client client110 =3D setupClient(connection11, se= rviceType1, instanceName1); clients.add(client110); + Client client111 =3D setupClient(connection11, se= rviceType1, instanceName1); clients.add(client111); + = + // Test invocations. + for (int i =3D 0; i < 5; i++) { + assertEquals(id0, client000.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client001.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client010.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client011.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client100.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client101.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client110.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client111.invoke("dummy"), "Should be equal"= ); + } + assertEquals(20, sp0.requestListener.counter, "Should be equal"); + assertEquals(20, sp1.requestListener.counter, "Should be equal"); + log.info("testSharedExecutor() PASSES"); + } finally { + clients.close(); + connections.close(); + sp0.close(); + sp1.close(); + exit(); + } + } + = + /** + * Distinct Xnio's, TcpServers, RequestListeners: one instance each of = two distinct services in single Endpoint + * Two Connections per TcpServer, two Clients per Connection, one conne= cted to service1 and the other connected to service2. + */ + @Test + public void testSharedExecutorEndpoint() throws Exception { + enter(); + ServerPackage sp0 =3D null; + ServerPackage sp1 =3D null; + ConnectionSet connections =3D new ConnectionSet(); + ClientSet clients =3D new ClientSet(); + = + try { + int id0 =3D counter++; + int id1 =3D counter++; + String serviceType0 =3D "test" + id0; + String instanceName0 =3D serviceType0; + String serviceType1 =3D "test" + id1; + String instanceName1 =3D serviceType1; + = + // Set up services. + sp0 =3D setupServer(null, id0, null, serviceType0, instanceName0,= 0); + sp1 =3D new ServerPackage(sp0.executor, sp0.endpoint, null, null,= null, null, -1); + setupServer(sp1, id1, null, serviceType1, instanceName1, 0); + + // Verify configuration. + assertSame(sp0.executor, sp1.executor, "Should be same"); + assertSame(sp0.endpoint, sp1.endpoint, "Should be same"); + assertNotSame(sp0.xnio, sp1.xnio, "Should be distinct"); + assertNotSame(sp0.tcpServer, sp1.tcpServer, "Should be distinct"); + assertNotSame(sp0.requestListener, sp1.requestListener, "Should b= e distinct"); + = + // Set up connections and clients. + Connection connection00 =3D setupConnection(sp0.port); connection= s.add(connection00); + Connection connection01 =3D setupConnection(sp0.port); connection= s.add(connection01); + Connection connection10 =3D setupConnection(sp1.port); connection= s.add(connection10); + Connection connection11 =3D setupConnection(sp1.port); connection= s.add(connection11); + Client client000 =3D setupClient(connection00, se= rviceType0, instanceName0); clients.add(client000); + Client client001 =3D setupClient(connection00, se= rviceType1, instanceName1); clients.add(client001); + Client client010 =3D setupClient(connection01, se= rviceType0, instanceName0); clients.add(client010); + Client client011 =3D setupClient(connection01, se= rviceType1, instanceName1); clients.add(client011); + Client client100 =3D setupClient(connection10, se= rviceType0, instanceName0); clients.add(client100); + Client client101 =3D setupClient(connection10, se= rviceType1, instanceName1); clients.add(client101); + Client client110 =3D setupClient(connection11, se= rviceType0, instanceName0); clients.add(client110); + Client client111 =3D setupClient(connection11, se= rviceType1, instanceName1); clients.add(client111); + = + // Test invocations. + for (int i =3D 0; i < 5; i++) { + assertEquals(id0, client000.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client001.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client010.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client011.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client100.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client101.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client110.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client111.invoke("dummy"), "Should be equal"= ); + } + assertEquals(20, sp0.requestListener.counter, "Should be equal"); + assertEquals(20, sp1.requestListener.counter, "Should be equal"); + log.info("testSharedExecutorEndpoint() PASSES"); + } finally { + clients.close(); + connections.close(); + sp0.close(); + sp1.close(); + exit(); + } + } + = + /** + * Distinct TcpServers, RequestListeners: one instance each of two dist= inct services in single Endpoint + * Two Connections per TcpServer, two Clients per Connection, one conne= cted to service1 and the other connected to service2. + */ + @Test + public void testSharedExecutorEndpointXnio() throws Exception { + enter(); + ServerPackage sp0 =3D null; + ServerPackage sp1 =3D null; + ConnectionSet connections =3D new ConnectionSet(); + ClientSet clients =3D new ClientSet(); + = + try { + int id0 =3D counter++; + int id1 =3D counter++; + String serviceType0 =3D "test" + id0; + String instanceName0 =3D serviceType0; + String serviceType1 =3D "test" + id1; + String instanceName1 =3D serviceType1; + = + // Set up services. + sp0 =3D setupServer(null, id0, null, serviceType0, instanceName0,= 0); + sp1 =3D new ServerPackage(sp0.executor, sp0.endpoint, sp0.xnio, n= ull, null, null, -1); + setupServer(sp1, id1, null, serviceType1, instanceName1, 0); + = + // Verify configuration. + assertSame(sp0.executor, sp1.executor, "Should be same"); + assertSame(sp0.endpoint, sp1.endpoint, "Should be same"); + assertSame(sp0.xnio, sp1.xnio, "Should be same"); + assertNotSame(sp0.tcpServer, sp1.tcpServer, "Should be distinct"); + assertNotSame(sp0.requestListener, sp1.requestListener, "Should b= e distinct"); + = + // Set up connections and clients. + Connection connection00 =3D setupConnection(sp0.port); connection= s.add(connection00); + Connection connection01 =3D setupConnection(sp0.port); connection= s.add(connection01); + Connection connection10 =3D setupConnection(sp1.port); connection= s.add(connection10); + Connection connection11 =3D setupConnection(sp1.port); connection= s.add(connection11); + Client client000 =3D setupClient(connection00, se= rviceType0, instanceName0); clients.add(client000); + Client client001 =3D setupClient(connection00, se= rviceType1, instanceName1); clients.add(client001); + Client client010 =3D setupClient(connection01, se= rviceType0, instanceName0); clients.add(client010); + Client client011 =3D setupClient(connection01, se= rviceType1, instanceName1); clients.add(client011); + Client client100 =3D setupClient(connection10, se= rviceType0, instanceName0); clients.add(client100); + Client client101 =3D setupClient(connection10, se= rviceType1, instanceName1); clients.add(client101); + Client client110 =3D setupClient(connection11, se= rviceType0, instanceName0); clients.add(client110); + Client client111 =3D setupClient(connection11, se= rviceType1, instanceName1); clients.add(client111); = + = + // Test invocations. + for (int i =3D 0; i < 5; i++) { + assertEquals(id0, client000.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client001.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client010.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client011.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client100.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client101.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client110.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client111.invoke("dummy"), "Should be equal"= ); + } + assertEquals(20, sp0.requestListener.counter, "Should be equal"); + assertEquals(20, sp1.requestListener.counter, "Should be equal"); + log.info("testSharedExecutorEndpointXnio() PASSES"); + } finally { + clients.close(); + connections.close(); + sp0.close(); + sp1.close(); + exit(); + } + } + = + /** + * Two instances each of two distinct services in single Endpoint, each= with a distinct RequestListener. + * Two Connections to the single TcpServer, four Clients per Connection= , one per service instance. + */ + @Test + public void testSharedExecutorEndpointXnioTcpServer() throws Exception { + enter(); + ServerPackage sp00 =3D null; + ServerPackage sp01 =3D null; + ServerPackage sp10 =3D null; + ServerPackage sp11 =3D null; + ConnectionSet connections =3D new ConnectionSet(); + ClientSet clients =3D new ClientSet(); + = + try { + int id0 =3D counter++; + int id1 =3D counter++; + String serviceType0 =3D "test" + id0; + String serviceType1 =3D "test" + id1; + String instanceName0 =3D "instance0"; + String instanceName1 =3D "instance1"; + = + // Set up services. + sp00 =3D setupServer(null, id0, null, serviceType0, instanceName0= , 0); + sp01 =3D new ServerPackage(sp00.executor, sp00.endpoint, sp00.xni= o, sp00.tcpServer, null, null, -1); + setupServer(sp01, id0, null, serviceType0, instanceName1, 0); + sp10 =3D new ServerPackage(sp00.executor, sp00.endpoint, sp00.xni= o, sp00.tcpServer, null, null, -1); + setupServer(sp10, id1, null, serviceType1, instanceName0, 0); + sp11 =3D new ServerPackage(sp00.executor, sp00.endpoint, sp00.xni= o, sp00.tcpServer, null, null, -1); + setupServer(sp11, id1, null, serviceType1, instanceName1, 0); + = + // Verify configuration. + assertSame(sp00.executor, sp01.executor, "Should be same"); + assertSame(sp00.executor, sp10.executor, "Should be same"); + assertSame(sp00.executor, sp11.executor, "Should be same"); + assertSame(sp00.endpoint, sp01.endpoint, "Should be same"); + assertSame(sp00.endpoint, sp10.endpoint, "Should be same"); + assertSame(sp00.endpoint, sp11.endpoint, "Should be same"); + assertSame(sp00.xnio, sp01.xnio, "Should be same"); + assertSame(sp00.xnio, sp10.xnio, "Should be same"); + assertSame(sp00.xnio, sp11.xnio, "Should be same"); + assertSame(sp00.tcpServer, sp01.tcpServer, "Should be same"); + assertSame(sp00.tcpServer, sp10.tcpServer, "Should be same"); + assertSame(sp00.tcpServer, sp11.tcpServer, "Should be same"); + assertNotSame(sp00.requestListener, sp01.requestListener, "Should= be distinct"); + assertNotSame(sp00.requestListener, sp10.requestListener, "Should= be distinct"); + assertNotSame(sp00.requestListener, sp11.requestListener, "Should= be distinct"); + assertNotSame(sp01.requestListener, sp10.requestListener, "Should= be distinct"); + assertNotSame(sp01.requestListener, sp11.requestListener, "Should= be distinct"); + assertNotSame(sp10.requestListener, sp11.requestListener, "Should= be distinct"); + = + // Set up connections and clients. + Connection connection0 =3D setupConnection(sp00.port); connection= s.add(connection0); + Connection connection1 =3D setupConnection(sp00.port); connection= s.add(connection1); + Client client000 =3D setupClient(connection0, ser= viceType0, instanceName0); clients.add(client000); + Client client001 =3D setupClient(connection0, ser= viceType0, instanceName1); clients.add(client001); + Client client010 =3D setupClient(connection0, ser= viceType1, instanceName0); clients.add(client010); + Client client011 =3D setupClient(connection0, ser= viceType1, instanceName1); clients.add(client011); + Client client100 =3D setupClient(connection1, ser= viceType0, instanceName0); clients.add(client100); + Client client101 =3D setupClient(connection1, ser= viceType0, instanceName1); clients.add(client101); + Client client110 =3D setupClient(connection1, ser= viceType1, instanceName0); clients.add(client110); + Client client111 =3D setupClient(connection1, ser= viceType1, instanceName1); clients.add(client111); = + = + // Test invocations. + for (int i =3D 0; i < 5; i++) { + assertEquals(id0, client000.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client001.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client010.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client011.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client100.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client101.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client110.invoke("dummy"), "Should be equal"= ); + assertEquals(id1, client111.invoke("dummy"), "Should be equal"= ); + } + assertEquals(10, sp00.requestListener.counter, "Should be equal"); + assertEquals(10, sp01.requestListener.counter, "Should be equal"); + assertEquals(10, sp10.requestListener.counter, "Should be equal"); + assertEquals(10, sp11.requestListener.counter, "Should be equal"); + log.info("testSharedExecutorEndpointXnioTcpServer() PASSES"); + } finally { + clients.close(); + connections.close(); + sp00.close(); + sp01.close(); + sp10.close(); + sp11.close(); + exit(); + } + } + = + /** + * Two instances each of two distinct services in single Endpoint, all = sharing a single RequestListener. + * Two Connections to the single TcpServer, four Clients per Connection= , one per service instance. + */ + @Test + public void testSharedExecutorEndpointXnioTcpServerRequestListener() th= rows Exception { + enter(); + ServerPackage sp00 =3D null; + ServerPackage sp01 =3D null; + ServerPackage sp10 =3D null; + ServerPackage sp11 =3D null; + ConnectionSet connections =3D new ConnectionSet(); + ClientSet clients =3D new ClientSet(); + = + try { + int id0 =3D counter++; + int id1 =3D counter++; + String serviceType0 =3D "test" + id0; + String serviceType1 =3D "test" + id1; + String instanceName0 =3D "instance0"; + String instanceName1 =3D "instance1"; + = + // Set up services. + sp00 =3D setupServer(null, id0, null, serviceType0, instanceName0= , 0); + sp01 =3D new ServerPackage(sp00.executor, sp00.endpoint, sp00.xni= o, sp00.tcpServer, null, null, -1); + setupServer(sp01, -1, sp00.requestListener, serviceType0, instanc= eName1, 0); + sp10 =3D new ServerPackage(sp00.executor, sp00.endpoint, sp00.xni= o, sp00.tcpServer, null, null, -1); + setupServer(sp10, -1, sp00.requestListener, serviceType1, instanc= eName0, 0); + sp11 =3D new ServerPackage(sp00.executor, sp00.endpoint, sp00.xni= o, sp00.tcpServer, null, null, -1); + setupServer(sp11, -1, sp00.requestListener, serviceType1, instanc= eName1, 0); + = + // Verify configuration. + assertSame(sp00.executor, sp01.executor, "Should be same"); + assertSame(sp00.executor, sp10.executor, "Should be same"); + assertSame(sp00.executor, sp11.executor, "Should be same"); + assertSame(sp00.endpoint, sp01.endpoint, "Should be same"); + assertSame(sp00.endpoint, sp10.endpoint, "Should be same"); + assertSame(sp00.endpoint, sp11.endpoint, "Should be same"); + assertSame(sp00.xnio, sp01.xnio, "Should be same"); + assertSame(sp00.xnio, sp10.xnio, "Should be same"); + assertSame(sp00.xnio, sp11.xnio, "Should be same"); + assertSame(sp00.tcpServer, sp01.tcpServer, "Should be same"); + assertSame(sp00.tcpServer, sp10.tcpServer, "Should be same"); + assertSame(sp00.tcpServer, sp11.tcpServer, "Should be same"); + assertSame(sp00.requestListener, sp01.requestListener, "Should be= same"); + assertSame(sp00.requestListener, sp10.requestListener, "Should be= same"); + assertSame(sp00.requestListener, sp11.requestListener, "Should be= same"); + = + // Set up connections and clients. + Connection connection0 =3D setupConnection(sp00.port); connection= s.add(connection0); + Connection connection1 =3D setupConnection(sp00.port); connection= s.add(connection1); + Client client000 =3D setupClient(connection0, ser= viceType0, instanceName0); clients.add(client000); + Client client001 =3D setupClient(connection0, ser= viceType0, instanceName1); clients.add(client001); + Client client010 =3D setupClient(connection0, ser= viceType1, instanceName0); clients.add(client010); + Client client011 =3D setupClient(connection0, ser= viceType1, instanceName1); clients.add(client011); + Client client100 =3D setupClient(connection1, ser= viceType0, instanceName0); clients.add(client100); + Client client101 =3D setupClient(connection1, ser= viceType0, instanceName1); clients.add(client101); + Client client110 =3D setupClient(connection1, ser= viceType1, instanceName0); clients.add(client110); + Client client111 =3D setupClient(connection1, ser= viceType1, instanceName1); clients.add(client111); = + = + // Test invocations. + for (int i =3D 0; i < 5; i++) { + assertEquals(id0, client000.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client001.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client010.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client011.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client100.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client101.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client110.invoke("dummy"), "Should be equal"= ); + assertEquals(id0, client111.invoke("dummy"), "Should be equal"= ); + } + assertEquals(40, sp00.requestListener.counter, "Should be equal"); + log.info("testSharedExecutorEndpointXnioTcpServerRequestListener(= ) PASSES"); + } finally { + clients.close(); + connections.close(); + sp00.close(); + sp01.close(); + sp10.close(); + sp11.close(); + exit(); + } + } + = + protected String getRemotingScheme() { + return "remote"; + } + = + protected RemotingServiceDescriptor getProto= colDescriptor() { + return new RemoteProtocolDescriptor(); + } + + protected ServerPackage setupServer(ServerPackage sp, int id, TestReque= stListener requestListener, String serviceType, String instanceName, int po= rt) throws IOException { + = + if (sp =3D=3D null) { + sp =3D new ServerPackage(); + } + = + // Create and configure endpoint. + if (sp.endpoint =3D=3D null) { + if (sp.executor =3D=3D null) { + sp.executor =3D new ThreadPoolExecutor(8, 64, 30, TimeUnit.SEC= ONDS, new ArrayBlockingQueue(64)); + } + sp.endpoint =3D Remoting.createEndpoint("endpoint" + id, sp.execu= tor, OptionMap.EMPTY); + final Registration reg1 =3D sp.endpoint.addProtocolService(Protoc= olServiceType.MARSHALLER_PROVIDER_DESCRIPTOR, "river", new RiverProviderDes= criptor()); + final Registration reg2 =3D sp.endpoint.addConnectionProvider(get= RemotingScheme(), getProtocolDescriptor().getService(new Properties())); + sp.endpoint.addCloseHandler(new CloseHandler() { + public void handleClose(final Endpoint closed) { + reg1.close(); + reg2.close(); + }}); + } + = + // Set up XNIO layer. + OptionMap serverOptions =3D OptionMap.builder().setSequence(Options.= SASL_MECHANISMS, "EXTERNAL", "DIGEST-MD5").getMap(); + SimpleServerAuthenticationProvider authenticationProvider =3D new Si= mpleServerAuthenticationProvider(); + authenticationProvider.addUser("user", sp.endpoint.getName(), "passw= ord".toCharArray()); + NetworkServerProvider provider =3D sp.endpoint.getConnectionProvider= Interface(getRemotingScheme(), NetworkServerProvider.class); + ChannelListener> listener = =3D provider.getServerListener(serverOptions, authenticationProvider); + if (sp.xnio =3D=3D null) { + sp.xnio =3D Xnio.getInstance(String.valueOf(id)); + } + if (sp.tcpServer =3D=3D null) { + createTcpServer(sp, listener, port); + } + = + // Register service with endpoint. + sp.requestListener =3D (requestListener =3D=3D null) ? new TestReque= stListener(id) : requestListener; + if (sp.registration =3D=3D null) { + ServiceBuilder sb =3D sp.endpoint.serviceBuilder(= Object.class, Object.class); + sb.setInstanceName(instanceName).setServiceType(serviceType); + sb.setClientListener(new TestClientListener(sp.requestListener)); + sp.registration =3D sb.register(); + } + return sp; + } + = + protected void createTcpServer(ServerPackage sp, ChannelListener> listener, int port) throws IOException= { + log.info(this + " creating TcpServer"); + TcpServer tcpServer =3D sp.xnio.createTcpServer(listener, OptionMap= .EMPTY); + IoFuture> future =3D tcpSe= rver.bind(new InetSocketAddress("localhost", port)); + getFutureResult(future, "unable to bind " + sp.tcpServer); + sp.tcpServer =3D tcpServer; + sp.port =3D tcpServer.getChannels().iterator().next().getLocalAddres= s().getPort(); + } + + protected Connection setupConnection(int port) throws IOException, URIS= yntaxException { + Endpoint endpoint =3D Remoting.getConfiguredEndpoint(); + URI uri =3D new URI(getRemotingScheme() + "://localhost:" + port); + Connection connection =3D getFutureResult(endpoint.connect(uri, getC= onnectionOptionMap(), "user", null, "password".toCharArray()), "unable to c= onnect to " + uri); + return connection; + } + = + protected OptionMap getConnectionOptionMap() { + return OptionMap.EMPTY; + } + = + protected Client setupClient(Connection connection, Str= ing serviceType, String instanceName) throws IOException, URISyntaxExceptio= n { + Client client =3D getFutureResult(connection.openCli= ent(serviceType, instanceName, Object.class, Object.class), "unable to open= client to " + serviceType + ":" + instanceName); + return client; + } + + static class TestRequestListener implements RequestListener { + public int counter =3D 0; + private int answer; + + public TestRequestListener(int answer) { + this.answer =3D answer; + } + + public void handleRequest(RequestContext context, Object req= uest) throws RemoteExecutionException { + try { + counter++; + context.sendReply(answer); + } catch (IOException e) { + try { + context.sendFailure("error returning response", e); + } catch (IOException e1) { + e.printStackTrace(); + throw new RemoteExecutionException("error returning excepti= on", e1); + } + } + } + } + + static class TestClientListener implements ClientListener { + private RequestListener requestListener; + + TestClientListener(RequestListener requestListener) { + this.requestListener =3D requestListener; + } + + public RequestListener handleClientOpen(final Client= Context clientContext, final OptionMap optionMap) { + clientContext.addCloseHandler(new CloseHandler() { + public void handleClose(final ClientContext closed) { + log.info("Client closed"); + } + }); + return requestListener; + } + } + + static class ServerPackage { + public ThreadPoolExecutor executor; + public Endpoint endpoint; + public Xnio xnio; + public AcceptingServer tcpServer; + public TestRequestListener requestListener; + public Registration registration; + public int port; + = + public ServerPackage(ThreadPoolExecutor executor, Endpoint endpoint,= Xnio xnio, AcceptingServer tcpServer, TestRequestListener request= Listener, Registration registration, int port) { + this.executor =3D executor; + this.endpoint =3D endpoint; + this.xnio =3D xnio; + this.tcpServer =3D tcpServer; + this.requestListener =3D requestListener; + this.registration =3D registration; + this.port =3D port; + } + = + public ServerPackage() { = + } + + public void close() { + if (executor !=3D null) { + executor.shutdown(); + } + if (endpoint !=3D null) { + try { + endpoint.close(); + } catch (IOException e) { + log.error("unable to close " + endpoint); + } + } + if (xnio !=3D null) { + try { + xnio.close(); + } catch (IOException e) { + log.error("unable to close " + xnio); + } + } + if (tcpServer !=3D null) { + try { + tcpServer.close(); + } catch (IOException e) { + log.error("unable to close " + tcpServer); + } + } + if (registration !=3D null) { + registration.close(); + } + } + } + = + static class ConnectionSet extends HashSet { + private static final long serialVersionUID =3D 1L; + + public void close() { + for (Connection connection: this) { + try { + connection.close(); + } catch (IOException e) { + log.error("unable to close " + connection); + } + } + } + } + + static class ClientSet extends HashSet> { + private static final long serialVersionUID =3D 1L; + + public void close() { + for (Client client: this) { + try { + client.close(); + } catch (IOException e) { + log.error("unable to close " + client); + } + } + } + } +} Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/tes= t/ClientServerRemoteSSLConfigurationTestCase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/C= lientServerRemoteSSLConfigurationTestCase.java (rev= 0) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/C= lientServerRemoteSSLConfigurationTestCase.java 2010-06-22 20:29:57 UTC (rev= 5874) @@ -0,0 +1,115 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.remoting3.test; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; + +import org.jboss.remoting3.remote.RemoteSslProtocolDescriptor; +import org.jboss.remoting3.spi.ConnectionProviderFactory; +import org.jboss.remoting3.spi.RemotingServiceDescriptor; +import org.jboss.xnio.ChannelListener; +import org.jboss.xnio.IoFuture; +import org.jboss.xnio.OptionMap; +import org.jboss.xnio.Options; +import org.jboss.xnio.SslTcpServer; +import org.jboss.xnio.Xnio; +import org.jboss.xnio.OptionMap.Builder; +import org.jboss.xnio.channels.BoundChannel; +import org.jboss.xnio.channels.ConnectedStreamChannel; +import org.jboss.xnio.log.Logger; +import org.testng.annotations.Test; + +/** + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright Jun 10, 2010 + */ +(a)Test(suiteName =3D "ClientServerRemoteSSLConfiguration") +public class ClientServerRemoteSSLConfigurationTestCase extends ClientServ= erRemoteConfigurationTestCase { + + private static final Logger log =3D Logger.getLogger(ClientServerRemote= SSLConfigurationTestCase.class); + = + // Use anonymous ciphers so we don't need a trust store configuration o= f any sort + private static final String[] CIPHER_SUITES =3D { + "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", + "TLS_DH_anon_WITH_AES_128_CBC_SHA", + "TLS_DH_anon_WITH_AES_256_CBC_SHA", + "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", + "SSL_DH_anon_WITH_DES_CBC_SHA", + "SSL_DH_anon_WITH_RC4_128_MD5", + "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", + "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", + }; + + private static final String[] PROTOCOLS =3D { + "TLSv1", + }; + = + protected String getRemotingScheme() { + return "remote+ssl"; + } + = + protected RemotingServiceDescriptor getProto= colDescriptor() { + return new RemoteSslProtocolDescriptor(); + } + = + protected OptionMap getConnectionOptionMap() { + Builder builder =3D OptionMap.builder(); + builder.setSequence(Options.SSL_ENABLED_CIPHER_SUITES, CIPHER_SUITES= ); + builder.setSequence(Options.SSL_ENABLED_PROTOCOLS, PROTOCOLS); + return builder.getMap(); + } + = + @Override + protected void createTcpServer(ServerPackage sp, ChannelListener> listener, int port) throws IOException= { + log.info(this + " creating SslTcpServer"); + Builder builder =3D OptionMap.builder(); + builder.setSequence(Options.SSL_ENABLED_CIPHER_SUITES, CIPHER_SUITES= ); + builder.setSequence(Options.SSL_ENABLED_PROTOCOLS, PROTOCOLS); + SslTcpServer sslTcpServer; + try { + sslTcpServer =3D sp.xnio.createSslTcpServer(listener, builder.get= Map()); + } catch (NoSuchProviderException e) { + throw new IOException(e); + } catch (NoSuchAlgorithmException e) { + throw new IOException(e); + } + IoFuture> future =3D sslTc= pServer.bind(new InetSocketAddress("localhost", port)); + getFutureResult(future, "unable to bind " + sp.tcpServer); + sp.tcpServer =3D sslTcpServer; + sp.port =3D sslTcpServer.getChannels().iterator().next().getLocalAdd= ress().getPort(); + } + = + protected SslTcpServer getServer(final ChannelListener> listener, final Xnio xnio) throws NoSuchProvider= Exception, NoSuchAlgorithmException { + final OptionMap serverOptions =3D OptionMap.builder() + .setSequence(Options.SSL_ENABLED_CIPHER_SUITES, CIPHER_SUIT= ES) + .setSequence(Options.SSL_ENABLED_PROTOCOLS, PROTOCOLS) + .getMap(); + return xnio.createSslTcpServer(listener, serverOptions); + } +} --===============3433118405482743363==-- From jboss-remoting-commits at lists.jboss.org Tue Jun 22 18:30:05 2010 Content-Type: multipart/mixed; boundary="===============7722914747375590074==" 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: r5875 - remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test. Date: Tue, 22 Jun 2010 18:30:05 -0400 Message-ID: <201006222230.o5MMU5HX000472@svn01.web.mwc.hst.phx2.redhat.com> --===============7722914747375590074== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-22 18:30:04 -0400 (Tue, 22 Jun 2010) New Revision: 5875 Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/Se= rviceRegistrationTestCase.java Log: JBREM-1228: Added unit test for configuration of services. Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/tes= t/ServiceRegistrationTestCase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/S= erviceRegistrationTestCase.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/S= erviceRegistrationTestCase.java 2010-06-22 22:30:04 UTC (rev 5875) @@ -0,0 +1,177 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.remoting3.test; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertSame; + +import java.io.IOException; +import java.util.HashMap; + +import org.jboss.remoting3.ClientContext; +import org.jboss.remoting3.ClientListener; +import org.jboss.remoting3.Endpoint; +import org.jboss.remoting3.Registration; +import org.jboss.remoting3.RemoteExecutionException; +import org.jboss.remoting3.Remoting; +import org.jboss.remoting3.RemotingOptions; +import org.jboss.remoting3.RequestContext; +import org.jboss.remoting3.RequestListener; +import org.jboss.remoting3.ServiceRegistrationListener; +import org.jboss.remoting3.Endpoint.ServiceBuilder; +import org.jboss.xnio.OptionMap; +import org.jboss.xnio.Options; +import org.jboss.xnio.OptionMap.Builder; +import org.jboss.xnio.log.Logger; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +/** + * Tests the configuration of services registered with an Endpoint. + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright Jun 22, 2010 + * @param + */ +(a)Test(suiteName =3D "ServiceRegistration") +public class ServiceRegistrationTestCase { + + private static final Logger log =3D Logger.getLogger(ServiceRegistratio= nTestCase.class); + private static Object lock =3D new Object(); + + static void enter() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Entering: %s#%s", e.getClassName(), e.getMethodName()); + } + + static void exit() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Exiting: %s#%s", e.getClassName(), e.getMethodName()); + log.info("----------------------------------------------------------= ---"); + } + + @BeforeMethod + public void setUp() { + } + + @AfterMethod + public void tearDown() throws IOException { + } + + @Test + public void testRegistration() throws Exception { + enter(); + Endpoint endpoint =3D Remoting.getConfiguredEndpoint(); + TestServiceRegistrationListener registrationListener =3D new TestSer= viceRegistrationListener(); + endpoint.addServiceRegistrationListener(registrationListener, null); + TestClassLoader testClassLoader =3D new TestClassLoader(); + ClientListener testClientListener =3D new Te= stClientListener(); + Registration registration =3D null; + = + try { + ServiceBuilder sb =3D endpoint.serviceBui= lder(RequestType.class, ReplyType.class); + sb.setClassLoader(testClassLoader); + sb.setInstanceName("instance"); + sb.setServiceType("service"); + sb.setRequestType(SuperRequestType.class); + sb.setReplyType(SubReplyType.class); + OptionMap optionMap =3D buildOptionMap(); + sb.setOptionMap(optionMap); + sb.setClientListener(testClientListener); + registration =3D sb.register(); + = + synchronized (lock) { + lock.wait(); + } + assertNotNull(registrationListener.info); + assertSame(testClassLoader, registrationListener.info.getServiceC= lassLoader()); + assertEquals("instance", registrationListener.info.getInstanceNam= e()); + assertEquals("service", registrationListener.info.getServiceType(= )); + assertEquals(SuperRequestType.class, registrationListener.info.ge= tRequestClass()); + assertEquals(SubReplyType.class, registrationListener.info.getRep= lyClass()); + assertSame(optionMap, registrationListener.info.getOptionMap()); + = + } finally { + if (registration !=3D null) { + registration.close(); + } + if (endpoint !=3D null) { + endpoint.close(); + } + exit(); + } + } + = + protected OptionMap buildOptionMap() { + Builder builder =3D OptionMap.builder(); + builder.set(RemotingOptions.METRIC, 1); + builder.setSequence(Options.SASL_MECHANISMS, "EXTERNAL", "DIGEST-MD5= "); + HashMap map =3D new HashMap(); + map.put(RemotingOptions.REMOTELY_VISIBLE, true); + map.put(RemotingOptions.REQUIRE_SECURE, false); + builder.add(map); + return builder.getMap(); + } + = + static class TestClassLoader extends ClassLoader { + } + = + static class TestRequestListener implements RequestListener { + public void handleRequest(RequestContext context, Request= Type request) throws RemoteExecutionException { + } + } + + static class TestClientListener implements ClientListener { + public RequestListener handleClientOpen(fina= l ClientContext clientContext, final OptionMap optionMap) { + return new TestRequestListener(); + } + } + = + static class SuperRequestType { + } + + static class RequestType extends SuperRequestType { + } + = + static class ReplyType { + } + = + static class SubReplyType extends ReplyType { + } + = + static class TestServiceRegistrationListener implements ServiceRegistra= tionListener { + public ServiceInfo info; + = + public void serviceRegistered(Registration listenerHandle, ServiceIn= fo info) { + this.info =3D info; + synchronized (lock) { + lock.notify(); + } + } + = + } +} --===============7722914747375590074==-- From jboss-remoting-commits at lists.jboss.org Wed Jun 23 10:12:56 2010 Content-Type: multipart/mixed; boundary="===============0391832777304233372==" 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: r5876 - remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test. Date: Wed, 23 Jun 2010 10:12:56 -0400 Message-ID: <201006231412.o5NECux0006928@svn01.web.mwc.hst.phx2.redhat.com> --===============0391832777304233372== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-23 10:12:55 -0400 (Wed, 23 Jun 2010) New Revision: 5876 Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/Re= motingTestBase.java Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/Cl= ientServerRemoteConfigurationTestCase.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/En= dpointConfigurationTestCase.java remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/Se= rviceRegistrationTestCase.java Log: JBREM-1228: Added RemotingTestBase as parent class. Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/= test/ClientServerRemoteConfigurationTestCase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/C= lientServerRemoteConfigurationTestCase.java 2010-06-22 22:30:04 UTC (rev 58= 75) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/C= lientServerRemoteConfigurationTestCase.java 2010-06-23 14:12:55 UTC (rev 58= 76) @@ -63,7 +63,6 @@ import org.jboss.xnio.Options; import org.jboss.xnio.TcpServer; import org.jboss.xnio.Xnio; -import org.jboss.xnio.IoFuture.Status; import org.jboss.xnio.channels.BoundChannel; import org.jboss.xnio.channels.ConnectedStreamChannel; import org.jboss.xnio.log.Logger; @@ -81,39 +80,12 @@ * Copyright Jun 7, 2010 */ @Test(suiteName =3D "ClientServerRemoteConfiguration") -public class ClientServerRemoteConfigurationTestCase { +public class ClientServerRemoteConfigurationTestCase extends RemotingTestB= ase { = private static final Logger log =3D Logger.getLogger(ClientServerRemote= ConfigurationTestCase.class); = private static int counter; = - static void enter() { - final StackTraceElement e =3D new Throwable().getStackTrace()[1]; - log.info("Entering: %s#%s", e.getClassName(), e.getMethodName()); - } - - static void exit() { - final StackTraceElement e =3D new Throwable().getStackTrace()[1]; - log.info("Exiting: %s#%s", e.getClassName(), e.getMethodName()); - log.info("----------------------------------------------------------= ---"); - } - = - static T getFutureResult(IoFuture future, String errorMessage) t= hrows IOException { - Status status =3D null; - switch (status =3D future.await(5000, TimeUnit.MILLISECONDS)) { - case DONE: { - return future.get(); - } - case FAILED: { - log.error(errorMessage); - throw future.getException(); - } - default: { - throw new RuntimeException("unexpected future state: " + statu= s); - } - } - } - @BeforeMethod public void setUp() { ServiceLoader.load(RemotingServiceDescriptor.class); @@ -178,7 +150,7 @@ } assertEquals(20, sp0.requestListener.counter, "Should be equal"); assertEquals(20, sp1.requestListener.counter, "Should be equal"); - log.info("testAllDistinct() PASSES"); + log.info(getName() + " PASSES"); } finally { clients.close(); connections.close(); @@ -248,7 +220,7 @@ } assertEquals(20, sp0.requestListener.counter, "Should be equal"); assertEquals(20, sp1.requestListener.counter, "Should be equal"); - log.info("testSharedExecutor() PASSES"); + log.info(getName() + " PASSES"); } finally { clients.close(); connections.close(); @@ -317,7 +289,7 @@ } assertEquals(20, sp0.requestListener.counter, "Should be equal"); assertEquals(20, sp1.requestListener.counter, "Should be equal"); - log.info("testSharedExecutorEndpoint() PASSES"); + log.info(getName() + " PASSES"); } finally { clients.close(); connections.close(); @@ -386,7 +358,7 @@ } assertEquals(20, sp0.requestListener.counter, "Should be equal"); assertEquals(20, sp1.requestListener.counter, "Should be equal"); - log.info("testSharedExecutorEndpointXnio() PASSES"); + log.info(getName() + " PASSES"); } finally { clients.close(); connections.close(); @@ -474,7 +446,7 @@ assertEquals(10, sp01.requestListener.counter, "Should be equal"); assertEquals(10, sp10.requestListener.counter, "Should be equal"); assertEquals(10, sp11.requestListener.counter, "Should be equal"); - log.info("testSharedExecutorEndpointXnioTcpServer() PASSES"); + log.info(getName() + " PASSES"); } finally { clients.close(); connections.close(); @@ -558,7 +530,7 @@ assertEquals(id0, client111.invoke("dummy"), "Should be equal"= ); } assertEquals(40, sp00.requestListener.counter, "Should be equal"); - log.info("testSharedExecutorEndpointXnioTcpServerRequestListener(= ) PASSES"); + log.info(getName() + " PASSES"); } finally { clients.close(); connections.close(); Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/= test/EndpointConfigurationTestCase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/E= ndpointConfigurationTestCase.java 2010-06-22 22:30:04 UTC (rev 5875) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/E= ndpointConfigurationTestCase.java 2010-06-23 14:12:55 UTC (rev 5876) @@ -73,21 +73,10 @@ * Copyright Jun 21, 2010 */ @Test(suiteName =3D "EndpointConfiguration") -public class EndpointConfigurationTestCase { +public class EndpointConfigurationTestCase extends RemotingTestBase { = private static final Logger log =3D Logger.getLogger(EndpointConfigurat= ionTestCase.class); = - static void enter() { - final StackTraceElement e =3D new Throwable().getStackTrace()[1]; - log.info("Entering: %s#%s", e.getClassName(), e.getMethodName()); - } - - static void exit() { - final StackTraceElement e =3D new Throwable().getStackTrace()[1]; - log.info("Exiting: %s#%s", e.getClassName(), e.getMethodName()); - log.info("----------------------------------------------------------= ---"); - } - @BeforeMethod public void setUp() { System.clearProperty("remoting.property.file"); @@ -148,7 +137,7 @@ assertSame(mockClassTable, context.getProtocolServiceProvider(Pro= tocolServiceType.CLASS_TABLE, "mockClassTable")); assertSame(mockObjectResolver, context.getProtocolServiceProvider= (ProtocolServiceType.OBJECT_RESOLVER, "mockObjectResolver")); assertSame(mockObjectTable, context.getProtocolServiceProvider(Pr= otocolServiceType.OBJECT_TABLE, "mockObjectTable")); - log.info("testProgrammaticConfiguration() PASSES"); + log.info(getName() + " PASSES"); = } finally { if (regClassExternalizerFactoryProvider !=3D null) { @@ -195,7 +184,7 @@ assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .CLASS_TABLE, "mockClassTable_sd") instanceof MockClassTable); assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_RESOLVER, "mockObjectResolver_sd") instanceof MockObjectResolver); assertTrue(context.getProtocolServiceProvider(ProtocolServiceType= .OBJECT_TABLE, "mockObjectTable_sd") instanceof MockObjectTable); - log.info("testConfigurationByServiceDescriptorFile() PASSES"); + log.info(getName() + " PASSES"); } finally { exit(); } Added: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/tes= t/RemotingTestBase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/R= emotingTestBase.java (rev 0) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/R= emotingTestBase.java 2010-06-23 14:12:55 UTC (rev 5876) @@ -0,0 +1,77 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.remoting3.test; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import org.jboss.xnio.IoFuture; +import org.jboss.xnio.IoFuture.Status; +import org.jboss.xnio.log.Logger; + +/** + * = + * @author Ron Sigal + * @version $Revision: 1.1 $ + *

+ * Copyright Jun 23, 2010 + */ +public class RemotingTestBase { + private static final Logger log =3D Logger.getLogger(RemotingTestBase.c= lass); + = + protected String getName() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + return e.getMethodName(); = + } + = + protected static void enter() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Entering: %s#%s", e.getClassName(), e.getMethodName()); + } + + protected static void exit() { + final StackTraceElement e =3D new Throwable().getStackTrace()[1]; + log.info("Exiting: %s#%s", e.getClassName(), e.getMethodName()); + log.info("----------------------------------------------------------= ---"); + } + = + protected static T getFutureResult(IoFuture future, String error= Message) throws IOException { + return getFutureResult(future, 5000, errorMessage); + } + = + protected static T getFutureResult(IoFuture future, int timeout,= String errorMessage) throws IOException { + Status status =3D null; + switch (status =3D future.await(timeout, TimeUnit.MILLISECONDS)) { + case DONE: { + return future.get(); + } + case FAILED: { + log.error(errorMessage); + throw future.getException(); + } + default: { + throw new RuntimeException("unexpected future state: " + statu= s); + } + } + } +} Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/= test/ServiceRegistrationTestCase.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 --- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/S= erviceRegistrationTestCase.java 2010-06-22 22:30:04 UTC (rev 5875) +++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/S= erviceRegistrationTestCase.java 2010-06-23 14:12:55 UTC (rev 5876) @@ -58,22 +58,11 @@ * @param */ @Test(suiteName =3D "ServiceRegistration") -public class ServiceRegistrationTestCase { +public class ServiceRegistrationTestCase extends RemotingTestBase { = private static final Logger log =3D Logger.getLogger(ServiceRegistratio= nTestCase.class); private static Object lock =3D new Object(); = - static void enter() { - final StackTraceElement e =3D new Throwable().getStackTrace()[1]; - log.info("Entering: %s#%s", e.getClassName(), e.getMethodName()); - } - - static void exit() { - final StackTraceElement e =3D new Throwable().getStackTrace()[1]; - log.info("Exiting: %s#%s", e.getClassName(), e.getMethodName()); - log.info("----------------------------------------------------------= ---"); - } - @BeforeMethod public void setUp() { } @@ -115,6 +104,8 @@ assertEquals(SubReplyType.class, registrationListener.info.getRep= lyClass()); assertSame(optionMap, registrationListener.info.getOptionMap()); = + log.info(getName() + " PASSES"); + = } finally { if (registration !=3D null) { registration.close(); @@ -172,6 +163,5 @@ lock.notify(); } } - = } } --===============0391832777304233372==-- From jboss-remoting-commits at lists.jboss.org Thu Jun 24 19:25:30 2010 Content-Type: multipart/mixed; boundary="===============4030975127138980146==" 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: r5877 - remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services. Date: Thu, 24 Jun 2010 19:25:30 -0400 Message-ID: <201006242325.o5ONPUUd004925@svn01.web.mwc.hst.phx2.redhat.com> --===============4030975127138980146== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-24 19:25:30 -0400 (Thu, 24 Jun 2010) New Revision: 5877 Modified: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.= jboss.remoting3.spi.RemotingServiceDescriptor Log: JBREM-1228: Forgot to commit RemotingServiceDescriptor file for EndpointCon= figurationTestCase. Modified: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/servic= es/org.jboss.remoting3.spi.RemotingServiceDescriptor =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 --- remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.remoting3.spi.RemotingServiceDescriptor 2010-06-23 14:12:55 UTC (rev= 5876) +++ remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.remoting3.spi.RemotingServiceDescriptor 2010-06-24 23:25:30 UTC (rev= 5877) @@ -1,5 +1,13 @@ # -# Remoting "remote" protocol descriptors +# Remoting "mockTransport" protocol descriptor # + org.jboss.remoting3.remote.RemoteProtocolDescriptor org.jboss.remoting3.remote.RemoteSslProtocolDescriptor + +org.jboss.remoting3.test.EndpointConfigurationTestCase$MockProtocolDescrip= tor +org.jboss.remoting3.test.EndpointConfigurationTestCase$MockClassExternaliz= erFactoryServiceDescriptor +org.jboss.remoting3.test.EndpointConfigurationTestCase$MockClassResolverSe= rviceDescriptor +org.jboss.remoting3.test.EndpointConfigurationTestCase$MockClassTableServi= ceDescriptor +org.jboss.remoting3.test.EndpointConfigurationTestCase$MockObjectResolverS= erviceDescriptor +org.jboss.remoting3.test.EndpointConfigurationTestCase$MockObjectTableServ= iceDescriptor \ No newline at end of file --===============4030975127138980146==-- From jboss-remoting-commits at lists.jboss.org Thu Jun 24 20:02:04 2010 Content-Type: multipart/mixed; boundary="===============8893995133169666578==" 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: r5878 - remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services. Date: Thu, 24 Jun 2010 20:02:04 -0400 Message-ID: <201006250002.o5P024YI009594@svn01.web.mwc.hst.phx2.redhat.com> --===============8893995133169666578== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-24 20:02:04 -0400 (Thu, 24 Jun 2010) New Revision: 5878 Modified: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.= jboss.remoting3.spi.RemotingServiceDescriptor Log: JBREM-1228: Added stuff to the wrong RemotingServiceDescriptor. Modified: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/servic= es/org.jboss.remoting3.spi.RemotingServiceDescriptor =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 --- remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.remoting3.spi.RemotingServiceDescriptor 2010-06-24 23:25:30 UTC (rev= 5877) +++ remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.remoting3.spi.RemotingServiceDescriptor 2010-06-25 00:02:04 UTC (rev= 5878) @@ -1,13 +1,5 @@ # # Remoting "mockTransport" protocol descriptor # - org.jboss.remoting3.remote.RemoteProtocolDescriptor -org.jboss.remoting3.remote.RemoteSslProtocolDescriptor - -org.jboss.remoting3.test.EndpointConfigurationTestCase$MockProtocolDescrip= tor -org.jboss.remoting3.test.EndpointConfigurationTestCase$MockClassExternaliz= erFactoryServiceDescriptor -org.jboss.remoting3.test.EndpointConfigurationTestCase$MockClassResolverSe= rviceDescriptor -org.jboss.remoting3.test.EndpointConfigurationTestCase$MockClassTableServi= ceDescriptor -org.jboss.remoting3.test.EndpointConfigurationTestCase$MockObjectResolverS= erviceDescriptor -org.jboss.remoting3.test.EndpointConfigurationTestCase$MockObjectTableServ= iceDescriptor \ No newline at end of file +org.jboss.remoting3.remote.RemoteSslProtocolDescriptor \ No newline at end of file --===============8893995133169666578==-- From jboss-remoting-commits at lists.jboss.org Thu Jun 24 20:17:07 2010 Content-Type: multipart/mixed; boundary="===============0820619609313813841==" 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: r5879 - remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services. Date: Thu, 24 Jun 2010 20:17:07 -0400 Message-ID: <201006250017.o5P0H7QH016792@svn01.web.mwc.hst.phx2.redhat.com> --===============0820619609313813841== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-24 20:17:07 -0400 (Thu, 24 Jun 2010) New Revision: 5879 Removed: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.= jboss.marshalling.ProviderDescriptor Log: JBREM-1228: Put this file in the wrong directory. Deleted: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/service= s/org.jboss.marshalling.ProviderDescriptor =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 --- remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.marshalling.ProviderDescriptor 2010-06-25 00:02:04 UTC (rev 5878) +++ remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.marshalling.ProviderDescriptor 2010-06-25 00:17:07 UTC (rev 5879) @@ -1,5 +0,0 @@ -# -# MockMarshaller provider descriptor -# - -org.jboss.remoting3.test.EndpointConfigurationTestCase$MockMarshallerProvi= derDescriptor --===============0820619609313813841==-- From jboss-remoting-commits at lists.jboss.org Thu Jun 24 20:19:09 2010 Content-Type: multipart/mixed; boundary="===============2381898190364362961==" 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: r5880 - remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services. Date: Thu, 24 Jun 2010 20:19:09 -0400 Message-ID: <201006250019.o5P0J9WH016824@svn01.web.mwc.hst.phx2.redhat.com> --===============2381898190364362961== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ron.sigal(a)jboss.com Date: 2010-06-24 20:19:09 -0400 (Thu, 24 Jun 2010) New Revision: 5880 Modified: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org.= jboss.remoting3.spi.RemotingServiceDescriptor Log: JBREM-1228: Reverting to previous, correct version. Modified: remoting3/trunk/jboss-remoting/src/main/resources/META-INF/servic= es/org.jboss.remoting3.spi.RemotingServiceDescriptor =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 --- remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.remoting3.spi.RemotingServiceDescriptor 2010-06-25 00:17:07 UTC (rev= 5879) +++ remoting3/trunk/jboss-remoting/src/main/resources/META-INF/services/org= .jboss.remoting3.spi.RemotingServiceDescriptor 2010-06-25 00:19:09 UTC (rev= 5880) @@ -1,5 +1,5 @@ # -# Remoting "mockTransport" protocol descriptor +# Remoting "remote" protocol descriptors # org.jboss.remoting3.remote.RemoteProtocolDescriptor -org.jboss.remoting3.remote.RemoteSslProtocolDescriptor \ No newline at end of file +org.jboss.remoting3.remote.RemoteSslProtocolDescriptor --===============2381898190364362961==--