PolicyWildcardTest.java revision 869a36e2649ae064c98063cf1e55198488d78d12
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2011 ForgeRock AS. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
*/
/**
* To support the testing of OPENAM-726 - Multi-threaded entitlement evaluation gives wrong result
* @author Mark de Reeper
*/
public class PolicyWildcardTest {
private static String URL_USER_TEST3 = "https://www.forgerock.com:443/example/user/maintainUser?cid=200";
private static String URL_ADMIN_USER_TEST1 = "https://www.forgerock.com:443/example/admin/results?cid=14";
private static String URL_ADMIN_USER_TEST2 = "https://www.forgerock.com:443/example/admin/maintainUser?cid=200";
private static String URL_ADMIN_USER_TEST3 = "https://www.forgerock.com:443/example/admin/maintainUser";
private AMIdentity testAdminGroup;
private AMIdentity testAdminUser;
private AMIdentity testUser;
private SSOToken userSSOToken;
private SSOToken adminUserSSOToken;
private SSOToken adminToken;
}
}
@Test
public void testIsAllowedTest1() throws Exception {
Assert.assertTrue(pe.isAllowed(userSSOToken, URL_USER_TEST1, Util.GET_ACTION), "Expecting " + URL_USER_TEST1 + " to be allowed.");
}
@Test
public void testIsAllowedTest2() throws Exception {
Assert.assertTrue(pe.isAllowed(userSSOToken, URL_USER_TEST2, Util.GET_ACTION), "Expecting " + URL_USER_TEST2 + " to be allowed.");
}
@Test
public void testIsAllowedTest3() throws Exception {
Assert.assertTrue(pe.isAllowed(userSSOToken, URL_USER_TEST3, Util.GET_ACTION), "Expecting " + URL_USER_TEST3 + " to be allowed.");
}
@Test
public void testIsAdminAllowedTest1() throws Exception {
Assert.assertTrue(pe.isAllowed(adminUserSSOToken, URL_ADMIN_USER_TEST1, Util.GET_ACTION), "Expecting " + URL_ADMIN_USER_TEST1 + " to be allowed.");
}
@Test
public void testIsAdminAllowedTest2() throws Exception {
Assert.assertTrue(pe.isAllowed(adminUserSSOToken, URL_ADMIN_USER_TEST2, Util.GET_ACTION), "Expecting " + URL_ADMIN_USER_TEST2 + " to be allowed.");
}
@Test
public void testIsAdminAllowedTest3() throws Exception {
Assert.assertTrue(pe.isAllowed(adminUserSSOToken, URL_ADMIN_USER_TEST3, Util.GET_ACTION), "Expecting " + URL_ADMIN_USER_TEST3 + " to be allowed.");
}
@Test
public void testResourceSelfTest1() throws Exception {
Util.isGetPostAllowed(userSSOToken, URL_USER_TEST1, ResourceResult.SELF_SCOPE), "Expecting SELF " + URL_USER_TEST1 + " to be allowed.");
}
@Test
public void testResourceSelfTest2() throws Exception {
Util.isGetPostAllowed(userSSOToken, URL_USER_TEST2, ResourceResult.SELF_SCOPE), "Expecting SELF " + URL_USER_TEST2 + " to be allowed.");
}
@Test
public void testResourceSelfTest3() throws Exception {
Util.isGetPostAllowed(userSSOToken, URL_USER_TEST3, ResourceResult.SELF_SCOPE), "Expecting SELF " + URL_USER_TEST3 + " to be allowed.");
}
@Test
public void testResourceSubTreeTest1() throws Exception {
Util.isGetPostAllowed(userSSOToken, URL_USER_TEST1, ResourceResult.SUBTREE_SCOPE), "Expecting SUBTREE " + URL_USER_TEST1 + " to be allowed.");
}
@Test
public void testResourceSubTreeTest2() throws Exception {
Util.isGetPostAllowed(userSSOToken, URL_USER_TEST2, ResourceResult.SUBTREE_SCOPE), "Expecting SUBTREE " + URL_USER_TEST2 + " to be allowed.");
}
@Test
public void testResourceSubTreeTest3() throws Exception {
Util.isGetPostAllowed(userSSOToken, URL_USER_TEST3, ResourceResult.SUBTREE_SCOPE), "Expecting SUBTREE " + URL_USER_TEST3 + " to be allowed.");
}
@Test
public void testResourceSubTreeTest4() throws Exception {
Util.isGetPostAllowed(userSSOToken, URL_USER_TEST4, ResourceResult.SUBTREE_SCOPE), "Expecting SUBTREE " + URL_USER_TEST4 + " to be allowed.");
}
}