2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shale.test.mock;
19
20 import java.util.HashMap;
21 import java.util.Iterator;
22 import java.util.Map;
23
24 import javax.faces.lifecycle.Lifecycle;
25 import javax.faces.lifecycle.LifecycleFactory;
26
27 /***
28 * <p>Mock implementation of <code>LifecycleFactory</code>.</p>
29 *
30 * $Id$
31 */
32
33 public class MockLifecycleFactory extends LifecycleFactory {
34
35
36
37
38
39 /***
40 * <p>Return a default instance.</p>
41 */
42 public MockLifecycleFactory() {
43
44 lifecycles = new HashMap();
45 lifecycles.put(LifecycleFactory.DEFAULT_LIFECYCLE, new MockLifecycle());
46
47 }
48
49
50
51
52
53
54
55
56 /***
57 * <p>The set of Lifecycle instances registered with us.</p>
58 */
59 private Map lifecycles = null;
60
61
62
63
64
65 /*** {@inheritDoc} */
66 public void addLifecycle(String lifecycleId, Lifecycle lifecycle) {
67
68 lifecycles.put(lifecycleId, lifecycle);
69
70 }
71
72
73 /*** {@inheritDoc} */
74 public Lifecycle getLifecycle(String lifecycleId) {
75
76 return (Lifecycle) lifecycles.get(lifecycleId);
77
78 }
79
80
81 /*** {@inheritDoc} */
82 public Iterator getLifecycleIds() {
83
84 return lifecycles.keySet().iterator();
85
86 }
87
88
89 }