[jboss-cvs] JBossAS SVN: r97689 - in projects/snowdrop/examples/trunk/sportsclub: sportsclub-reservations-web/src/main/webapp and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 10 05:24:15 EST 2009


Author: lvlcek at redhat.com
Date: 2009-12-10 05:24:14 -0500 (Thu, 10 Dec 2009)
New Revision: 97689

Modified:
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-hibernate-dao/src/test/java/org/jboss/snowdrop/samples/stayfit/dao/hibernate/TestHibernateReservationRepository.java
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml
   projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml
Log:
JSF converter now managed by Spring

Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-hibernate-dao/src/test/java/org/jboss/snowdrop/samples/stayfit/dao/hibernate/TestHibernateReservationRepository.java
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-hibernate-dao/src/test/java/org/jboss/snowdrop/samples/stayfit/dao/hibernate/TestHibernateReservationRepository.java	2009-12-10 10:12:48 UTC (rev 97688)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-hibernate-dao/src/test/java/org/jboss/snowdrop/samples/stayfit/dao/hibernate/TestHibernateReservationRepository.java	2009-12-10 10:24:14 UTC (rev 97689)
@@ -14,8 +14,6 @@
 
 import java.util.*;
 
-/**
- */
 @ContextConfiguration(locations = {"classpath:test-infrastructure.xml", "classpath:dao-context.xml"})
 @RunWith(SpringJUnit4ClassRunner.class)
 public class TestHibernateReservationRepository
@@ -25,11 +23,11 @@
 
    @Test
    @Transactional
-   public void testReservationRepository()
+   public void testFromToFilterCriteria()
    {
 
-      Date from = getDate(2009,1,1);
-      Date to = getDate(2009,12,31);
+      Date from = getDate(2009, 1, 1);
+      Date to = getDate(2009, 12, 31);
 
       ReservationSearchCriteria criteria = new ReservationSearchCriteria();
       criteria.setFromDate(from);
@@ -39,35 +37,42 @@
       Assert.assertEquals(6, reservations.size());
 
       criteria = new ReservationSearchCriteria();
-      criteria.setFromDate(getDate(2009,02,01));
+      criteria.setFromDate(getDate(2009, 02, 01));
 
       reservations = reservationRepository.getByCriteria(criteria);
       Assert.assertEquals(5, reservations.size());
 
       criteria = new ReservationSearchCriteria();
-      criteria.setToDate(getDate(2009,11,30));
+      criteria.setToDate(getDate(2009, 11, 30));
 
       reservations = reservationRepository.getByCriteria(criteria);
       Assert.assertEquals(5, reservations.size());
+   }
 
-      
+   @Test
+   @Transactional
+   public void testEquipmentTypeFilterCriteria()
+   {
+      Date from = getDate(2009, 1, 1);
+      Date to = getDate(2009, 12, 31);
+
       List<EquipmentType> types = new ArrayList<EquipmentType>();
       types.add(EquipmentType.COURT);
-      criteria = new ReservationSearchCriteria();
+      ReservationSearchCriteria criteria = new ReservationSearchCriteria();
       criteria.setFromDate(from);
       criteria.setToDate(to);
       criteria.setEquipmentType(types);
 
-      reservations = reservationRepository.getByCriteria(criteria);
+      List<Reservation> reservations = reservationRepository.getByCriteria(criteria);
+
       Assert.assertEquals(1, reservations.size());
-      
    }
 
    private Date getDate(int year, int month, int day)
    {
       Calendar cal = Calendar.getInstance(Locale.US);
       cal.clear();
-      cal.set(year, month-1, day);
+      cal.set(year, month - 1, day);
       return cal.getTime();
    }
 }

Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml	2009-12-10 10:12:48 UTC (rev 97688)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/WEB-INF/spring-beans.xml	2009-12-10 10:24:14 UTC (rev 97689)
@@ -21,7 +21,8 @@
         <property name="equipmentService" ref="equipmentService"/>
     </bean>
 
-    <!--bean id="equipmentTypeConverter" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.EquipmentTypeConverter"/-->
+    <!-- JSF Converters managed by Spring -->
+    <bean id="equipmentTypeConverter" class="org.jboss.snowdrop.samples.sportsclub.jsf.beans.EquipmentTypeConverter"/>
     
     <context:annotation-config/>
     

Modified: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml	2009-12-10 10:12:48 UTC (rev 97688)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/webapp/reservationSearch.xhtml	2009-12-10 10:24:14 UTC (rev 97689)
@@ -16,13 +16,14 @@
                 to:
                 <rich:calendar value="#{reservationSearch.toDate}"/>
                 <h:commandButton id="submit" value="Display Reservations"
-                                 action="#{reservationSearch.searchReservations}" /> <!-- reRender="searchResults"-->
+                                 action="#{reservationSearch.searchReservations}"/> <!-- reRender="searchResults"-->
                 <br/>
                 Equipment Type:
-                <h:selectManyCheckbox id="equipmentTypes" value="#{reservationSearch.selectedEquipmentTypes}" layout="lineDirection"><!--converter="equipmentTypeConverter"-->
+                <h:selectManyCheckbox id="equipmentTypes" value="#{reservationSearch.selectedEquipmentTypes}"
+                                      layout="lineDirection" converter="#{equipmentTypeConverter}">
                     <f:selectItems value="#{referenceData.equipmentTypes}"/>
-                    <f:converter  converterId="equipmentTypeConverter" />
-                    <a4j:support event="onchange" action="#{reservationSearch.equipmentTypeCheckboxChanged}" reRender="searchResults"/>                    
+                    <a4j:support event="onchange" action="#{reservationSearch.equipmentTypeCheckboxChanged}"
+                                 reRender="searchResults"/>
                 </h:selectManyCheckbox>
 
             </h:form>
@@ -76,7 +77,7 @@
 
                         <f:facet name="footer">
                             <rich:datascroller id="scroller" for="searchResultsTable" maxPages="5"
-                                               page="#{reservationSearch.currentPage}" />
+                                               page="#{reservationSearch.currentPage}"/>
                         </f:facet>
 
                     </rich:dataTable>




More information about the jboss-cvs-commits mailing list