5
5
6
6
import junit .framework .Assert ;
7
7
import junit .framework .AssertionFailedError ;
8
- import junit .framework .TestCase ;
9
8
10
9
import org .apache .shiro .SecurityUtils ;
11
10
import org .apache .shiro .authc .UsernamePasswordToken ;
12
11
import org .apache .shiro .authz .UnauthorizedException ;
13
- import org .apache .shiro .config .IniSecurityManagerFactory ;
14
- import org .apache .shiro .mgt .SecurityManager ;
15
12
import org .apache .shiro .subject .Subject ;
16
13
14
+ import eu .flatwhite .shiro .spatial .AbstractShiroFullConfigTest ;
17
15
import eu .flatwhite .shiro .spatial .ex1 .domain .Person ;
18
16
import eu .flatwhite .shiro .spatial .ex1 .domain .Person .Gender ;
19
17
import eu .flatwhite .shiro .spatial .ex1 .domain .PersonDao ;
29
27
* @author cstamas
30
28
*
31
29
*/
32
- public abstract class Example1Base extends TestCase {
33
-
34
- protected IniSecurityManagerFactory config ;
35
-
36
- protected SecurityManager securityManager ;
30
+ public abstract class Example1Base extends AbstractShiroFullConfigTest {
37
31
38
32
protected PersonDao personDao ;
39
33
@@ -44,23 +38,13 @@ public abstract class Example1Base extends TestCase {
44
38
protected void setUp () throws Exception {
45
39
super .setUp ();
46
40
47
- config = new IniSecurityManagerFactory (getIniPath ());
48
-
49
- securityManager = config .getInstance ();
50
-
51
- SecurityUtils .setSecurityManager (securityManager );
52
-
53
41
personDao = (PersonDao ) config .getBeans ().get ("personDao" );
54
42
55
43
personRoleDao = (PersonRoleDao ) config .getBeans ().get ("personRoleDao" );
56
44
57
45
vendingMachine = new ProtectedVendingMachine (new SimpleVendingMachine ());
58
46
}
59
47
60
- protected void tearDown () throws Exception {
61
- super .tearDown ();
62
- }
63
-
64
48
// Protected resources simulated with canI* methods
65
49
66
50
protected boolean canIHaveCoffe (Subject subject ) {
@@ -157,8 +141,6 @@ protected void assertChecks(int expectedFailures)
157
141
158
142
// Test preparation methods
159
143
160
- protected abstract String getIniPath ();
161
-
162
144
protected abstract void applyManagerDecrete ();
163
145
164
146
protected void populateInitialEmployees () {
0 commit comments