[seam-commits] Seam SVN: r8411 - in branches/Seam_1_2_1_AP/examples/icefaces: src/org/jboss/seam/example/booking and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Jun 24 12:28:14 EDT 2008


Author: manaRH
Date: 2008-06-24 12:28:14 -0400 (Tue, 24 Jun 2008)
New Revision: 8411

Removed:
   branches/Seam_1_2_1_AP/examples/icefaces/resources/WEB-INF/navigation.xml
   branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedIn.java
   branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedInInterceptor.java
   branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Login.java
   branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoginAction.java
   branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Logout.java
   branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LogoutAction.java
   branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/test/BookingUnitTest.java
Log:
JBPAPP-801

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/resources/WEB-INF/navigation.xml
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/resources/WEB-INF/navigation.xml	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/resources/WEB-INF/navigation.xml	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE faces-config 
-    PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
-    "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
-    
-<faces-config>
-
-    <navigation-rule>
-        <from-view-id>/home.xhtml</from-view-id>
-        <navigation-case>
-            <from-outcome>main</from-outcome>
-            <to-view-id>/main.xhtml</to-view-id>
-            <redirect/>
-        </navigation-case>
-    </navigation-rule>
-
-    <navigation-rule>
-         <from-view-id>/hotel.xhtml</from-view-id>
-        <navigation-case>
-            <from-outcome>main</from-outcome>
-            <to-view-id>/main.xhtml</to-view-id>
-            <redirect/>
-        </navigation-case>
-    </navigation-rule>
-
-
-    <navigation-rule>
-
-        <navigation-case>
-            <from-outcome>login</from-outcome>
-            <to-view-id>/home.xhtml</to-view-id>
-            <redirect />
-        </navigation-case>
-        
-        <navigation-case>
-            <from-outcome>register</from-outcome>
-            <to-view-id>/register.xhtml</to-view-id>
-            <redirect />
-        </navigation-case>
-
-        <navigation-case>
-            <from-outcome>password</from-outcome>
-            <to-view-id>/password.xhtml</to-view-id>
-            <redirect />
-        </navigation-case>
-
-        <navigation-case>
-            <from-outcome>main</from-outcome>
-            <to-view-id>/main.xhtml</to-view-id>
-            </navigation-case>
-
-        <navigation-case>
-            <from-outcome>hotel</from-outcome>
-            <to-view-id>/hotel.xhtml</to-view-id>
-            <redirect />
-        </navigation-case>
-
-    </navigation-rule>
-
-    <navigation-rule>
-
-        <from-view-id>/hotel.xhtml</from-view-id>
-
-        <navigation-case>
-            <from-outcome>book</from-outcome>
-            <to-view-id>/book.xhtml</to-view-id>
-            <redirect />
-        </navigation-case>
-
-    </navigation-rule>
-
-    <navigation-rule>
-
-        <from-view-id>/book.xhtml</from-view-id>
-
-        <navigation-case>
-            <from-outcome>confirm</from-outcome>
-            <to-view-id>/confirm.xhtml</to-view-id>
-            <redirect />
-        </navigation-case>
-
-    </navigation-rule>
-
-    <navigation-rule>
-
-        <from-view-id>/confirm.xhtml</from-view-id>
-
-        <navigation-case>
-            <from-outcome>confirmed</from-outcome>
-            <to-view-id>/main.xhtml</to-view-id>
-            <redirect/>
-        </navigation-case>
-
-        <navigation-case>
-            <from-outcome>back</from-outcome>
-            <to-view-id>/book.xhtml</to-view-id>
-            <redirect />
-        </navigation-case>
-
-    </navigation-rule>
-    
-</faces-config>

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedIn.java
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedIn.java	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedIn.java	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,17 +0,0 @@
-//$Id$
-package org.jboss.seam.example.booking;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.interceptor.Interceptors;
-
- at Target(TYPE)
- at Retention(RUNTIME)
- at Documented
- at Interceptors(LoggedInInterceptor.class)
-public @interface LoggedIn {}

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedInInterceptor.java
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedInInterceptor.java	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoggedInInterceptor.java	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,61 +0,0 @@
-//$Id$
-package org.jboss.seam.example.booking;
-
-import java.lang.reflect.Method;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.InvocationContext;
-import javax.faces.event.PhaseId;
-
-import org.jboss.seam.annotations.Interceptor;
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.contexts.Lifecycle;
-import org.jboss.seam.interceptors.BijectionInterceptor;
-import org.jboss.seam.interceptors.BusinessProcessInterceptor;
-import org.jboss.seam.interceptors.ConversationInterceptor;
-import org.jboss.seam.interceptors.RemoveInterceptor;
-import org.jboss.seam.interceptors.ValidationInterceptor;
-
- at Interceptor(around={BijectionInterceptor.class, ValidationInterceptor.class, 
-                     ConversationInterceptor.class, BusinessProcessInterceptor.class},
-             within=RemoveInterceptor.class)
-public class LoggedInInterceptor
-{
-
-   @AroundInvoke
-   public Object checkLoggedIn(InvocationContext invocation) throws Exception
-   {
-      boolean isLoggedIn = Contexts.getSessionContext().get("loggedIn")!=null;
-      if ( Lifecycle.getPhaseId()==PhaseId.INVOKE_APPLICATION )
-      {
-         if (isLoggedIn) 
-         {
-            return invocation.proceed();
-         }
-         else 
-         {
-            return "login";
-         }
-      }
-      else
-      {
-         if ( isLoggedIn )
-         {
-            return invocation.proceed();
-         }
-         else
-         {
-            Method method = invocation.getMethod();
-            if ( method.getReturnType().equals(void.class) )
-            {
-               return null;
-            }
-            else
-            {
-               return method.invoke( invocation.getTarget(), invocation.getParameters() );
-            }
-         }
-      }
-   }
-
-}

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Login.java
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Login.java	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Login.java	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,10 +0,0 @@
-//$Id$
-package org.jboss.seam.example.booking;
-
-import javax.ejb.Local;
-
- at Local
-public interface Login
-{
-   public String login();
-}

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoginAction.java
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoginAction.java	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LoginAction.java	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,49 +0,0 @@
-//$Id$
-package org.jboss.seam.example.booking;
-
-import java.util.List;
-
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.core.FacesMessages;
-
- at Stateless
- at Name("login")
-public class LoginAction implements Login
-{
-   
-   @In @Out
-   private User user;
-   
-   @PersistenceContext
-   private EntityManager em;
-
-   public String login()
-   {
-      List<User> results = em.createQuery("select u from User u where u.username=:username and u.password=:password")
-            .setParameter("username", user.getUsername())
-            .setParameter("password", user.getPassword())
-            .getResultList();
-      
-      if ( results.size()==0 )
-      {
-         FacesMessages.instance().add("Invalid login");
-         return "login";
-      }
-      else
-      {
-         user = results.get(0);
-         Contexts.getSessionContext().set("loggedIn", true);
-         FacesMessages.instance().add("Welcome, #{user.name}");
-         return "main";
-      }
-      
-   }
-
-}

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Logout.java
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Logout.java	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/Logout.java	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,10 +0,0 @@
-//$Id$
-package org.jboss.seam.example.booking;
-
-import javax.ejb.Local;
-
- at Local
-public interface Logout
-{
-   public String logout();
-}
\ No newline at end of file

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LogoutAction.java
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LogoutAction.java	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/LogoutAction.java	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,19 +0,0 @@
-//$Id$
-package org.jboss.seam.example.booking;
-
-import javax.ejb.Stateless;
-
-import org.jboss.seam.Seam;
-import org.jboss.seam.annotations.Name;
-
- at Stateless
- at LoggedIn
- at Name("logout")
-public class LogoutAction implements Logout
-{
-   public String logout()
-   {
-      Seam.invalidateSession();
-      return "login";
-   }
-}

Deleted: branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/test/BookingUnitTest.java
===================================================================
--- branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/test/BookingUnitTest.java	2008-06-24 16:20:32 UTC (rev 8410)
+++ branches/Seam_1_2_1_AP/examples/icefaces/src/org/jboss/seam/example/booking/test/BookingUnitTest.java	2008-06-24 16:28:14 UTC (rev 8411)
@@ -1,86 +0,0 @@
-package org.jboss.seam.example.booking.test;
-
-import java.util.List;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-import org.jboss.seam.core.Events;
-import org.jboss.seam.core.FacesMessages;
-import org.jboss.seam.example.booking.Booking;
-import org.jboss.seam.example.booking.Hotel;
-import org.jboss.seam.example.booking.HotelBooking;
-import org.jboss.seam.example.booking.HotelBookingAction;
-import org.jboss.seam.example.booking.HotelSearching;
-import org.jboss.seam.example.booking.HotelSearchingAction;
-import org.jboss.seam.example.booking.User;
-import org.jboss.seam.log.Logging;
-import org.jboss.seam.mock.SeamTest;
-import org.testng.annotations.Test;
-
-public class BookingUnitTest extends SeamTest
-{
-   
-   @Test
-   public void testHotelSearching() throws Exception
-   {
-      EntityManagerFactory emf = Persistence.createEntityManagerFactory("bookingDatabase");
-
-      EntityManager em = emf.createEntityManager();
-      
-      HotelSearching hs = new HotelSearchingAction();
-      
-      setField(hs, "em", em);
-      
-      hs.setSearchString("atlanta");
-      hs.find();
-      
-      List<Hotel> hotels = (List<Hotel>) getField(hs, "hotels");
-      assert hotels!=null;
-      assert hotels.size()==3;
-      
-      em.close();
-   }
-   
-   @Test
-   public void testHotelBooking() throws Exception
-   {
-      EntityManagerFactory emf = Persistence.createEntityManagerFactory("bookingDatabase");
-      final EntityManager em = emf.createEntityManager();
-      
-      Hotel hotel =  em.getReference(Hotel.class, 1l);
-      
-      HotelBooking hb = new HotelBookingAction();
-      
-      setField(hb, "em", em);
-      //setField(hb, "hotelSearch", hs);
-      setField(hb, "user", em.getReference(User.class, "gavin"));
-      setField(hb, "facesMessages", new FacesMessages());
-      setField(hb, "events", new Events() { @Override public void raiseEvent(String type, Object... params) { assert "bookingConfirmed".equals(type); } } );
-      setField(hb, "log", Logging.getLog(HotelBookingAction.class));
-      
-      assert hb.selectHotel(hotel).equals("hotel");
-
-      User user = em.getReference(User.class, "gavin");
-      assert user!=null;
-      assert hb.bookHotel().equals("book");
-      
-      Booking booking = (Booking) getField(hb, "booking");
-      assert booking!=null;
-      assert booking.getHotel()!=null;
-      assert booking.getUser()!=null;
-      
-      booking.setCreditCard("1234123412341234");
-      booking.setCreditCardName("GAVIN A KING");
-      
-      assert hb.setBookingDetails().equals("confirm");
-
-      getUserTransaction().begin();
-      assert hb.confirm().equals("confirmed");
-      getUserTransaction().commit();
-      
-      em.close();
-   }
-
-}




More information about the seam-commits mailing list