|
1
|
|
package com.tirsen.angkor.test.unit.mock;
|
|
2
|
|
|
|
3
|
|
import javax.servlet.ServletContext;
|
|
4
|
|
import javax.servlet.http.HttpSession;
|
|
5
|
|
import javax.servlet.http.HttpSessionContext;
|
|
6
|
|
import javax.servlet.http.HttpSessionBindingListener;
|
|
7
|
|
import javax.servlet.http.HttpSessionBindingEvent;
|
|
8
|
|
import java.util.Enumeration;
|
|
9
|
|
import java.util.HashMap;
|
|
10
|
|
import java.util.Map;
|
|
11
|
|
|
|
12
|
|
/*
|
|
13
|
|
* Created by IntelliJ IDEA.
|
|
14
|
|
* User: Jon Tirsén
|
|
15
|
|
* Date: 2002-okt-09
|
|
16
|
|
* Time: 21:08:04
|
|
17
|
|
* To change this template use Options | File Templates.
|
|
18
|
|
*/
|
|
19
|
|
public class MockHttpSession implements HttpSession
|
|
20
|
|
{
|
|
21
|
|
private Map attributes = new HashMap();
|
|
22
|
|
|
|
23
|
20
|
public MockHttpSession()
|
|
24
|
|
{
|
|
25
|
|
}
|
|
26
|
|
|
|
27
|
0
|
public boolean isNew()
|
|
28
|
|
{
|
|
29
|
|
// TODO implement MockHttpSession.isNew
|
|
30
|
0
|
throw new RuntimeException("MockHttpSession.isNew is not implemented yet.");
|
|
31
|
|
}
|
|
32
|
|
|
|
33
|
0
|
public void invalidate()
|
|
34
|
|
{
|
|
35
|
|
// TODO implement MockHttpSession.invalidate
|
|
36
|
0
|
throw new RuntimeException("MockHttpSession.invalidate is not implemented yet.");
|
|
37
|
|
}
|
|
38
|
|
|
|
39
|
0
|
public void removeValue(String s)
|
|
40
|
|
{
|
|
41
|
|
// TODO implement MockHttpSession.removeValue
|
|
42
|
0
|
throw new RuntimeException("MockHttpSession.removeValue is not implemented yet.");
|
|
43
|
|
}
|
|
44
|
|
|
|
45
|
0
|
public void removeAttribute(String s)
|
|
46
|
|
{
|
|
47
|
|
// TODO implement MockHttpSession.removeAttribute
|
|
48
|
0
|
throw new RuntimeException("MockHttpSession.removeAttribute is not implemented yet.");
|
|
49
|
|
}
|
|
50
|
|
|
|
51
|
0
|
public void putValue(String s, Object o)
|
|
52
|
|
{
|
|
53
|
|
// TODO implement MockHttpSession.putValue
|
|
54
|
0
|
throw new RuntimeException("MockHttpSession.putValue is not implemented yet.");
|
|
55
|
|
}
|
|
56
|
|
|
|
57
|
3
|
public void setAttribute(String attribute, Object value)
|
|
58
|
|
{
|
|
59
|
3
|
attributes.put(attribute, value);
|
|
60
|
3
|
if (value instanceof HttpSessionBindingListener)
|
|
61
|
|
{
|
|
62
|
3
|
HttpSessionBindingListener httpSessionBindingListener = (HttpSessionBindingListener) value;
|
|
63
|
3
|
httpSessionBindingListener.valueBound(new HttpSessionBindingEvent(this, attribute));
|
|
64
|
|
}
|
|
65
|
|
}
|
|
66
|
|
|
|
67
|
0
|
public String[] getValueNames()
|
|
68
|
|
{
|
|
69
|
|
// TODO implement MockHttpSession.getValueNames
|
|
70
|
0
|
throw new RuntimeException("MockHttpSession.getValueNames is not implemented yet.");
|
|
71
|
|
}
|
|
72
|
|
|
|
73
|
0
|
public Enumeration getAttributeNames()
|
|
74
|
|
{
|
|
75
|
|
// TODO implement MockHttpSession.getAttributeNames
|
|
76
|
0
|
throw new RuntimeException("MockHttpSession.getAttributeNames is not implemented yet.");
|
|
77
|
|
}
|
|
78
|
|
|
|
79
|
0
|
public Object getValue(String s)
|
|
80
|
|
{
|
|
81
|
|
// TODO implement MockHttpSession.getValue
|
|
82
|
0
|
throw new RuntimeException("MockHttpSession.getValue is not implemented yet.");
|
|
83
|
|
}
|
|
84
|
|
|
|
85
|
11
|
public Object getAttribute(String attribute)
|
|
86
|
|
{
|
|
87
|
11
|
return attributes.get(attribute);
|
|
88
|
|
}
|
|
89
|
|
|
|
90
|
0
|
public HttpSessionContext getSessionContext()
|
|
91
|
|
{
|
|
92
|
|
// TODO implement MockHttpSession.getSessionContext
|
|
93
|
0
|
throw new RuntimeException("MockHttpSession.getSessionContext is not implemented yet.");
|
|
94
|
|
}
|
|
95
|
|
|
|
96
|
0
|
public int getMaxInactiveInterval()
|
|
97
|
|
{
|
|
98
|
|
// TODO implement MockHttpSession.getMaxInactiveInterval
|
|
99
|
0
|
throw new RuntimeException("MockHttpSession.getMaxInactiveInterval is not implemented yet.");
|
|
100
|
|
}
|
|
101
|
|
|
|
102
|
1
|
public void setMaxInactiveInterval(int i)
|
|
103
|
|
{
|
|
104
|
|
// ignore
|
|
105
|
|
}
|
|
106
|
|
|
|
107
|
0
|
public ServletContext getServletContext()
|
|
108
|
|
{
|
|
109
|
|
// TODO implement MockHttpSession.getServletContext
|
|
110
|
0
|
throw new RuntimeException("MockHttpSession.getServletContext is not implemented yet.");
|
|
111
|
|
}
|
|
112
|
|
|
|
113
|
0
|
public long getLastAccessedTime()
|
|
114
|
|
{
|
|
115
|
|
// TODO implement MockHttpSession.getLastAccessedTime
|
|
116
|
0
|
throw new RuntimeException("MockHttpSession.getLastAccessedTime is not implemented yet.");
|
|
117
|
|
}
|
|
118
|
|
|
|
119
|
0
|
public String getId()
|
|
120
|
|
{
|
|
121
|
|
// TODO implement MockHttpSession.getId
|
|
122
|
0
|
throw new RuntimeException("MockHttpSession.getId is not implemented yet.");
|
|
123
|
|
}
|
|
124
|
|
|
|
125
|
0
|
public long getCreationTime()
|
|
126
|
|
{
|
|
127
|
|
// TODO implement MockHttpSession.getCreationTime
|
|
128
|
0
|
throw new RuntimeException("MockHttpSession.getCreationTime is not implemented yet.");
|
|
129
|
|
}
|
|
130
|
|
}
|
|
131
|
|
|