portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Dam <d....@hippo.nl>
Subject Re: Failing test cases in in components/portal
Date Fri, 02 Nov 2007 14:42:34 GMT
Hey Scott/ Ate,

I also managed to fix the other two tests, TestLayout and 
TestPortletPlacement. I ran a full Jetspeed test, successfully!

A few notes on my changes:

TestLayout:

* One test failed because a test tried to move a root fragment to the 
right. There was a change in the implementation of MovePortletAction 
that now returns a "failure" when you try to move a root fragment. This 
is because it cannot find a parent for the root fragment (see 
BasePortletAction). Possibly in the past it returned "success", but it 
didn't move the root fragment. I simply disabled the test for now.

* Other tests failed because they were invalid. For example, applying a 
"moveright" action for a fragment which is already in the rightmost 
column, but the test expects the column number to change.  I changed the 
"expected column" number so that it matches the "old column" number, 
which is correct IMO.

* I also changed FragmentUtil (which creates the mock RequestContext), 
so that a non-null Subject is set, to avoid a NPE in  
MovePortletAction.getRoles().

TestPortletPlacement:

* there was a test which checks the number of columns in a page. The 
mock page contained 2 columns (see FragmentUtil), but the test asserts 
with 3 columns. I changed 3 to 2.

Dennis



Here is the patch :

Index: 
components/portal/src/test/org/apache/jetspeed/layout/FragmentUtil.java
===================================================================
--- 
components/portal/src/test/org/apache/jetspeed/layout/FragmentUtil.java    
(revision 591304)
+++ 
components/portal/src/test/org/apache/jetspeed/layout/FragmentUtil.java    
(working copy)
@@ -16,6 +16,8 @@
  */
 package org.apache.jetspeed.layout;
 
+import javax.security.auth.Subject;
+
 import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
@@ -104,7 +106,9 @@
 
         RequestContext a_oRC = new JetspeedRequestContext(request, 
response,
                 config, null);
-
+       
+        a_oRC.setSubject(new Subject());
+       
         Page a_oPage = setupPage();
         ContentPage a_oContentPage = new ContentPageImpl(a_oPage);
 
Index: 
components/portal/src/test/org/apache/jetspeed/layout/TestPortletPlacement.java
===================================================================
--- 
components/portal/src/test/org/apache/jetspeed/layout/TestPortletPlacement.java    
(revision 591304)
+++ 
components/portal/src/test/org/apache/jetspeed/layout/TestPortletPlacement.java    
(working copy)
@@ -41,7 +41,7 @@
         {
             PortletPlacementContext ppc = new 
PortletPlacementContextImpl(requestContext);
             int a_iNumCols = ppc.getNumberColumns();
-            assertEquals(a_iNumCols, 3);
+            assertEquals(a_iNumCols, 2);
 
             int a_iNumRows = ppc.getNumberRows(1);
             assertEquals(a_iNumRows, 2);
Index: components/portal/src/test/org/apache/jetspeed/layout/TestLayout.java
===================================================================
--- 
components/portal/src/test/org/apache/jetspeed/layout/TestLayout.java    
(revision 591304)
+++ 
components/portal/src/test/org/apache/jetspeed/layout/TestLayout.java    
(working copy)
@@ -216,7 +216,8 @@
 
         moveSuccess("moveleft", "1", "1", "0", "0", "0", "0", "0"); // 
Shouldn't
                                                                     // move
-        moveSuccess("moveleft", "6", "0", "0", "0", "0", "0", "0"); // 
Shouldn't
+// Root layout ("6") shouldn't/cannot be moved, so the following test 
doesn't make sense
+//      moveSuccess("moveleft", "6", "0", "0", "0", "0", "0", "0"); // 
Shouldn't
                                                                     // move
         moveSuccess("moveleft", "3", "2", "0", "1", "0", "1", "0"); // 
Straight
                                                                     // 
across
@@ -229,11 +230,11 @@
                                                                         
// across
         moveSuccess("moveright", "2", "1", "1", "2", "1", "2", "1"); // 
Straight
                                                                         
// across
-        moveSuccess("moveright", "3", "2", "0", "3", "0", "3", "0"); // 
Shouldn't
+        moveSuccess("moveright", "3", "2", "0", "3", "0", "2", "0"); // 
Shouldn't
 //                                                                        
// move
-        moveSuccess("moveright", "4", "2", "1", "3", "0", "3", "0"); // 
Shouldn't
+        moveSuccess("moveright", "4", "2", "1", "3", "0", "2", "1"); // 
Shouldn't
                                                                         
// move
-        moveSuccess("moveright", "5", "2", "2", "3", "0", "3", "0"); // 
Shouldn't
+        moveSuccess("moveright", "5", "2", "2", "3", "0", "2", "2"); // 
Shouldn't
                                                                         
// move
 
         moveSuccess("moveup", "2", "1", "1", "1", "0", "1", "0"); // 
Straight
@@ -287,7 +288,6 @@
             }
 
             valve.invoke(rc, null);
-
             // Take a look at the response to verify a failiure
             TestLayout.assertTrue("couldn't find value", 
FragmentUtil.findValue(rc,
                     "success"));





---------------------------------------------------------------------
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