[gatein-commits] gatein SVN: r5506 - in components/wsrp/trunk/common/src: test/java/org/gatein/wsrp/other and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 8 08:49:57 EST 2010


Author: chris.laprun at jboss.com
Date: 2010-12-08 08:49:57 -0500 (Wed, 08 Dec 2010)
New Revision: 5506

Modified:
   components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
   components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
Log:
- GTNWSRP-188: Should now prefer operation when we have a proper resource id.

Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java	2010-12-08 13:32:24 UTC (rev 5505)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java	2010-12-08 13:49:57 UTC (rev 5506)
@@ -68,6 +68,11 @@
          // if the container didn't provide us with a resource id, fake one so that we can still build a correct WSRP URL.
          resourceId = DEFAULT_RESOURCE_ID;
       }
+      else
+      {
+         // request operation if we have a proper resource id
+         preferOperation = true;
+      }
 
       if (context != null && !URLContext.EMPTY.equals(context))
       {

Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java	2010-12-08 13:32:24 UTC (rev 5505)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java	2010-12-08 13:49:57 UTC (rev 5506)
@@ -193,6 +193,17 @@
       assertEquals("true", preferOperation);
    }
 
+   public void testShouldSetPreferOperationToTrueWhenResourceIdIsPresent()
+   {
+      ResourceURL resourceURL = new TestResourceURL(TestResourceURL.RESID, TestResourceURL.DEFAULT_NS, CacheLevel.FULL);
+      WSRPPortletURL url = WSRPPortletURL.create(resourceURL, false, WSRPPortletURL.URLContext.EMPTY);
+
+      String actual = url.toString();
+      assertTrue(actual.contains("wsrp-urlType=resource"));
+      assertTrue(actual.contains("wsrp-resourceID=" + TestResourceURL.RESID));
+      assertTrue(actual.contains("wsrp-preferOperation=true"));
+   }
+
    public void testShouldProperlyTransmitResourceState()
    {
       // create URL from container



More information about the gatein-commits mailing list