You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/01/18 02:10:28 UTC

svn commit: r1434999 - in /myfaces/core/branches/2.2.x: api/src/main/java/javax/faces/ api/src/main/java/javax/faces/context/ api/src/main/java/javax/faces/event/ api/src/main/java/javax/faces/flow/ api/src/main/java/javax/faces/flow/builder/ impl/src/...

Author: lu4242
Date: Fri Jan 18 01:10:28 2013
New Revision: 1434999

URL: http://svn.apache.org/viewvc?rev=1434999&view=rev
Log:
MYFACES-3676 Implement FlashFactory and related events (tests still pending!!!)

Added:
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashFactory.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashWrapper.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostKeepFlashValueEvent.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostPutFlashValueEvent.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreClearFlashEvent.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreRemoveFlashValueEvent.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/Flow.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandler.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandlerFactory.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/NodeBuilder.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletFlashFactoryImpl.java   (with props)
Modified:
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/FactoryFinder.java
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/Flash.java
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/ComponentSystemEvent.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigDispenser.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/Factory.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigUnmarshallerImpl.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/Factory.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/ExternalContextFactoryImpl.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
    myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
    myfaces/core/branches/2.2.x/shared/src/test/java/org/apache/myfaces/shared/context/flash/FlashImplTest.java

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/FactoryFinder.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/FactoryFinder.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/FactoryFinder.java (original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/FactoryFinder.java Fri Jan 18 01:10:28 2013
@@ -34,7 +34,9 @@ import javax.faces.component.visit.Visit
 import javax.faces.context.ExceptionHandlerFactory;
 import javax.faces.context.ExternalContextFactory;
 import javax.faces.context.FacesContextFactory;
+import javax.faces.context.FlashFactory;
 import javax.faces.context.PartialViewContextFactory;
+import javax.faces.flow.FlowHandlerFactory;
 import javax.faces.lifecycle.LifecycleFactory;
 import javax.faces.render.RenderKitFactory;
 import javax.faces.view.ViewDeclarationLanguageFactory;
@@ -60,6 +62,8 @@ public final class FactoryFinder
     public static final String VIEW_DECLARATION_LANGUAGE_FACTORY = "javax.faces.view.ViewDeclarationLanguageFactory";
     public static final String VISIT_CONTEXT_FACTORY = "javax.faces.component.visit.VisitContextFactory";
     public static final String FACELET_CACHE_FACTORY = "javax.faces.view.facelets.FaceletCacheFactory";
+    public static final String FLASH_FACTORY = "javax.faces.context.FlashFactory";
+    public static final String FLOW_HANDLER_FACTORY = "javax.faces.flow.FlowHandlerFactory";
 
     /**
      * used as a monitor for itself and _factories. Maps in this map are used as monitors for themselves and the
@@ -96,6 +100,8 @@ public final class FactoryFinder
         VALID_FACTORY_NAMES.add(VIEW_DECLARATION_LANGUAGE_FACTORY);
         VALID_FACTORY_NAMES.add(VISIT_CONTEXT_FACTORY);
         VALID_FACTORY_NAMES.add(FACELET_CACHE_FACTORY);
+        VALID_FACTORY_NAMES.add(FLASH_FACTORY);
+        VALID_FACTORY_NAMES.add(FLOW_HANDLER_FACTORY);
         
         ABSTRACT_FACTORY_CLASSES.put(APPLICATION_FACTORY, ApplicationFactory.class);
         ABSTRACT_FACTORY_CLASSES.put(EXCEPTION_HANDLER_FACTORY, ExceptionHandlerFactory.class);
@@ -108,6 +114,8 @@ public final class FactoryFinder
         ABSTRACT_FACTORY_CLASSES.put(VIEW_DECLARATION_LANGUAGE_FACTORY, ViewDeclarationLanguageFactory.class);
         ABSTRACT_FACTORY_CLASSES.put(VISIT_CONTEXT_FACTORY, VisitContextFactory.class);
         ABSTRACT_FACTORY_CLASSES.put(FACELET_CACHE_FACTORY, FaceletCacheFactory.class);
+        ABSTRACT_FACTORY_CLASSES.put(FLASH_FACTORY, FlashFactory.class);
+        ABSTRACT_FACTORY_CLASSES.put(FLOW_HANDLER_FACTORY, FlowHandlerFactory.class);
         try
         {
             ClassLoader classLoader;

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/Flash.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/Flash.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/Flash.java (original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/Flash.java Fri Jan 18 01:10:28 2013
@@ -28,6 +28,11 @@ import java.util.Map;
  */
 public abstract class Flash implements Map<String, Object>
 {
+    /**
+     * @since 2.2
+     */
+    public static final String NULL_VALUE = "javax.faces.context.Flash.NULL_VALUE";
+    
     public abstract boolean isKeepMessages();
 
     public abstract boolean isRedirect();
@@ -43,4 +48,5 @@ public abstract class Flash implements M
     public abstract void doPrePhaseActions(FacesContext context);
     
     public abstract void doPostPhaseActions(FacesContext context);
+    
 }

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashFactory.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashFactory.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashFactory.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.context;
+
+import javax.faces.FacesWrapper;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 2.2
+ */
+public abstract class FlashFactory implements FacesWrapper<FlashFactory>
+{
+    public abstract Flash getFlash(boolean create);
+    
+    public FlashFactory getWrapped()
+    {
+        return null;
+    }
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashWrapper.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashWrapper.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashWrapper.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.context;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import javax.faces.FacesWrapper;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 2.2
+ */
+public abstract class FlashWrapper extends Flash implements FacesWrapper<Flash>
+{
+
+    @Override
+    public boolean isKeepMessages()
+    {
+        return getWrapped().isKeepMessages();
+    }
+
+    @Override
+    public boolean isRedirect()
+    {
+        return getWrapped().isRedirect();
+    }
+
+    @Override
+    public void keep(String key)
+    {
+        getWrapped().keep(key);
+    }
+
+    @Override
+    public void putNow(String key, Object value)
+    {
+        getWrapped().putNow(key, value);
+    }
+
+    @Override
+    public void setKeepMessages(boolean newValue)
+    {
+        getWrapped().setKeepMessages(newValue);
+    }
+
+    @Override
+    public void setRedirect(boolean newValue)
+    {
+        getWrapped().setRedirect(newValue);
+    }
+
+    @Override
+    public void doPrePhaseActions(FacesContext context)
+    {
+        getWrapped().doPrePhaseActions(context);
+    }
+
+    @Override
+    public void doPostPhaseActions(FacesContext context)
+    {
+        getWrapped().doPostPhaseActions(context);
+    }
+
+    public int size()
+    {
+        return getWrapped().size();
+    }
+
+    public boolean isEmpty()
+    {
+        return getWrapped().isEmpty();
+    }
+
+    public boolean containsKey(Object key)
+    {
+        return getWrapped().containsKey(key);
+    }
+
+    public boolean containsValue(Object value)
+    {
+        return getWrapped().containsValue(value);
+    }
+
+    public Object get(Object key)
+    {
+        return getWrapped().get(key);
+    }
+
+    public Object put(String key, Object value)
+    {
+        return getWrapped().put(key, value);
+    }
+
+    public Object remove(Object key)
+    {
+        return getWrapped().remove(key);
+    }
+
+    public void putAll(Map<? extends String, ? extends Object> m)
+    {
+        getWrapped().putAll(m);
+    }
+
+    public void clear()
+    {
+        getWrapped().clear();
+    }
+
+    public Set<String> keySet()
+    {
+        return getWrapped().keySet();
+    }
+
+    public Collection<Object> values()
+    {
+        return getWrapped().values();
+    }
+
+    public Set<Entry<String, Object>> entrySet()
+    {
+        return getWrapped().entrySet();
+    }
+    
+    public abstract Flash getWrapped();
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/FlashWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/ComponentSystemEvent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/ComponentSystemEvent.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/ComponentSystemEvent.java (original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/ComponentSystemEvent.java Fri Jan 18 01:10:28 2013
@@ -35,4 +35,12 @@ public abstract class ComponentSystemEve
     {
         return (UIComponent) getSource();
     }
+    
+    @Override
+    public boolean isAppropriateListener(FacesListener listener)
+    {
+        return listener instanceof ComponentSystemEventListener ||
+            super.isAppropriateListener(listener);
+    }
+
 }

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostKeepFlashValueEvent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostKeepFlashValueEvent.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostKeepFlashValueEvent.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostKeepFlashValueEvent.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.event;
+
+import javax.faces.context.Flash;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class PostKeepFlashValueEvent extends SystemEvent
+{
+    
+    public PostKeepFlashValueEvent(String key)
+    {
+        super(key == null ? Flash.NULL_VALUE : key);
+    }
+
+    public String getKey()
+    {
+        return getSource().toString();
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostKeepFlashValueEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostPutFlashValueEvent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostPutFlashValueEvent.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostPutFlashValueEvent.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostPutFlashValueEvent.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.event;
+
+import javax.faces.context.Flash;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class PostPutFlashValueEvent extends SystemEvent
+{
+
+    public PostPutFlashValueEvent(String key)
+    {
+        super(key == null ? Flash.NULL_VALUE : key);
+    }
+
+    public String getKey()
+    {
+        return getSource().toString();
+    }
+
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PostPutFlashValueEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreClearFlashEvent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreClearFlashEvent.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreClearFlashEvent.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreClearFlashEvent.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.event;
+
+import java.util.Map;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class PreClearFlashEvent extends SystemEvent
+{
+    
+    public PreClearFlashEvent(Map<String,Object> source)
+    {
+        super(source);
+    }
+
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreClearFlashEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreRemoveFlashValueEvent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreRemoveFlashValueEvent.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreRemoveFlashValueEvent.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreRemoveFlashValueEvent.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.event;
+
+import javax.faces.context.Flash;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class PreRemoveFlashValueEvent extends SystemEvent
+{
+
+    public PreRemoveFlashValueEvent(String key)
+    {
+        super(key == null ? Flash.NULL_VALUE : key);
+    }
+
+    public String getKey()
+    {
+        return getSource().toString();
+    }
+
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/event/PreRemoveFlashValueEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/Flow.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/Flow.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/Flow.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/Flow.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.flow;
+
+/**
+ *
+ * @TODO: Implement me!
+ * @since 2.2
+ */
+public abstract class Flow
+{
+    
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/Flow.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandler.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandler.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandler.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.flow;
+
+/**
+ *
+ * @TODO: Implement me!
+ * @since 2.2
+ */
+public class FlowHandler
+{
+    
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandlerFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandlerFactory.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandlerFactory.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandlerFactory.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.flow;
+
+import javax.faces.context.FacesContext;
+
+/**
+ *
+ * @author Leonardo Uribe
+ * @since 2.2
+ */
+public abstract class FlowHandlerFactory
+{
+    
+    public abstract FlowHandler createFlowHandler(FacesContext context);
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/FlowHandlerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/NodeBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/NodeBuilder.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/NodeBuilder.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/NodeBuilder.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.flow.builder;
+
+/**
+ *
+ * @author lu4242
+ */
+public interface NodeBuilder
+{
+    
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/flow/builder/NodeBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigDispenser.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigDispenser.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigDispenser.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigDispenser.java Fri Jan 18 01:10:28 2013
@@ -110,4 +110,12 @@ public abstract class FacesConfigDispens
     {
     }
 
+    /**
+     * @since 2.2
+     * @param factoryClassName 
+     */
+    public void feedFlashFactory(String factoryClassName)
+    {
+    }
+
 }

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java Fri Jan 18 01:10:28 2013
@@ -90,6 +90,7 @@ import org.apache.myfaces.context.Except
 import org.apache.myfaces.context.ExternalContextFactoryImpl;
 import org.apache.myfaces.context.FacesContextFactoryImpl;
 import org.apache.myfaces.context.PartialViewContextFactoryImpl;
+import org.apache.myfaces.context.servlet.ServletFlashFactoryImpl;
 import org.apache.myfaces.el.DefaultPropertyResolver;
 import org.apache.myfaces.el.VariableResolverImpl;
 import org.apache.myfaces.el.unified.ResolverBuilderBase;
@@ -141,6 +142,7 @@ public class FacesConfigurator
     private static final String DEFAULT_EXCEPTION_HANDLER_FACTORY = ExceptionHandlerFactoryImpl.class.getName();
     private static final String DEFAULT_TAG_HANDLER_DELEGATE_FACTORY = TagHandlerDelegateFactoryImpl.class.getName();
     private static final String DEFAULT_FACELET_CACHE_FACTORY = FaceletCacheFactoryImpl.class.getName();
+    private static final String DEFAULT_FLASH_FACTORY = ServletFlashFactoryImpl.class.getName();
     private static final String DEFAULT_FACES_CONFIG = "/WEB-INF/faces-config.xml";
 
     private final ExternalContext _externalContext;
@@ -491,6 +493,9 @@ public class FacesConfigurator
                 DEFAULT_VIEW_DECLARATION_LANGUAGE_FACTORY);
         setFactories(FactoryFinder.FACELET_CACHE_FACTORY, dispenser.getFaceletCacheFactoryIterator(),
                 DEFAULT_FACELET_CACHE_FACTORY);
+        setFactories(FactoryFinder.FLASH_FACTORY, dispenser.getFlashFactoryIterator(),
+                DEFAULT_FLASH_FACTORY);
+
     }
 
     private void setFactories(String factoryName, Collection<String> factories, String defaultFactory)

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/FacesConfigData.java Fri Jan 18 01:10:28 2013
@@ -76,6 +76,14 @@ public abstract class FacesConfigData im
         return Collections.emptyList();
     }
     
+    /**
+     * @since 2.2
+     * @return 
+     */
+    public Collection<String> getFlashFactoryIterator()
+    {
+        return Collections.emptyList();
+    }
 
     /** @return Iterator over ActionListener class names (in reverse order!) */
     public abstract Collection<String> getActionListenerIterator();

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/Factory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/Factory.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/Factory.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/element/Factory.java Fri Jan 18 01:10:28 2013
@@ -56,4 +56,9 @@ public abstract class Factory implements
     {
         return Collections.emptyList();
     }
+    
+    public List<String> getFlashFactory()
+    {
+        return Collections.emptyList();
+    }
 }

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigDispenserImpl.java Fri Jan 18 01:10:28 2013
@@ -67,6 +67,7 @@ public class DigesterFacesConfigDispense
     private List<String> tagHandlerDelegateFactories = new ArrayList<String>();
     private List<String> visitContextFactories = new ArrayList<String>();
     private List<String> faceletCacheFactories = new ArrayList<String>();
+    private List<String> flashFactories = new ArrayList<String>();
     
     private String defaultRenderKitId;
     private String messageBundle;
@@ -131,6 +132,7 @@ public class DigesterFacesConfigDispense
             tagHandlerDelegateFactories.addAll(factory.getTagHandlerDelegateFactory());
             visitContextFactories.addAll(factory.getVisitContextFactory());
             faceletCacheFactories.addAll(factory.getFaceletCacheFactory());
+            flashFactories.addAll(factory.getFlashFactory());
         }
 
         components.putAll(config.getComponents());
@@ -696,4 +698,16 @@ public class DigesterFacesConfigDispense
         return faceletCacheFactories;
     }
 
+    @Override
+    public void feedFlashFactory(String factoryClassName)
+    {
+        flashFactories.add(factoryClassName);
+    }
+
+    @Override
+    public Collection<String> getFlashFactoryIterator()
+    {
+        return flashFactories;
+    }
+
 }

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigUnmarshallerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigUnmarshallerImpl.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigUnmarshallerImpl.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/DigesterFacesConfigUnmarshallerImpl.java Fri Jan 18 01:10:28 2013
@@ -125,6 +125,9 @@ public class DigesterFacesConfigUnmarsha
         // 2.1 specific start
         digester.addCallMethod("faces-config/factory/facelet-cache-factory", "addFaceletCacheFactory", 0);
         // 2.1 specific end
+        // 2.2 specific start
+        digester.addCallMethod("faces-config/factory/flash-factory", "addFlashFactory", 0);
+        // 2.2 specific end
 
         digester.addObjectCreate("faces-config/factory", Factory.class);
         digester.addSetNext("faces-config/factory", "addFactory");

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/Factory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/Factory.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/Factory.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/config/impl/digester/elements/Factory.java Fri Jan 18 01:10:28 2013
@@ -38,6 +38,7 @@ public class Factory extends org.apache.
     private List<String> tagHandlerDelegateFactories = new ArrayList<String>();
     private List<String> visitContextFactories = new ArrayList<String>();
     private List<String> faceletCacheFactories = new ArrayList<String>();
+    private List<String> flashFactories = new ArrayList<String>();
 
     public void addApplicationFactory(String factory)
     {
@@ -149,5 +150,11 @@ public class Factory extends org.apache.
     {
         return faceletCacheFactories;
     }
+
+    @Override
+    public List<String> getFlashFactory()
+    {
+        return flashFactories;
+    }
     
 }

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/ExternalContextFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/ExternalContextFactoryImpl.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/ExternalContextFactoryImpl.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/ExternalContextFactoryImpl.java Fri Jan 18 01:10:28 2013
@@ -19,8 +19,10 @@
 package org.apache.myfaces.context;
 
 import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.ExternalContextFactory;
+import javax.faces.context.FlashFactory;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
@@ -39,6 +41,14 @@ public class ExternalContextFactoryImpl 
     public static final String EXTERNAL_CONTEXT_KEY = 
         "org.apache.myfaces.context.servlet.ServletExternalContextImpl";
     
+    private final FlashFactory _flashFactory;
+    
+    public ExternalContextFactoryImpl()
+    {
+        _flashFactory = (FlashFactory) FactoryFinder.getFactory(
+                    FactoryFinder.FLASH_FACTORY);
+    }
+    
     @Override
     public ExternalContext getExternalContext(Object context, Object request,
             Object response) throws FacesException
@@ -59,7 +69,8 @@ public class ExternalContextFactoryImpl 
         if (context instanceof ServletContext)
         {
             ExternalContext externalContext = new ServletExternalContextImpl(
-                    (ServletContext) context, (ServletRequest) request, (ServletResponse) response);
+                    (ServletContext) context, (ServletRequest) request, (ServletResponse) response,
+                    _flashFactory);
             
             externalContext.getRequestMap().put(EXTERNAL_CONTEXT_KEY, externalContext);
             

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java Fri Jan 18 01:10:28 2013
@@ -34,8 +34,10 @@ import java.util.Map;
 import java.util.logging.Logger;
 
 import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
 import javax.faces.context.FacesContext;
 import javax.faces.context.Flash;
+import javax.faces.context.FlashFactory;
 import javax.faces.context.PartialResponseWriter;
 import javax.faces.context.PartialViewContext;
 import javax.faces.lifecycle.ClientWindow;
@@ -82,6 +84,8 @@ public final class ServletExternalContex
     private HttpServletResponse _httpServletResponse;
     private String _requestServletPath;
     private String _requestPathInfo;
+    private FlashFactory _flashFactory;
+    private Flash _flash;
 
     public ServletExternalContextImpl(final ServletContext servletContext, 
             final ServletRequest servletRequest,
@@ -110,6 +114,15 @@ public final class ServletExternalContex
             _requestPathInfo = _httpServletRequest.getPathInfo();
         }
     }
+    
+    public ServletExternalContextImpl(final ServletContext servletContext, 
+            final ServletRequest servletRequest,
+            final ServletResponse servletResponse,
+            final FlashFactory flashFactory)
+    {
+        this(servletContext, servletRequest, servletResponse);
+        _flashFactory = flashFactory;
+    }
 
     public void release()
     {
@@ -887,7 +900,29 @@ public final class ServletExternalContex
      */
     public Flash getFlash()
     {
-        return FlashImpl.getCurrentInstance(this);
+        if (_flash == null)
+        {
+            if (_flashFactory == null)
+            {
+                _flashFactory = (FlashFactory) FactoryFinder.getFactory(
+                    FactoryFinder.FLASH_FACTORY);
+                if (_flashFactory == null)
+                {
+                    //Fallback to servlet default flash
+                    _flash = FlashImpl.getCurrentInstance(this);
+                }
+                else
+                {
+                    _flash = _flashFactory.getFlash(true);
+                }
+            }
+            else
+            {
+                _flash = _flashFactory.getFlash(true);
+            }
+        }
+        return _flash;
+        //return FlashImpl.getCurrentInstance(this);
     }
 
     @Override

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletFlashFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletFlashFactoryImpl.java?rev=1434999&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletFlashFactoryImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletFlashFactoryImpl.java Fri Jan 18 01:10:28 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.context.servlet;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.Flash;
+import javax.faces.context.FlashFactory;
+import org.apache.myfaces.shared.context.flash.FlashImpl;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class ServletFlashFactoryImpl extends FlashFactory
+{
+
+    @Override
+    public Flash getFlash(boolean create)
+    {
+        return FlashImpl.getCurrentInstance(
+            FacesContext.getCurrentInstance().getExternalContext(), create);
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletFlashFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java (original)
+++ myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java Fri Jan 18 01:10:28 2013
@@ -40,6 +40,10 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Logger;
+import javax.faces.event.PostKeepFlashValueEvent;
+import javax.faces.event.PostPutFlashValueEvent;
+import javax.faces.event.PreClearFlashEvent;
+import javax.faces.event.PreRemoveFlashValueEvent;
 import javax.faces.lifecycle.ClientWindow;
 
 /**
@@ -138,10 +142,15 @@ public class FlashImpl extends Flash
      */
     public static Flash getCurrentInstance(ExternalContext context)
     {
+        return getCurrentInstance(context, true);
+    }
+    
+    public static Flash getCurrentInstance(ExternalContext context, boolean create)
+    {
         Map<String, Object> applicationMap = context.getApplicationMap();
         
         Flash flash = (Flash) applicationMap.get(FLASH_INSTANCE);
-        if (flash == null)
+        if (flash == null && create)
         {
             // synchronize the ApplicationMap to ensure that only
             // once instance of FlashImpl is created and stored in it.
@@ -365,6 +374,9 @@ public class FlashImpl extends Flash
         
         // put it in the render FlashMap
         _getRenderFlashMap(facesContext).put(key, value);
+        
+        facesContext.getApplication().publishEvent(facesContext,
+                PostKeepFlashValueEvent.class, key);
     }
 
     /**
@@ -495,7 +507,13 @@ public class FlashImpl extends Flash
         }
         else
         {
-            return _getFlashMapForWriting().put(key, value); 
+            Object resp = _getFlashMapForWriting().put(key, value); 
+            
+            FacesContext facesContext = FacesContext.getCurrentInstance();
+            facesContext.getApplication().publishEvent(facesContext,
+                PostPutFlashValueEvent.class, key);
+
+            return resp;
         }
     }
 
@@ -508,6 +526,11 @@ public class FlashImpl extends Flash
     public Object remove(Object key)
     {
         _checkFlashScopeDisabled();
+        
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        facesContext.getApplication().publishEvent(facesContext,
+            PreRemoveFlashValueEvent.class, key);
+        
         return _getFlashMapForWriting().remove(key);
     }
 
@@ -1012,6 +1035,10 @@ public class FlashImpl extends Flash
     {
         Map<String, Object> map = _getExecuteFlashMap(facesContext);
 
+        //JSF 2.2 invoke PreClearFlashEvent
+        facesContext.getApplication().publishEvent(facesContext, 
+            PreClearFlashEvent.class, map);
+        
         // Clear everything - note that because of naming conventions,
         // this will in fact automatically recurse through all children
         // grandchildren etc. - which is kind of a design flaw of SubKeyMap,

Modified: myfaces/core/branches/2.2.x/shared/src/test/java/org/apache/myfaces/shared/context/flash/FlashImplTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/test/java/org/apache/myfaces/shared/context/flash/FlashImplTest.java?rev=1434999&r1=1434998&r2=1434999&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/test/java/org/apache/myfaces/shared/context/flash/FlashImplTest.java (original)
+++ myfaces/core/branches/2.2.x/shared/src/test/java/org/apache/myfaces/shared/context/flash/FlashImplTest.java Fri Jan 18 01:10:28 2013
@@ -30,26 +30,27 @@ import javax.servlet.ServletContext;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import org.apache.myfaces.test.base.junit4.AbstractJsfTestCase;
 
-import org.apache.myfaces.test.base.AbstractViewControllerTestCase;
 import org.apache.myfaces.test.mock.MockExternalContext20;
 import org.apache.myfaces.test.mock.MockFacesContext20;
 import org.apache.myfaces.test.mock.MockHttpServletRequest;
 import org.apache.myfaces.test.mock.MockHttpServletResponse;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Tests for FlashImpl.
  * @author Jakob Korherr (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class FlashImplTest extends AbstractViewControllerTestCase
+public class FlashImplTest extends AbstractJsfTestCase
 {
     
     private FlashImpl _flash;
 
-    public FlashImplTest(String name)
+    public FlashImplTest()
     {
-        super(name);
     }
 
     @Override
@@ -63,7 +64,7 @@ public class FlashImplTest extends Abstr
     }
 
     @Override
-    protected void setUp() throws Exception
+    public void setUp() throws Exception
     {
         super.setUp();
         
@@ -71,7 +72,7 @@ public class FlashImplTest extends Abstr
     }
 
     @Override
-    protected void tearDown() throws Exception
+    public void tearDown() throws Exception
     {
         _flash = null;
         
@@ -83,6 +84,7 @@ public class FlashImplTest extends Abstr
      * and correctly stores the values in it.
      * @throws Exception
      */
+    @Test
     public void testSessionMapWrapperSubKeyMap() throws Exception
     {
         // set phase to RESTORE_VIEW to create the flash tokens on doPrePhaseActions()
@@ -103,7 +105,7 @@ public class FlashImplTest extends Abstr
                 FlashImpl.SEPARATOR_CHAR + renderToken + "testkey1";
         
         // Assertion
-        assertEquals("The render FlashMap must use the session Map to store the values.",
+        Assert.assertEquals("The render FlashMap must use the session Map to store the values.",
                 "testvalue1", session.getAttribute(sessionMapKey));     
     }
     
@@ -112,6 +114,7 @@ public class FlashImplTest extends Abstr
      * @throws Exception
      */
     @SuppressWarnings("unchecked")
+    @Test
     public void testKeepValueNormalPostback() throws Exception
     {
         // simulate JSF lifecycle:
@@ -172,7 +175,7 @@ public class FlashImplTest extends Abstr
         // _flash.get() will ask the execute FlashMap for the value
         // and this must be the render FlashMap of the previous request,
         // thus it must contain the value from the previous request.
-        assertEquals("flashvalue", _flash.get("flashkey"));
+        Assert.assertEquals("flashvalue", _flash.get("flashkey"));
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -180,14 +183,14 @@ public class FlashImplTest extends Abstr
         
         // _flash.get() also references to the execute FlashMap, but
         // this one has to be cleared by now, thus it must be null.
-        assertNull("Execute FlashMap must have been cleared", _flash.get("flashkey"));
+        Assert.assertNull("Execute FlashMap must have been cleared", _flash.get("flashkey"));
         
         // get the execute Map of the second postback (FlashImpl internals)
         Map<String, Object> executeMap = (Map<String, Object>) externalContext
                 .getRequestMap().get(FlashImpl.FLASH_EXECUTE_MAP);
         
         // must be empty
-        assertTrue("The execute Map of the second postback must have been cleared",
+        Assert.assertTrue("The execute Map of the second postback must have been cleared",
                 executeMap.isEmpty());
     }
     
@@ -196,6 +199,7 @@ public class FlashImplTest extends Abstr
      * @throws Exception
      */
     @SuppressWarnings("unchecked")
+    @Test
     public void testKeepValuePostRedirectGet() throws Exception
     {
         // simulate JSF lifecycle:
@@ -237,7 +241,7 @@ public class FlashImplTest extends Abstr
         // set redirect to true, this happens by the NavigationHandler in phase 5
         _flash.setRedirect(true);
         
-        assertTrue("setRedirect(true) was just called, thus isRedirect() must be true",
+        Assert.assertTrue("setRedirect(true) was just called, thus isRedirect() must be true",
                 _flash.isRedirect());
         
         // note that setRedirect(true) was called, thus the cleanup happens
@@ -259,7 +263,7 @@ public class FlashImplTest extends Abstr
         _flash.doPrePhaseActions(facesContext);
         
         // check isRedirect();
-        assertTrue("setRedirect(true) was called on the previous request, "
+        Assert.assertTrue("setRedirect(true) was called on the previous request, "
                 + " and we are in the execute portion of the lifecycle, "
                 + " thus isRedirect() must be true.",
                 _flash.isRedirect());
@@ -268,14 +272,14 @@ public class FlashImplTest extends Abstr
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
         
         // check isRedirect();
-        assertFalse("setRedirect(true) was called on the previous request, "
+        Assert.assertFalse("setRedirect(true) was called on the previous request, "
                 + " but we are already in the render portion of the lifecycle, "
                 + " thus isRedirect() must be false.",
                 _flash.isRedirect());
         
         // _flash.get() will ask the execute FlashMap and this one
         // must contain the key used in keep()
-        assertEquals("flashvalue", _flash.get("flashkey"));
+        Assert.assertEquals("flashvalue", _flash.get("flashkey"));
         
         _flash.doPostPhaseActions(facesContext);
         
@@ -295,7 +299,7 @@ public class FlashImplTest extends Abstr
         facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
         
         // check isRedirect();
-        assertFalse("setRedirect(true) was called on the pre-previous request, "
+        Assert.assertFalse("setRedirect(true) was called on the pre-previous request, "
                 + " thus isRedirect() must be false again.",
                 _flash.isRedirect());
         
@@ -304,7 +308,7 @@ public class FlashImplTest extends Abstr
         // thus it must not contain the value from the previous request,
         // because the value was on the previous request's execute FlashMap
         // and not on the previous request's render FlashMap.
-        assertNull(_flash.get("flashkey"));
+        Assert.assertNull(_flash.get("flashkey"));
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -315,7 +319,7 @@ public class FlashImplTest extends Abstr
                 .getRequestMap().get(FlashImpl.FLASH_EXECUTE_MAP);
         
         // must be empty
-        assertTrue("The execute Map of the second postback must have been cleared",
+        Assert.assertTrue("The execute Map of the second postback must have been cleared",
                 executeMap.isEmpty());
     }
     
@@ -323,6 +327,7 @@ public class FlashImplTest extends Abstr
      * Tests the functionality of keepMessages in a normal postback scenario.
      * @throws Exception
      */
+    @Test
     public void testKeepMessagesNormalPostback() throws Exception
     {
         // simulate JSF lifecycle:
@@ -364,12 +369,12 @@ public class FlashImplTest extends Abstr
         facesContext.addMessage(null, messageNoClientId);
         
         // now the FacesContext must contain 2 messages
-        assertEquals(2, facesContext.getMessageList().size());
+        Assert.assertEquals(2, facesContext.getMessageList().size());
         
         // keep messages
         _flash.setKeepMessages(true);
         
-        assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
+        Assert.assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
                 + "must be true.", _flash.isKeepMessages());
         
         // simulate JSF lifecycle
@@ -385,18 +390,18 @@ public class FlashImplTest extends Abstr
         ((MockFacesContext20) facesContext).setPostback(true);
         
         // now the FacesContext must contain 0 messages (new request, new FacesContext)
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
         _flash.doPrePhaseActions(facesContext);
         
         // now the messages must be here again
-        assertEquals(2, facesContext.getMessageList().size());
-        assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
-        assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+        Assert.assertEquals(2, facesContext.getMessageList().size());
+        Assert.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+        Assert.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
         
-        assertFalse("setKeepMessages(true) was not called on this request, thus "
+        Assert.assertFalse("setKeepMessages(true) was not called on this request, thus "
                 + "isKeepMessages() must be false.", _flash.isKeepMessages());
         
         // simulate JSF lifecycle
@@ -412,7 +417,7 @@ public class FlashImplTest extends Abstr
         ((MockFacesContext20) facesContext).setPostback(true);
         
         // now the FacesContext must contain 0 messages (new request, new FacesContext)
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -420,7 +425,7 @@ public class FlashImplTest extends Abstr
         
         // the messages must still be gone here, because setKeepMessages(true)
         // was not called on the previous request
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -433,6 +438,7 @@ public class FlashImplTest extends Abstr
      * then not from the GET to the next postback.
      * @throws Exception
      */
+    @Test
     public void testKeepMessagesPostRedirectGet() throws Exception
     {
         // simulate JSF lifecycle:
@@ -474,16 +480,16 @@ public class FlashImplTest extends Abstr
         facesContext.addMessage(null, messageNoClientId);
         
         // now the FacesContext must contain 2 messages
-        assertEquals(2, facesContext.getMessageList().size());
+        Assert.assertEquals(2, facesContext.getMessageList().size());
         
         // keep messages
         _flash.setKeepMessages(true);
-        assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
+        Assert.assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
                 + "must be true.", _flash.isKeepMessages());
         
         // set redirect to true, this happens by the NavigationHandler in phase 5
         _flash.setRedirect(true);
-        assertTrue("setRedirect(true) was just called, thus isRedirect() must be true",
+        Assert.assertTrue("setRedirect(true) was just called, thus isRedirect() must be true",
                 _flash.isRedirect());
         
         // note that setRedirect(true) was called, thus the cleanup happens
@@ -499,7 +505,7 @@ public class FlashImplTest extends Abstr
         ((MockFacesContext20) facesContext).setPostback(false);
         
         // now the FacesContext must contain 0 messages (new request, new FacesContext)
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         // Note that doPrePhaseActions() is called on RESTORE_VIEW even
@@ -511,12 +517,12 @@ public class FlashImplTest extends Abstr
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
         
         // now the messages must be here again
-        assertEquals(2, facesContext.getMessageList().size());
-        assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
-        assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+        Assert.assertEquals(2, facesContext.getMessageList().size());
+        Assert.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+        Assert.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
         
         // check isKeepMessages()
-        assertFalse("setKeepMessages(true) was not called on this request, thus "
+        Assert.assertFalse("setKeepMessages(true) was not called on this request, thus "
                 + "isKeepMessages() must be false.", _flash.isKeepMessages());
         
         _flash.doPostPhaseActions(facesContext);
@@ -530,7 +536,7 @@ public class FlashImplTest extends Abstr
         ((MockFacesContext20) facesContext).setPostback(true);
         
         // now the FacesContext must contain 0 messages (new request, new FacesContext)
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -541,7 +547,7 @@ public class FlashImplTest extends Abstr
         
         // now the FacesContext must contain 0 messages, because 
         // setKeepMessages(true) was not called on the GET-request
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -554,6 +560,7 @@ public class FlashImplTest extends Abstr
      * then also from the GET to the next postback.
      * @throws Exception
      */
+    @Test
     public void testKeepMessagesPostRedirectGetTwoTimes() throws Exception
     {
         // simulate JSF lifecycle:
@@ -595,16 +602,16 @@ public class FlashImplTest extends Abstr
         facesContext.addMessage(null, messageNoClientId);
         
         // now the FacesContext must contain 2 messages
-        assertEquals(2, facesContext.getMessageList().size());
+        Assert.assertEquals(2, facesContext.getMessageList().size());
         
         // keep messages
         _flash.setKeepMessages(true);
-        assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
+        Assert.assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
                 + "must be true.", _flash.isKeepMessages());
         
         // set redirect to true, this happens by the NavigationHandler in phase 5
         _flash.setRedirect(true);
-        assertTrue("setRedirect(true) was just called, thus isRedirect() must be true",
+        Assert.assertTrue("setRedirect(true) was just called, thus isRedirect() must be true",
                 _flash.isRedirect());
         
         // note that setRedirect(true) was called, thus the cleanup happens
@@ -620,7 +627,7 @@ public class FlashImplTest extends Abstr
         ((MockFacesContext20) facesContext).setPostback(false);
         
         // now the FacesContext must contain 0 messages (new request, new FacesContext)
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         // Note that doPrePhaseActions() is called on RESTORE_VIEW even
@@ -632,17 +639,17 @@ public class FlashImplTest extends Abstr
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
         
         // now the messages must be here again
-        assertEquals(2, facesContext.getMessageList().size());
-        assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
-        assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+        Assert.assertEquals(2, facesContext.getMessageList().size());
+        Assert.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+        Assert.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
         
         // check isKeepMessages()
-        assertFalse("setKeepMessages(true) was not called on this request, thus "
+        Assert.assertFalse("setKeepMessages(true) was not called on this request, thus "
                 + "isKeepMessages() must be false.", _flash.isKeepMessages());
         
         // keep messages - again
         _flash.setKeepMessages(true);
-        assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
+        Assert.assertTrue("setKeepMessages(true) was just called, thus isKeepMessages() "
                 + "must be true.", _flash.isKeepMessages());
         
         _flash.doPostPhaseActions(facesContext);
@@ -656,7 +663,7 @@ public class FlashImplTest extends Abstr
         ((MockFacesContext20) facesContext).setPostback(true);
         
         // now the FacesContext must contain 0 messages (new request, new FacesContext)
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -666,9 +673,9 @@ public class FlashImplTest extends Abstr
         facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
         
         // now the messages must be here again
-        assertEquals(2, facesContext.getMessageList().size());
-        assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
-        assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
+        Assert.assertEquals(2, facesContext.getMessageList().size());
+        Assert.assertEquals(Arrays.asList(messageClientId), facesContext.getMessageList("clientId"));
+        Assert.assertEquals(Arrays.asList(messageNoClientId), facesContext.getMessageList(null));
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -683,7 +690,7 @@ public class FlashImplTest extends Abstr
         ((MockFacesContext20) facesContext).setPostback(true);
         
         // now the FacesContext must contain 0 messages (new request, new FacesContext)
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RESTORE_VIEW);
@@ -694,7 +701,7 @@ public class FlashImplTest extends Abstr
         
         // now the FacesContext must contain 0 messages, because 
         // setKeepMessages(true) was not called on the previous postback
-        assertEquals(0, facesContext.getMessageList().size());
+        Assert.assertEquals(0, facesContext.getMessageList().size());
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -705,53 +712,57 @@ public class FlashImplTest extends Abstr
      * Test if setRedirect(true) works via _flash.put("redirect", true)
      * and if isRedirect() is equal to _flash.get("redirect").
      */
+    @Test
     public void testSetRedirect()
     {
-        assertFalse(_flash.isRedirect());
-        assertFalse((Boolean) _flash.get("redirect"));
+        Assert.assertFalse(_flash.isRedirect());
+        Assert.assertFalse((Boolean) _flash.get("redirect"));
         
         _flash.put("redirect", true);
         
-        assertTrue(_flash.isRedirect());
-        assertTrue((Boolean) _flash.get("redirect"));
+        Assert.assertTrue(_flash.isRedirect());
+        Assert.assertTrue((Boolean) _flash.get("redirect"));
     }
     
     /**
      * Test if setKeepMessages(true) works via _flash.put("keepMessages", true)
      * and if isKeepMessages() is equal to _flash.get("keepMessages").
      */
+    @Test
     public void testSetKeepMessages()
     {
-        assertFalse(_flash.isKeepMessages());
-        assertFalse((Boolean) _flash.get("keepMessages"));
+        Assert.assertFalse(_flash.isKeepMessages());
+        Assert.assertFalse((Boolean) _flash.get("keepMessages"));
         
         _flash.put("keepMessages", true);
         
-        assertTrue(_flash.isKeepMessages());
-        assertTrue((Boolean) _flash.get("keepMessages"));
+        Assert.assertTrue(_flash.isKeepMessages());
+        Assert.assertTrue((Boolean) _flash.get("keepMessages"));
     }
     
     /**
      * Tests the functionality of putNow().
      */
     @SuppressWarnings("unchecked")
+    @Test
     public void testPutNow()
     {
         Map<String, Object> requestMap = externalContext.getRequestMap();
         
         // requestMap must NOT contain the key
-        assertNull(requestMap.get("flashkey"));
+        Assert.assertNull(requestMap.get("flashkey"));
         
         _flash.putNow("flashkey", "flashvalue");
         
         // requestMap must contain the key
-        assertEquals("flashvalue", requestMap.get("flashkey"));
+        Assert.assertEquals("flashvalue", requestMap.get("flashkey"));
     }
     
     /**
      * Tests keep()
      * @throws Exception
      */
+    @Test
     public void testKeep() throws Exception
     {
         // simulate JSF lifecycle:
@@ -814,7 +825,7 @@ public class FlashImplTest extends Abstr
         facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
      
         // the value must be in the executeMap
-        assertEquals("flashvalue", _flash.get("flashkey"));
+        Assert.assertEquals("flashvalue", _flash.get("flashkey"));
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -827,6 +838,7 @@ public class FlashImplTest extends Abstr
      * Like testKeep(), but without calling keep() to keep the value.
      * @throws Exception
      */
+    @Test
     public void testNotKeep() throws Exception
     {
         // simulate JSF lifecycle:
@@ -887,7 +899,7 @@ public class FlashImplTest extends Abstr
         facesContext.setCurrentPhaseId(PhaseId.INVOKE_APPLICATION);
      
         // render FlashMap must be empty
-        assertNull(_flash.get("flashkey"));
+        Assert.assertNull(_flash.get("flashkey"));
         
         // simulate JSF lifecycle
         facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE);
@@ -900,6 +912,7 @@ public class FlashImplTest extends Abstr
      * Tests if the reading functions use _getFlashMapForReading()
      * and if the writing functions use _getFlashMapForWriting().
      */
+    @Test
     public void testMapMethodsUseDifferentMaps() throws Exception
     {
         // simulate JSF lifecycle:
@@ -937,7 +950,7 @@ public class FlashImplTest extends Abstr
         // in this configuration put() and get() are executed on different maps
         
         // there must not be a value with the key "flashkey"
-        assertNull(_flash.get("flashkey"));
+        Assert.assertNull(_flash.get("flashkey"));
         
         // put() always references the active FlashMap,
         // which is the render FlashMap in this case (phase is render response)
@@ -945,7 +958,7 @@ public class FlashImplTest extends Abstr
         
         // there must still not be a value with the key "flashkey"
         // NOTE that get still references the execute FlashMap
-        assertNull(_flash.get("flashkey"));
+        Assert.assertNull(_flash.get("flashkey"));
         
         _flash.doPostPhaseActions(facesContext);
     }
@@ -953,6 +966,7 @@ public class FlashImplTest extends Abstr
     /**
      * Tests the implementation of the methods from the java.util.Map interface.
      */
+    @Test
     public void testMapMethods()
     {
         // ensure that _getActiveFlashMap() returns the execute FlashMap
@@ -1000,13 +1014,13 @@ public class FlashImplTest extends Abstr
      */
     private void _noElementAssertions()
     {
-        assertTrue(_flash.isEmpty());
-        assertEquals(0, _flash.size());
-        assertFalse(_flash.containsKey("flashkey"));
-        assertFalse(_flash.containsValue("flashvalue"));
-        assertEquals(Collections.emptySet(), _flash.keySet());
-        assertNull(_flash.get("flashkey"));
-        assertTrue(_flash.values().isEmpty());
+        Assert.assertTrue(_flash.isEmpty());
+        Assert.assertEquals(0, _flash.size());
+        Assert.assertFalse(_flash.containsKey("flashkey"));
+        Assert.assertFalse(_flash.containsValue("flashvalue"));
+        Assert.assertEquals(Collections.emptySet(), _flash.keySet());
+        Assert.assertNull(_flash.get("flashkey"));
+        Assert.assertTrue(_flash.values().isEmpty());
     }
     
     /**
@@ -1014,13 +1028,13 @@ public class FlashImplTest extends Abstr
      */
     private void _oneElementAssertions()
     {
-        assertFalse(_flash.isEmpty());
-        assertEquals(1, _flash.size());
-        assertTrue(_flash.containsKey("flashkey"));
-        assertTrue(_flash.containsValue("flashvalue"));
-        assertEquals(new HashSet<String>(Arrays.asList("flashkey")), _flash.keySet());
-        assertEquals("flashvalue", _flash.get("flashkey"));
-        assertTrue(_flash.values().contains("flashvalue"));
+        Assert.assertFalse(_flash.isEmpty());
+        Assert.assertEquals(1, _flash.size());
+        Assert.assertTrue(_flash.containsKey("flashkey"));
+        Assert.assertTrue(_flash.containsValue("flashvalue"));
+        Assert.assertEquals(new HashSet<String>(Arrays.asList("flashkey")), _flash.keySet());
+        Assert.assertEquals("flashvalue", _flash.get("flashkey"));
+        Assert.assertTrue(_flash.values().contains("flashvalue"));
     }
     
     /**
@@ -1036,7 +1050,7 @@ public class FlashImplTest extends Abstr
         Cookie renderTokenCookie = response.getCookie(FlashImpl.FLASH_RENDER_MAP_TOKEN);
         
         // the Cookie must exist
-        assertNotNull(renderTokenCookie);
+        Assert.assertNotNull(renderTokenCookie);
         
         // check for the redirect-cookie
         Cookie redirectCookie = response.getCookie(FlashImpl.FLASH_REDIRECT);
@@ -1049,6 +1063,8 @@ public class FlashImplTest extends Abstr
         setUpExternalContext();
         setUpFacesContext();
         
+        facesContext.setApplication(application);
+        
         // add the cookie to the new request
         request.addCookie(renderTokenCookie);