001: /**
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */package com.tc.config.schema;
005:
006: import org.apache.commons.lang.builder.HashCodeBuilder;
007: import org.apache.xmlbeans.QNameSet;
008: import org.apache.xmlbeans.SchemaType;
009: import org.apache.xmlbeans.XmlCursor;
010: import org.apache.xmlbeans.XmlDocumentProperties;
011: import org.apache.xmlbeans.XmlObject;
012: import org.apache.xmlbeans.XmlOptions;
013: import org.apache.xmlbeans.xml.stream.XMLInputStream;
014: import org.w3c.dom.Node;
015: import org.xml.sax.ContentHandler;
016: import org.xml.sax.ext.LexicalHandler;
017:
018: import com.tc.exception.ImplementMe;
019: import com.tc.test.UniqueSequenceGenerator;
020: import com.terracottatech.config.Application;
021: import com.terracottatech.config.DsoApplication;
022: import com.terracottatech.config.Modules;
023: import com.terracottatech.config.SpringApplication;
024:
025: import java.io.File;
026: import java.io.InputStream;
027: import java.io.OutputStream;
028: import java.io.Reader;
029: import java.io.Writer;
030:
031: import javax.xml.namespace.QName;
032: import javax.xml.stream.XMLStreamReader;
033:
034: /**
035: * A mock {@link Application}, for use in tests.
036: */
037: public class MockApplication implements Application {
038:
039: private final int identity;
040:
041: public MockApplication() {
042: this (UniqueSequenceGenerator.getInstance().getNextInt());
043: }
044:
045: public MockApplication(int identity) {
046: this .identity = identity;
047: }
048:
049: public boolean equals(Object that) {
050: return ((that instanceof MockApplication) && ((MockApplication) that).identity == this .identity);
051: }
052:
053: public int hashCode() {
054: return new HashCodeBuilder().append(this .identity).toHashCode();
055: }
056:
057: public DsoApplication getDso() {
058: return null;
059: }
060:
061: public boolean isSetDso() {
062: return true;
063: }
064:
065: public void setDso(DsoApplication arg0) {
066: // nothing here
067: }
068:
069: public DsoApplication addNewDso() {
070: return null;
071: }
072:
073: public void unsetDso() {
074: // nothing here
075: }
076:
077: public SchemaType schemaType() {
078: return null;
079: }
080:
081: public boolean validate() {
082: return true;
083: }
084:
085: public boolean validate(XmlOptions arg0) {
086: return true;
087: }
088:
089: public XmlObject[] selectPath(String arg0) {
090: return null;
091: }
092:
093: public XmlObject[] selectPath(String arg0, XmlOptions arg1) {
094: return null;
095: }
096:
097: public XmlObject[] execQuery(String arg0) {
098: return null;
099: }
100:
101: public XmlObject[] execQuery(String arg0, XmlOptions arg1) {
102: return null;
103: }
104:
105: public XmlObject changeType(SchemaType arg0) {
106: return null;
107: }
108:
109: public XmlObject substitute(QName arg0, SchemaType arg1) {
110: return null;
111: }
112:
113: public boolean isNil() {
114: return false;
115: }
116:
117: public void setNil() {
118: // nothing here
119: }
120:
121: public boolean isImmutable() {
122: return false;
123: }
124:
125: public XmlObject set(XmlObject arg0) {
126: return null;
127: }
128:
129: public XmlObject copy() {
130: return null;
131: }
132:
133: public boolean valueEquals(XmlObject arg0) {
134: return false;
135: }
136:
137: public int valueHashCode() {
138: return 0;
139: }
140:
141: public int compareTo(Object arg0) {
142: return 0;
143: }
144:
145: public int compareValue(XmlObject arg0) {
146: return 0;
147: }
148:
149: public XmlObject[] selectChildren(QName arg0) {
150: return null;
151: }
152:
153: public XmlObject[] selectChildren(String arg0, String arg1) {
154: return null;
155: }
156:
157: public XmlObject[] selectChildren(QNameSet arg0) {
158: return null;
159: }
160:
161: public XmlObject selectAttribute(QName arg0) {
162: return null;
163: }
164:
165: public XmlObject selectAttribute(String arg0, String arg1) {
166: return null;
167: }
168:
169: public XmlObject[] selectAttributes(QNameSet arg0) {
170: return null;
171: }
172:
173: public Object monitor() {
174: return null;
175: }
176:
177: public XmlDocumentProperties documentProperties() {
178: return null;
179: }
180:
181: public XmlCursor newCursor() {
182: return null;
183: }
184:
185: public XMLInputStream newXMLInputStream() {
186: return null;
187: }
188:
189: public XMLStreamReader newXMLStreamReader() {
190: return null;
191: }
192:
193: public String xmlText() {
194: return null;
195: }
196:
197: public InputStream newInputStream() {
198: return null;
199: }
200:
201: public Reader newReader() {
202: return null;
203: }
204:
205: public Node newDomNode() {
206: return null;
207: }
208:
209: public Node getDomNode() {
210: return null;
211: }
212:
213: public void save(ContentHandler arg0, LexicalHandler arg1) {
214: // nothing here
215: }
216:
217: public void save(File arg0) {
218: // nothing here
219: }
220:
221: public void save(OutputStream arg0) {
222: // nothing here
223: }
224:
225: public void save(Writer arg0) {
226: // nothing here
227: }
228:
229: public XMLInputStream newXMLInputStream(XmlOptions arg0) {
230: return null;
231: }
232:
233: public XMLStreamReader newXMLStreamReader(XmlOptions arg0) {
234: return null;
235: }
236:
237: public String xmlText(XmlOptions arg0) {
238: return null;
239: }
240:
241: public InputStream newInputStream(XmlOptions arg0) {
242: return null;
243: }
244:
245: public Reader newReader(XmlOptions arg0) {
246: return null;
247: }
248:
249: public Node newDomNode(XmlOptions arg0) {
250: return null;
251: }
252:
253: public void save(ContentHandler arg0, LexicalHandler arg1,
254: XmlOptions arg2) {
255: // nothing here
256: }
257:
258: public void save(File arg0, XmlOptions arg1) {
259: // nothing here
260: }
261:
262: public void save(OutputStream arg0, XmlOptions arg1) {
263: // nothing here
264: }
265:
266: public void save(Writer arg0, XmlOptions arg1) {
267: // nothing here
268: }
269:
270: public void dump() {
271: // nothing here
272: }
273:
274: public String toString() {
275: return "<MockApplication: " + this .identity + ">";
276: }
277:
278: public SpringApplication addNewSpring() {
279: throw new ImplementMe();
280: }
281:
282: public SpringApplication getSpring() {
283: throw new ImplementMe();
284: }
285:
286: public boolean isSetSpring() {
287: throw new ImplementMe();
288: }
289:
290: public void setSpring(SpringApplication arg0) {
291: throw new ImplementMe();
292: }
293:
294: public void unsetSpring() {
295: throw new ImplementMe();
296: }
297:
298: public Modules addNewModules() {
299: throw new ImplementMe();
300: }
301:
302: public Modules getModules() {
303: throw new ImplementMe();
304: }
305:
306: public boolean isSetModules() {
307: throw new ImplementMe();
308: }
309:
310: public void setModules(Modules arg0) {
311: throw new ImplementMe();
312: }
313:
314: public void unsetModules() {
315: throw new ImplementMe();
316: }
317:
318: }
|