My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
*
*/
package org.openiaml.model.tests.codegen.model0_4;

import org.eclipse.core.resources.IFile;

/**
* Try the 'OR' constraint, which lets us have any
* of the required permissions.
*
* @author jmwright
* @example AccessControlHandler,ConstraintEdge,RequiresEdge
* An {@model AccessControlHandler} which {@model RequiresEdge requires}
* only one of two {@model Permission permissions},
* which are connected by a {@model ConstraintEdge}.
* @implementation AccessControlHandler,ConstraintEdge
* If an {@model AccessControlHandler}'s {@model RequiresEdge requirements}
* are connected by a {@model ConstraintEdge} of type "OR", only
* one of the requirements will be necessary to permit access.
*
*/
public class UserMultiplePermissionsOr extends AbstractDefaultRoleUserLoginTestCase {

@Override
public void setUp() throws Exception {
super.setUp();
root = loadAndCodegen(UserMultiplePermissionsOr.class);
initialiseDatabase();
}

/**
* Check the initial state of the application.
*
* @throws Exception
*/
public void testInitial() throws Exception {
beginAtSitemapThenPage("Home");
}

/**
* We cannot access the protected page as a User
* because it does not have the appropriate Role.
*
* @throws Exception
*/
public void testUser() throws Exception {
IFile sitemap = doStandardLoginAs("user@openiaml.org", "user");
// we actually expect a problem, because user does not have 'default role' permissions
assertProblem();

// if we then try to go to 'target', we likewise will also be prevented
gotoSitemapWithProblem(sitemap, "target");
assertTitleNotSame("target");
assertProblem(); // who knows where we are?
}

/**
* Log in as 'default role'
*
* @throws Exception
*/
public void testDefaultRole() throws Exception {
IFile sitemap = doStandardLoginAs("default@openiaml.org", "test123");
assertNoProblem();

gotoSitemapThenPage(sitemap, "target");
assertNoProblem();
}

/**
* Log in as 'another role'
*
* @throws Exception
*/
public void testAnotherRole() throws Exception {
IFile sitemap = doStandardLoginAs("another@openiaml.org", "test123");
assertNoProblem();

gotoSitemapThenPage(sitemap, "target");
assertNoProblem();
}

/**
* Log in as 'both role'
*
* @throws Exception
*/
public void testBothRoles() throws Exception {
IFile sitemap = doStandardLoginAs("both@openiaml.org", "test123");
assertNoProblem();

gotoSitemapThenPage(sitemap, "target");
assertNoProblem();
}

}

Change log

r1897 by soundasleep on Apr 14, 2010   Diff
reverting some failing test cases back
from changes made in r1867, as they should
not have actually been throwing
exceptions: AccessControlHandler should
create 'fail' wires rather than failing
directly
adding exception wrapper around
clickLinkWithExactText
Go to: 
Project members, sign in to write a code review

Older revisions

r1867 by soundasleep on Apr 10, 2010   Diff
some tests are supposed to throw
exceptions, rather than just simple
error messages
r1730 by soundasleep on Mar 17, 2010   Diff
updating codegen tests to the correct
implementation of assertNoProblem()
r1640 by soundasleep on Mar 7, 2010   Diff
fixing all broken @model links in
javadoc, and genmodel docs
All revisions of this file

File info

Size: 2645 bytes, 97 lines
Powered by Google Project Hosting