01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.config.schema.test;
05:
06: /**
07: * Allows you to build valid config for a query route. This class <strong>MUST NOT</strong> invoke the actual XML beans
08: * to do its work; one of its purposes is, in fact, to test that those beans are set up correctly.
09: */
10: public class QueryRouteConfigBuilder extends BaseConfigBuilder {
11:
12: private final String matchType;
13: private final String route;
14: private final String query;
15:
16: public static final String MATCH_TYPE_EXACT = "exact";
17: public static final String MATCH_TYPE_REGEX = "regex";
18:
19: public static final String ROUTE_TERRACOTTA = "terracotta";
20: public static final String ROUTE_NATIVE = "native";
21:
22: public QueryRouteConfigBuilder(String matchType, String route,
23: String query) {
24: super (5, new String[0]);
25:
26: this .matchType = matchType;
27: this .route = route;
28: this .query = query;
29: }
30:
31: public String toString() {
32: String out = indent() + "<query-route";
33: if (this .matchType != null)
34: out += " match-type=\"" + this .matchType + "\"";
35: if (this .route != null)
36: out += " route=\"" + this .route + "\"";
37: out += ">";
38: if (this .query != null)
39: out += this .query;
40: out += "</query-route>\n";
41:
42: return out;
43: }
44:
45: }
|