001: /* ====================================================================
002: The Jicarilla Software License
003:
004: Copyright (c) 2003 Leo Simons.
005: All rights reserved.
006:
007: Permission is hereby granted, free of charge, to any person obtaining
008: a copy of this software and associated documentation files (the
009: "Software"), to deal in the Software without restriction, including
010: without limitation the rights to use, copy, modify, merge, publish,
011: distribute, sublicense, and/or sell copies of the Software, and to
012: permit persons to whom the Software is furnished to do so, subject to
013: the following conditions:
014:
015: The above copyright notice and this permission notice shall be
016: included in all copies or substantial portions of the Software.
017:
018: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
019: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
020: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
021: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
022: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
023: TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
024: SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
025: ==================================================================== */
026: package org.jicarilla.container.test.integration.dna;
027:
028: import org.jicarilla.container.test.AbstractJicarillaAllInTheFamilyTestCase;
029: import org.jicarilla.container.DefaultContainer;
030: import org.jicarilla.container.Container;
031: import org.jicarilla.container.Resolver;
032: import org.jicarilla.container.integration.dna.DnaFactory;
033: import org.jicarilla.container.adapters.SingletonAdapter;
034: import org.jicarilla.container.tck.components.interfaces.Marge;
035: import org.jicarilla.container.tck.components.interfaces.Homer;
036: import org.jicarilla.container.tck.components.interfaces.Bart;
037: import org.jicarilla.container.tck.components.interfaces.Lisa;
038: import org.jicarilla.container.tck.components.interfaces.Maggie;
039: import org.jicarilla.container.tck.components.interfaces.Script;
040: import org.jicarilla.container.tck.components.type1.dna.DnaMaggie;
041: import org.jicarilla.container.tck.components.type1.dna.DnaLisa;
042: import org.jicarilla.container.tck.components.type1.dna.DnaBart;
043: import org.jicarilla.container.tck.components.type1.dna.DnaHomer;
044: import org.jicarilla.container.tck.components.type1.dna.DnaMarge;
045: import org.jicarilla.container.tck.components.type1.dna.DnaAllInTheFamilyScript;
046: import org.jicarilla.container.tck.components.type3.rich.AllInTheFamilyScript;
047: import org.jicarilla.container.tck.AbstractAllInTheFamilyTestCase;
048: import org.jicarilla.container.selectors.ClassSelector;
049:
050: /**
051: *
052: *
053: * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
054: * @version $Id: AbstractDnaAllInTheFamilyTestCase.java,v 1.1 2004/04/03 12:09:22 lsimons Exp $
055: */
056: public class AbstractDnaAllInTheFamilyTestCase extends
057: AbstractAllInTheFamilyTestCase {
058: protected Container jc;// = new DefaultContainer();
059: protected Resolver r;// = pc.getResolver();
060:
061: public void setUp() throws Exception {
062: jc = new DefaultContainer();
063: jc = getContainer();
064: r = jc.getResolver();
065:
066: doPopulate();
067:
068: super .setUp();
069: }
070:
071: protected Container getContainer() {
072: return jc;
073: }
074:
075: protected void doPopulate() {
076: jc.registerAdapter(new ClassSelector(Marge.class),
077: new SingletonAdapter(new DnaFactory(r, DnaMarge.class
078: .getName())));
079: jc.registerAdapter(new ClassSelector(Homer.class),
080: new SingletonAdapter(new DnaFactory(r, DnaHomer.class
081: .getName())));
082: jc.registerAdapter(new ClassSelector(Bart.class),
083: new SingletonAdapter(new DnaFactory(r, DnaBart.class
084: .getName())));
085: jc.registerAdapter(new ClassSelector(Lisa.class),
086: new SingletonAdapter(new DnaFactory(r, DnaLisa.class
087: .getName())));
088: jc.registerAdapter(new ClassSelector(Maggie.class),
089: new SingletonAdapter(new DnaFactory(r, DnaMaggie.class
090: .getName())));
091: jc.registerAdapter(new ClassSelector(Script.class),
092: new SingletonAdapter(new DnaFactory(r,
093: DnaAllInTheFamilyScript.class.getName())));
094: }
095:
096: protected Script getAllInTheFamilyScript() {
097: return (Script) r.get(Script.class);
098: }
099:
100: protected Homer getHomer() {
101: return (Homer) r.get(Homer.class);
102: }
103:
104: protected Marge getMarge() {
105: return (Marge) r.get(Marge.class);
106: }
107:
108: protected Bart getBart() {
109: return (Bart) r.get(Bart.class);
110: }
111:
112: protected Lisa getLisa() {
113: return (Lisa) r.get(Lisa.class);
114: }
115:
116: protected Maggie getMaggie() {
117: return (Maggie) r.get(Maggie.class);
118: }
119: }
|