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.avalon;
027:
028: import org.apache.avalon.fortress.Container;
029: import org.apache.avalon.fortress.impl.handler.ComponentHandler;
030: import org.jicarilla.container.tck.AbstractAllInTheFamilyTestCase;
031: import org.jicarilla.container.tck.components.interfaces.Bart;
032: import org.jicarilla.container.tck.components.interfaces.Homer;
033: import org.jicarilla.container.tck.components.interfaces.Lisa;
034: import org.jicarilla.container.tck.components.interfaces.Maggie;
035: import org.jicarilla.container.tck.components.interfaces.Marge;
036: import org.jicarilla.container.tck.components.interfaces.Script;
037: import org.jicarilla.container.tck.components.type3.rich.AllInTheFamilyScript;
038:
039: /**
040: *
041: *
042: * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
043: * @version $Id: AbstractAvalonAllInTheFamilyTestCase.java,v 1.2 2004/04/03 12:09:22 lsimons Exp $
044: */
045: public abstract class AbstractAvalonAllInTheFamilyTestCase extends
046: AbstractAllInTheFamilyTestCase {
047: protected Container c;
048:
049: protected abstract Container getContainer();
050:
051: public void setUp() throws Exception {
052: c = getContainer();
053: super .setUp();
054: }
055:
056: protected Script getAllInTheFamilyScript() {
057: try {
058: ComponentHandler handler = (ComponentHandler) c.get(
059: Script.class.getName(), null);
060: return (AllInTheFamilyScript) handler.get();
061: } catch (Exception e) {
062: fail("Can't comply with getScript() because of a "
063: + "Exception of type " + e.getClass().getName()
064: + " which " + "provides the message: "
065: + e.getMessage());
066: }
067: return null; // unreachable!
068: }
069:
070: protected Homer getHomer() {
071: try {
072: ComponentHandler handler = (ComponentHandler) c.get(
073: Homer.class.getName(), null);
074: return (Homer) handler.get();
075: } catch (Exception e) {
076: fail("Can't comply with getHomer() because of a "
077: + "Exception of type " + e.getClass().getName()
078: + " which " + "provides the message: "
079: + e.getMessage());
080: }
081: return null; // unreachable!
082: }
083:
084: protected Marge getMarge() {
085: try {
086: ComponentHandler handler = (ComponentHandler) c.get(
087: Marge.class.getName(), null);
088: return (Marge) handler.get();
089: } catch (Exception e) {
090: fail("Can't comply with getMarge() because of a "
091: + "Exception of type " + e.getClass().getName()
092: + " which " + "provides the message: "
093: + e.getMessage());
094: }
095: return null; // unreachable!
096: }
097:
098: protected Bart getBart() {
099: try {
100: ComponentHandler handler = (ComponentHandler) c.get(
101: Bart.class.getName(), null);
102: return (Bart) handler.get();
103: } catch (Exception e) {
104: fail("Can't comply with getBart() because of a "
105: + "Exception of type " + e.getClass().getName()
106: + " which " + "provides the message: "
107: + e.getMessage());
108: }
109: return null; // unreachable!
110: }
111:
112: protected Lisa getLisa() {
113: try {
114: ComponentHandler handler = (ComponentHandler) c.get(
115: Lisa.class.getName(), null);
116: return (Lisa) handler.get();
117: } catch (Exception e) {
118: fail("Can't comply with getLisa() because of a "
119: + "Exception of type " + e.getClass().getName()
120: + " which " + "provides the message: "
121: + e.getMessage());
122: }
123: return null; // unreachable!
124: }
125:
126: protected Maggie getMaggie() {
127: try {
128: ComponentHandler handler = (ComponentHandler) c.get(
129: Maggie.class.getName(), null);
130: return (Maggie) handler.get();
131: } catch (Exception e) {
132: fail("Can't comply with getMaggie() because of a "
133: + "Exception of type " + e.getClass().getName()
134: + " which " + "provides the message: "
135: + e.getMessage());
136: }
137: return null; // unreachable!
138: }
139: }
|