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