From jboss-remoting-commits at lists.jboss.org Tue Feb 16 11:46:39 2010
Content-Type: multipart/mixed; boundary="===============3441572880679739946=="
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: r5697 -
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/http/metadata.
Date: Tue, 16 Feb 2010 11:46:39 -0500
Message-ID: <201002161646.o1GGkdhk024258@svn01.web.mwc.hst.phx2.redhat.com>
--===============3441572880679739946==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: ron.sigal(a)jboss.com
Date: 2010-02-16 11:46:39 -0500 (Tue, 16 Feb 2010)
New Revision: 5697
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/http/m=
etadata/HTTPUnMarshallerMetadataTestCase_Retired.java
Log:
JBREM-1182: Retired this test - it was retired on the 2.x branch under JBRE=
M-930.
Copied: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/h=
ttp/metadata/HTTPUnMarshallerMetadataTestCase_Retired.java (from rev 4674, =
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/http/meta=
data/HTTPUnMarshallerMetadataTestCase.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/marshall/http/=
metadata/HTTPUnMarshallerMetadataTestCase_Retired.java =
(rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/marshall/http/=
metadata/HTTPUnMarshallerMetadataTestCase_Retired.java 2010-02-16 16:46:39 =
UTC (rev 5697)
@@ -0,0 +1,134 @@
+/*
+* 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.marshall.http.metadata;
+
+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.List;
+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 HTTPUnMarshallerMetadataTestCase_Retired extends TestCase
+{
+ private Client client;
+
+ public void init(String httpTargetURL, HTTPUnMarshallerMock unmarshalle=
r)
+ {
+ try
+ {
+ InvokerLocator locator =3D new InvokerLocator(httpTargetURL);
+ client =3D new Client(locator);
+ client.connect();
+ client.setUnMarshaller(unmarshaller);
+ client.connect();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public String makeInvocationCall(String httpTargetURL, String payload, =
Map metadata, HTTPUnMarshallerMock unmarshaller) throws Throwable
+ {
+ init(httpTargetURL, unmarshaller);
+
+ Object obj =3D client.invoke(payload, metadata);
+
+ System.out.println("invoke returned" + obj);
+
+ return (String) obj;
+ }
+
+ 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");
+
+ Properties headerProps =3D new Properties();
+ headerProps.put("SOAPAction", "");
+ headerProps.put("Content-type", "text/xml; charset=3DUTF-8");
+
+ metadata.put("HEADER", headerProps);
+
+
+ HTTPUnMarshallerMetadataTestCase_Retired client =3D new HTTPUnMarsha=
llerMetadataTestCase_Retired();
+
+ HTTPUnMarshallerMock unmarshaller =3D new HTTPUnMarshallerMock();
+
+ String result =3D client.makeInvocationCall(testURL, xml, metadata, =
unmarshaller);
+
+ // expect to get the following header
+ assertNotNull(unmarshaller.getMetadata());
+ List header =3D (List) unmarshaller.getMetadata().get("Status");
+ assertEquals("200", header.get(0));
+
+ // 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));
+
+ }
+
+ private String getExpectedWeatherResult()
+ {
+ return "" +
+ "" +
+ "" +
+ "" +
+ "60.0" +
+ "" +
+ "\n" +
+ "\n" +
+ "";
+ }
+
+
+}
\ No newline at end of file
--===============3441572880679739946==--