[jboss-remoting-commits] JBoss Remoting SVN: r5426 - in remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet: contenttype and 1 other directory.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Sep 1 21:04:21 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-09-01 21:04:21 -0400 (Tue, 01 Sep 2009)
New Revision: 5426

Added:
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/ServletContentTypeTestClient.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerCR.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerLF.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerOK.java
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/remoting-servlet-service.xml
Log:
JBREM-1101: New unit tests.

Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/ServletContentTypeTestClient.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/ServletContentTypeTestClient.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/ServletContentTypeTestClient.java	2009-09-02 01:04:21 UTC (rev 5426)
@@ -0,0 +1,60 @@
+/*
+ * 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.transport.servlet.contenttype;
+
+import org.apache.log4j.Logger;
+import org.jboss.test.remoting.transport.http.contenttype.ContentTypeTestCase;
+
+/**
+ * Unit tests for JBREM-1101.
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version 
+ * <p>
+ * Copyright Sep 1, 2009
+ * </p>
+ */
+public class ServletContentTypeTestClient extends ContentTypeTestCase
+{
+   protected static Logger log = Logger.getLogger(ServletContentTypeTestClient.class);
+   
+   protected void setupServer(String contentType) throws Exception
+   {
+      locatorURI = "http://localhost:8080/servlet-invoker/ServerInvokerServlet";
+      
+      if (CONTENT_TYPE.equals(contentType))
+      {
+         locatorURI += "/OK";
+      }
+      if (INVALID_CONTENT_TYPE_CR.equals(contentType))
+      {
+         locatorURI += "/CR";
+      }
+      else if (INVALID_CONTENT_TYPE_LF.equals(contentType))
+      {
+         locatorURI += "/LF";
+      }
+      
+      log.info("setting InvokerLocator to " + locatorURI);
+   }
+}
+

Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerCR.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerCR.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerCR.java	2009-09-02 01:04:21 UTC (rev 5426)
@@ -0,0 +1,64 @@
+/*
+ * 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.transport.servlet.contenttype;
+
+import java.util.Map;
+
+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;
+
+/**
+ * For JBREM-1101 unit tests.
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Sep 1, 2009
+ * </p>
+ */
+public class TestInvocationHandlerCR implements ServerInvocationHandler
+{
+   public static String CONTENT_TYPE = "test/testContentType";
+   public static String INVALID_CONTENT_TYPE_CR = "test/x" + '\r' + "y";
+   public static String INVALID_CONTENT_TYPE_LF = "test/x" + '\n' + "y";
+   public static String REQUEST = "testRequest";
+   public static String RESPONSE = "testResponse";
+   
+   public void addListener(InvokerCallbackHandler callbackHandler) {}
+   public Object invoke(final InvocationRequest invocation) throws Throwable
+   {
+      Map response = invocation.getReturnPayload();
+      if (response != null)
+      {
+         response.put("Content-Type", INVALID_CONTENT_TYPE_CR);
+      }
+      return RESPONSE;
+   }
+   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/transport/servlet/contenttype/TestInvocationHandlerLF.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerLF.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerLF.java	2009-09-02 01:04:21 UTC (rev 5426)
@@ -0,0 +1,64 @@
+/*
+ * 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.transport.servlet.contenttype;
+
+import java.util.Map;
+
+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;
+
+/**
+ * For JBREM-1101 unit tests.
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Sep 1, 2009
+ * </p>
+ */
+public class TestInvocationHandlerLF implements ServerInvocationHandler
+{
+   public static String CONTENT_TYPE = "test/testContentType";
+   public static String INVALID_CONTENT_TYPE_CR = "test/x" + '\r' + "y";
+   public static String INVALID_CONTENT_TYPE_LF = "test/x" + '\n' + "y";
+   public static String REQUEST = "testRequest";
+   public static String RESPONSE = "testResponse";
+   
+   public void addListener(InvokerCallbackHandler callbackHandler) {}
+   public Object invoke(final InvocationRequest invocation) throws Throwable
+   {
+      Map response = invocation.getReturnPayload();
+      if (response != null)
+      {
+         response.put("Content-Type", INVALID_CONTENT_TYPE_CR);
+      }
+      return RESPONSE;
+   }
+   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/transport/servlet/contenttype/TestInvocationHandlerOK.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerOK.java	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/TestInvocationHandlerOK.java	2009-09-02 01:04:21 UTC (rev 5426)
@@ -0,0 +1,64 @@
+/*
+ * 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.transport.servlet.contenttype;
+
+import java.util.Map;
+
+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;
+
+/**
+ * For JBREM-1101 unit tests.
+ * 
+ * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
+ * @version $Rev$
+ * <p>
+ * Copyright Sep 1, 2009
+ * </p>
+ */
+public class TestInvocationHandlerOK implements ServerInvocationHandler
+{
+   public static String CONTENT_TYPE = "test/testContentType";
+   public static String INVALID_CONTENT_TYPE_CR = "test/x" + '\r' + "y";
+   public static String INVALID_CONTENT_TYPE_LF = "test/x" + '\n' + "y";
+   public static String REQUEST = "testRequest";
+   public static String RESPONSE = "testResponse";
+   
+   public void addListener(InvokerCallbackHandler callbackHandler) {}
+   public Object invoke(final InvocationRequest invocation) throws Throwable
+   {
+      Map response = invocation.getReturnPayload();
+      if (response != null)
+      {
+         response.put("Content-Type", CONTENT_TYPE);
+      }
+      return RESPONSE;
+   }
+   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/transport/servlet/contenttype/remoting-servlet-service.xml
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/remoting-servlet-service.xml	                        (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/servlet/contenttype/remoting-servlet-service.xml	2009-09-02 01:04:21 UTC (rev 5426)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+
+           <mbean code="org.jboss.remoting.transport.Connector"
+                  name="jboss.remoting:service=Connector,transport=Servlet,target=tests,version=OK"
+                  display-name="Servlet transport Connector">
+
+              <attribute name="InvokerLocator">
+                 servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=OK
+              </attribute>
+
+              <attribute name="Configuration">
+                 <config>
+                    <handlers>
+                       <handler subsystem="test">org.jboss.test.remoting.transport.servlet.contenttype.TestInvocationHandlerOK</handler>
+                    </handlers>
+                 </config>
+              </attribute>
+           </mbean>
+           
+           <mbean code="org.jboss.remoting.transport.Connector"
+                  name="jboss.remoting:service=Connector,transport=Servlet,target=tests,version=CR"
+                  display-name="Servlet transport Connector">
+
+              <attribute name="InvokerLocator">
+                 servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=CR
+              </attribute>
+
+              <attribute name="Configuration">
+                 <config>
+                    <handlers>
+                       <handler subsystem="test">org.jboss.test.remoting.transport.servlet.contenttype.TestInvocationHandlerCR</handler>
+                    </handlers>
+                 </config>
+              </attribute>
+           </mbean>
+
+           <mbean code="org.jboss.remoting.transport.Connector"
+                  name="jboss.remoting:service=Connector,transport=Servlet,target=tests,version=LF"
+                  display-name="Servlet transport Connector">
+
+              <attribute name="InvokerLocator">
+                 servlet://localhost:8080/servlet-invoker/ServerInvokerServlet/?version=LF
+              </attribute>
+
+              <attribute name="Configuration">
+                 <config>
+                    <handlers>
+                       <handler subsystem="test">org.jboss.test.remoting.transport.servlet.contenttype.TestInvocationHandlerLF</handler>
+                    </handlers>
+                 </config>
+              </attribute>
+           </mbean>
+</server>



More information about the jboss-remoting-commits mailing list