myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1523328 - in /myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock: MockExternalContext22.java MockFacesContext22.java
Date Sat, 14 Sep 2013 21:10:32 GMT
Author: lu4242
Date: Sat Sep 14 21:10:32 2013
New Revision: 1523328

URL: http://svn.apache.org/r1523328
Log:
small fix add some extra mock methods

Modified:
    myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockExternalContext22.java
    myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFacesContext22.java

Modified: myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockExternalContext22.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockExternalContext22.java?rev=1523328&r1=1523327&r2=1523328&view=diff
==============================================================================
--- myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockExternalContext22.java
(original)
+++ myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockExternalContext22.java
Sat Sep 14 21:10:32 2013
@@ -17,9 +17,11 @@
 
 package org.apache.myfaces.test.mock;
 
+import javax.faces.lifecycle.ClientWindow;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 /**
  * <p>Mock implementation of <code>ExternalContext</code> that includes
the semantics
@@ -38,12 +40,68 @@ public class MockExternalContext22 exten
             HttpServletRequest request, HttpServletResponse response)
     {
         super(context, request, response);
+        _clientWindow = null;
     }
 
     // ------------------------------------------------------ Instance Variables
 
+    private ClientWindow _clientWindow;
+    
     // ----------------------------------------------------- Mock Object Methods
 
+
+    @Override
+    public boolean isSecure()
+    {
+        return request.isSecure();
+    }
+
+    @Override
+    public int getSessionMaxInactiveInterval()
+    {
+        HttpSession session = request.getSession();
+        return session.getMaxInactiveInterval();
+    }
+
+    @Override
+    public void setSessionMaxInactiveInterval(int interval)
+    {
+        HttpSession session = request.getSession();
+        session.setMaxInactiveInterval(interval);
+    }
+
+    @Override
+    public ClientWindow getClientWindow()
+    {
+        return _clientWindow;
+    }
+    
+    @Override
+    public void setClientWindow(ClientWindow window)
+    {
+        _clientWindow = window;
+    }
+
+    @Override
+    public String getSessionId(boolean create)
+    {
+        HttpSession session = ((HttpServletRequest) request).getSession(create);
+        if (session != null)
+        {
+            return session.getId();
+        }
+        else
+        {
+            return "";
+        }
+    }
+
+    @Override
+    public String getApplicationContextPath()
+    {
+        return context.getContextPath();
+    }
+
     // ------------------------------------------------- ExternalContext Methods
     
 }

Modified: myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFacesContext22.java
URL: http://svn.apache.org/viewvc/myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFacesContext22.java?rev=1523328&r1=1523327&r2=1523328&view=diff
==============================================================================
--- myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFacesContext22.java
(original)
+++ myfaces/test/trunk/test22/src/main/java/org/apache/myfaces/test/mock/MockFacesContext22.java
Sat Sep 14 21:10:32 2013
@@ -58,6 +58,7 @@ public class MockFacesContext22 extends 
 
     private List<String> _resourceLibraryContracts;
     private Character _separatorChar;
+    protected boolean _released = false;
     
     // ----------------------------------------------------- Mock Object Methods   
 
@@ -103,4 +104,16 @@ public class MockFacesContext22 extends 
 
     // ------------------------------------------------- ExternalContext Methods
 
+    @Override
+    public boolean isReleased()
+    {
+        return _released;
+    }
+
+    @Override
+    public void release()
+    {
+        super.release();
+        _released = true;
+    }
 }



Mime
View raw message