1   /* ===================================================================
2    * Copyright 2002-05 SRI International.
3    * Released under the MOZILLA PUBLIC LICENSE Version 1.1
4    * which can be obtained at http://www.mozilla.org/MPL/MPL-1.1.html
5    * This software is distributed on an "AS IS"
6    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
7    * See the License for the specific language governing rights and
8    * limitations under the License.
9    * =================================================================== */
10  package com.sri.emo.wizard.completion.management;
11  
12  import com.jcorporate.expresso.core.controller.ControllerException;
13  import com.jcorporate.expresso.core.controller.ExpressoResponse;
14  import com.jcorporate.expresso.services.test.ControllerTestFixture;
15  import com.jcorporate.expresso.services.test.TestSystemInitializer;
16  import com.sri.emo.test.DatabaseTestFixture;
17  import com.sri.emo.test.EmoTestSuite;
18  import com.sri.emo.wizard.completion.model.CompletionBean;
19  import com.sri.emo.test.EmoWizardDatabaseTestCase;
20  
21  /***
22   * Base test case for help dealing with the completion bean Controller test cases.
23   * @author Michael Rimov
24   * @version 1.0
25   */
26  public class ChooseCompletionTestBase extends EmoWizardDatabaseTestCase {
27      public ChooseCompletionTestBase() {
28          super();
29      }
30  
31      public ChooseCompletionTestBase(String name) {
32          super(name);
33      }
34  
35      protected CompletionBean getCompletionBean(ExpressoResponse response) throws ControllerException {
36          return (CompletionBean) response.getExpressoRequest().getSession().getPersistentAttribute(CompletionBeanManager.
37              BEAN_NAME);
38      }
39  
40      protected ControllerTestFixture testFixture;
41      protected DatabaseTestFixture databaseFixture = null;
42  
43      protected void setUp() throws Exception {
44          super.setUp();
45          testFixture = new ControllerTestFixture();
46          testFixture.setUp();
47  
48          databaseFixture = new DatabaseTestFixture(TestSystemInitializer.getTestContext(),
49              EmoTestSuite.class.getResourceAsStream("WizardTestData.xml"));
50          databaseFixture.setUp();
51  
52      }
53  
54      protected void tearDown() throws Exception {
55          testFixture.tearDown();
56          testFixture = null;
57          databaseFixture.tearDown();
58          databaseFixture = null;
59          super.tearDown();
60      }
61  }