rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlu...@apache.org
Subject svn commit: r1297178 - in /incubator/rave/trunk/rave-components/rave-core/src: main/java/org/apache/rave/portal/model/Page.java test/java/org/apache/rave/portal/repository/impl/JpaPageRepositoryTest.java
Date Mon, 05 Mar 2012 19:07:24 GMT
Author: carlucci
Date: Mon Mar  5 19:07:24 2012
New Revision: 1297178

URL: http://svn.apache.org/viewvc?rev=1297178&view=rev
Log:
RAVE-504: Sub Pages are not in correct render order
- added proper @OrderBy annotation to the list and added a unit test for this case

Modified:
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Page.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaPageRepositoryTest.java

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Page.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Page.java?rev=1297178&r1=1297177&r2=1297178&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Page.java
(original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Page.java
Mon Mar  5 19:07:24 2012
@@ -78,6 +78,7 @@ public class Page implements BasicEntity
     private Page parentPage;
 
     @OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL, mappedBy="parentPage")
+    @OrderBy("renderSequence")
     private List<Page> subPages;
 
     @Basic(optional=false) @Column(name="render_sequence")

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaPageRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaPageRepositoryTest.java?rev=1297178&r1=1297177&r2=1297178&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaPageRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/repository/impl/JpaPageRepositoryTest.java
Mon Mar  5 19:07:24 2012
@@ -164,6 +164,15 @@ public class JpaPageRepositoryTest {
         assertThat(p.getPageType(), is(PageType.PERSON_PROFILE));
         assertThat(p.getParentPage(), is(nullValue(Page.class)));
         assertThat(p.getSubPages().isEmpty(), is(false));
+
+        // verify that the sub pages are in proper order
+        Long lastRenderSequence = -1L;
+        for (Page subPage : p.getSubPages()) {
+            Long currentRenderSequence = subPage.getRenderSequence();
+            assertThat(currentRenderSequence > lastRenderSequence, is(true));
+            lastRenderSequence = currentRenderSequence;
+        }
+        
     }
 
     @Test



Mime
View raw message