01: /* ====================================================================
02: The Jicarilla Software License
03:
04: Copyright (c) 2003 Leo Simons.
05: All rights reserved.
06:
07: Permission is hereby granted, free of charge, to any person obtaining
08: a copy of this software and associated documentation files (the
09: "Software"), to deal in the Software without restriction, including
10: without limitation the rights to use, copy, modify, merge, publish,
11: distribute, sublicense, and/or sell copies of the Software, and to
12: permit persons to whom the Software is furnished to do so, subject to
13: the following conditions:
14:
15: The above copyright notice and this permission notice shall be
16: included in all copies or substantial portions of the Software.
17:
18: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23: TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24: SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25: ==================================================================== */
26: package org.jicarilla.container.test;
27:
28: import junit.framework.TestCase;
29: import org.jicarilla.container.Container;
30: import org.jicarilla.container.DefaultContainer;
31: import org.jicarilla.container.Resolver;
32: import org.jicarilla.container.adapters.SingleUseAdapter;
33: import org.jicarilla.container.adapters.SingletonAdapter;
34: import org.jicarilla.container.factories.Type25Factory;
35: import org.jicarilla.container.factories.Type2Factory;
36: import org.jicarilla.container.factories.Type35Factory;
37: import org.jicarilla.container.factories.Type3Factory;
38: import org.jicarilla.container.selectors.ClassSelector;
39: import org.jicarilla.container.tck.components.interfaces.Apu;
40: import org.jicarilla.container.tck.components.interfaces.Bart;
41: import org.jicarilla.container.tck.components.interfaces.Homer;
42: import org.jicarilla.container.tck.components.interfaces.Lisa;
43: import org.jicarilla.container.tck.components.interfaces.Maggie;
44: import org.jicarilla.container.tck.components.interfaces.Marge;
45: import org.jicarilla.container.tck.components.interfaces.Script;
46: import org.jicarilla.container.tck.components.type3.rich.AllInTheFamilyScript;
47: import org.jicarilla.container.tck.components.type3.rich.ApuImpl;
48: import org.jicarilla.container.tck.components.type3.rich.BartImpl;
49: import org.jicarilla.container.tck.components.type3.rich.HomerImpl;
50: import org.jicarilla.container.tck.components.type3.rich.LisaImpl;
51: import org.jicarilla.container.tck.components.type3.rich.MaggieImpl;
52: import org.jicarilla.container.tck.components.type3.rich.MargeImpl;
53:
54: /**
55: * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
56: * @version $Id: AbstractSimpson_test_case.java,v 1.8 2004/03/17 14:14:17 lsimons Exp $
57: */
58: public abstract class AbstractSimpson_test_case extends TestCase {
59: public Container jc;
60: public Resolver r;
61:
62: public void setUp() {
63: jc = getContainer();
64: r = jc.getResolver();
65: setUpJc();
66: }
67:
68: public Container getContainer() {
69: return new DefaultContainer();
70: }
71:
72: public void setUpJc() {
73: jc.registerAdapter(new ClassSelector(Apu.class),
74: new SingletonAdapter(new Type2Factory(r, ApuImpl.class
75: .getName())));
76: jc.registerAdapter(new ClassSelector(Marge.class),
77: new SingletonAdapter(new Type3Factory(r,
78: MargeImpl.class.getName())));
79: jc.registerAdapter(new ClassSelector(Homer.class),
80: new SingletonAdapter(new Type25Factory(r,
81: HomerImpl.class.getName())));
82: jc.registerAdapter(new ClassSelector(Bart.class),
83: new SingletonAdapter(new Type2Factory(r, BartImpl.class
84: .getName())));
85: jc.registerAdapter(new ClassSelector(Lisa.class),
86: new SingleUseAdapter(new Type3Factory(r, LisaImpl.class
87: .getName())));
88: jc.registerAdapter(new ClassSelector(Maggie.class),
89: new SingletonAdapter(new Type2Factory(r,
90: MaggieImpl.class.getName())));
91: jc.registerAdapter(new ClassSelector(Script.class),
92: new SingletonAdapter(new Type35Factory(r,
93: AllInTheFamilyScript.class.getName())));
94: }
95:
96: }
|