提交 a797f653 编写于 作者: O openharmony_ci 提交者: Gitee

!1026 remove JS context

Merge pull request !1026 from lichenlong1/master
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import dataRdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
import dataAbility from '@ohos.data.dataability'; import dataAbility from '@ohos.data.dataAbility';
import featureAbility from '@ohos.ability.featureAbility';
const TAG = "[RDB_JSKITS _TEST]" const TAG = "[RDB_JSKITS _TEST]"
const CREATE_TABLE_ALL_DATA_TYPE_SQL = "CREATE TABLE IF NOT EXISTS AllDataType " const CREATE_TABLE_ALL_DATA_TYPE_SQL = "CREATE TABLE IF NOT EXISTS AllDataType "
...@@ -31,14 +30,12 @@ const STORE_CONFIG = { ...@@ -31,14 +30,12 @@ const STORE_CONFIG = {
name: "Predicates.db", name: "Predicates.db",
} }
var rdbStore = undefined; var rdbStore = undefined;
var context = undefined;
var DOUBLE_MAX = 9223372036854775807; var DOUBLE_MAX = 9223372036854775807;
describe('dataAbilityPredicatesTest', function () { describe('dataAbilityPredicatesTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
context = await featureAbility.getContext(); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
rdbStore = await dataRdb.getRdbStore(context, STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_ALL_DATA_TYPE_SQL, null); await rdbStore.executeSql(CREATE_TABLE_ALL_DATA_TYPE_SQL, null);
await buildAllDataType1(); await buildAllDataType1();
await buildAllDataType2(); await buildAllDataType2();
...@@ -56,7 +53,7 @@ describe('dataAbilityPredicatesTest', function () { ...@@ -56,7 +53,7 @@ describe('dataAbilityPredicatesTest', function () {
afterAll(async function () { afterAll(async function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
rdbStore = null rdbStore = null
await dataRdb.deleteRdbStore(context, "Predicates.db"); await dataRdb.deleteRdbStore("Predicates.db");
}) })
function resultSize(resultSet) { function resultSize(resultSet) {
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
* 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 'deccjsunit/index'
import data_rdb from '@ohos.data.rdb' import dataRdb from '@ohos.data.rdb'
import ability_featureAbility from '@ohos.ability.featureAbility';
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)";
...@@ -23,13 +22,11 @@ const STORE_CONFIG = { ...@@ -23,13 +22,11 @@ const STORE_CONFIG = {
name: "Resultset.db", name: "Resultset.db",
} }
var rdbStore = undefined; var rdbStore = undefined;
var context = undefined;
describe('rdbResultSetTest', function () { describe('rdbResultSetTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext(); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
rdbStore = await data_rdb.getRdbStore(context, STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null); await rdbStore.executeSql(CREATE_TABLE_TEST, null);
await createTest(); await createTest();
}) })
...@@ -45,7 +42,7 @@ describe('rdbResultSetTest', function () { ...@@ -45,7 +42,7 @@ describe('rdbResultSetTest', function () {
afterAll(async function () { afterAll(async function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
rdbStore = null rdbStore = null
await data_rdb.deleteRdbStore(context, "Resultset.db"); await dataRdb.deleteRdbStore("Resultset.db");
}) })
//插入数据 //插入数据
async function createTest() { async function createTest() {
...@@ -90,7 +87,7 @@ describe('rdbResultSetTest', function () { ...@@ -90,7 +87,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetBlob0001', 0, async function (done) { it('testGetBlob0001', 0, async function (done) {
console.log(TAG + "************* testGetBlob0001 start *************"); console.log(TAG + "************* testGetBlob0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
{ {
...@@ -119,7 +116,7 @@ describe('rdbResultSetTest', function () { ...@@ -119,7 +116,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetBlob0002', 0, async function (done) { it('testGetBlob0002', 0, async function (done) {
console.log(TAG + "************* testGetBlob0002 start *************"); console.log(TAG + "************* testGetBlob0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
{ {
...@@ -149,7 +146,7 @@ describe('rdbResultSetTest', function () { ...@@ -149,7 +146,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetBlob0003', 0, async function (done) { it('testGetBlob0003', 0, async function (done) {
console.log(TAG + "************* testGetBlob0003 start *************"); console.log(TAG + "************* testGetBlob0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
{ {
...@@ -178,7 +175,7 @@ describe('rdbResultSetTest', function () { ...@@ -178,7 +175,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsStarted0001', 0, async function (done) { it('testIsStarted0001', 0, async function (done) {
console.log(TAG + "************* testIsStarted0001 start *************"); console.log(TAG + "************* testIsStarted0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(false).assertEqual(resultSet.isStarted) expect(false).assertEqual(resultSet.isStarted)
...@@ -197,7 +194,7 @@ describe('rdbResultSetTest', function () { ...@@ -197,7 +194,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsStarted0002', 0, async function (done) { it('testIsStarted0002', 0, async function (done) {
console.log(TAG + "************* testIsStarted0002 start *************"); console.log(TAG + "************* testIsStarted0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
resultSet.goTo(1) resultSet.goTo(1)
...@@ -217,7 +214,7 @@ describe('rdbResultSetTest', function () { ...@@ -217,7 +214,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsStarted0003', 0, async function (done) { it('testIsStarted0003', 0, async function (done) {
console.log(TAG + "************* testIsStarted0003 start *************"); console.log(TAG + "************* testIsStarted0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(true).assertEqual(resultSet.goToNextRow()) expect(true).assertEqual(resultSet.goToNextRow())
...@@ -239,7 +236,7 @@ describe('rdbResultSetTest', function () { ...@@ -239,7 +236,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsStarted0004', 0, async function (done) { it('testIsStarted0004', 0, async function (done) {
console.log(TAG + "************* testIsStarted0004 start *************"); console.log(TAG + "************* testIsStarted0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(true).assertEqual(resultSet.goToNextRow()) expect(true).assertEqual(resultSet.goToNextRow())
...@@ -261,7 +258,7 @@ describe('rdbResultSetTest', function () { ...@@ -261,7 +258,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsEnded0001', 0, async function (done) { it('testIsEnded0001', 0, async function (done) {
console.log(TAG + "************* testIsEnded0001 start *************"); console.log(TAG + "************* testIsEnded0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -281,7 +278,7 @@ describe('rdbResultSetTest', function () { ...@@ -281,7 +278,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsEnded0002', 0, async function (done) { it('testIsEnded0002', 0, async function (done) {
console.log(TAG + "************* testIsEnded0002 start *************"); console.log(TAG + "************* testIsEnded0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -301,7 +298,7 @@ describe('rdbResultSetTest', function () { ...@@ -301,7 +298,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsEnded0003', 0, async function (done) { it('testIsEnded0003', 0, async function (done) {
console.log(TAG + "************* testIsEnded0003 start *************"); console.log(TAG + "************* testIsEnded0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
resultSet.goToRow(3) resultSet.goToRow(3)
...@@ -321,7 +318,7 @@ describe('rdbResultSetTest', function () { ...@@ -321,7 +318,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsEnded0004', 0, async function (done) { it('testIsEnded0004', 0, async function (done) {
console.log(TAG + "************* testIsEnded0004 start *************"); console.log(TAG + "************* testIsEnded0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
resultSet.goToRow(3) resultSet.goToRow(3)
...@@ -342,7 +339,7 @@ describe('rdbResultSetTest', function () { ...@@ -342,7 +339,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testRowCount0001', 0, async function (done) { it('testRowCount0001', 0, async function (done) {
console.log(TAG + "************* testRowCount0001 start *************"); console.log(TAG + "************* testRowCount0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(3).assertEqual(resultSet.rowCount) expect(3).assertEqual(resultSet.rowCount)
...@@ -361,7 +358,7 @@ describe('rdbResultSetTest', function () { ...@@ -361,7 +358,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testRowCount0002', 0, async function (done) { it('testRowCount0002', 0, async function (done) {
console.log(TAG + "************* testRowCount0002 start *************"); console.log(TAG + "************* testRowCount0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
...@@ -381,7 +378,7 @@ describe('rdbResultSetTest', function () { ...@@ -381,7 +378,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testRowCount0003', 0, async function (done) { it('testRowCount0003', 0, async function (done) {
console.log(TAG + "************* testRowCount0003 start *************"); console.log(TAG + "************* testRowCount0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("data1", "hello"); predicates.equalTo("data1", "hello");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
...@@ -401,7 +398,7 @@ describe('rdbResultSetTest', function () { ...@@ -401,7 +398,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testRowCount0004', 0, async function (done) { it('testRowCount0004', 0, async function (done) {
console.log(TAG + "************* testRowCount0004 start *************"); console.log(TAG + "************* testRowCount0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("data1", "hello"); predicates.equalTo("data1", "hello");
predicates.equalTo("data2", 3); predicates.equalTo("data2", 3);
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
...@@ -422,7 +419,7 @@ describe('rdbResultSetTest', function () { ...@@ -422,7 +419,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetLong0001', 0, async function (done) { it('testGetLong0001', 0, async function (done) {
console.log(TAG + "************* testGetLong0001 start *************"); console.log(TAG + "************* testGetLong0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
{ {
...@@ -449,7 +446,7 @@ describe('rdbResultSetTest', function () { ...@@ -449,7 +446,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetLong0002', 0, async function (done) { it('testGetLong0002', 0, async function (done) {
console.log(TAG + "************* testGetLong0002 start *************"); console.log(TAG + "************* testGetLong0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
{ {
...@@ -475,7 +472,7 @@ describe('rdbResultSetTest', function () { ...@@ -475,7 +472,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetLong0003', 0, async function (done) { it('testGetLong0003', 0, async function (done) {
console.log(TAG + "************* testGetLong0003 start *************"); console.log(TAG + "************* testGetLong0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
{ {
...@@ -501,7 +498,7 @@ describe('rdbResultSetTest', function () { ...@@ -501,7 +498,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetString0001', 0, async function (done) { it('testGetString0001', 0, async function (done) {
console.log(TAG + "************* testGetString0001 start *************"); console.log(TAG + "************* testGetString0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -520,7 +517,7 @@ describe('rdbResultSetTest', function () { ...@@ -520,7 +517,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetString0002', 0, async function (done) { it('testGetString0002', 0, async function (done) {
console.log(TAG + "************* testGetString0002 start *************"); console.log(TAG + "************* testGetString0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -539,7 +536,7 @@ describe('rdbResultSetTest', function () { ...@@ -539,7 +536,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetString0003', 0, async function (done) { it('testGetString0003', 0, async function (done) {
console.log(TAG + "************* testGetString0003 start *************"); console.log(TAG + "************* testGetString0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -559,7 +556,7 @@ describe('rdbResultSetTest', function () { ...@@ -559,7 +556,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testGetString0004', 0, async function (done) { it('testGetString0004', 0, async function (done) {
console.log(TAG + "************* testGetString0004 start *************"); console.log(TAG + "************* testGetString0004 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -584,7 +581,7 @@ describe('rdbResultSetTest', function () { ...@@ -584,7 +581,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsClosed0001', 0, async function (done) { it('testIsClosed0001', 0, async function (done) {
console.log(TAG + "************* testIsClosed0001 start *************"); console.log(TAG + "************* testIsClosed0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(3).assertEqual(resultSet.rowCount) expect(3).assertEqual(resultSet.rowCount)
...@@ -603,7 +600,7 @@ describe('rdbResultSetTest', function () { ...@@ -603,7 +600,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsClosed0002', 0, async function (done) { it('testIsClosed0002', 0, async function (done) {
console.log(TAG + "************* testIsClosed0002 start *************"); console.log(TAG + "************* testIsClosed0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(false).assertEqual(resultSet.isClosed) expect(false).assertEqual(resultSet.isClosed)
...@@ -619,7 +616,7 @@ describe('rdbResultSetTest', function () { ...@@ -619,7 +616,7 @@ describe('rdbResultSetTest', function () {
*/ */
it('testIsClosed0003', 0, async function (done) { it('testIsClosed0003', 0, async function (done) {
console.log(TAG + "************* testIsClosed0003 start *************"); console.log(TAG + "************* testIsClosed0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(false).assertEqual(resultSet.isClosed) expect(false).assertEqual(resultSet.isClosed)
...@@ -637,7 +634,7 @@ describe('rdbResultSetTest', function () { ...@@ -637,7 +634,7 @@ describe('rdbResultSetTest', function () {
it('testColumnCount0001', 0, async function (done) { it('testColumnCount0001', 0, async function (done) {
console.log(TAG + "************* testColumnCount0001 start *************"); console.log(TAG + "************* testColumnCount0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(5).assertEqual(resultSet.columnCount); expect(5).assertEqual(resultSet.columnCount);
resultSet = null; resultSet = null;
...@@ -654,7 +651,7 @@ describe('rdbResultSetTest', function () { ...@@ -654,7 +651,7 @@ describe('rdbResultSetTest', function () {
it('testColumnCount0002', 0, async function (done) { it('testColumnCount0002', 0, async function (done) {
console.log(TAG + "************* testColumnCount0002 start *************"); console.log(TAG + "************* testColumnCount0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(0).assertEqual(resultSet.columnCount); expect(0).assertEqual(resultSet.columnCount);
...@@ -672,7 +669,7 @@ describe('rdbResultSetTest', function () { ...@@ -672,7 +669,7 @@ describe('rdbResultSetTest', function () {
it('testRowIndex0001', 0, async function (done) { it('testRowIndex0001', 0, async function (done) {
console.log(TAG + "************* testRowIndex0001 *************"); console.log(TAG + "************* testRowIndex0001 *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -693,7 +690,7 @@ describe('rdbResultSetTest', function () { ...@@ -693,7 +690,7 @@ describe('rdbResultSetTest', function () {
it('testRowIndex0002', 0, async function (done) { it('testRowIndex0002', 0, async function (done) {
console.log(TAG + "************* testRowIndex0002 *************"); console.log(TAG + "************* testRowIndex0002 *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -714,7 +711,7 @@ describe('rdbResultSetTest', function () { ...@@ -714,7 +711,7 @@ describe('rdbResultSetTest', function () {
it('testGoToFirstRow0001', 0, async function (done) { it('testGoToFirstRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToFirstRow0001 start *************"); console.log(TAG + "************* testGoToFirstRow0001 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -735,7 +732,7 @@ describe('rdbResultSetTest', function () { ...@@ -735,7 +732,7 @@ describe('rdbResultSetTest', function () {
it('testGoToFirstRow0002', 0, async function (done) { it('testGoToFirstRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToFirstRow0002 start *************"); console.log(TAG + "************* testGoToFirstRow0002 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
...@@ -756,7 +753,7 @@ describe('rdbResultSetTest', function () { ...@@ -756,7 +753,7 @@ describe('rdbResultSetTest', function () {
it('testGoToFirstRow0003', 0, async function (done) { it('testGoToFirstRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToFirstRow0003 start *************"); console.log(TAG + "************* testGoToFirstRow0003 start *************");
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -778,7 +775,7 @@ describe('rdbResultSetTest', function () { ...@@ -778,7 +775,7 @@ describe('rdbResultSetTest', function () {
it('testGoToLastRow0001', 0, async function (done) { it('testGoToLastRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToLastRow0001 start *************"); console.log(TAG + "************* testGoToLastRow0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -797,7 +794,7 @@ describe('rdbResultSetTest', function () { ...@@ -797,7 +794,7 @@ describe('rdbResultSetTest', function () {
it('testGoToLastRow0002', 0, async function (done) { it('testGoToLastRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToLastRow0002 start *************"); console.log(TAG + "************* testGoToLastRow0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
...@@ -817,7 +814,7 @@ describe('rdbResultSetTest', function () { ...@@ -817,7 +814,7 @@ describe('rdbResultSetTest', function () {
it('testGoToLastRow0003', 0, async function (done) { it('testGoToLastRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToLastRow0003 start *************"); console.log(TAG + "************* testGoToLastRow0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -838,7 +835,7 @@ describe('rdbResultSetTest', function () { ...@@ -838,7 +835,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0001', 0, async function (done) { it('testGoToNextRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0001 start *************"); console.log(TAG + "************* testGoToNextRow0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToNextRow()) expect(true).assertEqual(resultSet.goToNextRow())
...@@ -857,7 +854,7 @@ describe('rdbResultSetTest', function () { ...@@ -857,7 +854,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0002', 0, async function (done) { it('testGoToNextRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0002 start *************"); console.log(TAG + "************* testGoToNextRow0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
...@@ -877,7 +874,7 @@ describe('rdbResultSetTest', function () { ...@@ -877,7 +874,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0003', 0, async function (done) { it('testGoToNextRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0003 start *************"); console.log(TAG + "************* testGoToNextRow0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -899,7 +896,7 @@ describe('rdbResultSetTest', function () { ...@@ -899,7 +896,7 @@ describe('rdbResultSetTest', function () {
it('testGoToNextRow0004', 0, async function (done) { it('testGoToNextRow0004', 0, async function (done) {
console.log(TAG + "************* testGoToNextRow0004 start *************"); console.log(TAG + "************* testGoToNextRow0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -919,7 +916,7 @@ describe('rdbResultSetTest', function () { ...@@ -919,7 +916,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0001', 0, async function (done) { it('testGoToPreviousRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0001 start *************"); console.log(TAG + "************* testGoToPreviousRow0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(false).assertEqual(resultSet.goToPreviousRow()) expect(false).assertEqual(resultSet.goToPreviousRow())
...@@ -938,7 +935,7 @@ describe('rdbResultSetTest', function () { ...@@ -938,7 +935,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0002', 0, async function (done) { it('testGoToPreviousRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0002 start *************"); console.log(TAG + "************* testGoToPreviousRow0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
...@@ -958,7 +955,7 @@ describe('rdbResultSetTest', function () { ...@@ -958,7 +955,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0003', 0, async function (done) { it('testGoToPreviousRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0003 start *************"); console.log(TAG + "************* testGoToPreviousRow0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -979,7 +976,7 @@ describe('rdbResultSetTest', function () { ...@@ -979,7 +976,7 @@ describe('rdbResultSetTest', function () {
it('testGoToPreviousRow0004', 0, async function (done) { it('testGoToPreviousRow0004', 0, async function (done) {
console.log(TAG + "************* testGoToPreviousRow0004 start *************"); console.log(TAG + "************* testGoToPreviousRow0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -999,7 +996,7 @@ describe('rdbResultSetTest', function () { ...@@ -999,7 +996,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0001', 0, async function (done) { it('testGoTo0001', 0, async function (done) {
console.log(TAG + "************* testGoTo0001 start *************"); console.log(TAG + "************* testGoTo0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1020,7 +1017,7 @@ describe('rdbResultSetTest', function () { ...@@ -1020,7 +1017,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0002', 0, async function (done) { it('testGoTo0002', 0, async function (done) {
console.log(TAG + "************* testGoTo0002 start *************"); console.log(TAG + "************* testGoTo0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
...@@ -1041,7 +1038,7 @@ describe('rdbResultSetTest', function () { ...@@ -1041,7 +1038,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0003', 0, async function (done) { it('testGoTo0003', 0, async function (done) {
console.log(TAG + "************* testGoTo0003 start *************"); console.log(TAG + "************* testGoTo0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1063,7 +1060,7 @@ describe('rdbResultSetTest', function () { ...@@ -1063,7 +1060,7 @@ describe('rdbResultSetTest', function () {
it('testGoTo0004', 0, async function (done) { it('testGoTo0004', 0, async function (done) {
console.log(TAG + "************* testGoTo0004 start *************"); console.log(TAG + "************* testGoTo0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -1084,7 +1081,7 @@ describe('rdbResultSetTest', function () { ...@@ -1084,7 +1081,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0001', 0, async function (done) { it('testGoToRow0001', 0, async function (done) {
console.log(TAG + "************* testGoToRow0001 start *************"); console.log(TAG + "************* testGoToRow0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1105,7 +1102,7 @@ describe('rdbResultSetTest', function () { ...@@ -1105,7 +1102,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0002', 0, async function (done) { it('testGoToRow0002', 0, async function (done) {
console.log(TAG + "************* testGoToRow0002 start *************"); console.log(TAG + "************* testGoToRow0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
...@@ -1126,7 +1123,7 @@ describe('rdbResultSetTest', function () { ...@@ -1126,7 +1123,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0003', 0, async function (done) { it('testGoToRow0003', 0, async function (done) {
console.log(TAG + "************* testGoToRow0003 start *************"); console.log(TAG + "************* testGoToRow0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1149,7 +1146,7 @@ describe('rdbResultSetTest', function () { ...@@ -1149,7 +1146,7 @@ describe('rdbResultSetTest', function () {
it('testGoToRow0004', 0, async function (done) { it('testGoToRow0004', 0, async function (done) {
console.log(TAG + "************* testGoToRow0004 start *************"); console.log(TAG + "************* testGoToRow0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -1170,7 +1167,7 @@ describe('rdbResultSetTest', function () { ...@@ -1170,7 +1167,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0001', 0, async function (done) { it('testIsAtFirstRow0001', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0001 start *************"); console.log(TAG + "************* testIsAtFirstRow0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1190,7 +1187,7 @@ describe('rdbResultSetTest', function () { ...@@ -1190,7 +1187,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0002', 0, async function (done) { it('testIsAtFirstRow0002', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0002 start *************"); console.log(TAG + "************* testIsAtFirstRow0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
...@@ -1210,7 +1207,7 @@ describe('rdbResultSetTest', function () { ...@@ -1210,7 +1207,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0003', 0, async function (done) { it('testIsAtFirstRow0003', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0003 start *************"); console.log(TAG + "************* testIsAtFirstRow0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1231,7 +1228,7 @@ describe('rdbResultSetTest', function () { ...@@ -1231,7 +1228,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0004', 0, async function (done) { it('testIsAtFirstRow0004', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0004 start *************"); console.log(TAG + "************* testIsAtFirstRow0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -1251,7 +1248,7 @@ describe('rdbResultSetTest', function () { ...@@ -1251,7 +1248,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0005', 0, async function (done) { it('testIsAtFirstRow0005', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0005 start *************"); console.log(TAG + "************* testIsAtFirstRow0005 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goTo(1) resultSet.goTo(1)
...@@ -1272,7 +1269,7 @@ describe('rdbResultSetTest', function () { ...@@ -1272,7 +1269,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtFirstRow0006', 0, async function (done) { it('testIsAtFirstRow0006', 0, async function (done) {
console.log(TAG + "************* testIsAtFirstRow0006 start *************"); console.log(TAG + "************* testIsAtFirstRow0006 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goTo(1) resultSet.goTo(1)
...@@ -1293,7 +1290,7 @@ describe('rdbResultSetTest', function () { ...@@ -1293,7 +1290,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0001', 0, async function (done) { it('testIsAtLastRow0001', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0001 start *************"); console.log(TAG + "************* testIsAtLastRow0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1313,7 +1310,7 @@ describe('rdbResultSetTest', function () { ...@@ -1313,7 +1310,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0002', 0, async function (done) { it('testIsAtLastRow0002', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0002 start *************"); console.log(TAG + "************* testIsAtLastRow0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
...@@ -1333,7 +1330,7 @@ describe('rdbResultSetTest', function () { ...@@ -1333,7 +1330,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0003', 0, async function (done) { it('testIsAtLastRow0003', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0003 start *************"); console.log(TAG + "************* testIsAtLastRow0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1354,7 +1351,7 @@ describe('rdbResultSetTest', function () { ...@@ -1354,7 +1351,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0004', 0, async function (done) { it('testIsAtLastRow0004', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0004 start *************"); console.log(TAG + "************* testIsAtLastRow0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToLastRow()) expect(true).assertEqual(resultSet.goToLastRow())
...@@ -1374,7 +1371,7 @@ describe('rdbResultSetTest', function () { ...@@ -1374,7 +1371,7 @@ describe('rdbResultSetTest', function () {
it('testIsAtLastRow0005', 0, async function (done) { it('testIsAtLastRow0005', 0, async function (done) {
console.log(TAG + "************* testIsAtLastRow0005 start *************"); console.log(TAG + "************* testIsAtLastRow0005 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goToRow(2) resultSet.goToRow(2)
...@@ -1395,7 +1392,7 @@ describe('rdbResultSetTest', function () { ...@@ -1395,7 +1392,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0001', 0, async function (done) { it('testGetDouble0001', 0, async function (done) {
console.log(TAG + "************* testGetDouble0001 start *************"); console.log(TAG + "************* testGetDouble0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goTo(1) resultSet.goTo(1)
...@@ -1416,7 +1413,7 @@ describe('rdbResultSetTest', function () { ...@@ -1416,7 +1413,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0002', 0, async function (done) { it('testGetDouble0002', 0, async function (done) {
console.log(TAG + "************* testGetDouble0002 start *************"); console.log(TAG + "************* testGetDouble0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goTo(2) resultSet.goTo(2)
...@@ -1437,7 +1434,7 @@ describe('rdbResultSetTest', function () { ...@@ -1437,7 +1434,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0003', 0, async function (done) { it('testGetDouble0003', 0, async function (done) {
console.log(TAG + "************* testGetDouble0003 start *************"); console.log(TAG + "************* testGetDouble0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goTo(3) resultSet.goTo(3)
...@@ -1458,7 +1455,7 @@ describe('rdbResultSetTest', function () { ...@@ -1458,7 +1455,7 @@ describe('rdbResultSetTest', function () {
it('testGetDouble0004', 0, async function (done) { it('testGetDouble0004', 0, async function (done) {
console.log(TAG + "************* testGetDouble0004 start *************"); console.log(TAG + "************* testGetDouble0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goTo(1) resultSet.goTo(1)
...@@ -1479,7 +1476,7 @@ describe('rdbResultSetTest', function () { ...@@ -1479,7 +1476,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0001', 0, async function (done) { it('testIsColumnNull0001', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0001 start *************"); console.log(TAG + "************* testIsColumnNull0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1502,7 +1499,7 @@ describe('rdbResultSetTest', function () { ...@@ -1502,7 +1499,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0002', 0, async function (done) { it('testIsColumnNull0002', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0002 start *************"); console.log(TAG + "************* testIsColumnNull0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -1525,7 +1522,7 @@ describe('rdbResultSetTest', function () { ...@@ -1525,7 +1522,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0003', 0, async function (done) { it('testIsColumnNull0003', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0003 start *************"); console.log(TAG + "************* testIsColumnNull0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goToRow(5) resultSet.goToRow(5)
...@@ -1544,7 +1541,7 @@ describe('rdbResultSetTest', function () { ...@@ -1544,7 +1541,7 @@ describe('rdbResultSetTest', function () {
it('testIsColumnNull0004', 0, async function (done) { it('testIsColumnNull0004', 0, async function (done) {
console.log(TAG + "************* testIsColumnNull0004 start *************"); console.log(TAG + "************* testIsColumnNull0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
{ {
resultSet.goToRow(2) resultSet.goToRow(2)
...@@ -1564,7 +1561,7 @@ describe('rdbResultSetTest', function () { ...@@ -1564,7 +1561,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0001', 0, async function (done) { it('testGetColumnIndex0001', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0001 start *************"); console.log(TAG + "************* testGetColumnIndex0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
expect(1).assertEqual(resultSet.getColumnIndex("data1")) expect(1).assertEqual(resultSet.getColumnIndex("data1"))
...@@ -1583,7 +1580,7 @@ describe('rdbResultSetTest', function () { ...@@ -1583,7 +1580,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0002', 0, async function (done) { it('testGetColumnIndex0002', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0002 start *************"); console.log(TAG + "************* testGetColumnIndex0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(-1).assertEqual(resultSet.getColumnIndex("data1")) expect(-1).assertEqual(resultSet.getColumnIndex("data1"))
...@@ -1602,7 +1599,7 @@ describe('rdbResultSetTest', function () { ...@@ -1602,7 +1599,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0003', 0, async function (done) { it('testGetColumnIndex0003', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0003 start *************"); console.log(TAG + "************* testGetColumnIndex0003 start *************");
{ {
let predicates = await new data_rdb.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("dataX")) expect(-1).assertEqual(resultSet.getColumnIndex("dataX"))
...@@ -1620,7 +1617,7 @@ describe('rdbResultSetTest', function () { ...@@ -1620,7 +1617,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnIndex0004', 0, async function (done) { it('testGetColumnIndex0004', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0004 start *************"); console.log(TAG + "************* testGetColumnIndex0004 start *************");
{ {
let predicates = await new data_rdb.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(""))
...@@ -1638,7 +1635,7 @@ describe('rdbResultSetTest', function () { ...@@ -1638,7 +1635,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0001', 0, async function (done) { it('testGetColumnName0001', 0, async function (done) {
console.log(TAG + "************* testGetColumnIndex0001 start *************"); console.log(TAG + "************* testGetColumnIndex0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect("data1").assertEqual(resultSet.getColumnName(1)) expect("data1").assertEqual(resultSet.getColumnName(1))
...@@ -1658,7 +1655,7 @@ describe('rdbResultSetTest', function () { ...@@ -1658,7 +1655,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0002', 0, async function (done) { it('testGetColumnName0002', 0, async function (done) {
console.log(TAG + "************* testGetColumnName0002 start *************"); console.log(TAG + "************* testGetColumnName0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
...@@ -1679,7 +1676,7 @@ describe('rdbResultSetTest', function () { ...@@ -1679,7 +1676,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0003', 0, async function (done) { it('testGetColumnName0003', 0, async function (done) {
console.log(TAG + "************* testGetColumnName0003 start *************"); console.log(TAG + "************* testGetColumnName0003 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect("").assertEqual(resultSet.getColumnName(10)) expect("").assertEqual(resultSet.getColumnName(10))
...@@ -1698,7 +1695,7 @@ describe('rdbResultSetTest', function () { ...@@ -1698,7 +1695,7 @@ describe('rdbResultSetTest', function () {
it('testGetColumnName0004', 0, async function (done) { it('testGetColumnName0004', 0, async function (done) {
console.log(TAG + "************* testGetColumnName0004 start *************"); console.log(TAG + "************* testGetColumnName0004 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
...@@ -1718,7 +1715,7 @@ describe('rdbResultSetTest', function () { ...@@ -1718,7 +1715,7 @@ describe('rdbResultSetTest', function () {
it('testClose0001', 0, async function (done) { it('testClose0001', 0, async function (done) {
console.log(TAG + "************* testClose0001 start *************"); console.log(TAG + "************* testClose0001 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
resultSet.goToRow(1) resultSet.goToRow(1)
resultSet.close() resultSet.close()
...@@ -1738,7 +1735,7 @@ describe('rdbResultSetTest', function () { ...@@ -1738,7 +1735,7 @@ describe('rdbResultSetTest', function () {
it('testClose0002', 0, async function (done) { it('testClose0002', 0, async function (done) {
console.log(TAG + "************* testClose0002 start *************"); console.log(TAG + "************* testClose0002 start *************");
{ {
let predicates = await new data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "wangwu"); predicates.equalTo("name", "wangwu");
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
resultSet.close() resultSet.close()
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
* 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 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
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,7 +22,6 @@ const STORE_CONFIG = { ...@@ -23,7 +22,6 @@ const STORE_CONFIG = {
name: "Delete.db", name: "Delete.db",
} }
var rdbStore = undefined; var rdbStore = undefined;
var context = undefined;
describe('rdbStoreDeleteTest', function () { describe('rdbStoreDeleteTest', function () {
beforeAll(function () { beforeAll(function () {
...@@ -32,8 +30,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -32,8 +30,7 @@ describe('rdbStoreDeleteTest', function () {
beforeEach(async function () { beforeEach(async function () {
console.info(TAG + 'beforeEach') console.info(TAG + 'beforeEach')
context = await ability_featureAbility.getContext(); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
rdbStore = await ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null); await rdbStore.executeSql(CREATE_TABLE_TEST, null);
}) })
...@@ -41,7 +38,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -41,7 +38,7 @@ describe('rdbStoreDeleteTest', function () {
console.info(TAG + 'afterEach') console.info(TAG + 'afterEach')
await rdbStore.executeSql("DELETE FROM test"); await rdbStore.executeSql("DELETE FROM test");
rdbStore = null rdbStore = null
await ohos_data_rdb.deleteRdbStore(context, "Delete.db"); await dataRdb.deleteRdbStore("Delete.db");
}) })
afterAll(async function () { afterAll(async function () {
...@@ -86,7 +83,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -86,7 +83,7 @@ describe('rdbStoreDeleteTest', function () {
} }
//删除 //删除
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let deletePromise = rdbStore.delete(predicates) let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => { deletePromise.then(async (ret) => {
expect(3).assertEqual(ret) expect(3).assertEqual(ret)
...@@ -137,7 +134,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -137,7 +134,7 @@ describe('rdbStoreDeleteTest', function () {
} }
//删除 //删除
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "zhangsan") predicates.equalTo("name", "zhangsan")
let deletePromise = rdbStore.delete(predicates) let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => { deletePromise.then(async (ret) => {
...@@ -180,14 +177,14 @@ describe('rdbStoreDeleteTest', function () { ...@@ -180,14 +177,14 @@ describe('rdbStoreDeleteTest', function () {
} }
//删除前查询 //删除前查询
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("age", 28) predicates.equalTo("age", 28)
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(1).assertEqual(resultSet.rowCount) expect(1).assertEqual(resultSet.rowCount)
} }
//删除 //删除
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("age", 28) predicates.equalTo("age", 28)
let deletePromise = rdbStore.delete(predicates) let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => { deletePromise.then(async (ret) => {
...@@ -200,7 +197,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -200,7 +197,7 @@ describe('rdbStoreDeleteTest', function () {
} }
//删除后查询 //删除后查询
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("age", 28) predicates.equalTo("age", 28)
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(0).assertEqual(resultSet.rowCount) expect(0).assertEqual(resultSet.rowCount)
...@@ -246,7 +243,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -246,7 +243,7 @@ describe('rdbStoreDeleteTest', function () {
} }
//删除 //删除
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("aaa id", 1) predicates.equalTo("aaa id", 1)
let deletePromise = rdbStore.delete(predicates) let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => { deletePromise.then(async (ret) => {
...@@ -297,7 +294,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -297,7 +294,7 @@ describe('rdbStoreDeleteTest', function () {
} }
//删除 //删除
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
predicates.equalTo("name", "lisi") predicates.equalTo("name", "lisi")
let deletePromise = rdbStore.delete(predicates) let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => { deletePromise.then(async (ret) => {
...@@ -349,7 +346,7 @@ describe('rdbStoreDeleteTest', function () { ...@@ -349,7 +346,7 @@ describe('rdbStoreDeleteTest', function () {
} }
//删除 //删除
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("") let predicates = await new dataRdb.RdbPredicates("")
let deletePromise = rdbStore.delete(predicates) let deletePromise = rdbStore.delete(predicates)
deletePromise.then(async (ret) => { deletePromise.then(async (ret) => {
console.log(TAG + "delete done: " + ret) console.log(TAG + "delete done: " + ret)
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
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)";
...@@ -25,13 +24,11 @@ const STORE_CONFIG = { ...@@ -25,13 +24,11 @@ const STORE_CONFIG = {
} }
var rdbStore = undefined; var rdbStore = undefined;
var context = undefined;
describe('rdbStoreInsertTest', function () { describe('rdbStoreInsertTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext(); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
rdbStore = await ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null); await rdbStore.executeSql(CREATE_TABLE_TEST, null);
}) })
...@@ -47,7 +44,7 @@ describe('rdbStoreInsertTest', function () { ...@@ -47,7 +44,7 @@ describe('rdbStoreInsertTest', function () {
afterAll(async function () { afterAll(async function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
rdbStore = null rdbStore = null
await ohos_data_rdb.deleteRdbStore(context, "InsertTest.db"); await dataRdb.deleteRdbStore("InsertTest.db");
}) })
console.log(TAG + "*************Unit Test Begin*************"); console.log(TAG + "*************Unit Test Begin*************");
...@@ -88,7 +85,7 @@ describe('rdbStoreInsertTest', function () { ...@@ -88,7 +85,7 @@ describe('rdbStoreInsertTest', function () {
await rdbStore.insert("test", valueBucket) await rdbStore.insert("test", valueBucket)
} }
let predicates = new ohos_data_rdb.RdbPredicates("test"); let predicates = new dataRdb.RdbPredicates("test");
predicates.equalTo("name", "zhangsan") predicates.equalTo("name", "zhangsan")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
try { try {
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
* 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 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
const TAG = "[RDB_JSKITS _TEST]" const TAG = "[RDB_JSKITS _TEST]"
const CREATE_TABLE_ALL_DATA_TYPE_SQL = "CREATE TABLE IF NOT EXISTS AllDataType " const CREATE_TABLE_ALL_DATA_TYPE_SQL = "CREATE TABLE IF NOT EXISTS AllDataType "
...@@ -30,13 +29,11 @@ const STORE_CONFIG = { ...@@ -30,13 +29,11 @@ const STORE_CONFIG = {
name: "Predicates.db", name: "Predicates.db",
} }
var rdbStore = undefined; var rdbStore = undefined;
var context = undefined;
var DOUBLE_MAX = 9223372036854775807; var DOUBLE_MAX = 9223372036854775807;
describe('rdbPredicatesTest', function () { describe('rdbPredicatesTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext(); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
rdbStore = await ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_ALL_DATA_TYPE_SQL, null); await rdbStore.executeSql(CREATE_TABLE_ALL_DATA_TYPE_SQL, null);
await buildAllDataType1(); await buildAllDataType1();
await buildAllDataType2(); await buildAllDataType2();
...@@ -54,7 +51,7 @@ describe('rdbPredicatesTest', function () { ...@@ -54,7 +51,7 @@ describe('rdbPredicatesTest', function () {
afterAll(async function () { afterAll(async function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
rdbStore = null rdbStore = null
await ohos_data_rdb.deleteRdbStore(context, "Predicates.db"); await dataRdb.deleteRdbStore("Predicates.db");
}) })
function resultSize(resultSet) { function resultSize(resultSet) {
...@@ -137,7 +134,7 @@ describe('rdbPredicatesTest', function () { ...@@ -137,7 +134,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testEqualTo0001', 0, async function (done) { it('testEqualTo0001', 0, async function (done) {
console.log(TAG + "************* testEqualTo0001 start *************"); console.log(TAG + "************* testEqualTo0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
{ {
predicates.equalTo("booleanValue", true); predicates.equalTo("booleanValue", true);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
...@@ -156,7 +153,7 @@ describe('rdbPredicatesTest', function () { ...@@ -156,7 +153,7 @@ describe('rdbPredicatesTest', function () {
it('testEqualTo0002', 0, async function (done) { it('testEqualTo0002', 0, async function (done) {
console.log(TAG + "************* testEqualTo0002 start *************"); console.log(TAG + "************* testEqualTo0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("byteValue", -128).or().equalTo("byteValue", 1); predicates.equalTo("byteValue", -128).or().equalTo("byteValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -174,7 +171,7 @@ describe('rdbPredicatesTest', function () { ...@@ -174,7 +171,7 @@ describe('rdbPredicatesTest', function () {
it('testEqualTo0003', 0, async function (done) { it('testEqualTo0003', 0, async function (done) {
console.log(TAG + "************* testEqualTo0003 start *************"); console.log(TAG + "************* testEqualTo0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN"); predicates.equalTo("stringValue", "ABCDEFGHIJKLMN");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -192,7 +189,7 @@ describe('rdbPredicatesTest', function () { ...@@ -192,7 +189,7 @@ describe('rdbPredicatesTest', function () {
it('testEqualTo0004', 0, async function (done) { it('testEqualTo0004', 0, async function (done) {
console.log(TAG + "************* testEqualTo0004 start *************"); console.log(TAG + "************* testEqualTo0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("doubleValue", DOUBLE_MAX); predicates.equalTo("doubleValue", DOUBLE_MAX);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -210,7 +207,7 @@ describe('rdbPredicatesTest', function () { ...@@ -210,7 +207,7 @@ describe('rdbPredicatesTest', function () {
it('testEqualTo0005', 0, async function (done) { it('testEqualTo0005', 0, async function (done) {
console.log(TAG + "************* testEqualTo0005 start *************"); console.log(TAG + "************* testEqualTo0005 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("shortValue", -32768.0); predicates.equalTo("shortValue", -32768.0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -228,7 +225,7 @@ describe('rdbPredicatesTest', function () { ...@@ -228,7 +225,7 @@ describe('rdbPredicatesTest', function () {
it('testEqualTo0006', 0, async function (done) { it('testEqualTo0006', 0, async function (done) {
console.log(TAG + "************* testEqualTo0006 start *************"); console.log(TAG + "************* testEqualTo0006 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("integerValue", 1); predicates.equalTo("integerValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(true).assertEqual(result.goToFirstRow()); expect(true).assertEqual(result.goToFirstRow());
...@@ -246,7 +243,7 @@ describe('rdbPredicatesTest', function () { ...@@ -246,7 +243,7 @@ describe('rdbPredicatesTest', function () {
it('testEqualTo0007', 0, async function (done) { it('testEqualTo0007', 0, async function (done) {
console.log(TAG + "************* testEqualTo0007 start *************"); console.log(TAG + "************* testEqualTo0007 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("longValue", 1); predicates.equalTo("longValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(true).assertEqual(result.goToFirstRow()); expect(true).assertEqual(result.goToFirstRow());
...@@ -264,7 +261,7 @@ describe('rdbPredicatesTest', function () { ...@@ -264,7 +261,7 @@ describe('rdbPredicatesTest', function () {
it('testEqualTo0008', 0, async function (done) { it('testEqualTo0008', 0, async function (done) {
console.log(TAG + "************* testEqualTo0008 start *************"); console.log(TAG + "************* testEqualTo0008 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("floatValue", -0.123); predicates.equalTo("floatValue", -0.123);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(true).assertEqual(result.goToFirstRow()); expect(true).assertEqual(result.goToFirstRow());
...@@ -283,7 +280,7 @@ describe('rdbPredicatesTest', function () { ...@@ -283,7 +280,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0001', 0, async function (done) { it('testNotEqualTo0001', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0001 start *************"); console.log(TAG + "************* testNotEqualTo0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("booleanValue", true); predicates.notEqualTo("booleanValue", true);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -301,7 +298,7 @@ describe('rdbPredicatesTest', function () { ...@@ -301,7 +298,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0002', 0, async function (done) { it('testNotEqualTo0002', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0002 start *************"); console.log(TAG + "************* testNotEqualTo0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("byteValue", -128); predicates.notEqualTo("byteValue", -128);
predicates.notEqualTo("byteValue", 1); predicates.notEqualTo("byteValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
...@@ -320,7 +317,7 @@ describe('rdbPredicatesTest', function () { ...@@ -320,7 +317,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0003', 0, async function (done) { it('testNotEqualTo0003', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0003 start *************"); console.log(TAG + "************* testNotEqualTo0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("stringValue", "ABCDEFGHIJKLMN"); predicates.notEqualTo("stringValue", "ABCDEFGHIJKLMN");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -338,7 +335,7 @@ describe('rdbPredicatesTest', function () { ...@@ -338,7 +335,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0004', 0, async function (done) { it('testNotEqualTo0004', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0004 start *************"); console.log(TAG + "************* testNotEqualTo0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("doubleValue", DOUBLE_MAX); predicates.notEqualTo("doubleValue", DOUBLE_MAX);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -356,7 +353,7 @@ describe('rdbPredicatesTest', function () { ...@@ -356,7 +353,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0005', 0, async function (done) { it('testNotEqualTo0005', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0005 start *************"); console.log(TAG + "************* testNotEqualTo0005 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("shortValue", -32768); predicates.notEqualTo("shortValue", -32768);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -374,7 +371,7 @@ describe('rdbPredicatesTest', function () { ...@@ -374,7 +371,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0006', 0, async function (done) { it('testNotEqualTo0006', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0006 start *************"); console.log(TAG + "************* testNotEqualTo0006 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("integerValue", 1); predicates.notEqualTo("integerValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -392,7 +389,7 @@ describe('rdbPredicatesTest', function () { ...@@ -392,7 +389,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0007', 0, async function (done) { it('testNotEqualTo0007', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0007 start *************"); console.log(TAG + "************* testNotEqualTo0007 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("longValue", 1); predicates.notEqualTo("longValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -410,7 +407,7 @@ describe('rdbPredicatesTest', function () { ...@@ -410,7 +407,7 @@ describe('rdbPredicatesTest', function () {
it('testNotEqualTo0008', 0, async function (done) { it('testNotEqualTo0008', 0, async function (done) {
console.log(TAG + "************* testNotEqualTo0008 start *************"); console.log(TAG + "************* testNotEqualTo0008 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.notEqualTo("floatValue", -0.123); predicates.notEqualTo("floatValue", -0.123);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -427,7 +424,7 @@ describe('rdbPredicatesTest', function () { ...@@ -427,7 +424,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNull0001', 0, async function (done) { it('testIsNull0001', 0, async function (done) {
console.log(TAG + "************* testIsNull001 start *************"); console.log(TAG + "************* testIsNull001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNull("primLongValue"); predicates.isNull("primLongValue");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -443,7 +440,7 @@ describe('rdbPredicatesTest', function () { ...@@ -443,7 +440,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNull0002', 0, async function (done) { it('testIsNull0002', 0, async function (done) {
console.log(TAG + "************* testIsNull0002 start *************"); console.log(TAG + "************* testIsNull0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNull("longValue"); predicates.isNull("longValue");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -459,7 +456,7 @@ describe('rdbPredicatesTest', function () { ...@@ -459,7 +456,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNull0003', 0, async function (done) { it('testIsNull0003', 0, async function (done) {
console.log(TAG + "************* testIsNull0003 start *************"); console.log(TAG + "************* testIsNull0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNull("stringValue"); predicates.isNull("stringValue");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -475,7 +472,7 @@ describe('rdbPredicatesTest', function () { ...@@ -475,7 +472,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNull0004', 0, async function (done) { it('testIsNull0004', 0, async function (done) {
console.log(TAG + "************* testIsNull0004 start *************"); console.log(TAG + "************* testIsNull0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNull("stringValueX"); predicates.isNull("stringValueX");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(-1).assertEqual(result.rowCount); expect(-1).assertEqual(result.rowCount);
...@@ -491,7 +488,7 @@ describe('rdbPredicatesTest', function () { ...@@ -491,7 +488,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNotNull0001', 0, async function (done) { it('testIsNotNull0001', 0, async function (done) {
console.log(TAG + "************* testIsNotNull0001 start *************"); console.log(TAG + "************* testIsNotNull0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNotNull("primLongValue"); predicates.isNotNull("primLongValue");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -507,7 +504,7 @@ describe('rdbPredicatesTest', function () { ...@@ -507,7 +504,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNotNull0002', 0, async function (done) { it('testIsNotNull0002', 0, async function (done) {
console.log(TAG + "************* testIsNotNull0002 start *************"); console.log(TAG + "************* testIsNotNull0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNotNull("longValue"); predicates.isNotNull("longValue");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -523,7 +520,7 @@ describe('rdbPredicatesTest', function () { ...@@ -523,7 +520,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNotNull0003', 0, async function (done) { it('testIsNotNull0003', 0, async function (done) {
console.log(TAG + "************* testIsNotNull0003 start *************"); console.log(TAG + "************* testIsNotNull0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNotNull("stringValue"); predicates.isNotNull("stringValue");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -539,7 +536,7 @@ describe('rdbPredicatesTest', function () { ...@@ -539,7 +536,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIsNotNull0004', 0, async function (done) { it('testIsNotNull0004', 0, async function (done) {
console.log(TAG + "************* testIsNotNull0004 start *************"); console.log(TAG + "************* testIsNotNull0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.isNotNull("stringValueX"); predicates.isNotNull("stringValueX");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(-1).assertEqual(result.rowCount); expect(-1).assertEqual(result.rowCount);
...@@ -556,7 +553,7 @@ describe('rdbPredicatesTest', function () { ...@@ -556,7 +553,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0001', 0, async function (done) { it('testGreaterThan0001', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0001 start *************"); console.log(TAG + "************* testGreaterThan0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("stringValue", "ABC"); predicates.greaterThan("stringValue", "ABC");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -574,7 +571,7 @@ describe('rdbPredicatesTest', function () { ...@@ -574,7 +571,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0002', 0, async function (done) { it('testGreaterThan0002', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0002 start *************"); console.log(TAG + "************* testGreaterThan0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("doubleValue", 0.0); predicates.greaterThan("doubleValue", 0.0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -592,7 +589,7 @@ describe('rdbPredicatesTest', function () { ...@@ -592,7 +589,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0003', 0, async function (done) { it('testGreaterThan0003', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0003 start *************"); console.log(TAG + "************* testGreaterThan0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("integerValue", 1); predicates.greaterThan("integerValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -610,7 +607,7 @@ describe('rdbPredicatesTest', function () { ...@@ -610,7 +607,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0004', 0, async function (done) { it('testGreaterThan0004', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0004 start *************"); console.log(TAG + "************* testGreaterThan0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("longValue", 1); predicates.greaterThan("longValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -628,7 +625,7 @@ describe('rdbPredicatesTest', function () { ...@@ -628,7 +625,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0005', 0, async function (done) { it('testGreaterThan0005', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0005 start *************"); console.log(TAG + "************* testGreaterThan0005 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("stringValue", "ZZZ"); predicates.greaterThan("stringValue", "ZZZ");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -646,7 +643,7 @@ describe('rdbPredicatesTest', function () { ...@@ -646,7 +643,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0006', 0, async function (done) { it('testGreaterThan0006', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0006 start *************"); console.log(TAG + "************* testGreaterThan0006 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("doubleValue", 999.0); predicates.greaterThan("doubleValue", 999.0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -664,7 +661,7 @@ describe('rdbPredicatesTest', function () { ...@@ -664,7 +661,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0007', 0, async function (done) { it('testGreaterThan0007', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0007 start *************"); console.log(TAG + "************* testGreaterThan0007 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("integerValue", -999); predicates.greaterThan("integerValue", -999);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -682,7 +679,7 @@ describe('rdbPredicatesTest', function () { ...@@ -682,7 +679,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThan0008', 0, async function (done) { it('testGreaterThan0008', 0, async function (done) {
console.log(TAG + "************* testGreaterThan0008 start *************"); console.log(TAG + "************* testGreaterThan0008 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThan("longValue", -999); predicates.greaterThan("longValue", -999);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -700,7 +697,7 @@ describe('rdbPredicatesTest', function () { ...@@ -700,7 +697,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThanOrEqualTo0001', 0, async function (done) { it('testGreaterThanOrEqualTo0001', 0, async function (done) {
console.log(TAG + "************* testGreaterThanOrEqualTo0001 start *************"); console.log(TAG + "************* testGreaterThanOrEqualTo0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThanOrEqualTo("stringValue", "ABC"); predicates.greaterThanOrEqualTo("stringValue", "ABC");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -718,7 +715,7 @@ describe('rdbPredicatesTest', function () { ...@@ -718,7 +715,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThanOrEqualTo0002', 0, async function (done) { it('testGreaterThanOrEqualTo0002', 0, async function (done) {
console.log(TAG + "************* testGreaterThanOrEqualTo0002 start *************"); console.log(TAG + "************* testGreaterThanOrEqualTo0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThanOrEqualTo("doubleValue", 0.0); predicates.greaterThanOrEqualTo("doubleValue", 0.0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -736,7 +733,7 @@ describe('rdbPredicatesTest', function () { ...@@ -736,7 +733,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThanOrEqualTo0003', 0, async function (done) { it('testGreaterThanOrEqualTo0003', 0, async function (done) {
console.log(TAG + "************* testGreaterThanOrEqualTo0003 start *************"); console.log(TAG + "************* testGreaterThanOrEqualTo0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThanOrEqualTo("integerValue", 1); predicates.greaterThanOrEqualTo("integerValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -754,7 +751,7 @@ describe('rdbPredicatesTest', function () { ...@@ -754,7 +751,7 @@ describe('rdbPredicatesTest', function () {
it('testGreaterThanOrEqualTo0004', 0, async function (done) { it('testGreaterThanOrEqualTo0004', 0, async function (done) {
console.log(TAG + "************* testGreaterThanOrEqualTo0004 start *************"); console.log(TAG + "************* testGreaterThanOrEqualTo0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.greaterThanOrEqualTo("longValue", 1); predicates.greaterThanOrEqualTo("longValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -772,7 +769,7 @@ describe('rdbPredicatesTest', function () { ...@@ -772,7 +769,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0001', 0, async function (done) { it('testLessThan0001', 0, async function (done) {
console.log(TAG + "************* testLessThan0001 start *************"); console.log(TAG + "************* testLessThan0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("stringValue", "ABD"); predicates.lessThan("stringValue", "ABD");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -790,7 +787,7 @@ describe('rdbPredicatesTest', function () { ...@@ -790,7 +787,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0002', 0, async function (done) { it('testLessThan0002', 0, async function (done) {
console.log(TAG + "************* testLessThan0002 start *************"); console.log(TAG + "************* testLessThan0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("doubleValue", 0.0); predicates.lessThan("doubleValue", 0.0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -808,7 +805,7 @@ describe('rdbPredicatesTest', function () { ...@@ -808,7 +805,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0003', 0, async function (done) { it('testLessThan0003', 0, async function (done) {
console.log(TAG + "************* testLessThan0003 start *************"); console.log(TAG + "************* testLessThan0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("integerValue", 1); predicates.lessThan("integerValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -826,7 +823,7 @@ describe('rdbPredicatesTest', function () { ...@@ -826,7 +823,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0004', 0, async function (done) { it('testLessThan0004', 0, async function (done) {
console.log(TAG + "************* testLessThan0004 start *************"); console.log(TAG + "************* testLessThan0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("longValue", 1); predicates.lessThan("longValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -844,7 +841,7 @@ describe('rdbPredicatesTest', function () { ...@@ -844,7 +841,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0005', 0, async function (done) { it('testLessThan0005', 0, async function (done) {
console.log(TAG + "************* testLessThan0005 start *************"); console.log(TAG + "************* testLessThan0005 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("stringValue", "ABD"); predicates.lessThan("stringValue", "ABD");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -862,7 +859,7 @@ describe('rdbPredicatesTest', function () { ...@@ -862,7 +859,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0006', 0, async function (done) { it('testLessThan0006', 0, async function (done) {
console.log(TAG + "************* testLessThan0006 start *************"); console.log(TAG + "************* testLessThan0006 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("doubleValue", 1.0); predicates.lessThan("doubleValue", 1.0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -880,7 +877,7 @@ describe('rdbPredicatesTest', function () { ...@@ -880,7 +877,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0007', 0, async function (done) { it('testLessThan0007', 0, async function (done) {
console.log(TAG + "************* testLessThan0007 start *************"); console.log(TAG + "************* testLessThan0007 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("integerValue", -2147483648); predicates.lessThan("integerValue", -2147483648);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -898,7 +895,7 @@ describe('rdbPredicatesTest', function () { ...@@ -898,7 +895,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThan0008', 0, async function (done) { it('testLessThan0008', 0, async function (done) {
console.log(TAG + "************* testLessThan0008 start *************"); console.log(TAG + "************* testLessThan0008 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThan("longValue", -9223372036854775808); predicates.lessThan("longValue", -9223372036854775808);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -916,7 +913,7 @@ describe('rdbPredicatesTest', function () { ...@@ -916,7 +913,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThanOrEqualTo0001', 0, async function (done) { it('testLessThanOrEqualTo0001', 0, async function (done) {
console.log(TAG + "************* testLessThanOrEqualTo0001 start *************"); console.log(TAG + "************* testLessThanOrEqualTo0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThanOrEqualTo("stringValue", "ABD"); predicates.lessThanOrEqualTo("stringValue", "ABD");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -934,7 +931,7 @@ describe('rdbPredicatesTest', function () { ...@@ -934,7 +931,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThanOrEqualTo0002', 0, async function (done) { it('testLessThanOrEqualTo0002', 0, async function (done) {
console.log(TAG + "************* testLessThanOrEqualTo0002 start *************"); console.log(TAG + "************* testLessThanOrEqualTo0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThanOrEqualTo("doubleValue", 0.0); predicates.lessThanOrEqualTo("doubleValue", 0.0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -952,7 +949,7 @@ describe('rdbPredicatesTest', function () { ...@@ -952,7 +949,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThanOrEqualTo0003', 0, async function (done) { it('testLessThanOrEqualTo0003', 0, async function (done) {
console.log(TAG + "************* testLessThanOrEqualTo0003 start *************"); console.log(TAG + "************* testLessThanOrEqualTo0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThanOrEqualTo("integerValue", 1); predicates.lessThanOrEqualTo("integerValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -970,7 +967,7 @@ describe('rdbPredicatesTest', function () { ...@@ -970,7 +967,7 @@ describe('rdbPredicatesTest', function () {
it('testLessThanOrEqualTo0004', 0, async function (done) { it('testLessThanOrEqualTo0004', 0, async function (done) {
console.log(TAG + "************* testLessThanOrEqualTo0004 start *************"); console.log(TAG + "************* testLessThanOrEqualTo0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.lessThanOrEqualTo("longValue", 1); predicates.lessThanOrEqualTo("longValue", 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -988,7 +985,7 @@ describe('rdbPredicatesTest', function () { ...@@ -988,7 +985,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0001', 0, async function (done) { it('testBetween0001', 0, async function (done) {
console.log(TAG + "************* testBetween0001 start *************"); console.log(TAG + "************* testBetween0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("stringValue", "ABB", "ABD"); predicates.between("stringValue", "ABB", "ABD");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1006,7 +1003,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1006,7 +1003,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0002', 0, async function (done) { it('testBetween0002', 0, async function (done) {
console.log(TAG + "************* testBetween0002 start *************"); console.log(TAG + "************* testBetween0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("doubleValue", 0.0, DOUBLE_MAX); predicates.between("doubleValue", 0.0, DOUBLE_MAX);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1024,7 +1021,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1024,7 +1021,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0003', 0, async function (done) { it('testBetween0003', 0, async function (done) {
console.log(TAG + "************* testBetween0003 start *************"); console.log(TAG + "************* testBetween0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("integerValue", 0, 1); predicates.between("integerValue", 0, 1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1042,7 +1039,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1042,7 +1039,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0004', 0, async function (done) { it('testBetween0004', 0, async function (done) {
console.log(TAG + "************* testBetween0004 start *************"); console.log(TAG + "************* testBetween0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("longValue", 0, 2); predicates.between("longValue", 0, 2);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1060,7 +1057,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1060,7 +1057,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0005', 0, async function (done) { it('testBetween0005', 0, async function (done) {
console.log(TAG + "************* testBetween0005 start *************"); console.log(TAG + "************* testBetween0005 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("stringValue", "ABB", "ABB"); predicates.between("stringValue", "ABB", "ABB");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1078,7 +1075,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1078,7 +1075,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0006', 0, async function (done) { it('testBetween0006', 0, async function (done) {
console.log(TAG + "************* testBetween0006 start *************"); console.log(TAG + "************* testBetween0006 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("doubleValue", DOUBLE_MAX, DOUBLE_MAX); predicates.between("doubleValue", DOUBLE_MAX, DOUBLE_MAX);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1096,7 +1093,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1096,7 +1093,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0007', 0, async function (done) { it('testBetween0007', 0, async function (done) {
console.log(TAG + "************* testBetween0007 start *************"); console.log(TAG + "************* testBetween0007 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("integerValue", 1, 0); predicates.between("integerValue", 1, 0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1114,7 +1111,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1114,7 +1111,7 @@ describe('rdbPredicatesTest', function () {
it('testBetween0008', 0, async function (done) { it('testBetween0008', 0, async function (done) {
console.log(TAG + "************* testBetween0008 start *************"); console.log(TAG + "************* testBetween0008 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.between("longValue", 2, -1); predicates.between("longValue", 2, -1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1131,7 +1128,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1131,7 +1128,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testContains0001', 0, async function (done) { it('testContains0001', 0, async function (done) {
console.log(TAG + "************* testContains0001 start *************"); console.log(TAG + "************* testContains0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.contains("stringValue", "DEF"); predicates.contains("stringValue", "DEF");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1147,7 +1144,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1147,7 +1144,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testContains0002', 0, async function (done) { it('testContains0002', 0, async function (done) {
console.log(TAG + "************* testContains0002 start *************"); console.log(TAG + "************* testContains0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.contains("stringValue", "DEFX"); predicates.contains("stringValue", "DEFX");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1163,7 +1160,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1163,7 +1160,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testContains0003', 0, async function (done) { it('testContains0003', 0, async function (done) {
console.log(TAG + "************* testContains0003 start *************"); console.log(TAG + "************* testContains0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.contains("characterValue", ""); predicates.contains("characterValue", "");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1179,7 +1176,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1179,7 +1176,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testContains0004', 0, async function (done) { it('testContains0004', 0, async function (done) {
console.log(TAG + "************* testContains0004 start *************"); console.log(TAG + "************* testContains0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.contains("characterValue", "#"); predicates.contains("characterValue", "#");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1195,7 +1192,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1195,7 +1192,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testBeginsWith0001', 0, async function (done) { it('testBeginsWith0001', 0, async function (done) {
console.log(TAG + "************* testBeginsWith0001 start *************"); console.log(TAG + "************* testBeginsWith0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.beginsWith("stringValue", "ABC"); predicates.beginsWith("stringValue", "ABC");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1211,7 +1208,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1211,7 +1208,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testBeginsWith0002', 0, async function (done) { it('testBeginsWith0002', 0, async function (done) {
console.log(TAG + "************* testBeginsWith0002 start *************"); console.log(TAG + "************* testBeginsWith0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.beginsWith("stringValue", "ABCX"); predicates.beginsWith("stringValue", "ABCX");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1227,7 +1224,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1227,7 +1224,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testBeginsWith0003', 0, async function (done) { it('testBeginsWith0003', 0, async function (done) {
console.log(TAG + "************* testBeginsWith0003 start *************"); console.log(TAG + "************* testBeginsWith0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.beginsWith("characterValue", ""); predicates.beginsWith("characterValue", "");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1243,7 +1240,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1243,7 +1240,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testBeginsWith0004', 0, async function (done) { it('testBeginsWith0004', 0, async function (done) {
console.log(TAG + "************* testBeginsWith0004 start *************"); console.log(TAG + "************* testBeginsWith0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.beginsWith("characterValue", "#"); predicates.beginsWith("characterValue", "#");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1259,7 +1256,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1259,7 +1256,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testEndsWith0001', 0, async function (done) { it('testEndsWith0001', 0, async function (done) {
console.log(TAG + "************* testEndsWith0001 start *************"); console.log(TAG + "************* testEndsWith0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.endsWith("stringValue", "LMN"); predicates.endsWith("stringValue", "LMN");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1275,7 +1272,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1275,7 +1272,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testEndsWith0002', 0, async function (done) { it('testEndsWith0002', 0, async function (done) {
console.log(TAG + "************* testEndsWith0002 start *************"); console.log(TAG + "************* testEndsWith0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.endsWith("stringValue", "LMNX"); predicates.endsWith("stringValue", "LMNX");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1291,7 +1288,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1291,7 +1288,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testEndsWith0003', 0, async function (done) { it('testEndsWith0003', 0, async function (done) {
console.log(TAG + "************* testEndsWith0003 start *************"); console.log(TAG + "************* testEndsWith0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.endsWith("characterValue", ""); predicates.endsWith("characterValue", "");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1307,7 +1304,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1307,7 +1304,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testEndsWith0004', 0, async function (done) { it('testEndsWith0004', 0, async function (done) {
console.log(TAG + "************* testEndsWith0004 start *************"); console.log(TAG + "************* testEndsWith0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.endsWith("characterValue", "#"); predicates.endsWith("characterValue", "#");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1323,7 +1320,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1323,7 +1320,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLike0001', 0, async function (done) { it('testLike0001', 0, async function (done) {
console.log(TAG + "************* testLike0001 start *************"); console.log(TAG + "************* testLike0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "%LMN%"); predicates.like("stringValue", "%LMN%");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1339,7 +1336,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1339,7 +1336,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLike0002', 0, async function (done) { it('testLike0002', 0, async function (done) {
console.log(TAG + "************* testLike0002 start *************"); console.log(TAG + "************* testLike0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "%LMNX%"); predicates.like("stringValue", "%LMNX%");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1355,7 +1352,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1355,7 +1352,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLike0003', 0, async function (done) { it('testLike0003', 0, async function (done) {
console.log(TAG + "************* testLike0003 start *************"); console.log(TAG + "************* testLike0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("characterValue", "%中%"); predicates.like("characterValue", "%中%");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1371,7 +1368,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1371,7 +1368,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLike0004', 0, async function (done) { it('testLike0004', 0, async function (done) {
console.log(TAG + "************* testLike0004 start *************"); console.log(TAG + "************* testLike0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("characterValue", "%#%"); predicates.like("characterValue", "%#%");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1388,7 +1385,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1388,7 +1385,7 @@ describe('rdbPredicatesTest', function () {
it('testBeginWrap0001', 0, async function (done) { it('testBeginWrap0001', 0, async function (done) {
console.log(TAG + "************* testBeginWrap0001 start *************"); console.log(TAG + "************* testBeginWrap0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") predicates.equalTo("stringValue", "ABCDEFGHIJKLMN")
.beginWrap() .beginWrap()
.equalTo("integerValue", 1) .equalTo("integerValue", 1)
...@@ -1411,7 +1408,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1411,7 +1408,7 @@ describe('rdbPredicatesTest', function () {
it('testBeginWrap0002', 0, async function (done) { it('testBeginWrap0002', 0, async function (done) {
console.log(TAG + "************* testBeginWrap0002 start *************"); console.log(TAG + "************* testBeginWrap0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") predicates.equalTo("stringValue", "ABCDEFGHIJKLMN")
.beginWrap() .beginWrap()
.equalTo("characterValue", ' ') .equalTo("characterValue", ' ')
...@@ -1432,7 +1429,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1432,7 +1429,7 @@ describe('rdbPredicatesTest', function () {
it('testBeginWrap0003', 0, async function (done) { it('testBeginWrap0003', 0, async function (done) {
console.log(TAG + "************* testBeginWrap0003 start *************"); console.log(TAG + "************* testBeginWrap0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") predicates.equalTo("stringValue", "ABCDEFGHIJKLMN")
.beginWrap() .beginWrap()
.equalTo("characterValue", '') .equalTo("characterValue", '')
...@@ -1453,7 +1450,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1453,7 +1450,7 @@ describe('rdbPredicatesTest', function () {
it('testBeginWrap0004', 0, async function (done) { it('testBeginWrap0004', 0, async function (done) {
console.log(TAG + "************* testBeginWrap0004 start *************"); console.log(TAG + "************* testBeginWrap0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") predicates.equalTo("stringValue", "ABCDEFGHIJKLMN")
.equalTo("characterValue", '') .equalTo("characterValue", '')
.endWrap(); .endWrap();
...@@ -1473,7 +1470,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1473,7 +1470,7 @@ describe('rdbPredicatesTest', function () {
it('testBeginWrap0005', 0, async function (done) { it('testBeginWrap0005', 0, async function (done) {
console.log(TAG + "************* testBeginWrap0005 start *************"); console.log(TAG + "************* testBeginWrap0005 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") predicates.equalTo("stringValue", "ABCDEFGHIJKLMN")
.beginWrap() .beginWrap()
.equalTo("characterValue", ''); .equalTo("characterValue", '');
...@@ -1493,7 +1490,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1493,7 +1490,7 @@ describe('rdbPredicatesTest', function () {
it('testAnd0001', 0, async function (done) { it('testAnd0001', 0, async function (done) {
console.log(TAG + "************* testAnd0001 start *************"); console.log(TAG + "************* testAnd0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") predicates.equalTo("stringValue", "ABCDEFGHIJKLMN")
.and() .and()
.equalTo("integerValue", 1); .equalTo("integerValue", 1);
...@@ -1513,7 +1510,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1513,7 +1510,7 @@ describe('rdbPredicatesTest', function () {
it('testAnd0002', 0, async function (done) { it('testAnd0002', 0, async function (done) {
console.log(TAG + "************* testAnd0002 start *************"); console.log(TAG + "************* testAnd0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") predicates.equalTo("stringValue", "ABCDEFGHIJKLMN")
.beginWrap() .beginWrap()
.equalTo("integerValue", 1) .equalTo("integerValue", 1)
...@@ -1536,7 +1533,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1536,7 +1533,7 @@ describe('rdbPredicatesTest', function () {
it('testAnd0003', 0, async function (done) { it('testAnd0003', 0, async function (done) {
console.log(TAG + "************* testAnd0003 start *************"); console.log(TAG + "************* testAnd0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().and().equalTo("integerValue", 1); predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().and().equalTo("integerValue", 1);
console.log(TAG + "you should not start a request" + " with \"and\" or use or() before this function"); console.log(TAG + "you should not start a request" + " with \"and\" or use or() before this function");
} }
...@@ -1552,7 +1549,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1552,7 +1549,7 @@ describe('rdbPredicatesTest', function () {
it('testAnd0004', 0, async function (done) { it('testAnd0004', 0, async function (done) {
console.log(TAG + "************* testAnd0004 start *************"); console.log(TAG + "************* testAnd0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().or().equalTo("integerValue", 1); predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().or().equalTo("integerValue", 1);
console.log(TAG + "you are starting a sql request with predicate or or," console.log(TAG + "you are starting a sql request with predicate or or,"
+ "using function or() immediately after another or(). that is ridiculous."); + "using function or() immediately after another or(). that is ridiculous.");
...@@ -1569,7 +1566,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1569,7 +1566,7 @@ describe('rdbPredicatesTest', function () {
it('testOrder0001', 0, async function (done) { it('testOrder0001', 0, async function (done) {
console.log(TAG + "************* testOrder0001 start *************"); console.log(TAG + "************* testOrder0001 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByAsc("integerValue").distinct(); predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByAsc("integerValue").distinct();
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1593,7 +1590,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1593,7 +1590,7 @@ describe('rdbPredicatesTest', function () {
it('testOrder0002', 0, async function (done) { it('testOrder0002', 0, async function (done) {
console.log(TAG + "************* testOrder0002 start *************"); console.log(TAG + "************* testOrder0002 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByDesc("integerValue").distinct(); predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByDesc("integerValue").distinct();
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1617,7 +1614,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1617,7 +1614,7 @@ describe('rdbPredicatesTest', function () {
it('testOrder0003', 0, async function (done) { it('testOrder0003', 0, async function (done) {
console.log(TAG + "************* testOrder0003 start *************"); console.log(TAG + "************* testOrder0003 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByDesc("integerValueX").distinct(); predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByDesc("integerValueX").distinct();
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(-1).assertEqual(result.rowCount); expect(-1).assertEqual(result.rowCount);
...@@ -1635,7 +1632,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1635,7 +1632,7 @@ describe('rdbPredicatesTest', function () {
it('testOrder0004', 0, async function (done) { it('testOrder0004', 0, async function (done) {
console.log(TAG + "************* testOrder0004 start *************"); console.log(TAG + "************* testOrder0004 start *************");
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByAsc("integerValueX").distinct(); predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByAsc("integerValueX").distinct();
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(-1).assertEqual(result.rowCount); expect(-1).assertEqual(result.rowCount);
...@@ -1652,7 +1649,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1652,7 +1649,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLimit0001', 0, async function (done) { it('testLimit0001', 0, async function (done) {
console.log(TAG + "************* testLimit0001 start *************"); console.log(TAG + "************* testLimit0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(1); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1668,7 +1665,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1668,7 +1665,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLimit0002', 0, async function (done) { it('testLimit0002', 0, async function (done) {
console.log(TAG + "************* testLimit0002 start *************"); console.log(TAG + "************* testLimit0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1684,7 +1681,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1684,7 +1681,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLimit0003', 0, async function (done) { it('testLimit0003', 0, async function (done) {
console.log(TAG + "************* testLimit0003 start *************"); console.log(TAG + "************* testLimit0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(100); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(100);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1700,7 +1697,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1700,7 +1697,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLimit0004', 0, async function (done) { it('testLimit0004', 0, async function (done) {
console.log(TAG + "************* testLimit0004 start *************"); console.log(TAG + "************* testLimit0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "").limitAs(1); predicates.like("stringValue", "").limitAs(1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1716,7 +1713,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1716,7 +1713,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLimit0005', 0, async function (done) { it('testLimit0005', 0, async function (done) {
console.log(TAG + "************* testLimit0005 start *************"); console.log(TAG + "************* testLimit0005 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(0); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1732,7 +1729,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1732,7 +1729,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testLimit0006', 0, async function (done) { it('testLimit0006', 0, async function (done) {
console.log(TAG + "************* testLimit0006 start *************"); console.log(TAG + "************* testLimit0006 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(-1); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(-1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1748,7 +1745,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1748,7 +1745,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testOffset0001', 0, async function (done) { it('testOffset0001', 0, async function (done) {
console.log(TAG + "************* testOffset0001 start *************"); console.log(TAG + "************* testOffset0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(1); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(2).assertEqual(result.rowCount); expect(2).assertEqual(result.rowCount);
...@@ -1764,7 +1761,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1764,7 +1761,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testOffset0002', 0, async function (done) { it('testOffset0002', 0, async function (done) {
console.log(TAG + "************* testOffset0002 start *************"); console.log(TAG + "************* testOffset0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(0); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(0);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1780,7 +1777,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1780,7 +1777,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testOffset0003', 0, async function (done) { it('testOffset0003', 0, async function (done) {
console.log(TAG + "************* testOffset0003 start *************"); console.log(TAG + "************* testOffset0003 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(5); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(5);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(0).assertEqual(result.rowCount); expect(0).assertEqual(result.rowCount);
...@@ -1796,7 +1793,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1796,7 +1793,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testOffset0004', 0, async function (done) { it('testOffset0004', 0, async function (done) {
console.log(TAG + "************* testOffset0004 start *************"); console.log(TAG + "************* testOffset0004 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(-1); predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(-1);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1813,7 +1810,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1813,7 +1810,7 @@ describe('rdbPredicatesTest', function () {
it('testIn0001', 0, async function (done) { it('testIn0001', 0, async function (done) {
console.log(TAG + "************* testIn0001 start *************"); console.log(TAG + "************* testIn0001 start *************");
var values = [Number.MIN_VALUE.toString()]; var values = [Number.MIN_VALUE.toString()];
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.in("doubleValue", values); predicates.in("doubleValue", values);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1829,7 +1826,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1829,7 +1826,7 @@ describe('rdbPredicatesTest', function () {
it('testIn0002', 0, async function (done) { it('testIn0002', 0, async function (done) {
console.log(TAG + "************* testIn0002 start *************"); console.log(TAG + "************* testIn0002 start *************");
var values = ["1.0"]; var values = ["1.0"];
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.in("doubleValue", values); predicates.in("doubleValue", values);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1845,7 +1842,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1845,7 +1842,7 @@ describe('rdbPredicatesTest', function () {
it('testIn0003', 0, async function (done) { it('testIn0003', 0, async function (done) {
console.log(TAG + "************* testIn0003 start *************"); console.log(TAG + "************* testIn0003 start *************");
var values = [DOUBLE_MAX.toString()]; var values = [DOUBLE_MAX.toString()];
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.in("doubleValue", values); predicates.in("doubleValue", values);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(1).assertEqual(result.rowCount); expect(1).assertEqual(result.rowCount);
...@@ -1861,7 +1858,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1861,7 +1858,7 @@ describe('rdbPredicatesTest', function () {
it('testIn0004', 0, async function (done) { it('testIn0004', 0, async function (done) {
console.log(TAG + "************* testIn0004 start *************"); console.log(TAG + "************* testIn0004 start *************");
var values = [Number.MIN_VALUE.toString(), "1.0", DOUBLE_MAX.toString()]; var values = [Number.MIN_VALUE.toString(), "1.0", DOUBLE_MAX.toString()];
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.in("doubleValue", values); predicates.in("doubleValue", values);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1876,7 +1873,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1876,7 +1873,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testCreate0001', 0, async function (done) { it('testCreate0001', 0, async function (done) {
console.log(TAG + "************* testCreate0001 start *************"); console.log(TAG + "************* testCreate0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
done(); done();
...@@ -1890,7 +1887,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1890,7 +1887,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testCreate0002', 0, async function (done) { it('testCreate0002', 0, async function (done) {
console.log(TAG + "************* testCreate0002 start *************"); console.log(TAG + "************* testCreate0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("test"); let predicates = await new dataRdb.RdbPredicates("test");
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(-1).assertEqual(result.rowCount); expect(-1).assertEqual(result.rowCount);
done(); done();
...@@ -1904,7 +1901,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1904,7 +1901,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testGroupBy0001', 0, async function (done) { it('testGroupBy0001', 0, async function (done) {
console.log(TAG + "************* testGroupBy0001 start *************"); console.log(TAG + "************* testGroupBy0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").groupBy(["characterValue"]); predicates.like("stringValue", "ABCDEFGHIJKLMN").groupBy(["characterValue"]);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1920,7 +1917,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1920,7 +1917,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testGroupBy0002', 0, async function (done) { it('testGroupBy0002', 0, async function (done) {
console.log(TAG + "************* testGroupBy0002 start *************"); console.log(TAG + "************* testGroupBy0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").groupBy(["characterValueX"]); predicates.like("stringValue", "ABCDEFGHIJKLMN").groupBy(["characterValueX"]);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(-1).assertEqual(result.rowCount); expect(-1).assertEqual(result.rowCount);
...@@ -1936,7 +1933,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1936,7 +1933,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIndexedBy0001', 0, async function (done) { it('testIndexedBy0001', 0, async function (done) {
console.log(TAG + "************* testIndexedBy0001 start *************"); console.log(TAG + "************* testIndexedBy0001 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").indexedBy(["characterValue"]); predicates.like("stringValue", "ABCDEFGHIJKLMN").indexedBy(["characterValue"]);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
...@@ -1952,7 +1949,7 @@ describe('rdbPredicatesTest', function () { ...@@ -1952,7 +1949,7 @@ describe('rdbPredicatesTest', function () {
*/ */
it('testIndexedBy0002', 0, async function (done) { it('testIndexedBy0002', 0, async function (done) {
console.log(TAG + "************* testIndexedBy0002 start *************"); console.log(TAG + "************* testIndexedBy0002 start *************");
let predicates = await new ohos_data_rdb.RdbPredicates("AllDataType"); let predicates = await new dataRdb.RdbPredicates("AllDataType");
predicates.like("stringValue", "ABCDEFGHIJKLMN").indexedBy(["characterValueX"]); predicates.like("stringValue", "ABCDEFGHIJKLMN").indexedBy(["characterValueX"]);
let result = await rdbStore.query(predicates); let result = await rdbStore.query(predicates);
expect(3).assertEqual(result.rowCount); expect(3).assertEqual(result.rowCount);
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
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,11 +22,9 @@ const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIM ...@@ -23,11 +22,9 @@ const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIM
const STORE_CONFIG = { const STORE_CONFIG = {
name: "rdbstore.db", name: "rdbstore.db",
} }
var context = undefined;
describe('rdbStoreTest', function () { describe('rdbStoreTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext();
}) })
beforeEach(function () { beforeEach(function () {
...@@ -51,7 +48,7 @@ describe('rdbStoreTest', function () { ...@@ -51,7 +48,7 @@ describe('rdbStoreTest', function () {
*/ */
it('testRdbStore0001', 0, async function (done) { it('testRdbStore0001', 0, async function (done) {
console.log(TAG + "************* testRdbStore0001 start *************"); console.log(TAG + "************* testRdbStore0001 start *************");
let storePromise = ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1); let storePromise = dataRdb.getRdbStore(STORE_CONFIG, 1);
storePromise.then(async (store) => { storePromise.then(async (store) => {
try { try {
await console.log(TAG + "getRdbStore done: " + store); await console.log(TAG + "getRdbStore done: " + store);
...@@ -63,7 +60,7 @@ describe('rdbStoreTest', function () { ...@@ -63,7 +60,7 @@ describe('rdbStoreTest', function () {
}) })
await storePromise await storePromise
storePromise = null storePromise = null
await ohos_data_rdb.deleteRdbStore(context, "rdbstore.db"); await dataRdb.deleteRdbStore("rdbstore.db");
done(); done();
console.log(TAG + "************* testRdbStore0001 end *************"); console.log(TAG + "************* testRdbStore0001 end *************");
}) })
...@@ -75,7 +72,7 @@ describe('rdbStoreTest', function () { ...@@ -75,7 +72,7 @@ describe('rdbStoreTest', function () {
*/ */
it('testRdbStore0002', 0, async function (done) { it('testRdbStore0002', 0, async function (done) {
console.log(TAG + "************* testRdbStore0002 start *************"); console.log(TAG + "************* testRdbStore0002 start *************");
let storePromise = ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 2); let storePromise = dataRdb.getRdbStore(STORE_CONFIG, 2);
storePromise.then(async (store) => { storePromise.then(async (store) => {
try { try {
await console.log(TAG + "getRdbStore done: " + store); await console.log(TAG + "getRdbStore done: " + store);
...@@ -88,7 +85,7 @@ describe('rdbStoreTest', function () { ...@@ -88,7 +85,7 @@ describe('rdbStoreTest', function () {
}) })
await storePromise await storePromise
storePromise = null storePromise = null
await ohos_data_rdb.deleteRdbStore(context, "rdbstore.db"); await dataRdb.deleteRdbStore("rdbstore.db");
done(); done();
console.log(TAG + "************* testRdbStore0002 end *************"); console.log(TAG + "************* testRdbStore0002 end *************");
}) })
...@@ -104,7 +101,7 @@ describe('rdbStoreTest', function () { ...@@ -104,7 +101,7 @@ describe('rdbStoreTest', function () {
let storeConfig = { let storeConfig = {
name: "/wrong/rdbstore.db", name: "/wrong/rdbstore.db",
} }
let storePromise = ohos_data_rdb.getRdbStore(context, storeConfig, 4); let storePromise = dataRdb.getRdbStore(storeConfig, 4);
storePromise.then(async (ret) => { storePromise.then(async (ret) => {
await console.log(TAG + "getRdbStore done" + ret); await console.log(TAG + "getRdbStore done" + ret);
expect(null).assertFail(); expect(null).assertFail();
...@@ -124,7 +121,7 @@ describe('rdbStoreTest', function () { ...@@ -124,7 +121,7 @@ describe('rdbStoreTest', function () {
it('testRdbStore0004', 0, async function (done) { it('testRdbStore0004', 0, async function (done) {
console.log(TAG + "************* testRdbStore0004 start *************"); console.log(TAG + "************* testRdbStore0004 start *************");
let storePromise = ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 6); let storePromise = dataRdb.getRdbStore(STORE_CONFIG, 6);
storePromise.then(async (store) => { storePromise.then(async (store) => {
try { try {
await store.executeSql(CREATE_TABLE_TEST); await store.executeSql(CREATE_TABLE_TEST);
...@@ -136,7 +133,7 @@ describe('rdbStoreTest', function () { ...@@ -136,7 +133,7 @@ describe('rdbStoreTest', function () {
}) })
await storePromise await storePromise
storePromise = null storePromise = null
await ohos_data_rdb.deleteRdbStore(context, "rdbstore.db"); await dataRdb.deleteRdbStore("rdbstore.db");
done(); done();
console.log(TAG + "************* testRdbStore0004 end *************"); console.log(TAG + "************* testRdbStore0004 end *************");
}) })
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
* 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 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
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 NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"; const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)";
...@@ -23,13 +22,11 @@ const STORE_CONFIG = { ...@@ -23,13 +22,11 @@ const STORE_CONFIG = {
name: "ExcuteSqlTest.db", name: "ExcuteSqlTest.db",
} }
var rdbStore = undefined; var rdbStore = undefined;
var context = undefined;
describe('rdbStoreInsertTest', function () { describe('rdbStoreInsertTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext(); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
rdbStore = await ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null); await rdbStore.executeSql(CREATE_TABLE_TEST, null);
}) })
...@@ -45,7 +42,7 @@ describe('rdbStoreInsertTest', function () { ...@@ -45,7 +42,7 @@ describe('rdbStoreInsertTest', function () {
afterAll(async function () { afterAll(async function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
rdbStore = null rdbStore = null
await ohos_data_rdb.deleteRdbStore(context, "ExcuteSqlTest.db"); await dataRdb.deleteRdbStore("ExcuteSqlTest.db");
}) })
/** /**
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
* 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 'deccjsunit/index'
import ohos_data_rdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
import ability_featureAbility from '@ohos.ability.featureAbility';
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 UNIQUE, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"; const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT UNIQUE, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)";
...@@ -22,13 +21,11 @@ const STORE_CONFIG = { ...@@ -22,13 +21,11 @@ const STORE_CONFIG = {
name: "UpdataTest.db", name: "UpdataTest.db",
} }
var rdbStore = undefined; var rdbStore = undefined;
var context = undefined;
describe('rdbStoreUpdateTest', function () { describe('rdbStoreUpdateTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
context = await ability_featureAbility.getContext(); rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1);
rdbStore = await ohos_data_rdb.getRdbStore(context, STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST, null); await rdbStore.executeSql(CREATE_TABLE_TEST, null);
}) })
...@@ -44,7 +41,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -44,7 +41,7 @@ describe('rdbStoreUpdateTest', function () {
afterAll(async function () { afterAll(async function () {
console.info(TAG + 'afterAll') console.info(TAG + 'afterAll')
rdbStore = null rdbStore = null
await ohos_data_rdb.deleteRdbStore(context, "UpdataTest.db"); await dataRdb.deleteRdbStore("UpdataTest.db");
}) })
/** /**
...@@ -81,7 +78,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -81,7 +78,7 @@ describe('rdbStoreUpdateTest', function () {
"salary": 200.5, "salary": 200.5,
"blobType": u8, "blobType": u8,
} }
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
await predicates.equalTo("id", "1") await predicates.equalTo("id", "1")
let updatePromise = rdbStore.update(valueBucket, predicates) let updatePromise = rdbStore.update(valueBucket, predicates)
updatePromise.then(async (ret) => { updatePromise.then(async (ret) => {
...@@ -95,7 +92,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -95,7 +92,7 @@ describe('rdbStoreUpdateTest', function () {
} }
//查询 //查询
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
expect(true).assertEqual(resultSet.goToFirstRow()) expect(true).assertEqual(resultSet.goToFirstRow())
...@@ -137,7 +134,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -137,7 +134,7 @@ describe('rdbStoreUpdateTest', function () {
"blobType": u8, "blobType": u8,
} }
{ {
let predicates = new ohos_data_rdb.RdbPredicates("") let predicates = new dataRdb.RdbPredicates("")
let updatePromise = rdbStore.update(valueBucket, predicates) let updatePromise = rdbStore.update(valueBucket, predicates)
updatePromise.then(async (ret) => { updatePromise.then(async (ret) => {
await console.log(TAG + "update done: " + ret); await console.log(TAG + "update done: " + ret);
...@@ -148,7 +145,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -148,7 +145,7 @@ describe('rdbStoreUpdateTest', function () {
} }
{ {
const emptyBucket = {}; const emptyBucket = {};
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let updatePromise = rdbStore.update(emptyBucket, predicates) let updatePromise = rdbStore.update(emptyBucket, predicates)
updatePromise.then(async (ret) => { updatePromise.then(async (ret) => {
await console.log(TAG + "update done: " + ret); await console.log(TAG + "update done: " + ret);
...@@ -158,7 +155,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -158,7 +155,7 @@ describe('rdbStoreUpdateTest', function () {
}) })
} }
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
await predicates.equalTo("aaa", "null") await predicates.equalTo("aaa", "null")
let updatePromise = rdbStore.update(valueBucket, predicates) let updatePromise = rdbStore.update(valueBucket, predicates)
updatePromise.then(async (ret) => { updatePromise.then(async (ret) => {
...@@ -191,7 +188,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -191,7 +188,7 @@ describe('rdbStoreUpdateTest', function () {
"wrongColumn": 100.5, "wrongColumn": 100.5,
} }
{ {
let predicates = new ohos_data_rdb.RdbPredicates("wrongTable") let predicates = new dataRdb.RdbPredicates("wrongTable")
let updatePromise = rdbStore.update(valueBucket, predicates) let updatePromise = rdbStore.update(valueBucket, predicates)
updatePromise.then(async (ret) => { updatePromise.then(async (ret) => {
await console.log(TAG + "update done: " + ret); await console.log(TAG + "update done: " + ret);
...@@ -202,7 +199,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -202,7 +199,7 @@ describe('rdbStoreUpdateTest', function () {
//await updatePromise //await updatePromise
} }
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
let updatePromise = rdbStore.update(valueBucket, predicates) let updatePromise = rdbStore.update(valueBucket, predicates)
updatePromise.then(async (ret) => { updatePromise.then(async (ret) => {
await console.log(TAG + "update done: " + ret); await console.log(TAG + "update done: " + ret);
...@@ -234,7 +231,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -234,7 +231,7 @@ describe('rdbStoreUpdateTest', function () {
"blobType": u8, "blobType": u8,
} }
{ {
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
await predicates.equalTo("aaa", "null") await predicates.equalTo("aaa", "null")
let updatePromise = rdbStore.update(valueBucket, predicates) let updatePromise = rdbStore.update(valueBucket, predicates)
updatePromise.then(async (ret) => { updatePromise.then(async (ret) => {
...@@ -247,7 +244,7 @@ describe('rdbStoreUpdateTest', function () { ...@@ -247,7 +244,7 @@ describe('rdbStoreUpdateTest', function () {
} }
{ {
const emptyBucket = {}; const emptyBucket = {};
let predicates = await new ohos_data_rdb.RdbPredicates("test") let predicates = await new dataRdb.RdbPredicates("test")
await predicates.equalTo("name", "zhangsan") await predicates.equalTo("name", "zhangsan")
await predicates.equalTo("age", 18) await predicates.equalTo("age", 18)
await predicates.equalTo("null", 100.5) await predicates.equalTo("null", 100.5)
......
...@@ -44,8 +44,8 @@ describe('storageTest', function () { ...@@ -44,8 +44,8 @@ describe('storageTest', function () {
mPref.flushSync(); mPref.flushSync();
await mPref.clear(function (err, ret) { await mPref.clear(function (err, ret) {
expect("defaultvalue").assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue")); expect("defaultvalue").assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
});
done(); done();
});
}) })
/** /**
...@@ -57,9 +57,9 @@ describe('storageTest', function () { ...@@ -57,9 +57,9 @@ describe('storageTest', function () {
mPref.putSync(KEY_TEST_STRING_ELEMENT, "test"); mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
await mPref.has(KEY_TEST_STRING_ELEMENT, function (err, ret) { await mPref.has(KEY_TEST_STRING_ELEMENT, function (err, ret) {
expect(true).assertEqual(ret); expect(true).assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name has int callback interface test * @tc.name has int callback interface test
...@@ -70,9 +70,9 @@ describe('storageTest', function () { ...@@ -70,9 +70,9 @@ describe('storageTest', function () {
mPref.putSync(KEY_TEST_INT_ELEMENT, 1); mPref.putSync(KEY_TEST_INT_ELEMENT, 1);
await mPref.has(KEY_TEST_INT_ELEMENT, function (err, ret) { await mPref.has(KEY_TEST_INT_ELEMENT, function (err, ret) {
expect(true).assertEqual(ret); expect(true).assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name has float callback interface test * @tc.name has float callback interface test
...@@ -83,9 +83,9 @@ describe('storageTest', function () { ...@@ -83,9 +83,9 @@ describe('storageTest', function () {
mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 1.1); mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 1.1);
await mPref.has(KEY_TEST_FLOAT_ELEMENT, function (err, ret) { await mPref.has(KEY_TEST_FLOAT_ELEMENT, function (err, ret) {
expect(true).assertEqual(ret); expect(true).assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name has long callback interface test * @tc.name has long callback interface test
...@@ -96,9 +96,9 @@ describe('storageTest', function () { ...@@ -96,9 +96,9 @@ describe('storageTest', function () {
mPref.putSync(KEY_TEST_LONG_ELEMENT, 0); mPref.putSync(KEY_TEST_LONG_ELEMENT, 0);
await mPref.has(KEY_TEST_LONG_ELEMENT, function (err, ret) { await mPref.has(KEY_TEST_LONG_ELEMENT, function (err, ret) {
expect(true).assertEqual(ret); expect(true).assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name has boolean callback interface test * @tc.name has boolean callback interface test
...@@ -109,9 +109,9 @@ describe('storageTest', function () { ...@@ -109,9 +109,9 @@ describe('storageTest', function () {
mPref.putSync(KEY_TEST_BOOLEAN_ELEMENT, false); mPref.putSync(KEY_TEST_BOOLEAN_ELEMENT, false);
await mPref.has(KEY_TEST_BOOLEAN_ELEMENT, function (err, ret) { await mPref.has(KEY_TEST_BOOLEAN_ELEMENT, function (err, ret) {
expect(true).assertEqual(ret); expect(true).assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name get defaultValue callback interface test * @tc.name get defaultValue callback interface test
...@@ -122,9 +122,9 @@ describe('storageTest', function () { ...@@ -122,9 +122,9 @@ describe('storageTest', function () {
mPref.clearSync(); mPref.clearSync();
await mPref.get(KEY_TEST_STRING_ELEMENT, "defaultValue", function (err, ret) { await mPref.get(KEY_TEST_STRING_ELEMENT, "defaultValue", function (err, ret) {
expect('defaultValue').assertEqual(ret); expect('defaultValue').assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name get float callback interface test * @tc.name get float callback interface test
...@@ -136,9 +136,9 @@ describe('storageTest', function () { ...@@ -136,9 +136,9 @@ describe('storageTest', function () {
mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 3.0); mPref.putSync(KEY_TEST_FLOAT_ELEMENT, 3.0);
await mPref.get(KEY_TEST_FLOAT_ELEMENT, 0.0, function (err, ret) { await mPref.get(KEY_TEST_FLOAT_ELEMENT, 0.0, function (err, ret) {
expect(3.0).assertEqual(ret); expect(3.0).assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name get int callback interface test * @tc.name get int callback interface test
...@@ -150,9 +150,9 @@ describe('storageTest', function () { ...@@ -150,9 +150,9 @@ describe('storageTest', function () {
mPref.putSync(KEY_TEST_INT_ELEMENT, 3); mPref.putSync(KEY_TEST_INT_ELEMENT, 3);
await mPref.get(KEY_TEST_INT_ELEMENT, 0.0, function (err, ret) { await mPref.get(KEY_TEST_INT_ELEMENT, 0.0, function (err, ret) {
expect(3).assertEqual(ret); expect(3).assertEqual(ret);
})
done(); done();
}) })
})
/** /**
* @tc.name get long callback interface test * @tc.name get long callback interface test
...@@ -165,8 +165,8 @@ describe('storageTest', function () { ...@@ -165,8 +165,8 @@ describe('storageTest', function () {
expect(3).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0)); expect(3).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
await mPref.get(KEY_TEST_LONG_ELEMENT, 0, function (err, ret) { await mPref.get(KEY_TEST_LONG_ELEMENT, 0, function (err, ret) {
expect(3).assertEqual(ret); expect(3).assertEqual(ret);
});
done(); done();
});
}) })
/** /**
...@@ -180,8 +180,8 @@ describe('storageTest', function () { ...@@ -180,8 +180,8 @@ describe('storageTest', function () {
mPref.flushSync(); mPref.flushSync();
await mPref.get(KEY_TEST_STRING_ELEMENT, "defaultvalue", function (err, ret) { await mPref.get(KEY_TEST_STRING_ELEMENT, "defaultvalue", function (err, ret) {
expect('test').assertEqual(ret); expect('test').assertEqual(ret);
});
done(); done();
});
}) })
/** /**
...@@ -195,8 +195,8 @@ describe('storageTest', function () { ...@@ -195,8 +195,8 @@ describe('storageTest', function () {
expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false)); expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
mPref.flushSync(); mPref.flushSync();
expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false)); expect(true).assertEqual(mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, false));
});
done(); done();
});
}) })
/** /**
...@@ -210,8 +210,8 @@ describe('storageTest', function () { ...@@ -210,8 +210,8 @@ describe('storageTest', function () {
expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0)); expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
mPref.flushSync(); mPref.flushSync();
expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0)); expect(4.0).assertEqual(mPref.getSync(KEY_TEST_FLOAT_ELEMENT, 0.0));
});
done(); done();
});
}) })
/** /**
...@@ -225,8 +225,8 @@ describe('storageTest', function () { ...@@ -225,8 +225,8 @@ describe('storageTest', function () {
expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0)); expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
mPref.flushSync(); mPref.flushSync();
expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0)); expect(4).assertEqual(mPref.getSync(KEY_TEST_INT_ELEMENT, 0));
});
done(); done();
});
}) })
/** /**
...@@ -241,8 +241,8 @@ describe('storageTest', function () { ...@@ -241,8 +241,8 @@ describe('storageTest', function () {
expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0)); expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
mPref.flushSync(); mPref.flushSync();
expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0)); expect(4).assertEqual(mPref.getSync(KEY_TEST_LONG_ELEMENT, 0));
});
done(); done();
});
}) })
/** /**
...@@ -252,13 +252,11 @@ describe('storageTest', function () { ...@@ -252,13 +252,11 @@ describe('storageTest', function () {
*/ */
it('testPutString0162', 0, async function (done) { it('testPutString0162', 0, async function (done) {
mPref.clearSync(); mPref.clearSync();
await mPref.put(KEY_TEST_STRING_ELEMENT, "abc", function (err, ret) { await mPref.put(KEY_TEST_STRING_ELEMENT, '', function (err, ret) {
mPref.put(KEY_TEST_STRING_ELEMENT, '', function (err, ret) {
expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue")); expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
mPref.flushSync(); mPref.flushSync();
expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue")); expect('').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue"));
});
});
done(); done();
});
}) })
}) })
\ No newline at end of file
...@@ -110,8 +110,8 @@ describe('storageTest', function () { ...@@ -110,8 +110,8 @@ describe('storageTest', function () {
} }
try { try {
perf.putSync("int", 3); perf.putSync("int", 3);
expect(null).assertFail();
} catch (e) { } catch (e) {
expect(null).assertFail();
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册