Jaffa Logo
 
SourceForge.net
Home Contact Us FAQs Site Map
Source Forge: Homepage Bugs @ Sourceforge Mailing Lists @ Sourceforge Task Manager @ Sourceforge CVS @ Sourceforge
Jaffa Site
Jaffa Runtime
Jaffa RAD
Sub-Projects
Getting Started / Unit Tests

HttpUnit Tests For Data Security

This section covers how to run and test Data Security using the HttpUnitTest automated tests

Assumptions

  • It is assumed that you have downloaded a fresh copy of Jaffa project and want to run HttpunittestApp .

  • Have Tomcat 4.0.4 (or higher) installed with CATALINA_HOME set to the Tomcat installed directory.

  • Tomcat uses Memory Realm

    tomcat-users.xml
    <user name="PAUL"   password="dummy" roles="MANAGER,SUPERVISOR,CLERK" />
    <user name="MAHESH" password="dummy" roles="SUPERVISOR,CLERK" />
    <user name="GAUTAM" password="dummy" roles="CLERK" />
    

Defined Policies

We have one policy defined for the Item table. (This can be found in 'ItemFilter.xml'). With this policy applied, a user that has access to the role "Manager" can see only those items where serial is less then "C"

Prerequisites

Set Up The Database

  1. Change init.xml (under source\httpunittest\Java\jdbcengine) to point it to the right database.

  2. Create DB user - "jaffatest" . This is the same user used as <SchemaName> in itemfilter.xml. (Refer to Writing the XML Profile)

  3. Run Item.sql located under source\httpunittest\java\jdbcengine to create Item table.

Set Up The Data

Insert the following data into the Item table already created

INSERT INTO ITEM (ITEM_ID, SC, PART, Serial,QTY) VALUES('TESTITEM-01',  'SOME SC', 'TESTPART-01', 'A', 2);
INSERT INTO ITEM (ITEM_ID, SC, PART, Serial,QTY) VALUES('TESTITEM-02',  'SOME SC', 'TESTPART-02', 'B', 2);
INSERT INTO ITEM (ITEM_ID, SC, PART, Serial,QTY) VALUES('TESTITEM-03',  'SOME SC', 'TESTPART-03', 'C', 2);
INSERT INTO ITEM (ITEM_ID, SC, PART, Serial,QTY) VALUES('TESTITEM-04',  'SOME SC', 'TESTPART-04', 'D', 2);
INSERT INTO ITEM (ITEM_ID, SC, PART, Serial,QTY) VALUES('TESTITEM-05',  'SOME SC', 'TESTPART-05', 'E', 2);

Apply The Security Rules

Execute the SQL Scripts

  1. Log on to Oracle as jaffatest/changeme.

  2. Run CreateCtxPackage.sql under source\sql\admin\datasecurity. (Refer to Create Package to Access the context)

  3. Log on to Oracle as system/manager.

  4. Run CreateContext.sql under source\sql\system\datasecurity to create the context. (Refer to Create Context)

  5. Log on to Oracle as jaffatest/changeme.

  6. Run the sql script itemfilter_CreatePredicate.sql under source\httpunittest\sql\admin\datasecurity\itemfilter (Refer to Applying the Scripts to the database)

  7. Log on to Oracle as system/manager.

  8. Run itemfilter_ApplyPredicate.sql under source\httpunittest\sql\system\datasecurity\itemfilter

Running The Tests

Build and deploy the 'Httpunittest' Application, then run the tests.

  • In Forte , Run the ant script HttpUnittestApp under Jaffa\build.

  • This will build the HttpUnitTestApp war file and deploy it under Tomcat.

  • If the Tomcat server is not running , start the server before running any HttpUnitTestApp.

  • Now, under Forte , mount the File System Jaffa\source\httpunittest\tests

  • Execute AllTests under datasecurity package.

File: httpunittests.html, Last Modified: Tue Jul 15 2003 at 4:02:03pm. This site has been built using PPWIZARD