DBA Data[Home] [Help]

PACKAGE BODY: APPS.JTF_AUTH_TRIGGERTEST

Source


1 PACKAGE BODY JTF_AUTH_TRIGGERTEST AS
2 /* $Header: jtf_TriggerTestB.pls 120.2 2005/10/25 05:09:26 psanyal noship $ */
3 
4   ------------------------------------------------------------
5   -- procedure to initialize test datastructures
6   -- executes prior to test run
7   ------------------------------------------------------------
8   PROCEDURE init IS
9   BEGIN
10    /* Setup datastructures for tests (one possible usage below) */
11     null;
12   END;
13 
14   ------------------------------------------------------------
15   -- procedure to cleanup any  test datastructures that were setup in the init
16   --  procedure call executes after test run
17   ------------------------------------------------------------
18   PROCEDURE cleanup IS
19   BEGIN
20   /*  Cleanup datastructures used by test and set up in init call
21   * to restore database to original state  [optional] Generally the
22   * test writer should write code here to undo what was done in init()
23   * to return the datavase to a pre-diagnostic test state */
24     null;
25   END;
26 
27 
28   ------------------------------------------------------------
29   -- procedure to execute the PLSQL test
30   -- the inputs needed for the test are passed in and a report
31   -- object and CLOB are -- returned.
32   ------------------------------------------------------------
33   PROCEDURE runtest(inputs IN  JTF_DIAG_INPUTTBL,
34                             report OUT NOCOPY JTF_DIAG_REPORT,
35                             reportClob OUT NOCOPY CLOB) IS
36      statusStr   VARCHAR2(50);   -- SUCCESS or FAILURE strings
37      errStr      VARCHAR2(4000); -- upto a max of 4000 chars.
38      fixInfo     VARCHAR2(4000); -- upto a max of 4000 chars.
39      isFatal     VARCHAR2(50);   -- TRUE or FALSE strings
40      reportStr   LONG;
41 
42 
43      v_count1   NUMBER;          -- JTF_AUTH_PRINCIPAL_MAPS_T4
44      v_count2   NUMBER;          -- JTF_AUTH_DOMAIN_TI
45      v_count3   NUMBER;          -- JTF_AUTH_ROLE_PERM_TI
46      v_count4   NUMBER;          -- JTF_AUTH_PERMISSIONS_B_T1
47      v_count5   NUMBER;          -- JTF_AUTH_DOMAINS_B_T1
48      v_count6   NUMBER;          -- JTF_AUTH_PRINCIPALS_B_T1
49      v_count7   NUMBER;          -- JTF_AUTH_PRINCIPAL_MAPS_T3
50 
51 
52 
53    BEGIN
54      /* Initialixe some core PL/SQL datastructions CLOB */
55      JTF_DIAGNOSTIC_ADAPTUTIL.setUpVars;
56      JTF_DIAGNOSTIC_ADAPTUTIL.addStringToReport('@html');
57 
58 
59      select count(*) into v_count1 from ALL_TRIGGERS where upper(TRIGGER_NAME) = 'JTF_AUTH_PRINCIPAL_MAPS_T4' and OWNER = 'APPS';
60      select count(*) into v_count2 from ALL_TRIGGERS where upper(TRIGGER_NAME) = 'JTF_AUTH_DOMAIN_TI' and OWNER = 'APPS';
61      select count(*) into v_count3 from ALL_TRIGGERS where upper(TRIGGER_NAME) = 'JTF_AUTH_ROLE_PERM_TI' and OWNER = 'APPS';
62      select count(*) into v_count4 from ALL_TRIGGERS where upper(TRIGGER_NAME) = 'JTF_AUTH_PERMISSIONS_B_T1' and OWNER = 'APPS';
63      select count(*) into v_count5 from ALL_TRIGGERS where upper(TRIGGER_NAME) = 'JTF_AUTH_DOMAINS_B_T1' and OWNER = 'APPS';
64      select count(*) into v_count6 from ALL_TRIGGERS where upper(TRIGGER_NAME) = 'JTF_AUTH_PRINCIPALS_B_T1' and OWNER = 'APPS';
65      select count(*) into v_count7 from ALL_TRIGGERS where upper(TRIGGER_NAME) = 'JTF_AUTH_PRINCIPAL_MAPS_T3' and OWNER = 'APPS';
66 
67 
68      IF (v_count1 = 1) AND (v_count2 = 1) AND (v_count3 = 1) AND (v_count4 = 1) AND (v_count5 = 1) AND (v_count6 = 1) AND (v_count7 = 1) THEN
69 
70         reportStr := 'The triggers exist. Test is successful';
71         JTF_DIAGNOSTIC_ADAPTUTIL.addStringToReport(reportStr);
72         statusStr := 'SUCCESS';
73      ELSE
74         JTF_DIAGNOSTIC_COREAPI.line_out('The following triggers do not exist : ');
75         JTF_DIAGNOSTIC_COREAPI.BRPrint;
76         IF (v_count1 <> 1) THEN
77            JTF_DIAGNOSTIC_COREAPI.line_out('jtf_auth_principal_maps_t4');
78            JTF_DIAGNOSTIC_COREAPI.BRPrint;
79         END IF;
80         IF (v_count2 <> 1) THEN
81            JTF_DIAGNOSTIC_COREAPI.line_out('jtf_auth_domain_tI');
82            JTF_DIAGNOSTIC_COREAPI.BRPrint;
83         END IF;
84         IF (v_count3 <> 1) THEN
85            JTF_DIAGNOSTIC_COREAPI.line_out('jtf_auth_role_perm_tI');
86            JTF_DIAGNOSTIC_COREAPI.BRPrint;
87         END IF;
88         IF (v_count4 <> 1) THEN
89            JTF_DIAGNOSTIC_COREAPI.line_out('JTF_AUTH_PERMISSIONS_B_T1');
90            JTF_DIAGNOSTIC_COREAPI.BRPrint;
91         END IF;
92         IF (v_count5 <> 1) THEN
93            JTF_DIAGNOSTIC_COREAPI.line_out('JTF_AUTH_DOMAINS_B_T1');
94            JTF_DIAGNOSTIC_COREAPI.BRPrint;
95         END IF;
96         IF (v_count6 <> 1) THEN
97            JTF_DIAGNOSTIC_COREAPI.line_out('JTF_AUTH_PRINCIPALS_B_T1');
98            JTF_DIAGNOSTIC_COREAPI.BRPrint;
99         END IF;
100         IF (v_count7 <> 1) THEN
101            JTF_DIAGNOSTIC_COREAPI.line_out('JTF_AUTH_PRINCIPAL_MAPS_T3');
102            JTF_DIAGNOSTIC_COREAPI.BRPrint;
103         END IF;
104 
105         statusStr := 'FAILURE';
106         errStr := 'The triggers do not exist. Test is failure';
107         fixInfo := 'Security Triggers are to be created.';
108         isFatal := 'FALSE';
109      END IF;
110 
111      /* Assign the OUT JTF_DIAG_REPORT object with the various report fields */
112      report := JTF_DIAGNOSTIC_ADAPTUTIL.constructReport(statusStr,errStr,fixInfo,isFatal);
113 
114      /* Retrieve and assign the OUT CLOB object with the current CLOB */
115      reportClob := JTF_DIAGNOSTIC_ADAPTUTIL.getReportClob;
116 
117    EXCEPTION WHEN others THEN
118      JTF_DIAGNOSTIC_COREAPI.errorprint('Error: '||sqlerrm);
119      report := JTF_DIAGNOSTIC_ADAPTUTIL.constructReport('FAILURE','The test has failed','Try rerunning','FALSE');
120      reportClob := JTF_DIAGNOSTIC_ADAPTUTIL.getReportClob;
121    END runTest;
122 
123 
124 
125 
126 
127    FUNCTION getTestMode return INTEGER IS
128    BEGIN
129      return JTF_DIAGNOSTIC_ADAPTUTIL.BASIC_MODE;
130    END getTestMode;
131 
132   ------------------------------------------------------------
133   -- procedure to report name back to framework
134   ------------------------------------------------------------
135   PROCEDURE getComponentName(compName OUT NOCOPY VARCHAR2) IS
136   BEGIN
137    compName := 'JTF Security Trigger Test';
138   END;
139 
140   ------------------------------------------------------------
141   -- procedure to report test description back to framework
142   ------------------------------------------------------------
143   PROCEDURE getTestDesc(testDesc OUT NOCOPY VARCHAR2) IS
144   BEGIN
145    testDesc := 'This test is used to find out the existance of security framework triggers';
146   END;
147 
148   ------------------------------------------------------------
149   -- procedure to report test name back to framework
150   ------------------------------------------------------------
151   PROCEDURE getTestName(testName OUT NOCOPY VARCHAR2) IS
152   BEGIN
153    testName := 'JTF Security Trigger Test';
154   END;
155 
156   ------------------------------------------------------------
157   -- procedure to provide/populate  the default parameters for the test case.
158   ------------------------------------------------------------
159   PROCEDURE getDefaultTestParams(defaultInputValues OUT NOCOPY JTF_DIAG_INPUTTBL) IS
160     ip JTF_DIAG_INPUTTBL;
161   BEGIN
162     /* return a initialized JTF_DIAG_INPUTTBL object */
163     ip := JTF_DIAGNOSTIC_ADAPTUTIL.initinputtable;
164     defaultInputValues := ip;
165   END getDefaultTestParams;
166 
167 
168 END JTF_AUTH_TRIGGERTEST;