KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > listen > MockConfigurationChangeListener


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.listen;
5
6 import org.apache.xmlbeans.XmlObject;
7
8 /**
9  * A mock {@link ConfigurationChangeListener}, for use in tests.
10  */

11 public class MockConfigurationChangeListener implements ConfigurationChangeListener {
12
13   private int numConfigurationChangeds;
14   private XmlObject lastOldConfig;
15   private XmlObject lastNewConfig;
16
17   public MockConfigurationChangeListener() {
18     reset();
19   }
20
21   public void reset() {
22     this.numConfigurationChangeds = 0;
23     this.lastOldConfig = null;
24     this.lastNewConfig = null;
25   }
26
27   public void configurationChanged(XmlObject oldConfig, XmlObject newConfig) {
28     ++this.numConfigurationChangeds;
29     this.lastOldConfig = oldConfig;
30     this.lastNewConfig = newConfig;
31   }
32
33   public XmlObject getLastNewConfig() {
34     return lastNewConfig;
35   }
36
37   public XmlObject getLastOldConfig() {
38     return lastOldConfig;
39   }
40
41   public int getNumConfigurationChangeds() {
42     return numConfigurationChangeds;
43   }
44
45 }
46
Popular Tags