View Javadoc
1   /*
2    * JBoss, Home of Professional Open Source
3    * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
4    * contributors by the @authors tag. See the copyright.txt in the
5    * distribution for a full listing of individual contributors.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * http://www.apache.org/licenses/LICENSE-2.0
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.jboss.as.quickstarts.tasksJsf;
18  
19  import java.util.Iterator;
20  
21  import javax.faces.application.Application;
22  import javax.faces.application.FacesMessage;
23  import javax.faces.application.FacesMessage.Severity;
24  import javax.faces.component.UIViewRoot;
25  import javax.faces.context.ExternalContext;
26  import javax.faces.context.FacesContext;
27  import javax.faces.context.ResponseStream;
28  import javax.faces.context.ResponseWriter;
29  import javax.faces.render.RenderKit;
30  
31  /**
32   * Stub of {@link FacesContext} to allow testing without real JSF session.
33   * 
34   * @author Lukas Fryc
35   * 
36   */
37  public class FacesContextStub extends FacesContext {
38  
39      FacesContextStub(String test) {
40      }
41  
42      public static void setCurrentInstance(FacesContext facesContext) {
43          FacesContext.setCurrentInstance(facesContext);
44      }
45  
46      @Override
47      public Application getApplication() {
48          return null;
49      }
50  
51      @Override
52      public Iterator<String> getClientIdsWithMessages() {
53          return null;
54      }
55  
56      @Override
57      public ExternalContext getExternalContext() {
58          return null;
59      }
60  
61      @Override
62      public Severity getMaximumSeverity() {
63          return null;
64      }
65  
66      @Override
67      public Iterator<FacesMessage> getMessages() {
68          return null;
69      }
70  
71      @Override
72      public Iterator<FacesMessage> getMessages(String clientId) {
73          return null;
74      }
75  
76      @Override
77      public RenderKit getRenderKit() {
78          return null;
79      }
80  
81      @Override
82      public boolean getRenderResponse() {
83          return false;
84      }
85  
86      @Override
87      public boolean getResponseComplete() {
88          return false;
89      }
90  
91      @Override
92      public ResponseStream getResponseStream() {
93  
94          return null;
95      }
96  
97      @Override
98      public void setResponseStream(ResponseStream responseStream) {
99  
100     }
101 
102     @Override
103     public ResponseWriter getResponseWriter() {
104 
105         return null;
106     }
107 
108     @Override
109     public void setResponseWriter(ResponseWriter responseWriter) {
110 
111     }
112 
113     @Override
114     public UIViewRoot getViewRoot() {
115 
116         return null;
117     }
118 
119     @Override
120     public void setViewRoot(UIViewRoot root) {
121 
122     }
123 
124     @Override
125     public void addMessage(String clientId, FacesMessage message) {
126 
127     }
128 
129     @Override
130     public void release() {
131 
132     }
133 
134     @Override
135     public void renderResponse() {
136 
137     }
138 
139     @Override
140     public void responseComplete() {
141 
142     }
143 
144 }