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: */package com.tc.config.schema.validate;
04:
05: import org.apache.xmlbeans.XmlException;
06: import org.apache.xmlbeans.XmlObject;
07:
08: public class MockConfigurationValidator implements
09: ConfigurationValidator {
10:
11: private int numValidates;
12: private XmlObject lastBean;
13: private XmlException thrownException;
14:
15: public MockConfigurationValidator() {
16: this .thrownException = null;
17:
18: reset();
19: }
20:
21: public void reset() {
22: this .numValidates = 0;
23: this .lastBean = null;
24: }
25:
26: public void validate(XmlObject bean) throws XmlException {
27: ++this .numValidates;
28: this .lastBean = bean;
29: if (this .thrownException != null)
30: throw this .thrownException;
31: }
32:
33: public XmlObject getLastBean() {
34: return lastBean;
35: }
36:
37: public int getNumValidates() {
38: return numValidates;
39: }
40:
41: public void setThrownException(XmlException thrownException) {
42: this.thrownException = thrownException;
43: }
44:
45: }
|