KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > MockIllegalConfigurationChangeHandler


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema;
5
6 import com.tc.config.schema.dynamic.ConfigItem;
7
8 /**
9  * A mock {@link IllegalConfigurationChangeHandler}, for use in tests.
10  */

11 public class MockIllegalConfigurationChangeHandler implements IllegalConfigurationChangeHandler {
12
13   private int numChangeFaileds;
14   private ConfigItem lastItem;
15   private Object JavaDoc lastOldValue;
16   private Object JavaDoc lastNewValue;
17
18   public MockIllegalConfigurationChangeHandler() {
19     reset();
20   }
21
22   public void reset() {
23     this.numChangeFaileds = 0;
24     this.lastItem = null;
25     this.lastOldValue = null;
26     this.lastNewValue = null;
27   }
28
29   public void changeFailed(ConfigItem item, Object JavaDoc oldValue, Object JavaDoc newValue) {
30     ++this.numChangeFaileds;
31     this.lastItem = item;
32     this.lastOldValue = oldValue;
33     this.lastNewValue = newValue;
34   }
35
36   public ConfigItem getLastItem() {
37     return lastItem;
38   }
39
40   public Object JavaDoc getLastNewValue() {
41     return lastNewValue;
42   }
43
44   public Object JavaDoc getLastOldValue() {
45     return lastOldValue;
46   }
47
48   public int getNumChangeFaileds() {
49     return numChangeFaileds;
50   }
51
52 }
53
Popular Tags