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;
05:
06: import com.tc.config.schema.dynamic.ConfigItem;
07:
08: /**
09: * A mock {@link IllegalConfigurationChangeHandler}, for use in tests.
10: */
11: public class MockIllegalConfigurationChangeHandler implements
12: IllegalConfigurationChangeHandler {
13:
14: private int numChangeFaileds;
15: private ConfigItem lastItem;
16: private Object lastOldValue;
17: private Object lastNewValue;
18:
19: public MockIllegalConfigurationChangeHandler() {
20: reset();
21: }
22:
23: public void reset() {
24: this .numChangeFaileds = 0;
25: this .lastItem = null;
26: this .lastOldValue = null;
27: this .lastNewValue = null;
28: }
29:
30: public void changeFailed(ConfigItem item, Object oldValue,
31: Object newValue) {
32: ++this .numChangeFaileds;
33: this .lastItem = item;
34: this .lastOldValue = oldValue;
35: this .lastNewValue = newValue;
36: }
37:
38: public ConfigItem getLastItem() {
39: return lastItem;
40: }
41:
42: public Object getLastNewValue() {
43: return lastNewValue;
44: }
45:
46: public Object getLastOldValue() {
47: return lastOldValue;
48: }
49:
50: public int getNumChangeFaileds() {
51: return numChangeFaileds;
52: }
53:
54: }
|