Author: chris.laprun(a)jboss.com
Date: 2010-11-03 20:13:05 -0400 (Wed, 03 Nov 2010)
New Revision: 4928
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProvider.java
portal/trunk/component/wsrp/src/test/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProviderTestCase.java
Log:
- Updated tests: not sure why I thought they were passing when I last committed... :(
+ Do not test the existence of windows anymore since it's only testing the mock in
testPageDeletionEvent.
+ Fixed wrong assumption: currently, when a page is deleted, its subpages are not, which
is weird.
+ Trying to get a list of children windows for an inexistent page should really fail.
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProvider.java
===================================================================
---
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProvider.java 2010-11-03
21:47:13 UTC (rev 4927)
+++
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProvider.java 2010-11-04
00:13:05 UTC (rev 4928)
@@ -106,7 +106,10 @@
public List<String> getWindowIdentifiersFor(String pageId)
{
PageInfo pageInfo = pageInfos.get(pageId);
- ParameterValidation.throwIllegalArgExceptionIfNull(pageInfo, "PageInfo for
" + pageId);
+ if (pageInfo == null)
+ {
+ throw new IllegalArgumentException("Page '" + pageId + "'
does not exist.");
+ }
return pageInfo.getChildrenWindows();
}
Modified:
portal/trunk/component/wsrp/src/test/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProviderTestCase.java
===================================================================
---
portal/trunk/component/wsrp/src/test/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProviderTestCase.java 2010-11-03
21:47:13 UTC (rev 4927)
+++
portal/trunk/component/wsrp/src/test/java/org/gatein/portal/wsrp/structure/MOPConsumerStructureProviderTestCase.java 2010-11-04
00:13:05 UTC (rev 4928)
@@ -66,8 +66,15 @@
public void testGetWindowIdentifiersForInexistingPage()
{
- List<String> windows =
provider.getWindowIdentifiersFor("inexisting");
- assertTrue(windows.isEmpty());
+ try
+ {
+ provider.getWindowIdentifiersFor("inexisting");
+ fail("Cannot retrieve windows for an inexistent page");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
}
public void testGetWindowIdentifiersFor()
@@ -133,16 +140,11 @@
provider.onEvent(new Event<DataStorage,
org.exoplatform.portal.config.model.Page>(DataStorage.PAGE_REMOVED, null,
portalPage));
List<String> identifiers = provider.getPageIdentifiers();
- assertEquals(pageNumber - 3, identifiers.size());
+ assertEquals(pageNumber - 1, identifiers.size());
+ // deleting a page doesn't delete its children, see GTNPORTAL-1630
assertFalse(identifiers.contains("page1"));
- assertFalse(identifiers.contains("page11"));
- assertFalse(identifiers.contains("page12"));
-
- assertNull(structureAccess.getWindowFrom(getIdFor("window11")));
- assertNull(structureAccess.getWindowFrom(getIdFor("window12")));
- assertNull(structureAccess.getWindowFrom(getIdFor("window111")));
- assertNull(structureAccess.getWindowFrom(getIdFor("window112")));
- assertNull(structureAccess.getWindowFrom(getIdFor("window121")));
+ assertTrue(identifiers.contains("page11"));
+ assertTrue(identifiers.contains("page12"));
}
public void testPageUpdatedEvent() throws Exception
Show replies by date