org.objectweb.jonas.jtests.clients.security
Class A_AccessControl

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.objectweb.jonas.jtests.util.JTestCase
                    |
                    +--org.objectweb.jonas.jtests.clients.security.A_AccessControl
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
F_AccessControlEC, F_AccessControlEC2, F_AccessControlSL

public abstract class A_AccessControl
extends JTestCase

Security Management common tests for all type of beans (Entity/Session)

Author:
Ph.Coq, Ph.Durieux

Field Summary
protected static org.objectweb.security.context.SecurityCurrent current
           
protected static org.objectweb.security.context.SecurityContext principal1
           
protected static java.lang.String PRINCIPAL1_NAME
           
protected static org.objectweb.security.context.SecurityContext principal2
           
protected static java.lang.String ROLE1_NAME
           
protected static java.lang.String ROLE2_NAME
           
 
Fields inherited from class org.objectweb.jonas.jtests.util.JTestCase
ictx, isInit, jonasName, msgerror, testtorun, utx
 
Constructor Summary
A_AccessControl(java.lang.String name)
           
 
Method Summary
abstract  BaseS getBaseS(java.lang.String name)
           
protected  void setUp()
          init environment: - load beans
 void testBasicMethodAccept()
          test basic method accept
 void testBasicMethodReject()
          test basic method reject
 void testBeanToBeanPropagation()
          test principal propagation from bean to bean
 void testComplexMethodAccept()
          test complex method accept
 void testComplexMethodReject()
          test complex method reject
 void testGetCallerPrincipal()
          test getCallerPrincipal.
 void testIsCallerInRole()
          test isCallerInRole. principal1 = role1 principal2 = role2
 void testLocalMethodAccept()
          test accept access to a local method callAnotherMethod is called with role1 and call DerivedSF.anotheMethod with this role return false if access to anotheMethod was denied expected return is true
 void testLocalMethodReject()
          test reject access to a local method callAnotherMethod is called with role1 and call DerivedSF.anotheMethod with this role return false if access to anotheMethod was denied expected return is true
 void testRejectBeanToBeanAccess()
          test principal propagation from bean to bean and access is denied
 void testSecurityRoleRef()
          test security-role-ref in DD baserole -> role1
 
Methods inherited from class org.objectweb.jonas.jtests.util.JTestCase
debug, getDBEnv, random, sleep, tearDown, testEmpty, unloadBeans, useBeans
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PRINCIPAL1_NAME

protected static java.lang.String PRINCIPAL1_NAME

ROLE1_NAME

protected static java.lang.String ROLE1_NAME

ROLE2_NAME

protected static java.lang.String ROLE2_NAME

current

protected static org.objectweb.security.context.SecurityCurrent current

principal1

protected static org.objectweb.security.context.SecurityContext principal1

principal2

protected static org.objectweb.security.context.SecurityContext principal2
Constructor Detail

A_AccessControl

public A_AccessControl(java.lang.String name)
Method Detail

setUp

protected void setUp()
init environment: - load beans
Overrides:
setUp in class JTestCase

getBaseS

public abstract BaseS getBaseS(java.lang.String name)
                        throws java.lang.Exception

testGetCallerPrincipal

public void testGetCallerPrincipal()
                            throws java.lang.Exception
test getCallerPrincipal. The Principal must be propagated.

testIsCallerInRole

public void testIsCallerInRole()
                        throws java.lang.Exception
test isCallerInRole. principal1 = role1 principal2 = role2

testBasicMethodReject

public void testBasicMethodReject()
                           throws java.lang.Exception
test basic method reject

testBasicMethodAccept

public void testBasicMethodAccept()
                           throws java.lang.Exception
test basic method accept

testComplexMethodReject

public void testComplexMethodReject()
                             throws java.lang.Exception
test complex method reject

testComplexMethodAccept

public void testComplexMethodAccept()
                             throws java.lang.Exception
test complex method accept

testSecurityRoleRef

public void testSecurityRoleRef()
                         throws java.lang.Exception
test security-role-ref in DD baserole -> role1

testBeanToBeanPropagation

public void testBeanToBeanPropagation()
                               throws java.lang.Exception
test principal propagation from bean to bean

testRejectBeanToBeanAccess

public void testRejectBeanToBeanAccess()
                                throws java.lang.Exception
test principal propagation from bean to bean and access is denied

testLocalMethodAccept

public void testLocalMethodAccept()
                           throws java.lang.Exception
test accept access to a local method callAnotherMethod is called with role1 and call DerivedSF.anotheMethod with this role return false if access to anotheMethod was denied expected return is true

testLocalMethodReject

public void testLocalMethodReject()
                           throws java.lang.Exception
test reject access to a local method callAnotherMethod is called with role1 and call DerivedSF.anotheMethod with this role return false if access to anotheMethod was denied expected return is true