未验证 提交 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");
* you may not use this file except in compliance with the License.
* 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -310,34 +310,6 @@ describe('rdbStoreDistributedTest', function () {
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.number SUB_DDM_AppDataFWK_JSRDB_Distributed_Callback_011
......
/*
* 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -1652,9 +1652,9 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0004', 0, async function (done) {
console.info(TAG + '************* testGetColumnIndex0004 start *************');
{
let predicates = await new dataRdb.RdbPredicates('test');
let resultSet = await rdbStore.query(predicates);
expect(-1).assertEqual(resultSet.getColumnIndex(''));
let predicates = await new dataRdb.RdbPredicates('test')
let resultSet = await rdbStore.query(predicates)
expect(-1).assertEqual(resultSet.getColumnIndex(''))
resultSet = null;
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");
* you may not use this file except in compliance with the License.
* 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");
* you may not use this file except in compliance with the License.
* 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* 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';
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");
* you may not use this file except in compliance with the License.
* 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
const STORE_CONFIG = {
name: "Query.db",
}
const TEST_BUNDLE_NAME="ohos.acts.relationalStorejstest"
const TEST_BUNDLE_NAME="ohos.acts.rdbjstest"
var kvManager = 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");
* you may not use this file except in compliance with the License.
* 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");
* you may not use this file except in compliance with the License.
* 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");
* you may not use this file except in compliance with the License.
* 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......
......@@ -12,11 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rdbStoreV9Test from './RdbstoreRdbstoreV9.test.ets'
import rdbStoreDistributedTest from './RdbstoreDistributedEtsunit.test.ets'
import rdbResultSetTest from './RdbstoreResultsetV9Etsunit.test.ets'
import relationalStoreDistributedTest from './relationalStoreDistributedEtsunit.test.ets'
import relationalStoreTest from './relationalStoreEtsunit.test.ets'
import relationalStoreResultSetTest from './relationalStoreTestResultsetEtsunit.test.ets'
export default function testsuite() {
rdbStoreDistributedTest(globalThis.abilityContext)
rdbStoreV9Test(globalThis.abilityContext);
rdbResultSetTest(globalThis.abilityContext)
relationalStoreDistributedTest(globalThis.abilityContext)
relationalStoreTest(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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -15,7 +15,7 @@
*/
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 STORE_NAME = "distributed_rdb.db"
......@@ -27,20 +27,20 @@ const config = {
}
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)"
export default function rdbStoreDistributedTest(context) {
describe('rdbStoreDistributedTest', function () {
export default function relationalStoreDistributedTest(context) {
describe('relationalStoreDistributedTest', function () {
beforeAll(async function () {
console.info(TAG + 'beforeAll')
})
beforeEach(async function () {
rdbStore = await dataRdb.getRdbStoreV9(context, config, 1);
rdbStore = await dataRdb.getRdbStore(context, config);
await rdbStore.executeSql(CREATE_TABLE_TEST, null)
console.info(TAG + 'beforeEach')
})
afterEach(async function () {
await dataRdb.deleteRdbStoreV9(context, STORE_NAME);
await dataRdb.deleteRdbStore(context, STORE_NAME);
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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -14,7 +14,7 @@
*/
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 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) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export default function rdbStoreV9Test(context){
describe('rdbStoreV9Test', function () {
export default function relationalStoreTest(context){
describe('relationalStoreTest', function () {
beforeAll(async function () {
console.info(TAG + 'beforeAll')
})
......@@ -44,18 +44,18 @@ describe('rdbStoreV9Test', function () {
console.log(TAG + "*************Unit Test Begin*************");
/**
* @tc.name rdb store getRdbStoreV9 with securityLevel S1
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0100
* @tc.desc rdb store getRdbStoreV9 with securityLevel S1
* @tc.name rdb store getRdbStore with securityLevel S1
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100
* @tc.desc rdb store getRdbStore with securityLevel S1
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0100 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1
}
let storePromise = dataRdb.getRdbStoreV9(context, config, 1);
let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => {
try {
await store.executeSql(CREATE_TABLE_TEST);
......@@ -69,22 +69,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
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.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0200
* @tc.desc rdb store getRdbStoreV9 with securityLevel S2
* @tc.name rdb store getRdbStore with securityLevel S2
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200
* @tc.desc rdb store getRdbStore with securityLevel S2
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0200', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0200 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S2
}
let storePromise = dataRdb.getRdbStoreV9(context, config, 1);
let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => {
try {
await store.executeSql(CREATE_TABLE_TEST);
......@@ -98,22 +98,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
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.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0300
* @tc.desc rdb store getRdbStoreV9 with securityLevel S3
* @tc.name rdb store getRdbStore with securityLevel S3
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300
* @tc.desc rdb store getRdbStore with securityLevel S3
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0300', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0300 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S3
}
let storePromise = dataRdb.getRdbStoreV9(context, config, 1);
let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => {
try {
await store.executeSql(CREATE_TABLE_TEST);
......@@ -127,22 +127,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
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.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0400
* @tc.desc rdb store getRdbStoreV9 with securityLevel S4
* @tc.name rdb store getRdbStore with securityLevel S4
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400
* @tc.desc rdb store getRdbStore with securityLevel S4
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0400', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_PROMISE_0400 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0400 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S4
}
let storePromise = dataRdb.getRdbStoreV9(context, config, 1);
let storePromise = dataRdb.getRdbStore(context, config);
storePromise.then(async (store) => {
try {
await store.executeSql(CREATE_TABLE_TEST);
......@@ -156,22 +156,22 @@ describe('rdbStoreV9Test', function () {
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
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.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100
* @tc.desc rdb store getRdbStoreV9 with securityLevel S1
* @tc.name rdb store getRdbStore with securityLevel S1
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0100
* @tc.desc rdb store getRdbStore with securityLevel S1
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0100 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1
}
dataRdb.getRdbStoreV9(context, config, 1, async (err,data) => {
dataRdb.getRdbStore(context, config, async (err,data) => {
if(err != null){
console.info(TAG + "get rdb store error" + err.message)
expect(null).assertFail();
......@@ -181,24 +181,24 @@ describe('rdbStoreV9Test', function () {
dataRdb.deleteRdbStore(context,"secure.db").then(()=>{
console.info(TAG + "Delete rdbstore success")
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.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200
* @tc.desc rdb store getRdbStoreV9 with securityLevel S2
* @tc.name rdb store getRdbStore with securityLevel S2
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0200
* @tc.desc rdb store getRdbStore with securityLevel S2
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0200 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0200', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0200 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S2
}
dataRdb.getRdbStoreV9(context, config, 1,async (err,data) => {
dataRdb.getRdbStore(context, config,async (err,data) => {
if(err != null){
console.info(TAG + "get rdb store error")
expect(null).assertFail();
......@@ -207,24 +207,24 @@ describe('rdbStoreV9Test', function () {
}
dataRdb.deleteRdbStore(context, "secure.db").then(() => {
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.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300
* @tc.desc rdb store getRdbStoreV9 with securityLevel S3
* @tc.name rdb store getRdbStore with securityLevel S3
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0300
* @tc.desc rdb store getRdbStore with securityLevel S3
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0300 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0300', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0300 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S3
}
dataRdb.getRdbStoreV9(context, config, 1,async (err,data) => {
dataRdb.getRdbStore(context, config,async (err,data) => {
if(err != null){
console.info(TAG + "get rdb store error")
expect(null).assertFail();
......@@ -233,24 +233,24 @@ describe('rdbStoreV9Test', function () {
}
dataRdb.deleteRdbStore(context, "secure.db").then(() => {
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.number SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400
* @tc.desc rdb store getRdbStoreV9 with securityLevel S4
* @tc.name rdb store getRdbStore with securityLevel S4
* @tc.number SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0400
* @tc.desc rdb store getRdbStore with securityLevel S4
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTOREV9_CALLBACK_0400 start *************");
it('SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0400', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_CALLBACK_0400 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S4
}
dataRdb.getRdbStoreV9(context, config, 1,async (err,data) => {
dataRdb.getRdbStore(context, config,async (err,data) => {
if(err != null){
console.info(TAG + "get rdb store error")
expect(null).assertFail();
......@@ -259,53 +259,53 @@ describe('rdbStoreV9Test', function () {
}
dataRdb.deleteRdbStore(context,"secure.db").then(() => {
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.number SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100
* @tc.desc rdb store deleteRdbStoreV9
* @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100
* @tc.desc rdb store deleteRdbStore
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_PROMISE_0100 start *************");
it('SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S4
}
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")
})
await dataRdb.deleteRdbStoreV9(context,"secure.db").then(() => {
await dataRdb.deleteRdbStore(context,"secure.db").then(() => {
deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
});
expect(deleteResult).assertTrue();
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.number SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100
* @tc.desc rdb store deleteRdbStoreV9
* @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100
* @tc.desc rdb store deleteRdbStore
* @tc.require: I5PIL6
*/
it('SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTOREV9_CALLBACK_0100 start *************");
it('SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100', 0, async function (done) {
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100 start *************");
let config = {
name: "secure.db",
securityLevel: dataRdb.SecurityLevel.S1
}
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")
})
dataRdb.deleteRdbStoreV9(context,"secure.db", (err, data) => {
dataRdb.deleteRdbStore(context,"secure.db", (err, data) => {
if(err == undefined){
deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
......@@ -315,7 +315,7 @@ describe('rdbStoreV9Test', function () {
await sleep(1000)
expect(deleteResult).assertTrue();
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*************");
})
......
/*
* 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
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 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 = {
const COLOUNM_NAMES = ["id","data1","data2","data3","data4"];
var rdbStore = undefined;
export default function rdbResultSetTestV9(context) {
describe('rdbResultSetTestV9', function () {
export default function relationalStoreResultSetTest(context) {
describe('relationalStoreResultSetTest', function () {
beforeAll(async function () {
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 createTest();
})
......@@ -45,7 +45,7 @@ describe('rdbResultSetTestV9', function () {
afterAll(async function () {
console.info(TAG + 'afterAll')
rdbStore = null
await dataRdb.deleteRdbStoreV9(context, 'Resultset.db');
await dataRdb.deleteRdbStore(context, 'Resultset.db');
})
//插入数据
async function createTest() {
......@@ -84,32 +84,32 @@ describe('rdbResultSetTestV9', function () {
}
/**
* @tc.name resultSetV9 getBlob normal test
* @tc.number SUB_DDM_RELATIONALETS_RESULTSETV9_0010
* @tc.desc resultSetV9 getBlob normal test
* @tc.name resultSet getBlob normal test
* @tc.number SUB_DDM_RELATIONALETS_RESULTSET_0010
* @tc.desc resultSet getBlob normal test
*/
it('SUB_DDM_RELATIONALETS_RESULTSETV9_0010', 0, async function (done) {
console.info(TAG + '************* SUB_DDM_RELATIONALETS_RESULTSETV9_0010 start *************');
let predicates = await new dataRdb.RdbPredicatesV9('test')
let resultSetV9 = await rdbStore.query(predicates)
it('SUB_DDM_RELATIONALETS_RESULTSET_0010', 0, async function (done) {
console.info(TAG + '************* SUB_DDM_RELATIONALETS_RESULTSET_0010 start *************');
let predicates = await new dataRdb.RdbPredicates('test')
let resultSet = await rdbStore.query(predicates)
try {
{
expect(true).assertEqual(resultSetV9.goToFirstRow())
const id = resultSetV9.getLong(resultSetV9.getColumnIndex('id'))
const data4 = resultSetV9.getBlob(resultSetV9.getColumnIndex('data4'))
expect(true).assertEqual(resultSet.goToFirstRow())
const id = resultSet.getLong(resultSet.getColumnIndex('id'))
const data4 = resultSet.getBlob(resultSet.getColumnIndex('data4'))
console.info(TAG + 'id=' + id + ', data4=' + data4);
expect(1).assertEqual(data4[0]);
expect(2).assertEqual(data4[1]);
expect(3).assertEqual(data4[2]);
}
resultSetV9.close();
expect(true).assertEqual(resultSetV9.isClosed)
resultSet.close();
expect(true).assertEqual(resultSet.isClosed)
} catch (e) {
expect(null).assertFail();
}
resultSetV9 = null
resultSet = null
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*************');
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册