1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.javagen.funcgen.model;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import javax.xml.bind.annotation.XmlRootElement;
22 import javax.xml.bind.annotation.XmlTransient;
23
24 import org.javagen.agile.core.model.AbstractModel;
25 import org.javagen.agile.core.model.Model;
26
27 /***
28 * A permutation group represents a specific set of test properties and a set of values for those properties
29 * that are to be tested. Use permutation groups when a test condition can't be represented using a single
30 * property. A good example of a is a set of database properties:
31 * <pre>
32 * <permutationsGroup name="Database tests">
33 * <permutationSet name="Test on Oracle">
34 * <context>
35 * <entry key="dbUrl"><value>jdbc:oracle:thin:(HOST=dev03.javagen.com)</value></entry>
36 * <entry key="username"><value>tiger</value></entry>
37 * </context>
38 * </permutationSet>
39 * <permutationSet name="Test on HSQL">
40 * <context>
41 * <entry key="dbUrl"><value>jdbc:hsqldb:hsql://localhost/testdb</value></entry>
42 * <entry key="username"><value>sa</value></entry>
43 * </context>
44 * </permutationSet>
45 * </permutationsGroup>
46 *
47 * @todo finish integrating PermutationsGroup into FuncGen
48 *
49 * @author Richard Easterling
50 */
51 @XmlRootElement
52 public class PermutationsGroup extends AbstractModel {
53
54 public static final String DEFAULT_MODEL_TYPE = "permutationsGroup";
55
56 public PermutationsGroup() {
57 super();
58 this.setModelType(DEFAULT_MODEL_TYPE);
59 }
60
61 public PermutationsGroup(String name) {
62 this();
63 this.setName(name);
64 }
65
66 public void addPermutationSet(PermutationSet set) {
67 super.addChildModel(set);
68 }
69
70 /***
71 * Returns child PermutationSet instances.
72 */
73 @XmlTransient
74 public List<PermutationSet> getPermutationSets() {
75 List<PermutationSet> sets = new ArrayList<PermutationSet>();
76 for(Model child : getChildModels()) {
77 if (child instanceof PermutationSet)
78 sets.add( (PermutationSet)child );
79 }
80 return sets;
81 }
82
83
84
85 }