Skip to content

Commit 4c2336e

Browse files
committed
Update JSON Relational Duality view and Pipelined Table tests
1 parent b996fc5 commit 4c2336e

File tree

7 files changed

+68
-64
lines changed

7 files changed

+68
-64
lines changed

test/jsonDualityViews1.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -740,10 +740,11 @@ describe('272. jsonDualityView1.js', function() {
740740
describe('272.3.11 Create view without privilege ', function() {
741741
let connection = null;
742742
let conn = null;
743-
const createUser1 = `create user test1 identified by test1`;
744-
const createUser2 = `create user test2 identified by test2`;
745-
const grantPriv1 = `grant create session, resource, connect, unlimited tablespace to test1`;
746-
const grantPriv2 = `grant create session to test2`;
743+
const pwd = testsUtil.generateRandomPassword();
744+
const createUser1 = `create user njs_test1 identified by ${pwd}`;
745+
const createUser2 = `create user njs_test2 identified by ${pwd}`;
746+
const grantPriv1 = `grant create session, resource, connect, unlimited tablespace to njs_test1`;
747+
const grantPriv2 = `grant create session to njs_test2`;
747748

748749
const createTableStudent = `create table student(
749750
stuid number,
@@ -767,8 +768,8 @@ describe('272. jsonDualityView1.js', function() {
767768
});
768769

769770
after(async function() {
770-
await connection.execute(`drop user test1 cascade`);
771-
await connection.execute(`drop user test2 cascade`);
771+
await connection.execute(`drop user njs_test1 cascade`);
772+
await connection.execute(`drop user njs_test2 cascade`);
772773
await connection.close();
773774
});
774775

@@ -777,8 +778,8 @@ describe('272. jsonDualityView1.js', function() {
777778
AS
778779
student @insert @update @delete
779780
{StudentId: stuid, StudentName: name}`;
780-
conn = await oracledb.getConnection({user: 'test1',
781-
password: 'test1',
781+
conn = await oracledb.getConnection({user: 'njs_test1',
782+
password: pwd,
782783
connectString: dbConfig.connectString
783784
});
784785

@@ -799,13 +800,13 @@ describe('272. jsonDualityView1.js', function() {
799800

800801
it('272.3.11.2 Query with test2 user', async function() {
801802

802-
conn = await oracledb.getConnection({user: 'test2',
803-
password: 'test2',
803+
conn = await oracledb.getConnection({user: 'njs_test2',
804+
password: pwd,
804805
connectString: dbConfig.connectString
805806
});
806807

807808
await assert.rejects(
808-
async () => await conn.execute(`select * from test1.student_ov`),
809+
async () => await conn.execute(`select * from njs_test1.student_ov`),
809810
/ORA-00942:/ //ORA-00942: table or view does not exist
810811
);
811812
await conn.close();

test/jsonDualityViews2.js

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ describe('273. jsonDualityView2.js', function() {
5454
connectString : dbConfig.connectString,
5555
privilege : oracledb.SYSDBA,
5656
};
57+
const pwd = testsUtil.generateRandomPassword();
5758

5859
dbaConn = await oracledb.getConnection(dbaCredential);
59-
await dbaConn.execute(`create user jsonDv2 identified by jsonDv2`);
60+
await dbaConn.execute(`create user jsonDv2 identified by ${pwd}`);
6061
await dbaConn.execute(`grant create session, resource, connect,
6162
unlimited tablespace to jsonDv2`);
6263
connection = await oracledb.getConnection({user: 'jsonDv2',
63-
password: 'jsonDv2',
64+
password: pwd,
6465
connectString: dbConfig.connectString
6566
});
6667
});
@@ -314,10 +315,11 @@ describe('273. jsonDualityView2.js', function() {
314315
describe('273.4 Table and Views', function() {
315316
let conn1 = null;
316317
let conn2 = null;
317-
const createUser1 = `create user test1 identified by test1`;
318-
const createUser2 = `create user test2 identified by test2`;
319-
const grantPriv1 = `grant create session, resource, connect, unlimited tablespace to test1`;
320-
const grantPriv2 = `grant create session, resource, connect, unlimited tablespace to test2`;
318+
const pwd = testsUtil.generateRandomPassword();
319+
const createUser1 = `create user njs_test1 identified by ${pwd}`;
320+
const createUser2 = `create user njs_test2 identified by ${pwd}`;
321+
const grantPriv1 = `grant create session, resource, connect, unlimited tablespace to njs_test1`;
322+
const grantPriv2 = `grant create session, resource, connect, unlimited tablespace to njs_test2`;
321323
const createTableStudent = `create table student( \n` +
322324
`stuid number, \n` +
323325
`name varchar(128) default null, \n` +
@@ -328,22 +330,22 @@ describe('273. jsonDualityView2.js', function() {
328330
await dbaConn.execute(grantPriv1);
329331
await dbaConn.execute(createUser2);
330332
await dbaConn.execute(grantPriv2);
331-
conn1 = await oracledb.getConnection({user: 'test1',
332-
password: 'test1',
333+
conn1 = await oracledb.getConnection({user: 'njs_test1',
334+
password: pwd,
333335
connectString: dbConfig.connectString
334336
});
335337

336-
conn2 = await oracledb.getConnection({user: 'test2',
337-
password: 'test2',
338+
conn2 = await oracledb.getConnection({user: 'njs_test2',
339+
password: pwd,
338340
connectString: dbConfig.connectString
339341
});
340342
});
341343

342344
after(async function() {
343345
await conn2.close();
344346
await conn1.close();
345-
await dbaConn.execute(`drop user test1 cascade`);
346-
await dbaConn.execute(`drop user test2 cascade`);
347+
await dbaConn.execute(`drop user njs_test1 cascade`);
348+
await dbaConn.execute(`drop user njs_test2 cascade`);
347349
});
348350

349351
it('273.4.1 Base table in one schema and View in another schema', async function() {
@@ -357,7 +359,7 @@ describe('273. jsonDualityView2.js', function() {
357359
// commit the transaction
358360
await conn1.execute(`COMMIT`);
359361
// grant select privilege on student table to test2 with grant option
360-
await conn1.execute(`GRANT SELECT ON student TO test2 WITH GRANT OPTION`);
362+
await conn1.execute(`GRANT SELECT ON student TO njs_test2 WITH GRANT OPTION`);
361363
await assert.rejects(
362364
async () => await connection.execute(`CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW\n ` +
363365
`student_ov as test1__student{stuid,name}`),
@@ -453,7 +455,7 @@ describe('273. jsonDualityView2.js', function() {
453455

454456
await connection.execute(`
455457
CREATE BITMAP INDEX bitmap_index_demo_active_i
456-
ON bitmap_index_demo(active)`);
458+
ON bitmap_index_demo(active)`);
457459
await connection.execute(`INSERT INTO bitmap_index_demo(active) VALUES(1)`);
458460

459461
await connection.execute('COMMIT');
@@ -467,20 +469,20 @@ ON bitmap_index_demo(active)`);
467469

468470
describe('273.5 With Redaction on base tables', function() {
469471
let conn = null;
470-
472+
const pwd = testsUtil.generateRandomPassword();
471473
before(async function() {
472-
await dbaConn.execute(`create user testuser1 identified by testuser1`);
473-
await dbaConn.execute(`grant create session,resource,create table,unlimited tablespace to testuser1`);
474-
await dbaConn.execute(`grant execute on sys.dbms_redact to testuser1`);
474+
await dbaConn.execute(`create user njs_testuser1 identified by ${pwd}`);
475+
await dbaConn.execute(`grant create session,resource,create table,unlimited tablespace to njs_testuser1`);
476+
await dbaConn.execute(`grant execute on sys.dbms_redact to njs_testuser1`);
475477
});
476478

477479
after(async function() {
478-
await dbaConn.execute(`drop user testuser1 cascade`);
480+
await dbaConn.execute(`drop user njs_testuser1 cascade`);
479481
});
480482

481483
it('273.5.1 redaction enabled on a base table', async function() {
482-
conn = await oracledb.getConnection({user: 'testuser1',
483-
password: 'testuser1',
484+
conn = await oracledb.getConnection({user: 'njs_testuser1',
485+
password: pwd,
484486
connectString: dbConfig.connectString
485487
});
486488
await conn.execute(`create table redact(
@@ -503,7 +505,7 @@ ON bitmap_index_demo(active)`);
503505

504506
await dbaConn.execute(`begin
505507
dbms_redact.add_policy(
506-
object_schema => 'TESTUSER1',
508+
object_schema => 'NJS_TESTUSER1',
507509
object_name => 'redact',
508510
column_name => 'card_no',
509511
policy_name => 'redact_card_info',
@@ -512,8 +514,8 @@ ON bitmap_index_demo(active)`);
512514
);
513515
end;`);
514516

515-
conn = await oracledb.getConnection({user: 'testuser1',
516-
password: 'testuser1',
517+
conn = await oracledb.getConnection({user: 'njs_testuser1',
518+
password: pwd,
517519
connectString: dbConfig.connectString
518520
});
519521
result = await conn.execute(`select * from redact order by 1`);

test/jsonDualityViews3.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('274 jsonDualityView3.js', function() {
4141
let connection = null;
4242
let dbaConn = null;
4343
let isRunnable = false;
44-
44+
const pwd = testsUtil.generateRandomPassword();
4545
before(async function() {
4646
isRunnable = await testsUtil.checkPrerequisites(2100000000, 2300000000);
4747
if (!isRunnable) {
@@ -56,11 +56,11 @@ describe('274 jsonDualityView3.js', function() {
5656
};
5757

5858
dbaConn = await oracledb.getConnection(dbaCredential);
59-
await dbaConn.execute(`create user jsonDv3 identified by jsonDv3`);
59+
await dbaConn.execute(`create user njs_jsonDv3 identified by ${pwd}`);
6060
await dbaConn.execute(`grant create session, resource, connect,
61-
unlimited tablespace to jsonDv3`);
62-
connection = await oracledb.getConnection({user: 'jsonDv3',
63-
password: 'jsonDv3',
61+
unlimited tablespace to njs_jsonDv3`);
62+
connection = await oracledb.getConnection({user: 'njs_jsonDv3',
63+
password: pwd,
6464
connectString: dbConfig.connectString
6565
});
6666
});
@@ -69,7 +69,7 @@ describe('274 jsonDualityView3.js', function() {
6969
if (!isRunnable) return;
7070

7171
await connection.close();
72-
await dbaConn.execute(`drop user jsonDv3 CASCADE`);
72+
await dbaConn.execute(`drop user njs_jsonDv3 CASCADE`);
7373
await dbaConn.close();
7474
});
7575

test/jsonDualityViews4.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ describe('275. jsonDualityView4.js', function() {
5454
connectString : dbConfig.connectString,
5555
privilege : oracledb.SYSDBA,
5656
};
57-
57+
const pwd = testsUtil.generateRandomPassword();
5858
dbaConn = await oracledb.getConnection(dbaCredential);
59-
await dbaConn.execute(`create user jsonDv4 identified by jsonDv4`);
59+
60+
await dbaConn.execute(`create user njs_jsonDv4 identified by ${pwd}`);
6061
await dbaConn.execute(`grant create session, resource, connect,
61-
unlimited tablespace to jsonDv4`);
62-
connection = await oracledb.getConnection({user: 'jsonDv4',
63-
password: 'jsonDv4',
62+
unlimited tablespace to njs_jsonDv4`);
63+
connection = await oracledb.getConnection({user: 'njs_jsonDv4',
64+
password: pwd,
6465
connectString: dbConfig.connectString
6566
});
6667

@@ -97,12 +98,12 @@ describe('275. jsonDualityView4.js', function() {
9798
after(async function() {
9899
if (!isRunnable) return;
99100

100-
//await connection.execute(`drop table student_class PURGE`);
101101
await connection.execute(`drop table student PURGE`);
102102
await connection.execute(`drop table class PURGE`);
103+
103104
await connection.close();
105+
await dbaConn.execute(`drop user njs_jsonDv4 cascade`);
104106

105-
await dbaConn.execute(`drop user jsonDv4 cascade`);
106107
await dbaConn.close();
107108
});
108109

@@ -466,7 +467,7 @@ describe('275. jsonDualityView4.js', function() {
466467
// Query to create student_ov view using JSON RELATIONAL DUALITY
467468
const createStudentOvView = `
468469
CREATE OR REPLACE JSON RELATIONAL DUALITY VIEW student_ov
469-
AS jsonDv4.customer{id abc:customer @nest{dt}}
470+
AS njs_jsonDv4.customer{id abc:customer @nest{dt}}
470471
`;
471472

472473
await connection.execute(createCustomerTable);

test/jsonDualityViews5.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ describe('276. jsonDualityView5.js', function() {
5454
connectString : dbConfig.connectString,
5555
privilege : oracledb.SYSDBA,
5656
};
57-
57+
const pwd = testsUtil.generateRandomPassword();
5858
dbaConn = await oracledb.getConnection(dbaCredential);
59-
await dbaConn.execute(`create user jsonDv5 identified by jsonDv5`);
59+
await dbaConn.execute(`create user njs_jsonDv5 identified by ${pwd}`);
6060
await dbaConn.execute(`grant ctxapp, connect, resource,create session,create any table,
61-
create view,CREATE MATERIALIZED VIEW,unlimited tablespace to jsonDv5`);
62-
connection = await oracledb.getConnection({user: 'jsonDv5',
63-
password: 'jsonDv5',
61+
create view,CREATE MATERIALIZED VIEW,unlimited tablespace to njs_jsonDv5`);
62+
connection = await oracledb.getConnection({user: 'njs_jsonDv5',
63+
password: pwd,
6464
connectString: dbConfig.connectString
6565
});
6666

@@ -103,7 +103,7 @@ describe('276. jsonDualityView5.js', function() {
103103
await connection.execute(`drop table student PURGE`);
104104
await connection.close();
105105

106-
await dbaConn.execute(`drop user jsonDv5 cascade`);
106+
await dbaConn.execute(`drop user njs_jsonDv5 cascade`);
107107
await dbaConn.close();
108108
});
109109

test/jsonDualityViews6.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* limitations under the License.
2424
*
2525
* NAME
26-
* 277. jsonDualityView5.js
26+
* 277. jsonDualityView6.js
2727
*
2828
* DESCRIPTION
2929
* Testing JSON Relational Duality View using GraphQL
@@ -36,7 +36,7 @@ const assert = require('assert');
3636
const dbConfig = require('./dbconfig.js');
3737
const testsUtil = require('./testsUtil.js');
3838

39-
describe('277. jsonDualityView5.js', function() {
39+
describe('277. jsonDualityView6.js', function() {
4040

4141
let connection = null;
4242
let dbaConn = null;
@@ -54,13 +54,12 @@ describe('277. jsonDualityView5.js', function() {
5454
connectString : dbConfig.connectString,
5555
privilege : oracledb.SYSDBA,
5656
};
57-
58-
57+
const pwd = testsUtil.generateRandomPassword();
5958
dbaConn = await oracledb.getConnection(dbaCredential);
60-
await dbaConn.execute(`create user jsonDv5 identified by jsonDv5`);
61-
await dbaConn.execute(`grant create session, resource, connect, unlimited tablespace to jsonDv5`);
62-
connection = await oracledb.getConnection({user: 'jsonDv5',
63-
password: 'jsonDv5',
59+
await dbaConn.execute(`create user njs_jsonDv6 identified by ${pwd}`);
60+
await dbaConn.execute(`grant create session, resource, connect, unlimited tablespace to njs_jsonDv6`);
61+
connection = await oracledb.getConnection({user: 'njs_jsonDv6',
62+
password: pwd,
6463
connectString: dbConfig.connectString
6564
});
6665
});
@@ -69,7 +68,7 @@ describe('277. jsonDualityView5.js', function() {
6968
if (!isRunnable) return;
7069
await connection.close();
7170

72-
await dbaConn.execute(`drop user jsonDv5 cascade`);
71+
await dbaConn.execute(`drop user njs_jsonDv6 cascade`);
7372
await dbaConn.close();
7473
});
7574

test/opts/.mocharc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,4 @@ spec:
262262
- test/jsonDualityViews6.js
263263
- test/poolExpansion.js
264264
- test/poolShrinkage.js
265+
- test/pipelinedTables.js

0 commit comments

Comments
 (0)