From jboss-remoting-commits at lists.jboss.org Thu Jan 28 13:49:11 2010
Content-Type: multipart/mixed; boundary="===============1476806016751800913=="
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: r5679 -
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http.
Date: Thu, 28 Jan 2010 13:49:11 -0500
Message-ID: <201001281849.o0SInBJc031410@svn01.web.mwc.hst.phx2.redhat.com>
--===============1476806016751800913==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: rachmatowicz(a)jboss.com
Date: 2010-01-28 13:49:11 -0500 (Thu, 28 Jan 2010)
New Revision: 5679
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http/=
HTTPInvokerClientTestCase_deleted.java
Log:
Remove org.jboss.remoting.transport.http.HttpInvokerClientTestCase.java fro=
m the testsuite runs, as was done for Branch 2.x (JBREM-1182)
Copied: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/=
http/HTTPInvokerClientTestCase_deleted.java (from rev 5659, remoting2/branc=
hes/2.2/src/tests/org/jboss/test/remoting/transport/http/HTTPInvokerClientT=
estCase.java)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http=
/HTTPInvokerClientTestCase_deleted.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/http=
/HTTPInvokerClientTestCase_deleted.java 2010-01-28 18:49:11 UTC (rev 5679)
@@ -0,0 +1,259 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.test.remoting.transport.http;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Level;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Test case that uses the HTTPInvoker client to call on two different pub=
lic SOAP services (one based
+ * on Axis and the other based on .NET implementations).
+ *
+ * @author Tom Elrod
+ */
+public class HTTPInvokerClientTestCase extends TestCase
+{
+ private Client client;
+
+ public void init(String httpTargetURL)
+ {
+ try
+ {
+ InvokerLocator locator =3D new InvokerLocator(httpTargetURL);
+ Map config =3D new HashMap();
+ config.put(Client.ENABLE_LEASE, "false");
+ client =3D new Client(locator, config);
+ client.connect();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public String makeInvocationCall(String httpTargetURL, String payload, =
Map metadata) throws Throwable
+ {
+ init(httpTargetURL);
+ Object obj =3D client.invoke(payload, metadata);
+
+ System.out.println("invoke returned" + obj);
+
+ return (String) obj;
+ }
+
+ /* *** commented out because external site no longer available ***
+ public void testWeatherHTTPInvocation() throws Throwable
+ {
+
+ org.apache.log4j.BasicConfigurator.configure();
+ org.apache.log4j.Category.getRoot().setLevel(Level.INFO);
+ org.apache.log4j.Category.getInstance("org.jgroups").setLevel(Level.=
INFO);
+ org.apache.log4j.Category.getInstance("org.jboss.remoting").setLevel=
(Level.DEBUG);
+ org.apache.log4j.Category.getInstance("test").setLevel(Level.DEBUG);
+
+
+ String testURL =3D "http://services.xmethods.net:80/soap/servlet/rpc=
router";
+
+ String xml =3D "\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ " 30106\n" +
+ " \n" +
+ " \n" +
+ "";
+
+ Map metadata =3D new HashMap();
+ metadata.put(Client.RAW, Boolean.TRUE);
+ metadata.put("TYPE", "POST");
+
+ // proxy info
+ //metadata.put("http.proxyHost", "ginger");
+ //metadata.put("http.proxyPort", "80");
+ //metadata.put("http.proxy.username", "tom");
+ //metadata.put("http.proxy.password", "foobar");
+
+ Properties headerProps =3D new Properties();
+ headerProps.put("SOAPAction", "");
+ headerProps.put("Content-type", "text/xml; charset=3DUTF-8");
+
+ metadata.put("HEADER", headerProps);
+
+
+ HTTPInvokerClientTestCase client =3D new HTTPInvokerClientTestCase();
+
+ String result =3D client.makeInvocationCall(testURL, xml, metadata);
+ // don't need to comapre full string. (as actual temp value will cha=
nge each time run)
+ assertEquals(getExpectedWeatherResult().substring(0, 380), result.su=
bstring(0, 380));
+
+ }
+ */
+
+ public void testCitiesByCountryHTTPInvocation() throws Throwable
+ {
+
+ org.apache.log4j.BasicConfigurator.configure();
+ org.apache.log4j.Category.getRoot().setLevel(Level.INFO);
+ org.apache.log4j.Category.getInstance("org.jgroups").setLevel(Level.=
INFO);
+ org.apache.log4j.Category.getInstance("org.jboss.remoting").setLevel=
(Level.DEBUG);
+ org.apache.log4j.Category.getInstance("test").setLevel(Level.DEBUG);
+
+
+ String testURL =3D "http://www.webserviceX.NET/globalweather.asmx?op=
=3DGetCitiesByCountry";
+
+ String xml =3D "\n" +
+ "\n" +
+ " \n" +
+ " \n" +
+ " Germany\n" +
+ " \n" +
+ " \n" +
+ "";
+
+ Map metadata =3D new HashMap();
+ metadata.put(Client.RAW, Boolean.TRUE);
+ metadata.put("TYPE", "POST");
+
+ // proxy info
+ //metadata.put("http.proxyHost", "ginger");
+ //metadata.put("http.proxyPort", "80");
+ //metadata.put("http.proxy.username", "tom");
+ //metadata.put("http.proxy.password", "foobar");
+
+ Properties headerProps =3D new Properties();
+ headerProps.put("SOAPAction", "http://www.webserviceX.NET/GetCitiesB=
yCountry");
+ headerProps.put("Content-type", "text/xml; charset=3DUTF-8");
+
+ metadata.put("HEADER", headerProps);
+
+
+ HTTPInvokerClientTestCase client =3D new HTTPInvokerClientTestCase();
+
+ String result =3D client.makeInvocationCall(testURL, xml, metadata);
+ // 30 characters will be good enough.
+ assertEquals(getExpectedCityResult().substring(0, 200), result.subst=
ring(0, 200));
+
+ }
+
+
+// public void testGETHTTPInvocation() throws Throwable
+// {
+//
+// org.apache.log4j.BasicConfigurator.configure();
+// org.apache.log4j.Category.getRoot().setLevel(Level.INFO);
+// org.apache.log4j.Category.getInstance("org.jgroups").setLevel(Leve=
l.INFO);
+// org.apache.log4j.Category.getInstance("org.jboss.remoting").setLev=
el(Level.DEBUG);
+// org.apache.log4j.Category.getInstance("test").setLevel(Level.DEBUG=
);
+//
+//
+// String testURL =3D "http://www.gnu.org/licenses/gpl.html";
+//
+// Map metadata =3D new HashMap();
+// metadata.put(Client.RAW, Boolean.TRUE);
+// metadata.put("TYPE", "GET");
+//
+// HTTPInvokerClientTestCase client =3D new HTTPInvokerClientTestCase=
();
+//
+// String result =3D client.makeInvocationCall(testURL, null, metadat=
a);
+// // 30 characters will be good enough.
+// assertEquals(getExpectedGETResult().substring(0, 100), result.subs=
tring(0, 100));
+//
+// }
+
+ private String getExpectedGETResult()
+ {
+ return "GNU General Public License - " +
+ "GNU Project - Free Software Foundation (FSF)" +
+ "" +
+ "GNU General Public License
" +
+ "" +
+ "[ " +
+ "Czech| English| Japane=
se]" +
+ "" +
+ "