1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.mc.test.core.runner; |
20 | |
|
21 | |
import java.io.FileNotFoundException; |
22 | |
import java.io.IOException; |
23 | |
import java.io.InputStream; |
24 | |
import java.lang.reflect.Constructor; |
25 | |
import java.lang.reflect.Field; |
26 | |
import java.lang.reflect.InvocationTargetException; |
27 | |
import java.lang.reflect.Method; |
28 | |
import java.net.URI; |
29 | |
import java.net.URL; |
30 | |
import java.net.URLClassLoader; |
31 | |
import java.util.List; |
32 | |
import java.util.Map; |
33 | |
import java.util.concurrent.ConcurrentHashMap; |
34 | |
import java.util.logging.Level; |
35 | |
import java.util.logging.Logger; |
36 | |
import javax.el.ExpressionFactory; |
37 | |
import javax.faces.FacesException; |
38 | |
import javax.faces.FactoryFinder; |
39 | |
import javax.faces.application.Application; |
40 | |
import javax.faces.application.FacesMessage; |
41 | |
import javax.faces.application.ProjectStage; |
42 | |
import javax.faces.application.ViewHandler; |
43 | |
import javax.faces.component.UIViewRoot; |
44 | |
import javax.faces.context.ExternalContext; |
45 | |
import javax.faces.context.FacesContext; |
46 | |
import javax.faces.context.FacesContextFactory; |
47 | |
import javax.faces.context.Flash; |
48 | |
import javax.faces.event.ExceptionQueuedEvent; |
49 | |
import javax.faces.event.ExceptionQueuedEventContext; |
50 | |
import javax.faces.event.PhaseId; |
51 | |
import javax.faces.event.PhaseListener; |
52 | |
import javax.faces.event.PreRenderViewEvent; |
53 | |
import javax.faces.lifecycle.Lifecycle; |
54 | |
import javax.faces.lifecycle.LifecycleFactory; |
55 | |
import javax.faces.view.ViewDeclarationLanguage; |
56 | |
import javax.faces.webapp.FacesServlet; |
57 | |
import javax.naming.Context; |
58 | |
import javax.servlet.ServletContext; |
59 | |
import javax.servlet.ServletContextEvent; |
60 | |
import javax.servlet.ServletContextListener; |
61 | |
import javax.servlet.http.HttpServletResponse; |
62 | |
import org.apache.myfaces.config.ConfigFilesXmlValidationUtils; |
63 | |
import org.apache.myfaces.config.DefaultFacesConfigurationProvider; |
64 | |
import org.apache.myfaces.config.RuntimeConfig; |
65 | |
import org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider; |
66 | |
import org.apache.myfaces.config.element.FacesConfig; |
67 | |
import org.apache.myfaces.config.impl.digester.elements.FactoryImpl; |
68 | |
import org.apache.myfaces.lifecycle.LifecycleImpl; |
69 | |
import org.apache.myfaces.lifecycle.ViewNotFoundException; |
70 | |
import org.apache.myfaces.mc.test.core.annotation.BeforeJSFInit; |
71 | |
import org.apache.myfaces.mc.test.core.mock.MockMyFacesViewDeclarationLanguageFactory; |
72 | |
import org.apache.myfaces.mc.test.core.annotation.DeclareFacesConfig; |
73 | |
import org.apache.myfaces.mc.test.core.annotation.ManagedBeans; |
74 | |
import org.apache.myfaces.mc.test.core.annotation.TestConfig; |
75 | |
import org.apache.myfaces.mc.test.core.annotation.PageBean; |
76 | |
import org.apache.myfaces.mc.test.core.annotation.SetupWebConfigParams; |
77 | |
import org.apache.myfaces.mc.test.core.annotation.TestServletListeners; |
78 | |
import org.apache.myfaces.mc.test.core.mock.DefaultContext; |
79 | |
import org.apache.myfaces.mc.test.core.mock.MockInitialContextFactory; |
80 | |
import org.apache.myfaces.shared.config.MyfacesConfig; |
81 | |
import org.apache.myfaces.shared.util.ClassUtils; |
82 | |
import org.apache.myfaces.spi.FacesConfigurationProvider; |
83 | |
import org.apache.myfaces.spi.InjectionProvider; |
84 | |
import org.apache.myfaces.spi.impl.CDIAnnotationDelegateInjectionProvider; |
85 | |
import org.apache.myfaces.spi.impl.DefaultFacesConfigurationProviderFactory; |
86 | |
import org.apache.myfaces.spi.impl.NoInjectionAnnotationInjectionProvider; |
87 | |
import org.apache.myfaces.test.el.MockExpressionFactory; |
88 | |
import org.apache.myfaces.test.mock.MockPrintWriter; |
89 | |
import org.apache.myfaces.test.mock.MockServletConfig; |
90 | |
import org.apache.myfaces.test.mock.MockServletContext; |
91 | |
import org.apache.myfaces.test.mock.MockWebContainer; |
92 | |
import org.apache.myfaces.util.ExternalSpecifications; |
93 | |
import org.apache.myfaces.webapp.AbstractFacesInitializer; |
94 | |
import org.apache.myfaces.webapp.FacesInitializer; |
95 | |
import org.apache.myfaces.webapp.StartupServletContextListener; |
96 | |
import org.junit.runners.model.FrameworkMethod; |
97 | |
import org.junit.runners.model.TestClass; |
98 | |
import org.xml.sax.SAXException; |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | 0 | public class AbstractJsfTestContainer |
104 | |
{ |
105 | |
private static final Class<?> PHASE_EXECUTOR_CLASS; |
106 | |
private static final Class<?> PHASE_MANAGER_CLASS; |
107 | |
|
108 | |
static { |
109 | 0 | Class<?> phaseExecutorClass = null; |
110 | 0 | Class<?> phaseManagerClass = null; |
111 | |
try |
112 | |
{ |
113 | 0 | phaseExecutorClass = Class.forName("org.apache.myfaces.lifecycle.PhaseExecutor"); |
114 | 0 | phaseManagerClass = Class.forName("org.apache.myfaces.lifecycle.PhaseListenerManager"); |
115 | |
} |
116 | 0 | catch (ClassNotFoundException e) |
117 | |
{ |
118 | |
|
119 | 0 | } |
120 | 0 | PHASE_EXECUTOR_CLASS = phaseExecutorClass; |
121 | 0 | PHASE_MANAGER_CLASS = phaseManagerClass; |
122 | |
} |
123 | |
|
124 | |
public static final String PHASE_MANAGER_INSTANCE = "org.apache.myfaces.test.PHASE_MANAGER_INSTANCE"; |
125 | |
|
126 | |
public static final String LAST_PHASE_PROCESSED = "oam.LAST_PHASE_PROCESSED"; |
127 | |
|
128 | |
public static final String LAST_RENDER_PHASE_STEP = "oam.LAST_RENDER_PHASE_STEP"; |
129 | |
|
130 | |
public static final int BEFORE_RENDER_STEP = 1; |
131 | |
public static final int BUILD_VIEW_CYCLE_STEP = 2; |
132 | |
public static final int VIEWHANDLER_RENDER_STEP = 3; |
133 | |
public static final int AFTER_RENDER_STEP = 4; |
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
public AbstractJsfTestContainer(TestClass testClass) |
143 | 0 | { |
144 | 0 | this.testClass = testClass; |
145 | 0 | } |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
public void setUp(Object testInstance) |
154 | |
{ |
155 | 0 | this.testInstance = testInstance; |
156 | |
|
157 | 0 | setUpClassloader(); |
158 | |
|
159 | 0 | jsfConfiguration = sharedConfiguration.get(getTestJavaClass().getName()); |
160 | 0 | if (jsfConfiguration == null) |
161 | |
{ |
162 | 0 | jsfConfiguration = new SharedFacesConfiguration(); |
163 | |
} |
164 | |
|
165 | 0 | TestConfig testConfig = getTestJavaClass().getAnnotation(TestConfig.class); |
166 | 0 | boolean enableJNDI = (testConfig != null) ? testConfig.enableJNDI() : true; |
167 | 0 | if (enableJNDI) |
168 | |
{ |
169 | 0 | System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockInitialContextFactory.class.getName()); |
170 | 0 | jndiContext = new DefaultContext(); |
171 | 0 | MockInitialContextFactory.setCurrentContext(jndiContext); |
172 | |
} |
173 | |
|
174 | |
|
175 | 0 | setUpServletObjects(); |
176 | |
|
177 | |
|
178 | 0 | FactoryFinder.releaseFactories(); |
179 | |
|
180 | 0 | setUpServletListeners(); |
181 | |
|
182 | 0 | webContainer.contextInitialized(new ServletContextEvent(servletContext)); |
183 | |
|
184 | 0 | setUpFacesServlet(); |
185 | |
|
186 | 0 | sharedConfiguration.put(getTestJavaClass().getName(), jsfConfiguration); |
187 | 0 | } |
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
protected void setUpClassloader() |
197 | |
{ |
198 | |
|
199 | 0 | threadContextClassLoader = Thread.currentThread() |
200 | |
.getContextClassLoader(); |
201 | 0 | Thread.currentThread() |
202 | |
.setContextClassLoader( |
203 | |
new URLClassLoader(new URL[0], this.getClass() |
204 | |
.getClassLoader())); |
205 | 0 | classLoaderSet = true; |
206 | 0 | } |
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
protected void setUpServletObjects() |
219 | |
{ |
220 | 0 | servletContext = new MockServletContext(); |
221 | 0 | servletConfig = new MockServletConfig(servletContext); |
222 | 0 | servletContext.setDocumentRoot(getWebappContextURI()); |
223 | 0 | webContainer = new MockWebContainer(); |
224 | 0 | servletContext.setWebContainer(webContainer); |
225 | 0 | setUpWebConfigParams(); |
226 | 0 | } |
227 | |
|
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
|
233 | |
|
234 | |
|
235 | |
|
236 | |
|
237 | |
|
238 | |
|
239 | |
|
240 | |
protected void setUpWebConfigParams() |
241 | |
{ |
242 | |
|
243 | 0 | servletContext.addInitParameter("org.apache.myfaces.INITIALIZE_ALWAYS_STANDALONE", "true"); |
244 | 0 | servletContext.addInitParameter("javax.faces.PROJECT_STAGE", "UnitTest"); |
245 | 0 | servletContext.addInitParameter("javax.faces.PARTIAL_STATE_SAVING", "true"); |
246 | 0 | servletContext.addInitParameter(ViewHandler.FACELETS_REFRESH_PERIOD_PARAM_NAME,"-1"); |
247 | 0 | servletContext.addInitParameter("org.apache.myfaces.config.annotation.LifecycleProvider", |
248 | |
NoInjectionAnnotationLifecycleProvider.class.getName()); |
249 | |
|
250 | 0 | TestConfig testConfig = getTestJavaClass().getAnnotation(TestConfig.class); |
251 | 0 | if (testConfig != null && testConfig.oamAnnotationScanPackages() != null && |
252 | |
testConfig.oamAnnotationScanPackages().length() > 0) |
253 | |
{ |
254 | 0 | servletContext.addInitParameter("org.apache.myfaces.annotation.SCAN_PACKAGES", |
255 | |
testConfig.oamAnnotationScanPackages()); |
256 | |
} |
257 | |
|
258 | 0 | List<FrameworkMethod> setupWebConfigParamMethods = testClass.getAnnotatedMethods(SetupWebConfigParams.class); |
259 | 0 | if (setupWebConfigParamMethods != null && !setupWebConfigParamMethods.isEmpty()) |
260 | |
{ |
261 | 0 | for (FrameworkMethod fm : setupWebConfigParamMethods) |
262 | |
{ |
263 | |
try |
264 | |
{ |
265 | 0 | fm.invokeExplosively(testInstance); |
266 | |
} |
267 | 0 | catch (Throwable ex) |
268 | |
{ |
269 | 0 | throw new FacesException(ex); |
270 | 0 | } |
271 | 0 | } |
272 | |
} |
273 | 0 | } |
274 | |
|
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
|
281 | |
|
282 | |
protected URI getWebappContextURI() |
283 | |
{ |
284 | |
try |
285 | |
{ |
286 | 0 | ClassLoader cl = Thread.currentThread().getContextClassLoader(); |
287 | 0 | URL url = cl.getResource(getWebappResourcePath()); |
288 | 0 | if (url == null) |
289 | |
{ |
290 | 0 | throw new FileNotFoundException(cl.getResource("").getFile() |
291 | |
+ getWebappResourcePath() + " was not found"); |
292 | |
} |
293 | |
else |
294 | |
{ |
295 | 0 | return new URI(url.toString()); |
296 | |
} |
297 | |
} |
298 | 0 | catch (Exception e) |
299 | |
{ |
300 | 0 | throw new RuntimeException("Error Initializing Context", e); |
301 | |
} |
302 | |
} |
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
protected String getWebappResourcePath() |
312 | |
{ |
313 | 0 | TestConfig testConfig = getTestJavaClass().getAnnotation(TestConfig.class); |
314 | 0 | if (testConfig != null && testConfig.webappResourcePath() != null && |
315 | |
!"testClassResourcePackage".equals(testConfig.webappResourcePath())) |
316 | |
{ |
317 | 0 | return testConfig.webappResourcePath(); |
318 | |
} |
319 | 0 | return getTestJavaClass().getName().substring(0, |
320 | |
getTestJavaClass().getName().lastIndexOf('.')).replace('.', '/') |
321 | |
+ "/"; |
322 | |
} |
323 | |
|
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
protected ExpressionFactory createExpressionFactory() |
331 | |
{ |
332 | 0 | TestConfig testConfig = getTestJavaClass().getAnnotation(TestConfig.class); |
333 | 0 | if (testConfig != null && testConfig.expressionFactory() != null && |
334 | |
testConfig.expressionFactory().length() > 0) |
335 | |
{ |
336 | 0 | return (ExpressionFactory) ClassUtils.newInstance( |
337 | |
testConfig.expressionFactory(), ExpressionFactory.class); |
338 | |
} |
339 | 0 | return new MockExpressionFactory(); |
340 | |
} |
341 | |
|
342 | |
|
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
protected void setUpServlets() throws Exception |
348 | |
{ |
349 | 0 | setUpFacesServlet(); |
350 | 0 | } |
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
|
356 | |
|
357 | |
protected void setUpServletListeners() |
358 | |
{ |
359 | 0 | TestServletListeners testServletListeners = getTestJavaClass().getAnnotation(TestServletListeners.class); |
360 | 0 | if (testServletListeners != null && testServletListeners.value() != null) |
361 | |
{ |
362 | 0 | for (String listener : testServletListeners.value()) |
363 | |
{ |
364 | |
try |
365 | |
{ |
366 | 0 | webContainer.subscribeListener(listener); |
367 | |
} |
368 | 0 | catch (Exception ex) |
369 | |
{ |
370 | 0 | throw new FacesException(ex); |
371 | 0 | } |
372 | |
} |
373 | |
} |
374 | |
|
375 | |
|
376 | 0 | webContainer.subscribeListener(new ServletContextListener() |
377 | 0 | { |
378 | |
@Override |
379 | |
public void contextInitialized(ServletContextEvent sce) |
380 | |
{ |
381 | 0 | List<FrameworkMethod> setupWebConfigParamMethods = testClass.getAnnotatedMethods(BeforeJSFInit.class); |
382 | 0 | if (setupWebConfigParamMethods != null && !setupWebConfigParamMethods.isEmpty()) |
383 | |
{ |
384 | 0 | for (FrameworkMethod fm : setupWebConfigParamMethods) |
385 | |
{ |
386 | |
try |
387 | |
{ |
388 | 0 | fm.invokeExplosively(testInstance); |
389 | |
} |
390 | 0 | catch (Throwable ex) |
391 | |
{ |
392 | 0 | throw new FacesException(ex); |
393 | 0 | } |
394 | 0 | } |
395 | |
} |
396 | 0 | } |
397 | |
|
398 | |
@Override |
399 | |
public void contextDestroyed(ServletContextEvent sce) |
400 | |
{ |
401 | 0 | } |
402 | |
|
403 | |
}); |
404 | |
|
405 | |
|
406 | |
|
407 | 0 | setUpMyFaces(); |
408 | 0 | } |
409 | |
|
410 | |
|
411 | |
|
412 | |
|
413 | |
|
414 | |
protected FacesConfigurationProvider createFacesConfigurationProvider() |
415 | |
{ |
416 | 0 | return new MyFacesMockFacesConfigurationProvider(); |
417 | |
} |
418 | |
|
419 | |
protected AbstractFacesInitializer createFacesInitializer() |
420 | |
{ |
421 | 0 | return new JUnitFacesInitializer(this); |
422 | |
} |
423 | |
|
424 | |
protected void setUpMyFaces() |
425 | |
{ |
426 | 0 | if (facesConfigurationProvider == null) |
427 | |
{ |
428 | 0 | facesConfigurationProvider = createFacesConfigurationProvider(); |
429 | |
} |
430 | 0 | servletContext.setAttribute( |
431 | |
DefaultFacesConfigurationProviderFactory.FACES_CONFIGURATION_PROVIDER_INSTANCE_KEY, |
432 | |
facesConfigurationProvider); |
433 | 0 | listener = new StartupServletContextListener(); |
434 | 0 | listener.setFacesInitializer(getFacesInitializer()); |
435 | 0 | webContainer.subscribeListener(listener); |
436 | |
|
437 | 0 | } |
438 | |
|
439 | |
protected void tearDownMyFaces() |
440 | |
{ |
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | 0 | } |
447 | |
|
448 | |
protected void setUpFacesServlet() |
449 | |
{ |
450 | 0 | lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); |
451 | 0 | facesContextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); |
452 | 0 | lifecycle = lifecycleFactory.getLifecycle(getLifecycleId()); |
453 | 0 | } |
454 | |
|
455 | |
protected void tearDownFacesServlet() |
456 | |
{ |
457 | 0 | lifecycleFactory = null; |
458 | 0 | facesContextFactory = null; |
459 | 0 | } |
460 | |
|
461 | |
protected void tearDownServlets() |
462 | |
{ |
463 | 0 | tearDownFacesServlet(); |
464 | 0 | } |
465 | |
|
466 | |
protected void tearDownServletListeners() |
467 | |
{ |
468 | 0 | tearDownMyFaces(); |
469 | |
|
470 | 0 | } |
471 | |
|
472 | |
public void tearDown() |
473 | |
{ |
474 | 0 | tearDownServlets(); |
475 | |
|
476 | 0 | webContainer.contextDestroyed(new ServletContextEvent(servletContext)); |
477 | |
|
478 | 0 | tearDownServletListeners(); |
479 | |
|
480 | 0 | listener = null; |
481 | |
|
482 | 0 | servletConfig = null; |
483 | 0 | servletContext = null; |
484 | |
|
485 | 0 | FactoryFinder.releaseFactories(); |
486 | |
|
487 | 0 | if (jndiContext != null) |
488 | |
{ |
489 | 0 | MockInitialContextFactory.clearCurrentContext(); |
490 | |
} |
491 | |
|
492 | 0 | tearDownClassloader(); |
493 | 0 | } |
494 | |
|
495 | |
protected void tearDownClassloader() |
496 | |
{ |
497 | 0 | if (classLoaderSet) |
498 | |
{ |
499 | 0 | Thread.currentThread().setContextClassLoader(threadContextClassLoader); |
500 | 0 | threadContextClassLoader = null; |
501 | 0 | classLoaderSet = false; |
502 | |
} |
503 | 0 | } |
504 | |
|
505 | |
|
506 | |
public static void tearDownClass() |
507 | |
{ |
508 | 0 | standardFacesConfig = null; |
509 | 0 | sharedConfiguration.clear(); |
510 | 0 | } |
511 | |
|
512 | |
public static void tearDownClass(Class<?> targetTestClass) |
513 | |
{ |
514 | 0 | sharedConfiguration.remove(targetTestClass); |
515 | 0 | } |
516 | |
|
517 | |
private String getLifecycleId() |
518 | |
{ |
519 | |
|
520 | |
|
521 | |
|
522 | 0 | String serLifecycleId = servletConfig.getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR); |
523 | 0 | String appLifecycleId = servletConfig.getServletContext().getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR); |
524 | 0 | appLifecycleId = serLifecycleId == null ? appLifecycleId : serLifecycleId; |
525 | 0 | return appLifecycleId != null ? appLifecycleId : LifecycleFactory.DEFAULT_LIFECYCLE; |
526 | |
} |
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
|
532 | |
|
533 | |
public void processLifecycleExecute(FacesContext facesContext) |
534 | |
{ |
535 | 0 | lifecycle.attachWindow(facesContext); |
536 | 0 | lifecycle.execute(facesContext); |
537 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.INVOKE_APPLICATION); |
538 | 0 | } |
539 | |
|
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | |
|
545 | |
|
546 | |
public void restoreView(FacesContext facesContext) |
547 | |
{ |
548 | 0 | lifecycle.attachWindow(facesContext); |
549 | 0 | executePhase(facesContext, PhaseId.RESTORE_VIEW); |
550 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.RESTORE_VIEW); |
551 | 0 | } |
552 | |
|
553 | |
|
554 | |
|
555 | |
|
556 | |
|
557 | |
|
558 | |
|
559 | |
|
560 | |
public void applyRequestValues(FacesContext facesContext) |
561 | |
{ |
562 | 0 | if (facesContext.getRenderResponse() || facesContext.getResponseComplete()) |
563 | |
{ |
564 | 0 | return; |
565 | |
} |
566 | 0 | processRemainingPhasesBefore(facesContext, PhaseId.APPLY_REQUEST_VALUES); |
567 | 0 | executePhase(facesContext, PhaseId.APPLY_REQUEST_VALUES); |
568 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.APPLY_REQUEST_VALUES); |
569 | 0 | } |
570 | |
|
571 | |
|
572 | |
|
573 | |
|
574 | |
|
575 | |
|
576 | |
|
577 | |
|
578 | |
public void processValidations(FacesContext facesContext) |
579 | |
{ |
580 | 0 | if (facesContext.getRenderResponse() || facesContext.getResponseComplete()) |
581 | |
{ |
582 | 0 | return; |
583 | |
} |
584 | 0 | processRemainingPhasesBefore(facesContext, PhaseId.PROCESS_VALIDATIONS); |
585 | 0 | executePhase(facesContext, PhaseId.PROCESS_VALIDATIONS); |
586 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.PROCESS_VALIDATIONS); |
587 | 0 | } |
588 | |
|
589 | |
|
590 | |
|
591 | |
|
592 | |
|
593 | |
|
594 | |
|
595 | |
|
596 | |
public void updateModelValues(FacesContext facesContext) |
597 | |
{ |
598 | 0 | if (facesContext.getRenderResponse() || facesContext.getResponseComplete()) |
599 | |
{ |
600 | 0 | return; |
601 | |
} |
602 | 0 | processRemainingPhasesBefore(facesContext, PhaseId.UPDATE_MODEL_VALUES); |
603 | 0 | executePhase(facesContext, PhaseId.UPDATE_MODEL_VALUES); |
604 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.UPDATE_MODEL_VALUES); |
605 | |
|
606 | 0 | } |
607 | |
|
608 | |
|
609 | |
|
610 | |
|
611 | |
|
612 | |
|
613 | |
|
614 | |
|
615 | |
public void invokeApplication(FacesContext facesContext) |
616 | |
{ |
617 | 0 | if (facesContext.getRenderResponse() || facesContext.getResponseComplete()) |
618 | |
{ |
619 | 0 | return; |
620 | |
} |
621 | 0 | processRemainingPhasesBefore(facesContext, PhaseId.INVOKE_APPLICATION); |
622 | 0 | executePhase(facesContext, PhaseId.INVOKE_APPLICATION); |
623 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.INVOKE_APPLICATION); |
624 | 0 | } |
625 | |
|
626 | |
public void processLifecycleRender(FacesContext facesContext) |
627 | |
{ |
628 | 0 | renderResponse(facesContext); |
629 | 0 | } |
630 | |
|
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
public void renderResponse(FacesContext facesContext) |
637 | |
{ |
638 | 0 | processRemainingExecutePhases(facesContext); |
639 | 0 | lifecycle.render(facesContext); |
640 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.RENDER_RESPONSE); |
641 | 0 | facesContext.getAttributes().put(LAST_RENDER_PHASE_STEP, AFTER_RENDER_STEP); |
642 | 0 | } |
643 | |
|
644 | |
protected void processRemainingPhasesBefore(FacesContext facesContext, PhaseId phaseId) |
645 | |
{ |
646 | 0 | PhaseId lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
647 | 0 | if (lastPhaseId == null) |
648 | |
{ |
649 | 0 | if (!phaseId.equals(PhaseId.RESTORE_VIEW)) |
650 | |
{ |
651 | 0 | restoreView(facesContext); |
652 | 0 | lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
653 | |
} |
654 | |
else |
655 | |
{ |
656 | |
|
657 | 0 | return; |
658 | |
} |
659 | |
} |
660 | 0 | if (PhaseId.APPLY_REQUEST_VALUES.equals(phaseId)) |
661 | |
{ |
662 | 0 | return; |
663 | |
} |
664 | 0 | boolean continueProcess = false; |
665 | 0 | if (continueProcess || PhaseId.RESTORE_VIEW.equals(lastPhaseId)) |
666 | |
{ |
667 | 0 | applyRequestValues(facesContext); |
668 | 0 | lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
669 | 0 | continueProcess = true; |
670 | |
} |
671 | 0 | if (PhaseId.PROCESS_VALIDATIONS.equals(phaseId)) |
672 | |
{ |
673 | 0 | return; |
674 | |
} |
675 | 0 | if (continueProcess || PhaseId.APPLY_REQUEST_VALUES.equals(lastPhaseId)) |
676 | |
{ |
677 | 0 | processValidations(facesContext); |
678 | 0 | lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
679 | 0 | continueProcess = true; |
680 | |
} |
681 | 0 | if (PhaseId.UPDATE_MODEL_VALUES.equals(phaseId)) |
682 | |
{ |
683 | 0 | return; |
684 | |
} |
685 | 0 | if (continueProcess || PhaseId.PROCESS_VALIDATIONS.equals(lastPhaseId)) |
686 | |
{ |
687 | 0 | updateModelValues(facesContext); |
688 | 0 | lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
689 | 0 | continueProcess = true; |
690 | |
} |
691 | 0 | if (PhaseId.INVOKE_APPLICATION.equals(phaseId)) |
692 | |
{ |
693 | 0 | return; |
694 | |
} |
695 | 0 | if (continueProcess || PhaseId.UPDATE_MODEL_VALUES.equals(lastPhaseId)) |
696 | |
{ |
697 | 0 | invokeApplication(facesContext); |
698 | 0 | lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
699 | 0 | continueProcess = true; |
700 | |
} |
701 | 0 | if (PhaseId.RENDER_RESPONSE.equals(phaseId)) |
702 | |
{ |
703 | 0 | return; |
704 | |
} |
705 | 0 | if (continueProcess || PhaseId.INVOKE_APPLICATION.equals(lastPhaseId)) |
706 | |
{ |
707 | 0 | renderResponse(facesContext); |
708 | 0 | lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
709 | 0 | continueProcess = true; |
710 | |
} |
711 | 0 | } |
712 | |
|
713 | |
public void processRemainingExecutePhases(FacesContext facesContext) |
714 | |
{ |
715 | 0 | PhaseId lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
716 | 0 | if (lastPhaseId == null) |
717 | |
{ |
718 | 0 | processLifecycleExecute(facesContext); |
719 | 0 | return; |
720 | |
} |
721 | |
else |
722 | |
{ |
723 | 0 | boolean continueProcess = false; |
724 | 0 | if (PhaseId.RESTORE_VIEW.equals(lastPhaseId)) |
725 | |
{ |
726 | 0 | applyRequestValues(facesContext); |
727 | 0 | continueProcess = true; |
728 | |
} |
729 | 0 | if (continueProcess || PhaseId.APPLY_REQUEST_VALUES.equals(lastPhaseId)) |
730 | |
{ |
731 | 0 | processValidations(facesContext); |
732 | 0 | continueProcess = true; |
733 | |
} |
734 | 0 | if (continueProcess || PhaseId.PROCESS_VALIDATIONS.equals(lastPhaseId)) |
735 | |
{ |
736 | 0 | updateModelValues(facesContext); |
737 | 0 | continueProcess = true; |
738 | |
} |
739 | 0 | if (continueProcess || PhaseId.UPDATE_MODEL_VALUES.equals(lastPhaseId)) |
740 | |
{ |
741 | 0 | invokeApplication(facesContext); |
742 | 0 | continueProcess = true; |
743 | |
} |
744 | |
} |
745 | 0 | } |
746 | |
|
747 | |
public void processRemainingPhases(FacesContext facesContext) |
748 | |
{ |
749 | 0 | PhaseId lastPhaseId = (PhaseId) facesContext.getAttributes().get(LAST_PHASE_PROCESSED); |
750 | 0 | if (lastPhaseId == null) |
751 | |
{ |
752 | 0 | processLifecycleExecute(facesContext); |
753 | 0 | renderResponse(facesContext); |
754 | 0 | return; |
755 | |
} |
756 | |
else |
757 | |
{ |
758 | 0 | boolean continueProcess = false; |
759 | 0 | if (PhaseId.RESTORE_VIEW.equals(lastPhaseId)) |
760 | |
{ |
761 | 0 | applyRequestValues(facesContext); |
762 | 0 | continueProcess = true; |
763 | |
} |
764 | 0 | if (continueProcess || PhaseId.APPLY_REQUEST_VALUES.equals(lastPhaseId)) |
765 | |
{ |
766 | 0 | processValidations(facesContext); |
767 | 0 | continueProcess = true; |
768 | |
} |
769 | 0 | if (continueProcess || PhaseId.PROCESS_VALIDATIONS.equals(lastPhaseId)) |
770 | |
{ |
771 | 0 | updateModelValues(facesContext); |
772 | 0 | continueProcess = true; |
773 | |
} |
774 | 0 | if (continueProcess || PhaseId.UPDATE_MODEL_VALUES.equals(lastPhaseId)) |
775 | |
{ |
776 | 0 | invokeApplication(facesContext); |
777 | 0 | continueProcess = true; |
778 | |
} |
779 | 0 | if (continueProcess || PhaseId.INVOKE_APPLICATION.equals(lastPhaseId)) |
780 | |
{ |
781 | 0 | Integer step = (Integer) facesContext.getAttributes().get(LAST_RENDER_PHASE_STEP); |
782 | 0 | if (step == null) |
783 | |
{ |
784 | 0 | renderResponse(facesContext); |
785 | |
} |
786 | |
else |
787 | |
{ |
788 | 0 | if (BEFORE_RENDER_STEP == step.intValue()) |
789 | |
{ |
790 | 0 | executeBuildViewCycle(facesContext); |
791 | 0 | executeViewHandlerRender(facesContext); |
792 | 0 | executeAfterRender(facesContext); |
793 | |
} |
794 | 0 | else if (BUILD_VIEW_CYCLE_STEP == step.intValue()) |
795 | |
{ |
796 | 0 | executeViewHandlerRender(facesContext); |
797 | 0 | executeAfterRender(facesContext); |
798 | |
} |
799 | 0 | else if (VIEWHANDLER_RENDER_STEP == step.intValue()) |
800 | |
{ |
801 | 0 | executeAfterRender(facesContext); |
802 | |
} |
803 | |
} |
804 | |
} |
805 | |
} |
806 | 0 | } |
807 | |
|
808 | |
|
809 | |
|
810 | |
|
811 | |
|
812 | |
|
813 | |
|
814 | |
protected boolean isScanAnnotations() |
815 | |
{ |
816 | 0 | TestConfig testConfig = getTestJavaClass().getAnnotation(TestConfig.class); |
817 | 0 | if (testConfig != null) |
818 | |
{ |
819 | 0 | return testConfig.scanAnnotations(); |
820 | |
} |
821 | 0 | return false; |
822 | |
} |
823 | |
|
824 | |
public void executeBeforeRender(FacesContext facesContext) |
825 | |
{ |
826 | 0 | if (lifecycle instanceof LifecycleImpl) |
827 | |
{ |
828 | 0 | LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle; |
829 | |
|
830 | 0 | Object phaseExecutor = null; |
831 | 0 | Object phaseManager = null; |
832 | |
try |
833 | |
{ |
834 | 0 | Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor"); |
835 | 0 | if (!renderExecutorField.isAccessible()) |
836 | |
{ |
837 | 0 | renderExecutorField.setAccessible(true); |
838 | |
} |
839 | 0 | phaseExecutor = renderExecutorField.get(lifecycleImpl); |
840 | |
|
841 | 0 | if (facesContext.getResponseComplete()) |
842 | |
{ |
843 | 0 | return; |
844 | |
} |
845 | |
|
846 | 0 | phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE); |
847 | 0 | if (phaseManager == null) |
848 | |
{ |
849 | 0 | Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners"); |
850 | 0 | if (!getPhaseListenersMethod.isAccessible()) |
851 | |
{ |
852 | 0 | getPhaseListenersMethod.setAccessible(true); |
853 | |
} |
854 | |
|
855 | 0 | Constructor<?> plmc = PHASE_MANAGER_CLASS.getDeclaredConstructor( |
856 | |
new Class[]{Lifecycle.class, FacesContext.class, PhaseListener[].class}); |
857 | 0 | if (!plmc.isAccessible()) |
858 | |
{ |
859 | 0 | plmc.setAccessible(true); |
860 | |
} |
861 | 0 | phaseManager = plmc.newInstance(lifecycle, facesContext, getPhaseListenersMethod.invoke( |
862 | |
lifecycleImpl, null)); |
863 | 0 | facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager); |
864 | |
} |
865 | |
} |
866 | 0 | catch (NoSuchFieldException ex) |
867 | |
{ |
868 | 0 | throw new IllegalStateException("Cannot get executors from LifecycleImpl", ex); |
869 | |
} |
870 | 0 | catch (SecurityException ex) |
871 | |
{ |
872 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
873 | |
} |
874 | 0 | catch (IllegalArgumentException ex) |
875 | |
{ |
876 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
877 | |
} |
878 | 0 | catch (IllegalAccessException ex) |
879 | |
{ |
880 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
881 | |
} |
882 | 0 | catch (NoSuchMethodException ex) |
883 | |
{ |
884 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
885 | |
} |
886 | 0 | catch (InvocationTargetException ex) |
887 | |
{ |
888 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
889 | |
} |
890 | 0 | catch (InstantiationException ex) |
891 | |
{ |
892 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
893 | 0 | } |
894 | |
|
895 | 0 | Flash flash = facesContext.getExternalContext().getFlash(); |
896 | |
|
897 | |
try |
898 | |
{ |
899 | 0 | facesContext.setCurrentPhaseId(PhaseId.RENDER_RESPONSE); |
900 | |
|
901 | 0 | flash.doPrePhaseActions(facesContext); |
902 | |
|
903 | |
|
904 | |
|
905 | |
|
906 | 0 | Method doPrePhaseActionsMethod = phaseExecutor.getClass().getMethod( |
907 | |
"doPrePhaseActions", FacesContext.class); |
908 | 0 | if(!(doPrePhaseActionsMethod.isAccessible())) |
909 | |
{ |
910 | 0 | doPrePhaseActionsMethod.setAccessible(true); |
911 | |
} |
912 | 0 | doPrePhaseActionsMethod.invoke(phaseExecutor, facesContext); |
913 | |
|
914 | |
|
915 | 0 | Method informPhaseListenersBeforeMethod = |
916 | |
phaseManager.getClass().getDeclaredMethod("informPhaseListenersBefore", PhaseId.class); |
917 | 0 | if(!(informPhaseListenersBeforeMethod.isAccessible())) |
918 | |
{ |
919 | 0 | informPhaseListenersBeforeMethod.setAccessible(true); |
920 | |
} |
921 | 0 | informPhaseListenersBeforeMethod.invoke(phaseManager, PhaseId.RENDER_RESPONSE); |
922 | |
|
923 | |
|
924 | 0 | if (facesContext.getResponseComplete()) |
925 | |
{ |
926 | 0 | return; |
927 | |
} |
928 | |
|
929 | |
|
930 | |
} |
931 | |
|
932 | 0 | catch (Throwable e) |
933 | |
{ |
934 | |
|
935 | 0 | ExceptionQueuedEventContext context = new ExceptionQueuedEventContext ( |
936 | |
facesContext, e, null, PhaseId.RENDER_RESPONSE); |
937 | 0 | facesContext.getApplication().publishEvent (facesContext, ExceptionQueuedEvent.class, context); |
938 | |
} |
939 | |
|
940 | |
finally |
941 | 0 | { |
942 | |
|
943 | |
|
944 | |
|
945 | |
|
946 | |
|
947 | |
|
948 | |
|
949 | |
|
950 | 0 | } |
951 | |
|
952 | 0 | facesContext.getExceptionHandler().handle(); |
953 | |
|
954 | |
|
955 | 0 | facesContext.getAttributes().remove(PHASE_MANAGER_INSTANCE); |
956 | |
|
957 | 0 | facesContext.getAttributes().put(LAST_RENDER_PHASE_STEP, BEFORE_RENDER_STEP); |
958 | 0 | } |
959 | |
else |
960 | |
{ |
961 | 0 | throw new UnsupportedOperationException("Cannot execute phase on custom lifecycle instances"); |
962 | |
} |
963 | 0 | } |
964 | |
|
965 | |
public void executeBuildViewCycle(FacesContext facesContext) |
966 | |
{ |
967 | 0 | Application application = facesContext.getApplication(); |
968 | 0 | ViewHandler viewHandler = application.getViewHandler(); |
969 | |
UIViewRoot root; |
970 | |
UIViewRoot previousRoot; |
971 | |
String viewId; |
972 | |
String newViewId; |
973 | |
boolean isNotSameRoot; |
974 | 0 | int loops = 0; |
975 | 0 | int maxLoops = 15; |
976 | |
|
977 | 0 | if (facesContext.getViewRoot() == null) |
978 | |
{ |
979 | 0 | throw new ViewNotFoundException("A view is required to execute "+facesContext.getCurrentPhaseId()); |
980 | |
} |
981 | |
|
982 | |
try |
983 | |
{ |
984 | |
|
985 | |
do |
986 | |
{ |
987 | 0 | root = facesContext.getViewRoot(); |
988 | 0 | previousRoot = root; |
989 | 0 | viewId = root.getViewId(); |
990 | |
|
991 | 0 | ViewDeclarationLanguage vdl = viewHandler.getViewDeclarationLanguage( |
992 | |
facesContext, viewId); |
993 | 0 | if (vdl != null) |
994 | |
{ |
995 | 0 | vdl.buildView(facesContext, root); |
996 | |
} |
997 | |
|
998 | |
|
999 | |
|
1000 | |
|
1001 | 0 | application.publishEvent(facesContext, PreRenderViewEvent.class, root); |
1002 | |
|
1003 | |
|
1004 | 0 | if (facesContext.getResponseComplete()) |
1005 | |
{ |
1006 | 0 | return; |
1007 | |
} |
1008 | |
|
1009 | 0 | root = facesContext.getViewRoot(); |
1010 | |
|
1011 | 0 | newViewId = root.getViewId(); |
1012 | |
|
1013 | 0 | isNotSameRoot = !( (newViewId == null ? newViewId == viewId : newViewId.equals(viewId) ) && |
1014 | |
previousRoot.equals(root) ); |
1015 | |
|
1016 | 0 | loops++; |
1017 | |
} |
1018 | 0 | while ((newViewId == null && viewId != null) |
1019 | |
|| (newViewId != null && (!newViewId.equals(viewId) || isNotSameRoot ) ) && loops < maxLoops); |
1020 | |
|
1021 | 0 | if (loops == maxLoops) |
1022 | |
{ |
1023 | |
|
1024 | 0 | boolean production = facesContext.isProjectStage(ProjectStage.Production); |
1025 | |
|
1026 | |
|
1027 | |
|
1028 | |
|
1029 | |
|
1030 | |
|
1031 | |
|
1032 | |
} |
1033 | |
|
1034 | 0 | facesContext.getAttributes().put(LAST_RENDER_PHASE_STEP, BUILD_VIEW_CYCLE_STEP); |
1035 | |
} |
1036 | 0 | catch (IOException e) |
1037 | |
{ |
1038 | 0 | throw new FacesException(e.getMessage(), e); |
1039 | 0 | } |
1040 | 0 | } |
1041 | |
|
1042 | |
public void executeViewHandlerRender(FacesContext facesContext) |
1043 | |
{ |
1044 | 0 | Application application = facesContext.getApplication(); |
1045 | 0 | ViewHandler viewHandler = application.getViewHandler(); |
1046 | |
|
1047 | |
try |
1048 | |
{ |
1049 | 0 | viewHandler.renderView(facesContext, facesContext.getViewRoot()); |
1050 | |
|
1051 | |
|
1052 | |
|
1053 | |
|
1054 | |
|
1055 | 0 | List<FacesMessage> messageList = facesContext.getMessageList(); |
1056 | 0 | if (!messageList.isEmpty()) |
1057 | |
{ |
1058 | 0 | StringBuilder builder = new StringBuilder(); |
1059 | |
|
1060 | 0 | for (int i = 0, size = messageList.size(); i < size; i++) |
1061 | |
{ |
1062 | 0 | FacesMessage message = messageList.get(i); |
1063 | 0 | if (!message.isRendered()) |
1064 | |
{ |
1065 | 0 | builder.append("\n- "); |
1066 | 0 | builder.append(message.getDetail()); |
1067 | |
|
1068 | |
|
1069 | |
} |
1070 | |
} |
1071 | |
|
1072 | |
|
1073 | |
|
1074 | |
|
1075 | |
|
1076 | |
|
1077 | |
|
1078 | |
} |
1079 | 0 | facesContext.getAttributes().put(LAST_RENDER_PHASE_STEP, VIEWHANDLER_RENDER_STEP); |
1080 | |
} |
1081 | 0 | catch (IOException e) |
1082 | |
{ |
1083 | 0 | throw new FacesException(e.getMessage(), e); |
1084 | 0 | } |
1085 | 0 | } |
1086 | |
|
1087 | |
public void executeAfterRender(FacesContext facesContext) |
1088 | |
{ |
1089 | 0 | if (lifecycle instanceof LifecycleImpl) |
1090 | |
{ |
1091 | 0 | LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle; |
1092 | |
|
1093 | 0 | Object phaseExecutor = null; |
1094 | 0 | Object phaseManager = null; |
1095 | 0 | Method informPhaseListenersAfterMethod = null; |
1096 | |
try |
1097 | |
{ |
1098 | 0 | Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor"); |
1099 | 0 | if (!renderExecutorField.isAccessible()) |
1100 | |
{ |
1101 | 0 | renderExecutorField.setAccessible(true); |
1102 | |
} |
1103 | 0 | phaseExecutor = renderExecutorField.get(lifecycleImpl); |
1104 | |
|
1105 | 0 | phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE); |
1106 | 0 | if (phaseManager == null) |
1107 | |
{ |
1108 | 0 | Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners"); |
1109 | 0 | if (!getPhaseListenersMethod.isAccessible()) |
1110 | |
{ |
1111 | 0 | getPhaseListenersMethod.setAccessible(true); |
1112 | |
} |
1113 | |
|
1114 | 0 | Constructor<?> plmc = PHASE_MANAGER_CLASS.getDeclaredConstructor( |
1115 | |
new Class[]{Lifecycle.class, FacesContext.class, PhaseListener[].class}); |
1116 | 0 | if (!plmc.isAccessible()) |
1117 | |
{ |
1118 | 0 | plmc.setAccessible(true); |
1119 | |
} |
1120 | 0 | phaseManager = plmc.newInstance(lifecycle, facesContext, |
1121 | |
getPhaseListenersMethod.invoke(lifecycleImpl, null)); |
1122 | 0 | facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager); |
1123 | |
} |
1124 | |
|
1125 | |
|
1126 | 0 | informPhaseListenersAfterMethod = phaseManager.getClass().getDeclaredMethod( |
1127 | |
"informPhaseListenersAfter", PhaseId.class); |
1128 | 0 | if(!(informPhaseListenersAfterMethod.isAccessible())) |
1129 | |
{ |
1130 | 0 | informPhaseListenersAfterMethod.setAccessible(true); |
1131 | |
} |
1132 | |
|
1133 | 0 | informPhaseListenersAfterMethod.invoke(phaseManager, PhaseId.RENDER_RESPONSE); |
1134 | |
} |
1135 | 0 | catch (NoSuchFieldException ex) |
1136 | |
{ |
1137 | 0 | throw new IllegalStateException("Cannot get executors from LifecycleImpl", ex); |
1138 | |
} |
1139 | 0 | catch (SecurityException ex) |
1140 | |
{ |
1141 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1142 | |
} |
1143 | 0 | catch (IllegalArgumentException ex) |
1144 | |
{ |
1145 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1146 | |
} |
1147 | 0 | catch (IllegalAccessException ex) |
1148 | |
{ |
1149 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1150 | |
} |
1151 | 0 | catch (NoSuchMethodException ex) |
1152 | |
{ |
1153 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1154 | |
} |
1155 | 0 | catch (InvocationTargetException ex) |
1156 | |
{ |
1157 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1158 | |
} |
1159 | 0 | catch (InstantiationException ex) |
1160 | |
{ |
1161 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1162 | 0 | } |
1163 | |
|
1164 | 0 | Flash flash = facesContext.getExternalContext().getFlash(); |
1165 | |
|
1166 | 0 | flash.doPostPhaseActions(facesContext); |
1167 | |
|
1168 | 0 | facesContext.getExceptionHandler().handle(); |
1169 | |
|
1170 | 0 | facesContext.getAttributes().remove(PHASE_MANAGER_INSTANCE); |
1171 | |
|
1172 | 0 | facesContext.getAttributes().put(LAST_RENDER_PHASE_STEP, AFTER_RENDER_STEP); |
1173 | |
|
1174 | 0 | facesContext.getAttributes().put(LAST_PHASE_PROCESSED, PhaseId.RENDER_RESPONSE); |
1175 | 0 | } |
1176 | |
else |
1177 | |
{ |
1178 | 0 | throw new UnsupportedOperationException("Cannot execute phase on custom lifecycle instances"); |
1179 | |
} |
1180 | 0 | } |
1181 | |
|
1182 | |
|
1183 | |
|
1184 | |
|
1185 | |
|
1186 | |
|
1187 | |
|
1188 | |
|
1189 | |
protected void executePhase(FacesContext facesContext, PhaseId phase) |
1190 | |
{ |
1191 | 0 | if (lifecycle instanceof LifecycleImpl) |
1192 | |
{ |
1193 | 0 | LifecycleImpl lifecycleImpl = (LifecycleImpl) lifecycle; |
1194 | |
|
1195 | 0 | int phaseId = phase.equals(PhaseId.RESTORE_VIEW) ? 0 : |
1196 | |
phase.equals(PhaseId.APPLY_REQUEST_VALUES) ? 1 : |
1197 | |
phase.equals(PhaseId.PROCESS_VALIDATIONS) ? 2 : |
1198 | |
phase.equals(PhaseId.UPDATE_MODEL_VALUES) ? 3 : |
1199 | |
phase.equals(PhaseId.INVOKE_APPLICATION) ? 4 : 5 ; |
1200 | |
|
1201 | 0 | Method executePhaseMethod = null; |
1202 | 0 | Object phaseManager = null; |
1203 | 0 | Object phaseExecutor = null; |
1204 | |
try |
1205 | |
{ |
1206 | 0 | if (phaseId < 5) |
1207 | |
{ |
1208 | |
Field lifecycleExecutorsField; |
1209 | 0 | lifecycleExecutorsField = lifecycleImpl.getClass().getDeclaredField("lifecycleExecutors"); |
1210 | 0 | if (!lifecycleExecutorsField.isAccessible()) |
1211 | |
{ |
1212 | 0 | lifecycleExecutorsField.setAccessible(true); |
1213 | |
} |
1214 | 0 | phaseExecutor = ((Object[])lifecycleExecutorsField.get(lifecycleImpl))[phaseId]; |
1215 | 0 | } |
1216 | |
else |
1217 | |
{ |
1218 | 0 | Field renderExecutorField = lifecycleImpl.getClass().getDeclaredField("renderExecutor"); |
1219 | 0 | if (!renderExecutorField.isAccessible()) |
1220 | |
{ |
1221 | 0 | renderExecutorField.setAccessible(true); |
1222 | |
} |
1223 | 0 | phaseExecutor = renderExecutorField.get(lifecycleImpl); |
1224 | |
} |
1225 | |
|
1226 | 0 | phaseManager = facesContext.getAttributes().get(PHASE_MANAGER_INSTANCE); |
1227 | 0 | if (phaseManager == null) |
1228 | |
{ |
1229 | 0 | Method getPhaseListenersMethod = lifecycleImpl.getClass().getDeclaredMethod("getPhaseListeners"); |
1230 | 0 | if (!getPhaseListenersMethod.isAccessible()) |
1231 | |
{ |
1232 | 0 | getPhaseListenersMethod.setAccessible(true); |
1233 | |
} |
1234 | |
|
1235 | 0 | Constructor<?> plmc = PHASE_MANAGER_CLASS.getDeclaredConstructor( |
1236 | |
new Class[]{Lifecycle.class, FacesContext.class, PhaseListener[].class}); |
1237 | 0 | if (!plmc.isAccessible()) |
1238 | |
{ |
1239 | 0 | plmc.setAccessible(true); |
1240 | |
} |
1241 | 0 | phaseManager = plmc.newInstance(lifecycle, facesContext, |
1242 | |
getPhaseListenersMethod.invoke(lifecycleImpl, null)); |
1243 | 0 | facesContext.getAttributes().put(PHASE_MANAGER_INSTANCE, phaseManager); |
1244 | |
} |
1245 | |
|
1246 | 0 | executePhaseMethod = lifecycleImpl.getClass().getDeclaredMethod("executePhase", new Class[]{ |
1247 | |
FacesContext.class, PHASE_EXECUTOR_CLASS, PHASE_MANAGER_CLASS}); |
1248 | 0 | if (!executePhaseMethod.isAccessible()) |
1249 | |
{ |
1250 | 0 | executePhaseMethod.setAccessible(true); |
1251 | |
} |
1252 | |
|
1253 | 0 | executePhaseMethod.invoke(lifecycleImpl, facesContext, phaseExecutor, phaseManager); |
1254 | |
} |
1255 | 0 | catch (NoSuchFieldException ex) |
1256 | |
{ |
1257 | 0 | throw new IllegalStateException("Cannot get executors from LifecycleImpl", ex); |
1258 | |
} |
1259 | 0 | catch (SecurityException ex) |
1260 | |
{ |
1261 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1262 | |
} |
1263 | 0 | catch (IllegalArgumentException ex) |
1264 | |
{ |
1265 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1266 | |
} |
1267 | 0 | catch (IllegalAccessException ex) |
1268 | |
{ |
1269 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1270 | |
} |
1271 | 0 | catch (NoSuchMethodException ex) |
1272 | |
{ |
1273 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1274 | |
} |
1275 | 0 | catch (InvocationTargetException ex) |
1276 | |
{ |
1277 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1278 | |
} |
1279 | 0 | catch (InstantiationException ex) |
1280 | |
{ |
1281 | 0 | throw new UnsupportedOperationException("Cannot get executors from LifecycleImpl", ex); |
1282 | 0 | } |
1283 | |
|
1284 | 0 | if (phase.equals(PhaseId.RENDER_RESPONSE)) |
1285 | |
{ |
1286 | 0 | facesContext.getAttributes().remove(PHASE_MANAGER_INSTANCE); |
1287 | |
} |
1288 | 0 | } |
1289 | |
else |
1290 | |
{ |
1291 | 0 | throw new UnsupportedOperationException("Cannot execute phase on custom lifecycle instances"); |
1292 | |
} |
1293 | 0 | } |
1294 | |
|
1295 | |
public String getRenderedContent(FacesContext facesContext) throws IOException |
1296 | |
{ |
1297 | 0 | MockPrintWriter writer1 = (MockPrintWriter) (((HttpServletResponse) |
1298 | |
facesContext.getExternalContext().getResponse()).getWriter()); |
1299 | 0 | return String.valueOf(writer1.content()); |
1300 | |
} |
1301 | |
|
1302 | |
public MockServletConfig getServletConfig() |
1303 | |
{ |
1304 | 0 | return servletConfig; |
1305 | |
} |
1306 | |
|
1307 | |
public MockServletContext getServletContext() |
1308 | |
{ |
1309 | 0 | return servletContext; |
1310 | |
} |
1311 | |
|
1312 | |
public InjectionProvider getInjectionProvider() |
1313 | |
{ |
1314 | 0 | return injectionProvider; |
1315 | |
} |
1316 | |
|
1317 | |
|
1318 | |
|
1319 | |
|
1320 | |
|
1321 | 0 | private ClassLoader threadContextClassLoader = null; |
1322 | 0 | private boolean classLoaderSet = false; |
1323 | 0 | private Context jndiContext = null; |
1324 | |
|
1325 | |
|
1326 | 0 | protected MockServletConfig servletConfig = null; |
1327 | 0 | protected MockServletContext servletContext = null; |
1328 | 0 | protected MockWebContainer webContainer = null; |
1329 | |
|
1330 | |
|
1331 | 0 | protected StartupServletContextListener listener = null; |
1332 | 0 | protected FacesConfigurationProvider facesConfigurationProvider = null; |
1333 | 0 | private FacesInitializer facesInitializer = null; |
1334 | |
|
1335 | 0 | protected FacesContextFactory facesContextFactory = null; |
1336 | 0 | protected LifecycleFactory lifecycleFactory = null; |
1337 | |
protected Lifecycle lifecycle; |
1338 | |
|
1339 | |
private static FacesConfig standardFacesConfig; |
1340 | 0 | private static Map<String, SharedFacesConfiguration> sharedConfiguration = |
1341 | |
new ConcurrentHashMap<String, SharedFacesConfiguration>(); |
1342 | |
private SharedFacesConfiguration jsfConfiguration; |
1343 | |
protected TestClass testClass; |
1344 | |
protected Object testInstance; |
1345 | |
|
1346 | |
|
1347 | |
protected InjectionProvider injectionProvider; |
1348 | |
|
1349 | |
|
1350 | |
|
1351 | |
|
1352 | |
protected FacesInitializer getFacesInitializer() |
1353 | |
{ |
1354 | 0 | if (facesInitializer == null) |
1355 | |
{ |
1356 | 0 | facesInitializer = createFacesInitializer(); |
1357 | |
} |
1358 | 0 | return facesInitializer; |
1359 | |
} |
1360 | |
|
1361 | |
|
1362 | |
|
1363 | |
|
1364 | |
protected void setFacesInitializer(FacesInitializer facesInitializer) |
1365 | |
{ |
1366 | 0 | this.facesInitializer = facesInitializer; |
1367 | 0 | } |
1368 | |
|
1369 | |
protected Class<?> getTestJavaClass() |
1370 | |
{ |
1371 | 0 | return testClass.getJavaClass(); |
1372 | |
} |
1373 | |
|
1374 | |
|
1375 | |
|
1376 | |
|
1377 | |
|
1378 | |
|
1379 | |
|
1380 | |
|
1381 | |
|
1382 | |
|
1383 | |
|
1384 | |
|
1385 | |
protected class MyFacesMockFacesConfigurationProvider extends DefaultFacesConfigurationProvider |
1386 | |
{ |
1387 | |
|
1388 | |
public MyFacesMockFacesConfigurationProvider() |
1389 | 0 | { |
1390 | 0 | } |
1391 | |
|
1392 | |
@Override |
1393 | |
public FacesConfig getStandardFacesConfig(ExternalContext ectx) |
1394 | |
{ |
1395 | 0 | if (standardFacesConfig == null) |
1396 | |
{ |
1397 | 0 | FacesConfig sfc = super.getStandardFacesConfig(ectx); |
1398 | 0 | FactoryImpl factory = (FactoryImpl) sfc.getFactories().get(0); |
1399 | |
|
1400 | |
|
1401 | 0 | factory.getViewDeclarationLanguageFactory().set(0, |
1402 | |
MockMyFacesViewDeclarationLanguageFactory.class.getName()); |
1403 | 0 | standardFacesConfig = sfc; |
1404 | |
} |
1405 | 0 | return standardFacesConfig; |
1406 | |
} |
1407 | |
|
1408 | |
@Override |
1409 | |
public FacesConfig getAnnotationsFacesConfig(ExternalContext ectx, |
1410 | |
boolean metadataComplete) |
1411 | |
{ |
1412 | 0 | FacesConfig facesConfig = jsfConfiguration.getAnnotationsFacesConfig(); |
1413 | 0 | if (facesConfig == null) |
1414 | |
{ |
1415 | 0 | if (isScanAnnotations()) |
1416 | |
{ |
1417 | 0 | facesConfig = super.getAnnotationsFacesConfig(ectx, metadataComplete); |
1418 | |
} |
1419 | |
|
1420 | 0 | ManagedBeans annoManagedBeans = getTestJavaClass().getAnnotation(ManagedBeans.class); |
1421 | 0 | if (annoManagedBeans != null) |
1422 | |
{ |
1423 | 0 | if (facesConfig == null) |
1424 | |
{ |
1425 | 0 | facesConfig = new org.apache.myfaces.config.impl.digester.elements.FacesConfigImpl(); |
1426 | |
} |
1427 | 0 | for (PageBean annoPageBean : annoManagedBeans.value()) |
1428 | |
{ |
1429 | 0 | org.apache.myfaces.config.impl.digester.elements.ManagedBeanImpl bean = new |
1430 | |
org.apache.myfaces.config.impl.digester.elements.ManagedBeanImpl(); |
1431 | 0 | bean.setBeanClass(annoPageBean.clazz().getName()); |
1432 | 0 | bean.setName(annoPageBean.name() == null ? annoPageBean.clazz().getName() : |
1433 | |
annoPageBean.name()); |
1434 | 0 | bean.setScope(annoPageBean.scope() == null ? "request" : annoPageBean.scope()); |
1435 | 0 | bean.setEager(Boolean.toString(annoPageBean.eager())); |
1436 | |
|
1437 | 0 | ((org.apache.myfaces.config.impl.digester.elements.FacesConfigImpl)facesConfig). |
1438 | |
addManagedBean(bean); |
1439 | |
} |
1440 | |
} |
1441 | |
|
1442 | 0 | PageBean annoPageBean = getTestJavaClass().getAnnotation(PageBean.class); |
1443 | 0 | if (annoPageBean != null) |
1444 | |
{ |
1445 | 0 | if (facesConfig == null) |
1446 | |
{ |
1447 | 0 | facesConfig = new org.apache.myfaces.config.impl.digester.elements.FacesConfigImpl(); |
1448 | |
} |
1449 | 0 | org.apache.myfaces.config.impl.digester.elements.ManagedBeanImpl bean = new |
1450 | |
org.apache.myfaces.config.impl.digester.elements.ManagedBeanImpl(); |
1451 | 0 | bean.setBeanClass(annoPageBean.clazz().getName()); |
1452 | 0 | bean.setName(annoPageBean.name() == null ? annoPageBean.clazz().getName() : annoPageBean.name()); |
1453 | 0 | bean.setScope(annoPageBean.scope() == null ? "request" : annoPageBean.scope()); |
1454 | 0 | bean.setEager(Boolean.toString(annoPageBean.eager())); |
1455 | |
|
1456 | 0 | ((org.apache.myfaces.config.impl.digester.elements.FacesConfigImpl)facesConfig). |
1457 | |
addManagedBean(bean); |
1458 | |
} |
1459 | 0 | jsfConfiguration.setAnnotationFacesConfig(facesConfig); |
1460 | |
} |
1461 | 0 | return facesConfig; |
1462 | |
} |
1463 | |
|
1464 | |
@Override |
1465 | |
public List<FacesConfig> getClassloaderFacesConfig(ExternalContext ectx) |
1466 | |
{ |
1467 | 0 | List<FacesConfig> list = jsfConfiguration.getClassloaderFacesConfig(); |
1468 | 0 | if (list == null) |
1469 | |
{ |
1470 | 0 | list = super.getClassloaderFacesConfig(ectx); |
1471 | 0 | jsfConfiguration.setClassloaderFacesConfig(list); |
1472 | |
} |
1473 | 0 | return list; |
1474 | |
} |
1475 | |
|
1476 | |
@Override |
1477 | |
public List<FacesConfig> getFaceletTaglibFacesConfig(ExternalContext externalContext) |
1478 | |
{ |
1479 | 0 | List<FacesConfig> list = jsfConfiguration.getFaceletTaglibFacesConfig(); |
1480 | 0 | if (list == null) |
1481 | |
{ |
1482 | 0 | list = super.getFaceletTaglibFacesConfig(externalContext); |
1483 | 0 | jsfConfiguration.setFaceletTaglibFacesConfig(list); |
1484 | |
} |
1485 | 0 | return list; |
1486 | |
} |
1487 | |
|
1488 | |
@Override |
1489 | |
public List<FacesConfig> getFacesFlowFacesConfig(ExternalContext ectx) |
1490 | |
{ |
1491 | 0 | List<FacesConfig> list = jsfConfiguration.getFacesFlowFacesConfig(); |
1492 | 0 | if (list == null) |
1493 | |
{ |
1494 | 0 | list = super.getFacesFlowFacesConfig(ectx); |
1495 | 0 | jsfConfiguration.setFacesFlowFacesConfig(list); |
1496 | |
} |
1497 | 0 | return list; |
1498 | |
} |
1499 | |
|
1500 | |
@Override |
1501 | |
public FacesConfig getMetaInfServicesFacesConfig(ExternalContext ectx) |
1502 | |
{ |
1503 | 0 | FacesConfig facesConfig = jsfConfiguration.getMetaInfServicesFacesConfig(); |
1504 | 0 | if (facesConfig == null) |
1505 | |
{ |
1506 | 0 | facesConfig = super.getMetaInfServicesFacesConfig(ectx); |
1507 | |
} |
1508 | 0 | return facesConfig; |
1509 | |
} |
1510 | |
|
1511 | |
@Override |
1512 | |
public List<FacesConfig> getContextSpecifiedFacesConfig(ExternalContext ectx) |
1513 | |
{ |
1514 | 0 | List<FacesConfig> appConfigResources = super.getContextSpecifiedFacesConfig(ectx); |
1515 | |
|
1516 | 0 | DeclareFacesConfig annoFacesConfig = getTestJavaClass().getAnnotation(DeclareFacesConfig.class); |
1517 | 0 | if (annoFacesConfig != null) |
1518 | |
{ |
1519 | 0 | Logger log = Logger.getLogger(getTestJavaClass().getName()); |
1520 | |
try |
1521 | |
{ |
1522 | 0 | for (String systemId : annoFacesConfig.value()) |
1523 | |
{ |
1524 | 0 | if (MyfacesConfig.getCurrentInstance(ectx).isValidateXML()) |
1525 | |
{ |
1526 | 0 | URL url = ectx.getResource(systemId); |
1527 | 0 | if (url != null) |
1528 | |
{ |
1529 | 0 | validateFacesConfig(ectx, url); |
1530 | |
} |
1531 | |
} |
1532 | 0 | InputStream stream = ectx.getResourceAsStream(systemId); |
1533 | 0 | if (stream == null) |
1534 | |
{ |
1535 | |
|
1536 | 0 | log.severe("Faces config resource " + systemId + " not found"); |
1537 | 0 | continue; |
1538 | |
} |
1539 | |
|
1540 | 0 | if (log.isLoggable(Level.INFO)) |
1541 | |
{ |
1542 | 0 | log.info("Reading config " + systemId); |
1543 | |
} |
1544 | 0 | appConfigResources.add(getUnmarshaller(ectx).getFacesConfig(stream, systemId)); |
1545 | |
|
1546 | 0 | stream.close(); |
1547 | |
|
1548 | |
} |
1549 | |
} |
1550 | 0 | catch (Throwable e) |
1551 | |
{ |
1552 | 0 | throw new FacesException(e); |
1553 | 0 | } |
1554 | |
} |
1555 | 0 | return appConfigResources; |
1556 | |
} |
1557 | |
} |
1558 | |
|
1559 | |
private void validateFacesConfig(ExternalContext ectx, URL url) throws IOException, SAXException |
1560 | |
{ |
1561 | 0 | String version = ConfigFilesXmlValidationUtils.getFacesConfigVersion(url); |
1562 | 0 | if ("1.2".equals(version) || "2.0".equals(version) || "2.1".equals(version)) |
1563 | |
{ |
1564 | 0 | ConfigFilesXmlValidationUtils.validateFacesConfigFile(url, ectx, version); |
1565 | |
} |
1566 | 0 | } |
1567 | |
|
1568 | |
protected class JUnitFacesInitializer extends AbstractFacesInitializer |
1569 | |
{ |
1570 | |
private final AbstractJsfTestContainer testCase; |
1571 | |
|
1572 | |
public JUnitFacesInitializer(AbstractJsfTestContainer testCase) |
1573 | 0 | { |
1574 | 0 | this.testCase = testCase; |
1575 | 0 | } |
1576 | |
|
1577 | |
@Override |
1578 | |
protected void initContainerIntegration(ServletContext servletContext, |
1579 | |
ExternalContext externalContext) |
1580 | |
{ |
1581 | 0 | if (servletContext.getInitParameter("org.apache.myfaces.spi.InjectionProvider") == null) |
1582 | |
{ |
1583 | 0 | if (ExternalSpecifications.isCDIAvailable(externalContext)) |
1584 | |
{ |
1585 | 0 | ((MockServletContext)servletContext).addInitParameter("org.apache.myfaces.spi.InjectionProvider", |
1586 | |
CDIAnnotationDelegateInjectionProvider.class.getName()); |
1587 | |
} |
1588 | |
else |
1589 | |
{ |
1590 | 0 | ((MockServletContext)servletContext).addInitParameter("org.apache.myfaces.spi.InjectionProvider", |
1591 | |
NoInjectionAnnotationInjectionProvider.class.getName()); |
1592 | |
} |
1593 | |
} |
1594 | |
|
1595 | 0 | ExpressionFactory expressionFactory = createExpressionFactory(); |
1596 | |
|
1597 | 0 | RuntimeConfig runtimeConfig = buildConfiguration(servletContext, externalContext, expressionFactory); |
1598 | 0 | } |
1599 | |
|
1600 | |
public AbstractJsfTestContainer getTestCase() |
1601 | |
{ |
1602 | 0 | return testCase; |
1603 | |
} |
1604 | |
|
1605 | |
} |
1606 | |
|
1607 | 0 | protected static class SharedFacesConfiguration |
1608 | |
{ |
1609 | |
private List<FacesConfig> classloaderFacesConfig; |
1610 | |
private FacesConfig annotationFacesConfig; |
1611 | |
private List<FacesConfig> faceletTaglibFacesConfig; |
1612 | |
private List<FacesConfig> facesFlowFacesConfig; |
1613 | |
private FacesConfig metaInfServicesFacesConfig; |
1614 | |
private List<FacesConfig> contextSpecifiedFacesConfig; |
1615 | |
|
1616 | |
|
1617 | |
|
1618 | |
|
1619 | |
public FacesConfig getAnnotationsFacesConfig() |
1620 | |
{ |
1621 | 0 | return annotationFacesConfig; |
1622 | |
} |
1623 | |
|
1624 | |
|
1625 | |
|
1626 | |
|
1627 | |
public void setAnnotationFacesConfig(FacesConfig annotationFacesConfig) |
1628 | |
{ |
1629 | 0 | this.annotationFacesConfig = annotationFacesConfig; |
1630 | 0 | } |
1631 | |
|
1632 | |
|
1633 | |
|
1634 | |
|
1635 | |
public FacesConfig getAnnotationFacesConfig() |
1636 | |
{ |
1637 | 0 | return annotationFacesConfig; |
1638 | |
} |
1639 | |
|
1640 | |
|
1641 | |
|
1642 | |
|
1643 | |
public List<FacesConfig> getFaceletTaglibFacesConfig() |
1644 | |
{ |
1645 | 0 | return faceletTaglibFacesConfig; |
1646 | |
} |
1647 | |
|
1648 | |
|
1649 | |
|
1650 | |
|
1651 | |
public void setFaceletTaglibFacesConfig(List<FacesConfig> faceletTaglibFacesConfig) |
1652 | |
{ |
1653 | 0 | this.faceletTaglibFacesConfig = faceletTaglibFacesConfig; |
1654 | 0 | } |
1655 | |
|
1656 | |
|
1657 | |
|
1658 | |
|
1659 | |
public List<FacesConfig> getFacesFlowFacesConfig() |
1660 | |
{ |
1661 | 0 | return facesFlowFacesConfig; |
1662 | |
} |
1663 | |
|
1664 | |
|
1665 | |
|
1666 | |
|
1667 | |
public void setFacesFlowFacesConfig(List<FacesConfig> facesFlowFacesConfig) |
1668 | |
{ |
1669 | 0 | this.facesFlowFacesConfig = facesFlowFacesConfig; |
1670 | 0 | } |
1671 | |
|
1672 | |
|
1673 | |
|
1674 | |
|
1675 | |
public FacesConfig getMetaInfServicesFacesConfig() |
1676 | |
{ |
1677 | 0 | return metaInfServicesFacesConfig; |
1678 | |
} |
1679 | |
|
1680 | |
|
1681 | |
|
1682 | |
|
1683 | |
public void setMetaInfServicesFacesConfig(FacesConfig metaInfServicesFacesConfig) |
1684 | |
{ |
1685 | 0 | this.metaInfServicesFacesConfig = metaInfServicesFacesConfig; |
1686 | 0 | } |
1687 | |
|
1688 | |
|
1689 | |
|
1690 | |
|
1691 | |
public List<FacesConfig> getContextSpecifiedFacesConfig() |
1692 | |
{ |
1693 | 0 | return contextSpecifiedFacesConfig; |
1694 | |
} |
1695 | |
|
1696 | |
|
1697 | |
|
1698 | |
|
1699 | |
public void setContextSpecifiedFacesConfig(List<FacesConfig> contextSpecifiedFacesConfig) |
1700 | |
{ |
1701 | 0 | this.contextSpecifiedFacesConfig = contextSpecifiedFacesConfig; |
1702 | 0 | } |
1703 | |
|
1704 | |
|
1705 | |
|
1706 | |
|
1707 | |
public List<FacesConfig> getClassloaderFacesConfig() |
1708 | |
{ |
1709 | 0 | return classloaderFacesConfig; |
1710 | |
} |
1711 | |
|
1712 | |
|
1713 | |
|
1714 | |
|
1715 | |
public void setClassloaderFacesConfig(List<FacesConfig> classloaderFacesConfigList) |
1716 | |
{ |
1717 | 0 | this.classloaderFacesConfig = classloaderFacesConfigList; |
1718 | 0 | } |
1719 | |
} |
1720 | |
} |