001: /*
002: * Copyright 2001-2006 C:1 Financial Services GmbH
003: *
004: * This software is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License Version 2.1, as published by the Free Software Foundation.
007: *
008: * This software is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public
014: * License along with this library; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016: */
017:
018: package de.finix.contelligent.test.mock;
019:
020: import java.util.Collection;
021: import java.util.HashMap;
022: import java.util.List;
023: import java.util.Map;
024:
025: import com.mockobjects.MockObject;
026:
027: import de.finix.contelligent.ComponentManager;
028: import de.finix.contelligent.ComponentPath;
029: import de.finix.contelligent.Session;
030: import de.finix.contelligent.clientsupport.ClientNotificator;
031: import de.finix.contelligent.core.security.User;
032:
033: public class MockContelligentSession extends MockObject implements
034: Session {
035: private User user;
036:
037: private Map categoryMap;
038:
039: private ComponentManager componentManager;
040:
041: private Map sessionStore;
042:
043: private ComponentPath currentPage;
044:
045: private ClientNotificator notificator;
046:
047: public MockContelligentSession() {
048: sessionStore = new HashMap();
049: }
050:
051: public User getUser() {
052: return user;
053: }
054:
055: public void setUser(User user) {
056: this .user = user;
057: }
058:
059: // TODO: Test case needs to be fixed for real multi history support.
060: public void addCurrentPage(ComponentPath l, String environment) {
061: currentPage = l;
062: }
063:
064: public ComponentPath getCurrentPage() {
065: return currentPage;
066: }
067:
068: // TODO: Test case needs to be fixed for real multi history support.
069: public ComponentPath getHistoryPage(String environment, int history) {
070: return currentPage;
071: }
072:
073: public String resolveCategory(String categoryName) {
074: return null;
075: }
076:
077: public void setCategoryMap(Map map) {
078: categoryMap = map;
079: }
080:
081: public Map getCategoryMap() {
082: return categoryMap;
083: }
084:
085: public Map getSessionStore() {
086: return sessionStore;
087: }
088:
089: public ComponentManager getComponentManager() {
090: return componentManager;
091: }
092:
093: public void setComponentManager(ComponentManager componentManager) {
094: this .componentManager = componentManager;
095: }
096:
097: public ClientNotificator getClientNotificator() {
098: return notificator;
099: }
100:
101: public void setClientNotificator(ClientNotificator notificator) {
102: this .notificator = notificator;
103: }
104:
105: public Collection getEvents() {
106: return null;
107: }
108:
109: public void removeEvents(Collection events) {
110: }
111:
112: /**
113: * Answer the unique session id
114: */
115: public String getId() {
116: return "0";
117: }
118:
119: public void addObserverSession(Session session) {
120: }
121:
122: public void removeObserverSession(Session session) {
123: }
124:
125: public boolean hasObserverSession() {
126: return false;
127: }
128:
129: public void notifyObserverSessions(List eventList) {
130: }
131:
132: public boolean isClientSession() {
133: return false;
134: }
135:
136: public void setClientSession(boolean flag) {
137: }
138:
139: /**
140: * Answer the current workflow context of this session.
141: *
142: * @return id of the current workflow
143: */
144: public long getWorkflowId() {
145: return -1000;
146: }
147:
148: /**
149: * Set the current workflow context of this session.
150: *
151: * @param wfId
152: * id of the current workflow
153: */
154: public void setWorkflowId(long wfId) {
155: }
156:
157: /**
158: * Reset the user to the guest user.
159: */
160: public void resetToGuest() {
161: }
162:
163: public int getPreviewMode() {
164: return PREVIEW;
165: }
166:
167: public void setNamedUser(User user) {
168: setUser(user);
169: }
170: }
|