Author: ron.sigal(a)jboss.com
Date: 2009-03-25 00:00:20 -0400 (Wed, 25 Mar 2009)
New Revision: 4910
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/BisocketConfigurationMapTestCase.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/HttpConfigurationMapTestCase.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/RMIConfigurationMapTestCase.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/SocketConfigurationMapTestCase.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java
Log:
JBREM-1102: New unit tests.
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/BisocketConfigurationMapTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/BisocketConfigurationMapTestCase.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/BisocketConfigurationMapTestCase.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,170 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.marshal.MarshalFactory;
+
+/**
+ * Unit tests for JBREM-1102.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 21, 2009
+ * </p>
+ */
+public class BisocketConfigurationMapTestCase extends ConfigurationMapTestParent
+{
+ private static Logger log = Logger.getLogger(BisocketConfigurationMapTestCase.class);
+
+ protected String getTransport()
+ {
+ return "bisocket";
+ }
+
+ public void testDatatypeConfigWithCallbacks() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Cache marshaller/unmarshaller.
+ MarshalFactory.addMarshaller("config", new ConfigTestMarshaller(), new
ConfigTestUnmarshaller());
+
+ // Start server.
+ HashMap serverConfig = new HashMap();
+ serverConfig.put(InvokerLocator.DATATYPE, "config");
+ setupServer("x=y", serverConfig);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(InvokerLocator.DATATYPE, "config");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Configure callbacks.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ client.addListener(callbackHandler, new HashMap());
+
+ // Do tests.
+ assertTrue(ConfigTestMarshaller.ok(12));
+ assertTrue(ConfigTestUnmarshaller.ok(8));
+ assertTrue(LocatorTestMarshaller.ok());
+ assertTrue(LocatorTestUnmarshaller.ok());
+ assertEquals(1, callbackHandler.counter);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testFQNConfigWithCallbacks() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ HashMap serverConfig = new HashMap();
+ serverConfig.put(InvokerLocator.MARSHALLER, ConfigTestMarshaller.class.getName());
+ serverConfig.put(InvokerLocator.UNMARSHALLER,
ConfigTestUnmarshaller.class.getName());
+ setupServer("x=y", serverConfig);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(InvokerLocator.MARSHALLER, ConfigTestMarshaller.class.getName());
+ clientConfig.put(InvokerLocator.UNMARSHALLER,
ConfigTestUnmarshaller.class.getName());
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Do callback.
+ // Configure callbacks.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ client.addListener(callbackHandler, new HashMap());
+
+ // Do tests.
+ assertTrue(ConfigTestMarshaller.ok(6));
+ assertTrue(ConfigTestUnmarshaller.ok(4));
+ assertTrue(LocatorTestMarshaller.ok());
+ assertTrue(LocatorTestUnmarshaller.ok());
+ assertEquals(1, callbackHandler.counter);
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected TestInvocationHandler getInvocationHandler()
+ {
+ return new BisocketTestInvocationHandler();
+ }
+
+
+ static class BisocketTestInvocationHandler extends TestInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ try
+ {
+ callbackHandler.handleCallback(new Callback("callback"));
+ }
+ catch (HandleCallbackException e)
+ {
+ log.error("Error sending callback", e);
+ }
+ }
+ }
+
+ static class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public int counter;
+
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ counter++;
+ log.info("received callback");
+ }
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
+
+/**
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 24, 2009
+ * </p>
+ */
+public class ConfigTestMarshaller extends SerializableMarshaller
+{
+ protected static Logger log = Logger.getLogger(ConfigTestMarshaller.class);
+ private static final long serialVersionUID = 1L;
+ public static int cloned;
+ public static boolean wrote;
+
+ public void write(Object dataObject, OutputStream output, int version) throws
IOException
+ {
+ log.info(this + "writing Wrapper");
+ super.write(new Wrapper(dataObject), output, version);
+ wrote = true;
+ }
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ cloned++;
+ log.info("cloned ConfigTestMarshaller");
+// log.info("cloned ConfigTestMarshaller", new Exception());
+ return new ConfigTestMarshaller();
+ }
+
+ public static boolean ok(int count)
+ {
+ log.info("wrote: " + wrote + ", cloned: " + cloned);
+ return wrote && cloned == count;
+ }
+
+ public static void reset()
+ {
+ cloned = 0;
+ wrote = false;
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller;
+
+/**
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 24, 2009
+ * </p>
+ */
+public class ConfigTestUnmarshaller extends SerializableUnMarshaller
+{
+ protected static Logger log = Logger.getLogger(ConfigTestUnmarshaller.class);
+ private static final long serialVersionUID = 1L;
+ public static int cloned;
+ public static boolean read;
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ cloned++;
+ log.info("cloned ConfigTestUnmarshaller");
+// log.info("cloned ConfigTestUnmarshaller", new Exception());
+ ConfigTestUnmarshaller unmarshaller = new ConfigTestUnmarshaller();
+ unmarshaller.setClassLoader(this.customClassLoader);
+ return unmarshaller;
+ }
+
+ public Object read(InputStream inputStream, Map metadata, int version) throws
IOException, ClassNotFoundException
+ {
+ Object o = super.read(inputStream, metadata, version);
+ if (!(o instanceof Wrapper))
+ {
+ throw new IOException("expected Wrapper");
+ }
+ log.info(this + "read Wrapper");
+ read = true;
+ return ((Wrapper)o).wrappee;
+ }
+
+ public static boolean ok(int count)
+ {
+ log.info("read: " + read + ", cloned: " + cloned);
+ return read && cloned == count;
+ }
+
+ public static void reset()
+ {
+ cloned = 0;
+ read = false;
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,225 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.test.remoting.marshall.config;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+/**
+ * Unit test for JBREM-1102.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 20, 2009
+ * </p>
+ */
+public abstract class ConfigurationMapTestParent extends TestCase
+{
+ private static Logger log = Logger.getLogger(ConfigurationMapTestParent.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+
+ ConfigTestMarshaller.reset();
+ ConfigTestUnmarshaller.reset();
+ LocatorTestMarshaller.reset();
+ LocatorTestUnmarshaller.reset();
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testDatatypeConfig() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Cache marshaller/unmarshaller.
+ MarshalFactory.addMarshaller("config", new ConfigTestMarshaller(), new
ConfigTestUnmarshaller());
+
+ // Start server.
+ HashMap serverConfig = new HashMap();
+ serverConfig.put(InvokerLocator.DATATYPE, "config");
+ setupServer("x=y", serverConfig);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(InvokerLocator.DATATYPE, "config");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Do tests.
+ assertTrue(ConfigTestMarshaller.ok(6));
+ assertTrue(ConfigTestUnmarshaller.ok(4));
+ assertTrue(LocatorTestMarshaller.ok());
+ assertTrue(LocatorTestUnmarshaller.ok());
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ public void testFQNConfig() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ HashMap serverConfig = new HashMap();
+ serverConfig.put(InvokerLocator.MARSHALLER, ConfigTestMarshaller.class.getName());
+ serverConfig.put(InvokerLocator.UNMARSHALLER,
ConfigTestUnmarshaller.class.getName());
+ setupServer("x=y", serverConfig);
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(InvokerLocator.MARSHALLER, ConfigTestMarshaller.class.getName());
+ clientConfig.put(InvokerLocator.UNMARSHALLER,
ConfigTestUnmarshaller.class.getName());
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Do tests.
+ assertTrue(ConfigTestMarshaller.ok(configTestMarshallerCount()));
+ assertTrue(ConfigTestUnmarshaller.ok(configTestUnmarshallerCount()));
+ assertTrue(LocatorTestMarshaller.ok());
+ assertTrue(LocatorTestUnmarshaller.ok());
+
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected int configTestMarshallerCount()
+ {
+ return 3;
+ }
+
+
+ protected int configTestUnmarshallerCount()
+ {
+ return 2;
+ }
+
+
+ protected abstract String getTransport();
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer(String parameter, Map extraConfig) throws Exception
+ {
+ log.info("parameter: " + parameter);
+ log.info("extraConfig: " + extraConfig);
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port +
"/?" + parameter;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "&" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraServerConfig(config);
+ if (extraConfig != null)
+ {
+ config.putAll(extraConfig);
+ }
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = getInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ protected TestInvocationHandler getInvocationHandler()
+ {
+ return new TestInvocationHandler();
+ }
+}
\ No newline at end of file
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/HttpConfigurationMapTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/HttpConfigurationMapTestCase.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/HttpConfigurationMapTestCase.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+/**
+ * Unit tests for JBREM-1102.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 21, 2009
+ * </p>
+ */
+public class HttpConfigurationMapTestCase extends ConfigurationMapTestParent
+{
+ protected String getTransport()
+ {
+ return "http";
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+import org.jboss.remoting.marshal.Marshaller;
+
+/**
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 24, 2009
+ * </p>
+ */
+public class LocatorTestMarshaller extends ConfigTestMarshaller
+{
+ private static final long serialVersionUID = 1L;
+ public static int cloned;
+ public static boolean wrote;
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ cloned++;
+ log.info("cloned LocatorTestMarshaller");
+ return new LocatorTestMarshaller();
+ }
+
+ public static boolean ok()
+ {
+ return !wrote && cloned == 0;
+ }
+
+ public static void reset()
+ {
+ cloned = 0;
+ wrote = false;
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+import org.jboss.remoting.marshal.UnMarshaller;
+
+/**
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 24, 2009
+ * </p>
+ */
+public class LocatorTestUnmarshaller extends ConfigTestUnmarshaller
+{
+ private static final long serialVersionUID = 1L;
+ public static int cloned;
+ public static boolean read;
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ cloned++;
+ log.info("cloned LocatorTestUnmarshaller");
+ ConfigTestUnmarshaller unmarshaller = new LocatorTestUnmarshaller();
+ unmarshaller.setClassLoader(this.customClassLoader);
+ return unmarshaller;
+ }
+
+ public static boolean ok()
+ {
+ return !read && cloned == 0;
+ }
+
+ public static void reset()
+ {
+ cloned = 0;
+ read = false;
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/RMIConfigurationMapTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/RMIConfigurationMapTestCase.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/RMIConfigurationMapTestCase.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+/**
+ * Unit tests for JBREM-1102.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 21, 2009
+ * </p>
+ */
+public class RMIConfigurationMapTestCase extends ConfigurationMapTestParent
+{
+ protected String getTransport()
+ {
+ return "rmi";
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/SocketConfigurationMapTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/SocketConfigurationMapTestCase.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/SocketConfigurationMapTestCase.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+/**
+ * Unit tests for JBREM-1102.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 21, 2009
+ * </p>
+ */
+public class SocketConfigurationMapTestCase extends ConfigurationMapTestParent
+{
+ protected String getTransport()
+ {
+ return "socket";
+ }
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+import javax.management.MBeanServer;
+
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+
+/**
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 24, 2009
+ * </p>
+ */
+ public class TestInvocationHandler implements ServerInvocationHandler
+{
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+}
+
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java 2009-03-25
04:00:20 UTC (rev 4910)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.remoting.marshall.config;
+
+import java.io.Serializable;
+
+
+/**
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version
+ * <p>
+ * Copyright Mar 24, 2009
+ * </p>
+ */
+class Wrapper implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ public Object wrappee;
+
+ public Wrapper(Object o)
+ {
+ wrappee = o;
+ }
+}
+