01: package org.drools;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.io.Serializable;
20:
21: import org.drools.event.ActivationCancelledEvent;
22: import org.drools.event.ActivationCreatedEvent;
23: import org.drools.event.AfterActivationFiredEvent;
24: import org.drools.event.ObjectInsertedEvent;
25: import org.drools.event.ObjectUpdatedEvent;
26: import org.drools.event.ObjectRetractedEvent;
27: import org.drools.event.WorkingMemoryEventListener;
28:
29: public class TestWorkingMemoryEventListener implements
30: WorkingMemoryEventListener, Serializable {
31:
32: /**
33: *
34: */
35: private static final long serialVersionUID = 400L;
36: public int asserted;
37: public int modified;
38: public int retracted;
39: public int tested;
40: public int created;
41: public int cancelled;
42: public int fired;
43:
44: public TestWorkingMemoryEventListener() {
45: // intentionally left blank
46: }
47:
48: public void objectInserted(final ObjectInsertedEvent event) {
49: this .asserted++;
50: }
51:
52: public void objectUpdated(final ObjectUpdatedEvent event) {
53: this .modified++;
54: }
55:
56: public void objectRetracted(final ObjectRetractedEvent event) {
57: this .retracted++;
58: }
59:
60: /*
61: * public void conditionTested(ConditionTestedEvent event) { tested++; }
62: */
63: public void activationCreated(final ActivationCreatedEvent event) {
64: this .created++;
65: }
66:
67: public void activationCancelled(final ActivationCancelledEvent event) {
68: this .cancelled++;
69: }
70:
71: public void activationFired(final AfterActivationFiredEvent event) {
72: this.fired++;
73: }
74: }
|