01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.config.schema.test;
06:
07: /**
08: * Allows you to build valid config for the L2s. This class <strong>MUST NOT</strong> invoke the actual XML beans to do
09: * its work; one of its purposes is, in fact, to test that those beans are set up correctly.
10: */
11: public class L2SConfigBuilder extends BaseConfigBuilder {
12:
13: private L2ConfigBuilder[] l2s;
14: private HaConfigBuilder ha;
15:
16: public L2SConfigBuilder() {
17: super (1, new String[] { "l2s", "ha" });
18: }
19:
20: public void setL2s(L2ConfigBuilder[] l2s) {
21: this .l2s = l2s;
22: setProperty("l2s", l2s);
23: }
24:
25: public void setHa(HaConfigBuilder ha) {
26: this .ha = ha;
27: setProperty("ha", ha);
28: }
29:
30: public L2ConfigBuilder[] getL2s() {
31: return l2s;
32: }
33:
34: public HaConfigBuilder getHa() {
35: return ha;
36: }
37:
38: public String toString() {
39: String out = "";
40: if (isSet("l2s")) {
41: out += l2sToString();
42: }
43: if (isSet("ha")) {
44: out += ha.toString();
45: }
46: return out;
47: }
48:
49: private String l2sToString() {
50: String val = "";
51: for (int i = 0; i < l2s.length; i++) {
52: val += l2s[i].toString();
53: }
54: return val;
55: }
56:
57: public static L2SConfigBuilder newMinimalInstance() {
58: L2ConfigBuilder l2 = new L2ConfigBuilder();
59: // l2.setName("localhost");
60: // l2.setDSOPort(9510);
61:
62: HaConfigBuilder ha = new HaConfigBuilder();
63:
64: L2SConfigBuilder out = new L2SConfigBuilder();
65: out.setL2s(new L2ConfigBuilder[] { l2 });
66: out.setHa(ha);
67:
68: return out;
69: }
70:
71: }
|