Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F23F610511 for ; Wed, 10 Jul 2013 09:33:29 +0000 (UTC) Received: (qmail 96666 invoked by uid 500); 10 Jul 2013 09:33:29 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 96542 invoked by uid 500); 10 Jul 2013 09:33:28 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 96527 invoked by uid 99); 10 Jul 2013 09:33:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jul 2013 09:33:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jul 2013 09:33:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5960423888D7; Wed, 10 Jul 2013 09:32:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1501692 - in /cxf/branches/2.5.x-fixes: ./ systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java systests/transports/src/test/java/org/apache/cxf/systest/http/GreeterSessionImpl.java Date: Wed, 10 Jul 2013 09:32:54 -0000 To: commits@cxf.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130710093254.5960423888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ffang Date: Wed Jul 10 09:32:53 2013 New Revision: 1501692 URL: http://svn.apache.org/r1501692 Log: Merged revisions 1501681 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes ................ r1501681 | ffang | 2013-07-10 17:07:09 +0800 (三, 10 7 2013) | 16 lines Merged revisions 1501674 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ................ r1501674 | ffang | 2013-07-10 16:45:44 +0800 (三, 10 7 2013) | 9 lines Merged revisions 1501640 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1501640 | ffang | 2013-07-10 11:42:06 +0800 (三, 10 7 2013) | 1 line [CXF-5114]a testcase to demonstrate how to use session with Oneway invocation ........ ................ ................ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/GreeterSessionImpl.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/branches/2.7.x-fixes:r1501674 Merged /cxf/branches/2.6.x-fixes:r1501681 Merged /cxf/trunk:r1501640 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java?rev=1501692&r1=1501691&r2=1501692&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java Wed Jul 10 09:32:53 2013 @@ -33,6 +33,7 @@ import org.apache.cxf.greeter_control.Gr import org.apache.cxf.greeter_control.GreeterService; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; + import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; @@ -84,7 +85,8 @@ public class ClientServerSessionTest ext assertEquals("Hello Bonjour", greeting); assertTrue(cookie.contains("a=a")); assertTrue(cookie.contains("b=b")); - + + greeting = greeter.greetMe("Hello"); cookie = ""; if (greeting.indexOf(';') != -1) { @@ -213,6 +215,31 @@ public class ClientServerSessionTest ext assertEquals("Bonjour World", greeter.sayHi()); } + @Test + public void testOnewayInvocationWithSession() throws Exception { + + GreeterService service = new GreeterService(); + assertNotNull(service); + + try { + Greeter greeter = service.getGreeterPort(); + + BindingProvider bp = (BindingProvider)greeter; + updateAddressPort(bp, PORT); + bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true); + + greeter.greetMeOneWay("Bonjour"); + + String greeting = greeter.greetMe("Hello"); + + assertNotNull("no response received from service", greeting); + assertEquals("Hello Bonjour", greeting); + + } catch (UndeclaredThrowableException ex) { + throw (Exception)ex.getCause(); + } + } + private void doSessionsTest(String url) { GreeterService service = new GreeterService(); assertNotNull(service); Modified: cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/GreeterSessionImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/GreeterSessionImpl.java?rev=1501692&r1=1501691&r2=1501692&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/GreeterSessionImpl.java (original) +++ cxf/branches/2.5.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/GreeterSessionImpl.java Wed Jul 10 09:32:53 2013 @@ -67,6 +67,7 @@ public class GreeterSessionImpl implemen } } + HttpSession session = req.getSession(); // Get a session property "counter" from context if (session == null) { @@ -106,9 +107,24 @@ public class GreeterSessionImpl implemen } - public void greetMeOneWay(String requestType) { - // TODO Auto-generated method stub + public void greetMeOneWay(String me) { + LOG.info("Executing operation greetMeOneWay"); + LOG.info("Message received: " + me); + MessageContext mc = context.getMessageContext(); + HttpServletRequest req = (HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST); + HttpSession session = req.getSession(); + if (session == null) { + throw new WebServiceException("No session in WebServiceContext"); + } + String name = (String)session.getAttribute("name"); + if (name == null) { + name = me; + LOG.info("Starting the Session"); + } + + session.setAttribute("name", me); + }