portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r722429 - in /portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src: main/java/org/apache/jetspeed/cache/impl/EhPortletWindowCache.java test/java/org/apache/jetspeed/cache/TestPortletWindowCache.java
Date Tue, 02 Dec 2008 11:22:28 GMT
Author: woonsan
Date: Tue Dec  2 03:22:27 2008
New Revision: 722429

URL: http://svn.apache.org/viewvc?rev=722429&view=rev
Log:
fixed test cases for portlet window/entity cache.

Modified:
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhPortletWindowCache.java
    portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestPortletWindowCache.java

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhPortletWindowCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhPortletWindowCache.java?rev=722429&r1=722428&r2=722429&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhPortletWindowCache.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/main/java/org/apache/jetspeed/cache/impl/EhPortletWindowCache.java
Tue Dec  2 03:22:27 2008
@@ -92,8 +92,8 @@
 	public void putPortletWindow(PortletWindow window)
 	{
 	    assert window != null;
-		String windowId = window.getId().toString();
-		portletEntityIdToEntityid.put(window.getPortletEntity().getId().toString(), windowId);
+		String windowId = window.getId().getStringId();
+		portletEntityIdToEntityid.put(window.getPortletEntity().getId(), windowId);
 		put(createElement(windowId, window));
 	}
 	
@@ -106,7 +106,7 @@
 		PortletWindow window = getPortletWindow(portletWindowId);
 		if(window != null)
 		{			
-			portletEntityIdToEntityid.remove(window.getPortletEntity().getId().toString());
+			portletEntityIdToEntityid.remove(window.getPortletEntity().getId());
 			removeQuiet(portletWindowId);
 		}		
 	}
@@ -118,7 +118,7 @@
 		if(portletWindow != null)
 		{
 		    portletEntityIdToEntityid.remove(portletEntityId);
-            removeQuiet(portletWindow.getId().toString());
+            removeQuiet(portletWindow.getId().getStringId());
 		}
 	}
 	

Modified: portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestPortletWindowCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestPortletWindowCache.java?rev=722429&r1=722428&r2=722429&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestPortletWindowCache.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-871-pluto-2.0-upgrade/components/jetspeed-cm/src/test/java/org/apache/jetspeed/cache/TestPortletWindowCache.java
Tue Dec  2 03:22:27 2008
@@ -28,7 +28,7 @@
 import org.apache.jetspeed.cache.impl.EhPortletWindowCache;
 import org.apache.jetspeed.container.PortletEntity;
 import org.apache.jetspeed.container.PortletWindow;
-import org.apache.pluto.PortletWindowID;
+import org.apache.jetspeed.container.PortletWindowID;
 import org.jmock.Mock;
 import org.jmock.cglib.MockObjectTestCase;
 import org.jmock.core.stub.VoidStub;
@@ -52,7 +52,6 @@
     private Mock windowMock;
     private Mock entityMock;
     private Mock oidMock;
-    private Mock entityOidMock;
     
     protected void setUp() throws Exception
     {
@@ -61,7 +60,6 @@
         windowMock = mock(SerializablePortletWindow.class);
         entityMock = mock(PortletEntity.class);
         oidMock = mock(PortletWindowID.class);
-        entityOidMock = (Mock) mock(PortletWindowID.class);
     }    
 
     public void testSimplePutAndGet()
@@ -70,12 +68,10 @@
         PortletWindow window = (PortletWindow) windowMock.proxy();
         Element element = new Element(WINDOW_ID, window);
         PortletWindowID wid = (PortletWindowID) oidMock.proxy();
-        ObjectID entityOid = (ObjectID) entityOidMock.proxy();
-        entityOidMock.expects(atLeastOnce()).method("toString").will(returnValue(ENTITY_ID));
-        oidMock.expects(atLeastOnce()).method("toString").will(returnValue(WINDOW_ID));
-        windowMock.expects(once()).method("getId").withNoArguments().will(returnValue(oid));
+        oidMock.expects(atLeastOnce()).method("getStringId").will(returnValue(WINDOW_ID));
+        windowMock.expects(once()).method("getId").withNoArguments().will(returnValue(wid));
         windowMock.expects(once()).method("getPortletEntity").withNoArguments().will(returnValue(entityMock.proxy()));
-        entityMock.expects(once()).method("getId").withNoArguments().will(returnValue(entityOid));
+        entityMock.expects(once()).method("getId").withNoArguments().will(returnValue(ENTITY_ID));
         cacheMock.expects(once()).method("put").with(eq(element));
         cacheMock.expects(atLeastOnce()).method("get").with(eq(WINDOW_ID)).will(returnValue(element));
         
@@ -96,15 +92,13 @@
         SerializablePortletWindow window = (SerializablePortletWindow) windowMock.proxy();
         Element element = new Element(WINDOW_ID, window);
         
-        ObjectID oid = (ObjectID) oidMock.proxy();
-        oidMock.expects(atLeastOnce()).method("toString").will(returnValue(WINDOW_ID));
-        ObjectID entityOid = (ObjectID) entityOidMock.proxy();
-        entityOidMock.expects(atLeastOnce()).method("toString").will(returnValue(ENTITY_ID));
+        PortletWindowID oid = (PortletWindowID) oidMock.proxy();
+        oidMock.expects(atLeastOnce()).method("getStringId").will(returnValue(WINDOW_ID));
         cacheMock.expects(once()).method("put").with(eq(element));
         cacheMock.expects(once()).method("get").with(eq(WINDOW_ID)).will(returnValue(element));
         windowMock.expects(once()).method("getId").withNoArguments().will(returnValue(oid));
         windowMock.expects(once()).method("getPortletEntity").withNoArguments().will(returnValue(entityMock.proxy()));
-        entityMock.expects(once()).method("getId").withNoArguments().will(returnValue(entityOid));
+        entityMock.expects(once()).method("getId").withNoArguments().will(returnValue(ENTITY_ID));
         
         Ehcache cache = (Ehcache) cacheMock.proxy();        
         PortletWindowCache windowCache = new EhPortletWindowCache(cache);  
@@ -121,17 +115,14 @@
         SerializablePortletWindow window = (SerializablePortletWindow) windowMock.proxy();
         Element element = new Element(WINDOW_ID, window);
         
-        ObjectID oid = (ObjectID) oidMock.proxy();
-        oidMock.expects(atLeastOnce()).method("toString").will(returnValue(WINDOW_ID));
-        
-        ObjectID entityOid = (ObjectID)entityOidMock.proxy();
-        entityOidMock.expects(atLeastOnce()).method("toString").will(returnValue(ENTITY_ID));
+        PortletWindowID oid = (PortletWindowID) oidMock.proxy();
+        oidMock.expects(atLeastOnce()).method("getStringId").will(returnValue(WINDOW_ID));
         
         cacheMock.expects(once()).method("put").with(eq(element));
         cacheMock.expects(exactly(2)).method("get").with(eq(WINDOW_ID)).will(returnValue(element));
         windowMock.expects(once()).method("getId").withNoArguments().will(returnValue(oid));
         windowMock.expects(exactly(2)).method("getPortletEntity").withNoArguments().will(returnValue(entityMock.proxy()));
-        entityMock.expects(exactly(2)).method("getId").withNoArguments().will(returnValue(entityOid));
+        entityMock.expects(exactly(2)).method("getId").withNoArguments().will(returnValue(ENTITY_ID));
         
         
         cacheMock.expects(once()).method("removeQuiet").with(eq(WINDOW_ID)).will(returnValue(true));
@@ -152,17 +143,14 @@
         SerializablePortletWindow window = (SerializablePortletWindow) windowMock.proxy();
         Element element = new Element(WINDOW_ID, window);
         
-        ObjectID oid = (ObjectID) oidMock.proxy();
-        oidMock.expects(atLeastOnce()).method("toString").will(returnValue(WINDOW_ID));
-        
-        ObjectID entityOid = (ObjectID) entityOidMock.proxy();
-        entityOidMock.expects(atLeastOnce()).method("toString").will(returnValue(ENTITY_ID));
+        PortletWindowID oid = (PortletWindowID) oidMock.proxy();
+        oidMock.expects(atLeastOnce()).method("getStringId").will(returnValue(WINDOW_ID));
         
         cacheMock.expects(once()).method("put").with(eq(element));
         cacheMock.expects(exactly(3)).method("get").with(eq(WINDOW_ID)).will(onConsecutiveCalls(returnValue(element),
returnValue(element), new VoidStub()));
         windowMock.expects(exactly(2)).method("getId").withNoArguments().will(returnValue(oid));
         windowMock.expects(once()).method("getPortletEntity").withNoArguments().will(returnValue(entityMock.proxy()));
-        entityMock.expects(once()).method("getId").withNoArguments().will(returnValue(entityOid));
+        entityMock.expects(once()).method("getId").withNoArguments().will(returnValue(ENTITY_ID));
         
         
         cacheMock.expects(atLeastOnce()).method("removeQuiet").with(eq(WINDOW_ID)).will(returnValue(true));



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message