1   package org.apache.commons.betwixt.scarab;
2   
3   /*
4    * Copyright 2001-2004 The Apache Software Foundation.
5    * 
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * 
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */ 
18  
19  import java.io.Serializable;
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  import junit.framework.AssertionFailedError;
24  
25  import org.apache.commons.logging.Log;
26  import org.apache.commons.logging.LogFactory;
27  
28  /***
29   * <p><code>ScarabSettings</code> is a sample bean for use by the test cases.</p>
30   *
31   * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
32   * @version $Id: ScarabSettings.java,v 1.4 2002/06/05 10:30:50 jstrachan Exp $
33   */
34  public class ScarabSettings implements Serializable
35  {
36  
37      /***
38       * Logger
39       */
40      private final static Log log = LogFactory.getLog(ScarabSettings.class);
41  
42      private List globalAttributes;
43  
44      private List modules;
45      
46      private List globalIssueTypes;
47      
48      /***
49       * Constructor for the ScarabSettings object
50       */
51      public ScarabSettings() 
52      { 
53          globalAttributes = new ArrayList();
54          modules = new ArrayList();
55          globalIssueTypes = new ArrayList();
56      }
57  
58      public List getGlobalAttributes()
59      {
60          return globalAttributes;
61      }
62      
63      public void addGlobalAttribute(GlobalAttribute globalAttribute)
64      {
65          // adds an assertion that the name must be populated first
66          // as an extra test case
67          if (globalAttribute.getName() == null) 
68          {
69              throw new AssertionFailedError("Cannot add a new GlobalAttribute that has no name: " + globalAttribute);            
70          }
71          globalAttributes.add(globalAttribute);
72      }        
73  
74      public List getGlobalIssueTypes()
75      {
76          return globalIssueTypes;
77      }
78      
79      public void addGlobalIssueType(GlobalIssueType globalIssueType)
80      {
81          globalIssueTypes.add(globalIssueType);
82      }        
83  
84      public List getModules()
85      {
86          return modules;
87      }
88      
89      public void addModule(Module module)
90      {
91          modules.add(module);
92      }
93  }