[jboss-remoting-commits] JBoss Remoting SVN: r4900 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Mar 24 03:30:02 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-03-24 03:30:02 -0400 (Tue, 24 Mar 2009)
New Revision: 4900

Added:
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java
Modified:
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java
Log:
JBREM-1102: Broke classes out of ConfigurationMapTestParent.

Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java	2009-03-24 07:30:02 UTC (rev 4900)
@@ -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 at 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 + ", count: " + count);
+      return wrote && cloned == count;
+   }
+   
+   public static void reset()
+   {
+      cloned = 0;
+      wrote = false;
+   }
+}
+

Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestUnmarshaller.java	2009-03-24 07:30:02 UTC (rev 4900)
@@ -0,0 +1,79 @@
+/*
+ * 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 at jboss.com">Ron Sigal</a>
+ * @version 
+ * <p>
+ * Copyright Mar 24, 2009
+ * </p>
+ */
+public class ConfigTestUnmarshaller extends SerializableUnMarshaller
+{
+   protected 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)
+   {
+      return read && cloned == count;
+   }
+   
+   public static void reset()
+   {
+      cloned = 0;
+      read = false;
+   }
+}
+

Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java	2009-03-24 03:46:02 UTC (rev 4899)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/ConfigurationMapTestParent.java	2009-03-24 07:30:02 UTC (rev 4900)
@@ -22,16 +22,10 @@
 
 package org.jboss.test.remoting.marshall.config;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Serializable;
 import java.net.InetAddress;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.management.MBeanServer;
-
 import junit.framework.TestCase;
 
 import org.apache.log4j.ConsoleAppender;
@@ -40,16 +34,8 @@
 import org.apache.log4j.PatternLayout;
 import org.jboss.logging.XLevel;
 import org.jboss.remoting.Client;
-import org.jboss.remoting.InvocationRequest;
 import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.InvokerCallbackHandler;
 import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.remoting.marshal.Marshaller;
-import org.jboss.remoting.marshal.UnMarshaller;
-import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
-import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller;
 import org.jboss.remoting.transport.Connector;
 import org.jboss.remoting.transport.PortUtil;
 
@@ -166,8 +152,8 @@
       log.info("connection is good");
       
       // Do tests.
-      assertTrue(ConfigTestMarshaller.ok(3));
-      assertTrue(ConfigTestUnmarshaller.ok(2));
+      assertTrue(ConfigTestMarshaller.ok(configTestMarshallerCount()));
+      assertTrue(ConfigTestUnmarshaller.ok(configTestUnmarshallerCount()));
       assertTrue(LocatorTestMarshaller.ok());
       assertTrue(LocatorTestUnmarshaller.ok());
       
@@ -177,6 +163,18 @@
    }
    
    
+   protected int configTestMarshallerCount()
+   {
+      return 3;
+   }
+   
+   
+   protected int configTestUnmarshallerCount()
+   {
+      return 2;
+   }
+   
+   
    protected abstract String getTransport();
    
    
@@ -224,156 +222,4 @@
    {
       return new TestInvocationHandler();
    }
-   
-   
-   static 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) {}
-   }
-   
-   
-   public static class ConfigTestMarshaller extends SerializableMarshaller
-   {
-      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)
-      {
-         return wrote && cloned == count;
-      }
-      
-      public static void reset()
-      {
-         cloned = 0;
-         wrote = false;
-      }
-   }
-   
-   public static 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;
-      }
-   }
-
-   public static class ConfigTestUnmarshaller extends SerializableUnMarshaller
-   {
-      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)
-      {
-         return read && cloned == count;
-      }
-      
-      public static void reset()
-      {
-         cloned = 0;
-         read = false;
-      }
-   }
-   
-   
-   public static 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;
-      }
-   }
-   
-   
-   static class Wrapper implements Serializable
-   {
-      private static final long serialVersionUID = 1L;
-      public Object wrappee;
-      
-      public Wrapper(Object o)
-      {
-         wrappee = o;  
-      }
-   }
 }
\ No newline at end of file

Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestMarshaller.java	2009-03-24 07:30:02 UTC (rev 4900)
@@ -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 at 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.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/LocatorTestUnmarshaller.java	2009-03-24 07:30:02 UTC (rev 4900)
@@ -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 at 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.2/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/TestInvocationHandler.java	2009-03-24 07:30:02 UTC (rev 4900)
@@ -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 at 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.2/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/config/Wrapper.java	2009-03-24 07:30:02 UTC (rev 4900)
@@ -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 at 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;  
+   }
+}
+




More information about the jboss-remoting-commits mailing list