01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.gps.device.jdbc;
18:
19: import org.compass.gps.device.jdbc.snapshot.ConfigureSnapshotEvent;
20: import org.compass.gps.device.jdbc.snapshot.CreateAndUpdateSnapshotEvent;
21: import org.compass.gps.device.jdbc.snapshot.DeleteSnapshotEvent;
22: import org.compass.gps.device.jdbc.snapshot.JdbcSnapshotEventListener;
23:
24: /**
25: *
26: * @author kimchy
27: *
28: */
29: public class MockSnapshotEventListener implements
30: JdbcSnapshotEventListener {
31:
32: private boolean createAndUpdateCalled;
33:
34: private boolean createHappen;
35:
36: private boolean updateHappen;
37:
38: private boolean deleteCalled;
39:
40: private boolean deleteHappen;
41:
42: public void configure(ConfigureSnapshotEvent configureSnapshotEvent)
43: throws JdbcGpsDeviceException {
44: }
45:
46: public void onCreateAndUpdate(
47: CreateAndUpdateSnapshotEvent createAndUpdateSnapshotEvent)
48: throws JdbcGpsDeviceException {
49: createAndUpdateCalled = true;
50: createHappen = !createAndUpdateSnapshotEvent
51: .getCreateSnapshots().isEmpty();
52: updateHappen = !createAndUpdateSnapshotEvent
53: .getUpdateSnapshots().isEmpty();
54: }
55:
56: public void onDelete(DeleteSnapshotEvent deleteSnapshotEvent)
57: throws JdbcGpsDeviceException {
58: deleteCalled = true;
59: deleteHappen = !deleteSnapshotEvent.getDeleteSnapshots()
60: .isEmpty();
61: }
62:
63: public void clear() {
64: createAndUpdateCalled = false;
65: createHappen = false;
66: updateHappen = false;
67: deleteCalled = false;
68: deleteHappen = false;
69: }
70:
71: public boolean isCreateAndUpdateCalled() {
72: return createAndUpdateCalled;
73: }
74:
75: public boolean isDeleteCalled() {
76: return deleteCalled;
77: }
78:
79: public boolean isCreateHappen() {
80: return createHappen;
81: }
82:
83: public boolean isUpdateHappen() {
84: return updateHappen;
85: }
86:
87: public boolean isDeleteHappen() {
88: return deleteHappen;
89: }
90:
91: }
|