You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2018/05/03 18:25:59 UTC

[myfaces-test] 12/21: MYFACES-2327 Move facelets test code to myfaces

This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1_0_0_alpha
in repository https://gitbox.apache.org/repos/asf/myfaces-test.git

commit 5971ef1a6106a790ad9fd4fe25009b1abece8273
Author: Leonardo Uribe <lu...@apache.org>
AuthorDate: Thu Aug 13 21:53:04 2009 +0000

    MYFACES-2327 Move facelets test code to myfaces
---
 .../org/apache/shale/test/mock/MockResponseWriter.java |  7 ++++++-
 .../org/apache/shale/test/mock/MockFacesContext20.java | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/test12/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java b/test12/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java
index 487ffa9..efe550d 100644
--- a/test12/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java
+++ b/test12/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java
@@ -30,7 +30,12 @@ public class MockResponseWriter extends ResponseWriter {
 
     // ------------------------------------------------------------ Constructors
 
-
+    public MockResponseWriter(Writer writer) {
+        this.writer = writer;
+        this.contentType = "text/html";
+        this.characterEncoding = "UTF-8";
+    }
+    
     /**
      * <p>Construct an instance wrapping the specified writer.</p>
      *
diff --git a/test20/src/main/java/org/apache/shale/test/mock/MockFacesContext20.java b/test20/src/main/java/org/apache/shale/test/mock/MockFacesContext20.java
index 985767e..e2bb5ff 100644
--- a/test20/src/main/java/org/apache/shale/test/mock/MockFacesContext20.java
+++ b/test20/src/main/java/org/apache/shale/test/mock/MockFacesContext20.java
@@ -20,7 +20,10 @@ package org.apache.shale.test.mock;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.faces.FactoryFinder;
 import javax.faces.context.ExternalContext;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.PartialViewContextFactory;
 import javax.faces.event.PhaseId;
 import javax.faces.lifecycle.Lifecycle;
 
@@ -86,6 +89,21 @@ public class MockFacesContext20 extends MockFacesContext12 {
         return attributes;
     }
     
+    private PartialViewContext _partialViewContext = null;
+    
+    @Override
+    public PartialViewContext getPartialViewContext()
+    {
+        if (_partialViewContext == null)
+        {
+            //Get through factory finder
+            PartialViewContextFactory factory = (PartialViewContextFactory)
+                FactoryFinder.getFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY);
+            _partialViewContext = factory.getPartialViewContext(this);
+        }
+        return _partialViewContext;
+    }
+    
     // ------------------------------------------------- ExternalContext Methods
 
 }

-- 
To stop receiving notification emails like this one, please contact
deki@apache.org.