未验证 提交 cd8580dc 编写于 作者: O openharmony_ci 提交者: Gitee

!7648 【Distributeddatamgr】【master】master用例修改

Merge pull request !7648 from yanglifeng/monthly_20221018
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -309,34 +309,6 @@ describe('rdbStoreDistributedTest', function () { ...@@ -309,34 +309,6 @@ describe('rdbStoreDistributedTest', function () {
done(); done();
console.info(TAG + "************* testRdbStoreDistributed0011 end *************"); console.info(TAG + "************* testRdbStoreDistributed0011 end *************");
}) })
/**
* @tc.name sync test
* @tc.number SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100
* @tc.desc sync test
*/
it('SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100', 0, async function (done) {
console.info(TAG + "************* SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1
}
await dataRdb.getRdbStoreV9(context, config, 1).then(async (store) => {
let predicates = new dataRdb.RdbPredicatesV9("employee")
predicates = predicates.inDevices("12345678abcd");
try {
store.sync(dataRdb.SyncMode.SYNC_MODE_PUSH, predicates);
} catch (err) {
expect(null).assertFail();
}
}).catch((err) => {
expect(null).assertFail();
})
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.info(TAG + "************* SUB_DDM_AppDataFWK_JSRDB_Distributed_syncV9_0100 end *************");
})
/** /**
* @tc.name sync Callback test * @tc.name sync Callback test
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -1652,9 +1652,9 @@ describe('rdbResultSetTest', function () { ...@@ -1652,9 +1652,9 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0004', 0, async function (done) { it('testGetColumnIndex0004', 0, async function (done) {
console.info(TAG + '************* testGetColumnIndex0004 start *************'); console.info(TAG + '************* testGetColumnIndex0004 start *************');
{ {
let predicates = await new dataRdb.RdbPredicates('test'); let predicates = await new dataRdb.RdbPredicates('test')
let resultSet = await rdbStore.query(predicates); let resultSet = await rdbStore.query(predicates)
expect(-1).assertEqual(resultSet.getColumnIndex('')); expect(-1).assertEqual(resultSet.getColumnIndex(''))
resultSet = null; resultSet = null;
done(); done();
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
const TAG = "[RDB_JSKITS_TEST]" const TAG = "[RDB_JSKITS_TEST]"
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -23,7 +23,7 @@ const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIM ...@@ -23,7 +23,7 @@ const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIM
const STORE_CONFIG = { const STORE_CONFIG = {
name: "Query.db", name: "Query.db",
} }
const TEST_BUNDLE_NAME="ohos.acts.relationalStorejstest" const TEST_BUNDLE_NAME="ohos.acts.rdbjstest"
var kvManager = null var kvManager = null
var kvStore = null var kvStore = null
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
......
...@@ -12,11 +12,12 @@ ...@@ -12,11 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import rdbStoreV9Test from './RdbstoreRdbstoreV9.test.ets'
import rdbStoreDistributedTest from './RdbstoreDistributedEtsunit.test.ets' import relationalStoreDistributedTest from './relationalStoreDistributedEtsunit.test.ets'
import rdbResultSetTest from './RdbstoreResultsetV9Etsunit.test.ets' import relationalStoreTest from './relationalStoreEtsunit.test.ets'
import relationalStoreResultSetTest from './relationalStoreTestResultsetEtsunit.test.ets'
export default function testsuite() { export default function testsuite() {
rdbStoreDistributedTest(globalThis.abilityContext) relationalStoreDistributedTest(globalThis.abilityContext)
rdbStoreV9Test(globalThis.abilityContext); relationalStoreTest(globalThis.abilityContext)
rdbResultSetTest(globalThis.abilityContext) relationalStoreResultSetTest(globalThis.abilityContext)
} }
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.relationalStore';
const TAG = "[RDB_JSKITS_TEST_Distributed]" const TAG = "[RDB_JSKITS_TEST_Distributed]"
const STORE_NAME = "distributed_rdb.db" const STORE_NAME = "distributed_rdb.db"
...@@ -27,20 +27,20 @@ const config = { ...@@ -27,20 +27,20 @@ const config = {
} }
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)" + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"
export default function rdbStoreDistributedTest(context) { export default function relationalStoreDistributedTest(context) {
describe('rdbStoreDistributedTest', function () { describe('relationalStoreDistributedTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
}) })
beforeEach(async function () { beforeEach(async function () {
rdbStore = await dataRdb.getRdbStoreV9(context, config, 1); rdbStore = await dataRdb.getRdbStore(context, config);
await rdbStore.executeSql(CREATE_TABLE_TEST, null) await rdbStore.executeSql(CREATE_TABLE_TEST, null)
console.info(TAG + 'beforeEach') console.info(TAG + 'beforeEach')
}) })
afterEach(async function () { afterEach(async function () {
await dataRdb.deleteRdbStoreV9(context, STORE_NAME); await dataRdb.deleteRdbStore(context, STORE_NAME);
console.info(TAG + 'afterEach') console.info(TAG + 'afterEach')
}) })
......
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.relationalStore';
const TAG = "[RDB_JSKITS_TEST]" const TAG = "[RDB_JSKITS_TEST]"
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"; const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)";
...@@ -23,8 +23,8 @@ function sleep(ms) { ...@@ -23,8 +23,8 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
export default function rdbStoreV9Test(context){ export default function relationalStoreTest(context){
describe('rdbStoreV9Test', function () { describe('relationalStoreTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
}) })
...@@ -44,18 +44,18 @@ describe('rdbStoreV9Test', function () { ...@@ -44,18 +44,18 @@ describe('rdbStoreV9Test', function () {
console.log(TAG + "*************Unit Test Begin*************"); console.log(TAG + "*************Unit Test Begin*************");
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S1 * @tc.name rdb store getRdbStore with securityLevel S1
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0100 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100
* @tc.desc rdb store getRdbStoreV9 with securityLevel S1 * @tc.desc rdb store getRdbStore with securityLevel S1
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0100', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0100 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1 securityLevel: dataRdb.SecurityLevel.S1
} }
let storePromise = dataRdb.getRdbStoreV9(context, config, 1); let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => { storePromise.then(async (store) => {
try { try {
await store.executeSql(CREATE_TABLE_TEST); await store.executeSql(CREATE_TABLE_TEST);
...@@ -69,22 +69,22 @@ describe('rdbStoreV9Test', function () { ...@@ -69,22 +69,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db"); await dataRdb.deleteRdbStore(context,"secure.db");
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0100 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100 end *************");
}) })
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S2 * @tc.name rdb store getRdbStore with securityLevel S2
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0200 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200
* @tc.desc rdb store getRdbStoreV9 with securityLevel S2 * @tc.desc rdb store getRdbStore with securityLevel S2
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0200', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0200 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S2 securityLevel: dataRdb.SecurityLevel.S2
} }
let storePromise = dataRdb.getRdbStoreV9(context, config, 1); let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => { storePromise.then(async (store) => {
try { try {
await store.executeSql(CREATE_TABLE_TEST); await store.executeSql(CREATE_TABLE_TEST);
...@@ -98,22 +98,22 @@ describe('rdbStoreV9Test', function () { ...@@ -98,22 +98,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db"); await dataRdb.deleteRdbStore(context,"secure.db");
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0200 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200 end *************");
}) })
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S3 * @tc.name rdb store getRdbStore with securityLevel S3
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0300 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300
* @tc.desc rdb store getRdbStoreV9 with securityLevel S3 * @tc.desc rdb store getRdbStore with securityLevel S3
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0300', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0300 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S3 securityLevel: dataRdb.SecurityLevel.S3
} }
let storePromise = dataRdb.getRdbStoreV9(context, config, 1); let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => { storePromise.then(async (store) => {
try { try {
await store.executeSql(CREATE_TABLE_TEST); await store.executeSql(CREATE_TABLE_TEST);
...@@ -127,22 +127,22 @@ describe('rdbStoreV9Test', function () { ...@@ -127,22 +127,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db"); await dataRdb.deleteRdbStore(context,"secure.db");
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0300 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300 end *************");
}) })
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S4 * @tc.name rdb store getRdbStore with securityLevel S4
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0400 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400
* @tc.desc rdb store getRdbStoreV9 with securityLevel S4 * @tc.desc rdb store getRdbStore with securityLevel S4
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0400', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0400 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S4 securityLevel: dataRdb.SecurityLevel.S4
} }
let storePromise = dataRdb.getRdbStoreV9(context, config, 1); let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => { storePromise.then(async (store) => {
try { try {
await store.executeSql(CREATE_TABLE_TEST); await store.executeSql(CREATE_TABLE_TEST);
...@@ -156,22 +156,22 @@ describe('rdbStoreV9Test', function () { ...@@ -156,22 +156,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db"); await dataRdb.deleteRdbStore(context,"secure.db");
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0400 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400 end *************");
}) })
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S1 * @tc.name rdb store getRdbStore with securityLevel S1
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0100
* @tc.desc rdb store getRdbStoreV9 with securityLevel S1 * @tc.desc rdb store getRdbStore with securityLevel S1
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0100 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1 securityLevel: dataRdb.SecurityLevel.S1
} }
dataRdb.getRdbStoreV9(context, config, 1, async (err,data) => { dataRdb.getRdbStore(context, config, async (err,data) => {
if(err != null){ if(err != null){
console.info(TAG + "get rdb store error" + err.message) console.info(TAG + "get rdb store error" + err.message)
expect(null).assertFail(); expect(null).assertFail();
...@@ -181,24 +181,24 @@ describe('rdbStoreV9Test', function () { ...@@ -181,24 +181,24 @@ describe('rdbStoreV9Test', function () {
dataRdb.deleteRdbStore(context,"secure.db").then(()=>{ dataRdb.deleteRdbStore(context,"secure.db").then(()=>{
console.info(TAG + "Delete rdbstore success") console.info(TAG + "Delete rdbstore success")
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0100 end *************");
}) })
}); });
}) })
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S2 * @tc.name rdb store getRdbStore with securityLevel S2
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0200
* @tc.desc rdb store getRdbStoreV9 with securityLevel S2 * @tc.desc rdb store getRdbStore with securityLevel S2
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0200', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0200 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S2 securityLevel: dataRdb.SecurityLevel.S2
} }
dataRdb.getRdbStoreV9(context, config, 1,async (err,data) => { dataRdb.getRdbStore(context, config,async (err,data) => {
if(err != null){ if(err != null){
console.info(TAG + "get rdb store error") console.info(TAG + "get rdb store error")
expect(null).assertFail(); expect(null).assertFail();
...@@ -207,24 +207,24 @@ describe('rdbStoreV9Test', function () { ...@@ -207,24 +207,24 @@ describe('rdbStoreV9Test', function () {
} }
dataRdb.deleteRdbStore(context, "secure.db").then(() => { dataRdb.deleteRdbStore(context, "secure.db").then(() => {
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0200 end *************");
}) })
}); });
}) })
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S3 * @tc.name rdb store getRdbStore with securityLevel S3
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0300
* @tc.desc rdb store getRdbStoreV9 with securityLevel S3 * @tc.desc rdb store getRdbStore with securityLevel S3
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0300', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0300 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S3 securityLevel: dataRdb.SecurityLevel.S3
} }
dataRdb.getRdbStoreV9(context, config, 1,async (err,data) => { dataRdb.getRdbStore(context, config,async (err,data) => {
if(err != null){ if(err != null){
console.info(TAG + "get rdb store error") console.info(TAG + "get rdb store error")
expect(null).assertFail(); expect(null).assertFail();
...@@ -233,24 +233,24 @@ describe('rdbStoreV9Test', function () { ...@@ -233,24 +233,24 @@ describe('rdbStoreV9Test', function () {
} }
dataRdb.deleteRdbStore(context, "secure.db").then(() => { dataRdb.deleteRdbStore(context, "secure.db").then(() => {
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0300 end *************");
}) })
}); });
}) })
/** /**
* @tc.name rdb store getRdbStoreV9 with securityLevel S4 * @tc.name rdb store getRdbStore with securityLevel S4
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 * @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0400
* @tc.desc rdb store getRdbStoreV9 with securityLevel S4 * @tc.desc rdb store getRdbStore with securityLevel S4
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400', 0, async function (done) { it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0400', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0400 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S4 securityLevel: dataRdb.SecurityLevel.S4
} }
dataRdb.getRdbStoreV9(context, config, 1,async (err,data) => { dataRdb.getRdbStore(context, config,async (err,data) => {
if(err != null){ if(err != null){
console.info(TAG + "get rdb store error") console.info(TAG + "get rdb store error")
expect(null).assertFail(); expect(null).assertFail();
...@@ -259,53 +259,53 @@ describe('rdbStoreV9Test', function () { ...@@ -259,53 +259,53 @@ describe('rdbStoreV9Test', function () {
} }
dataRdb.deleteRdbStore(context,"secure.db").then(() => { dataRdb.deleteRdbStore(context,"secure.db").then(() => {
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0400 end *************");
}) })
}); });
}) })
/** /**
* @tc.name rdb store deleteRdbStoreV9 * @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100 * @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100
* @tc.desc rdb store deleteRdbStoreV9 * @tc.desc rdb store deleteRdbStore
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100', 0, async function (done) { it('SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S4 securityLevel: dataRdb.SecurityLevel.S4
} }
let deleteResult = false let deleteResult = false
await dataRdb.getRdbStoreV9(context, config, 1).then(async (store) => { await dataRdb.getRdbStore(context, config).then(async (store) => {
console.info(TAG + "create table success") console.info(TAG + "create table success")
}) })
await dataRdb.deleteRdbStoreV9(context,"secure.db").then(() => { await dataRdb.deleteRdbStore(context,"secure.db").then(() => {
deleteResult = true deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`) console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
}); });
expect(deleteResult).assertTrue(); expect(deleteResult).assertTrue();
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100 end *************");
}) })
/** /**
* @tc.name rdb store deleteRdbStoreV9 * @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100 * @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100
* @tc.desc rdb store deleteRdbStoreV9 * @tc.desc rdb store deleteRdbStore
* @tc.require: I5PIL6 * @tc.require: I5PIL6
*/ */
it('SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100', 0, async function (done) { it('SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100 start *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100 start *************");
let config = { let config = {
name: "secure.db", name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1 securityLevel: dataRdb.SecurityLevel.S1
} }
let deleteResult = false let deleteResult = false
await dataRdb.getRdbStoreV9(context, config, 1).then(async (store) => { await dataRdb.getRdbStore(context, config).then(async (store) => {
console.info(TAG + "create rdb store success") console.info(TAG + "create rdb store success")
}) })
dataRdb.deleteRdbStoreV9(context,"secure.db", (err, data) => { dataRdb.deleteRdbStore(context,"secure.db", (err, data) => {
if(err == undefined){ if(err == undefined){
deleteResult = true deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`) console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
...@@ -315,7 +315,7 @@ describe('rdbStoreV9Test', function () { ...@@ -315,7 +315,7 @@ describe('rdbStoreV9Test', function () {
await sleep(1000) await sleep(1000)
expect(deleteResult).assertTrue(); expect(deleteResult).assertTrue();
done(); done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100 end *************");
}) })
console.log(TAG + "*************Unit Test End*************"); console.log(TAG + "*************Unit Test End*************");
}) })
......
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import dataRdb from '@ohos.data.rdb' import dataRdb from '@ohos.data.relationalStore'
const TAG = '[RDB_JSKITS_TEST]' const TAG = '[RDB_JSKITS_TEST]'
const CREATE_TABLE_TEST = 'CREATE TABLE IF NOT EXISTS test (' + 'id INTEGER PRIMARY KEY AUTOINCREMENT, ' + 'data1 text,' + 'data2 long, ' + 'data3 double,' + 'data4 blob)'; const CREATE_TABLE_TEST = 'CREATE TABLE IF NOT EXISTS test (' + 'id INTEGER PRIMARY KEY AUTOINCREMENT, ' + 'data1 text,' + 'data2 long, ' + 'data3 double,' + 'data4 blob)';
...@@ -25,11 +25,11 @@ const STORE_CONFIG = { ...@@ -25,11 +25,11 @@ const STORE_CONFIG = {
const COLOUNM_NAMES = ["id","data1","data2","data3","data4"]; const COLOUNM_NAMES = ["id","data1","data2","data3","data4"];
var rdbStore = undefined; var rdbStore = undefined;
export default function rdbResultSetTestV9(context) { export default function relationalStoreResultSetTest(context) {
describe('rdbResultSetTestV9', function () { describe('relationalStoreResultSetTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
rdbStore = await dataRdb.getRdbStoreV9(context, STORE_CONFIG, 1); rdbStore = await dataRdb.getRdbStore(context, STORE_CONFIG);
await rdbStore.executeSql(CREATE_TABLE_TEST, null); await rdbStore.executeSql(CREATE_TABLE_TEST, null);
await createTest(); await createTest();
}) })
...@@ -45,7 +45,7 @@ describe('rdbResultSetTestV9', function () { ...@@ -45,7 +45,7 @@ describe('rdbResultSetTestV9', function () {
afterAll(async function () { afterAll(async function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
rdbStore = null rdbStore = null
await dataRdb.deleteRdbStoreV9(context, 'Resultset.db'); await dataRdb.deleteRdbStore(context, 'Resultset.db');
}) })
//插入数据 //插入数据
async function createTest() { async function createTest() {
...@@ -84,32 +84,32 @@ describe('rdbResultSetTestV9', function () { ...@@ -84,32 +84,32 @@ describe('rdbResultSetTestV9', function () {
} }
/** /**
* @tc.name resultSetV9 getBlob normal test * @tc.name resultSet getBlob normal test
* @tc.number SUB_DDM_RELATIONALETS_RESULTSETV9_0010 * @tc.number SUB_DDM_RELATIONALETS_RESULTSET_0010
* @tc.desc resultSetV9 getBlob normal test * @tc.desc resultSet getBlob normal test
*/ */
it('SUB_DDM_RELATIONALETS_RESULTSETV9_0010', 0, async function (done) { it('SUB_DDM_RELATIONALETS_RESULTSET_0010', 0, async function (done) {
console.info(TAG + '************* SUB_DDM_RELATIONALETS_RESULTSETV9_0010 start *************'); console.info(TAG + '************* SUB_DDM_RELATIONALETS_RESULTSET_0010 start *************');
let predicates = await new dataRdb.RdbPredicatesV9('test') let predicates = await new dataRdb.RdbPredicates('test')
let resultSetV9 = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
{ {
expect(true).assertEqual(resultSetV9.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
const id = resultSetV9.getLong(resultSetV9.getColumnIndex('id')) const id = resultSet.getLong(resultSet.getColumnIndex('id'))
const data4 = resultSetV9.getBlob(resultSetV9.getColumnIndex('data4')) const data4 = resultSet.getBlob(resultSet.getColumnIndex('data4'))
console.info(TAG + 'id=' + id + ', data4=' + data4); console.info(TAG + 'id=' + id + ', data4=' + data4);
expect(1).assertEqual(data4[0]); expect(1).assertEqual(data4[0]);
expect(2).assertEqual(data4[1]); expect(2).assertEqual(data4[1]);
expect(3).assertEqual(data4[2]); expect(3).assertEqual(data4[2]);
} }
resultSetV9.close(); resultSet.close();
expect(true).assertEqual(resultSetV9.isClosed) expect(true).assertEqual(resultSet.isClosed)
} catch (e) { } catch (e) {
expect(null).assertFail(); expect(null).assertFail();
} }
resultSetV9 = null resultSet = null
done(); done();
console.info(TAG + '************* SUB_DDM_RELATIONALETS_RESULTSETV9_0010 end *************'); console.info(TAG + '************* SUB_DDM_RELATIONALETS_RESULTSET_0010 end *************');
}) })
console.info(TAG + '*************Unit Test End*************'); console.info(TAG + '*************Unit Test End*************');
}) })
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
"pages": "$profile:main_pages", "pages": "$profile:main_pages",
"uiSyntax": "ets", "uiSyntax": "ets",
"metadata": [ "metadata": [
{ {
"name": "ArkTSPartialUpdate", "name": "ArkTSPartialUpdate",
"value": "false" "value": "false"
} }
], ],
"abilities": [ "abilities": [
{ {
"name": "ohos.acts.RelationalStoreStage.MainAbility", "name": "ohos.acts.RelationalStoreStage.MainAbility",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册