Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4dc6173e
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4dc6173e
编写于
9月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9927 【Distributeddatamgr】【Master】relationalStore用例优化,优化用例执行时序
Merge pull request !9927 from yanglifeng/master
上级
895b7d60
d69fbac8
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
3343 addition
and
3266 deletion
+3343
-3266
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
...bJstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
+914
-909
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js
...st/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js
+399
-399
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js
...bJstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js
+212
-214
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreAssetResultSetJsunit.test.js
.../main/js/test/RelationalStoreAssetResultSetJsunit.test.js
+2
-2
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreInsertJsunit.test.js
.../hap/src/main/js/test/RelationalStoreInsertJsunit.test.js
+1274
-1194
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreTransactionJsunit.test.js
...src/main/js/test/RelationalStoreTransactionJsunit.test.js
+400
-399
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreUpdateJsunit.test.js
.../hap/src/main/js/test/RelationalStoreUpdateJsunit.test.js
+142
-149
未找到文件。
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js
浏览文件 @
4dc6173e
此差异已折叠。
点击以展开。
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js
浏览文件 @
4dc6173e
...
...
@@ -26,7 +26,7 @@ const STORE_CONFIG = {
var
rdbStore
=
undefined
;
export
default
function
rdbstoreTransactionTest
()
{
describe
(
'
rdbstoreTransactionTest
'
,
function
()
{
describe
(
'
rdbstoreTransactionTest
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
TAG
+
'
beforeAll
'
)
})
...
...
@@ -75,7 +75,7 @@ describe('rdbstoreTransactionTest', function () {
console
.
info
(
TAG
+
"
testRdbTransactionInsert0001 result count
"
+
resultSet
.
rowCount
)
expect
(
1
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
}
catch
(
e
)
{
console
.
info
(
TAG
+
e
);
expect
(
null
).
assertFail
()
...
...
@@ -126,7 +126,7 @@ describe('rdbstoreTransactionTest', function () {
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
expect
(
3
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
}
catch
(
e
)
{
expect
(
null
).
assertFail
()
console
.
info
(
TAG
+
"
testRdbTransactionInsert0002 failed
"
);
...
...
@@ -167,7 +167,7 @@ describe('rdbstoreTransactionTest', function () {
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
const
valueBucket2
=
{
"
name
"
:
"
wangwu
"
,
"
age
"
:
16
,
...
...
@@ -214,7 +214,7 @@ describe('rdbstoreTransactionTest', function () {
console
.
info
(
TAG
+
"
testRdbTransactionRollBack0001 result count
"
+
resultSet
.
rowCount
);
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionRollBack0001 end *************
"
);
...
...
@@ -247,8 +247,7 @@ describe('rdbstoreTransactionTest', function () {
"
salary
"
:
220.5
,
"
blobType
"
:
u8
,
}
let
num
=
rdbStore
.
insert
(
"
test
"
,
valueBucket1
)
num
.
then
(
async
(
ret
)
=>
{
await
rdbStore
.
insert
(
"
test
"
,
valueBucket1
).
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0001 * insert result
"
+
ret
);
expect
(
2
).
assertEqual
(
ret
)
})
...
...
@@ -257,16 +256,15 @@ describe('rdbstoreTransactionTest', function () {
await
rdbStore
.
commit
()
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test
"
);
num
=
rdbStore
.
query
(
predicates
)
num
.
then
(
async
(
ret
)
=>
{
await
rdbStore
.
query
(
predicates
).
then
(
async
(
ret
)
=>
{
expect
(
2
).
assertEqual
(
ret
.
rowCount
)
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0001 end *************
"
);
ret
.
close
()
})
}
catch
(
e
)
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0001 fail *****
"
);
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0001 end *************
"
);
})
/**
...
...
@@ -287,9 +285,7 @@ describe('rdbstoreTransactionTest', function () {
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
,
function
(
err
,
ret
){
});
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
);
await
rdbStore
.
beginTransaction
()
const
valueBucket1
=
{
...
...
@@ -298,29 +294,29 @@ describe('rdbstoreTransactionTest', function () {
"
salary
"
:
220.5
,
"
blobType
"
:
u8
,
}
let
num
=
rdbStore
.
insert
(
"
test
"
,
valueBucket1
)
num
.
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * insert result
"
+
ret
);
expect
(
2
).
assertEqual
(
ret
)
ret
.
close
()
})
await
rdbStore
.
insert
(
"
test
"
,
valueBucket1
,
async
function
(
err
,
ret1
){
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * insert result
"
+
ret1
);
expect
(
2
).
assertEqual
(
ret1
)
await
rdbStore
.
rollBack
()
await
rdbStore
.
commit
()
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test
"
);
num
=
rdbStore
.
query
(
predicates
)
num
.
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * final query
"
+
ret
.
rowCount
);
expect
(
1
).
assertEqual
(
ret
.
rowCount
)
ret
.
close
()
await
rdbStore
.
query
(
predicates
).
then
(
async
(
ret2
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * final query
"
+
ret2
.
rowCount
);
expect
(
1
).
assertEqual
(
ret2
.
rowCount
)
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0002 end *************
"
);
ret2
.
close
()
})
})
}
catch
(
e
)
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 fail *****
"
);
expect
().
assertFail
();
done
();
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0002 end *************
"
);
})
/**
...
...
@@ -341,37 +337,41 @@ describe('rdbstoreTransactionTest', function () {
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
,
function
(
err
,
ret
){
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
);
});
await
rdbStore
.
beginTransaction
()
const
valueBucket1
=
{
await
rdbStore
.
beginTransaction
();
const
valueBucket2
=
{
"
name
"
:
"
zhangsan
"
,
"
age
"
:
20
,
"
salary
"
:
220.5
,
"
blobType
"
:
u8
,
}
let
num
=
await
rdbStore
.
insert
(
"
test
"
,
valueBucket1
)
await
rdbStore
.
insert
(
"
test
"
,
valueBucket2
);
await
rdbStore
.
rollBack
()
await
rdbStore
.
rollBack
();
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
)
await
rdbStore
.
commit
()
const
valueBucket3
=
{
"
name
"
:
"
wangwu
"
,
"
age
"
:
18
,
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket3
);
await
rdbStore
.
commit
();
let
predicates
=
new
dataRdb
.
RdbPredicates
(
"
test
"
);
num
=
rdbStore
.
query
(
predicates
)
num
.
then
(
async
(
ret
)
=>
{
await
rdbStore
.
query
(
predicates
).
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0003 * final query
"
+
ret
.
rowCount
);
expect
(
1
).
assertEqual
(
ret
.
rowCount
)
ret
.
close
()
expect
(
2
).
assertEqual
(
ret
.
rowCount
);
done
();
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0003 end *************
"
);
ret
.
close
();
})
}
catch
(
e
)
{
await
rdbStore
.
rollBack
()
console
.
info
(
TAG
+
"
testRdbTransactionMulti0003 rollback *****
"
);
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0003 end *************
"
);
})
/**
...
...
@@ -405,7 +405,7 @@ describe('rdbstoreTransactionTest', function () {
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
const
valueBucket2
=
{
"
name
"
:
"
wangwu
"
,
"
age
"
:
16
,
...
...
@@ -422,18 +422,18 @@ describe('rdbstoreTransactionTest', function () {
//删除
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
test
"
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
deletePromise
.
then
(
async
(
ret
)
=>
{
expect
(
3
).
assertEqual
(
ret
)
await
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
expect
(
3
).
assertEqual
(
ret
);
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionDelete0001 end *************
"
);
console
.
info
(
TAG
+
"
Delete done:
"
+
ret
)
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
();
done
();
})
await
deletePromise
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionDelete0001 end *************
"
);
})
console
.
info
(
TAG
+
"
*************Unit Test End*************
"
);
})}
})}
distributeddatamgr/relationalStoretest/RdbJstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js
浏览文件 @
4dc6173e
...
...
@@ -23,7 +23,7 @@ const STORE_CONFIG = {
var
rdbStore
=
undefined
;
export
default
function
rdbStoreUpdateTest
()
{
describe
(
'
rdbStoreUpdateTest
'
,
function
()
{
describe
(
'
rdbStoreUpdateTest
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
TAG
+
'
beforeAll
'
)
})
...
...
@@ -234,27 +234,25 @@ describe('rdbStoreUpdateTest', function () {
{
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
test
"
)
await
predicates
.
equalTo
(
"
aaa
"
,
"
null
"
)
let
updatePromise
=
rdbStore
.
update
(
valueBucket
,
predicates
)
updatePromise
.
then
(
async
(
ret
)
=>
{
await
rdbStore
.
update
(
valueBucket
,
predicates
).
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
update done:
"
+
ret
);
expect
(
null
).
assertFail
();
}).
catch
((
err
)
=>
{
console
.
info
(
TAG
+
"
update with wrong condition
"
);
expect
(
err
!==
null
).
assertTrue
();
})
//await updatePromise
}
{
const
emptyBucket
=
{};
let
predicates
=
await
new
dataRdb
.
RdbPredicates
(
"
test
"
)
await
predicates
.
equalTo
(
"
name
"
,
"
zhangsan
"
)
await
predicates
.
equalTo
(
"
age
"
,
18
)
await
predicates
.
equalTo
(
"
null
"
,
100.5
)
let
updatePromise
=
rdbStore
.
update
(
valueBucket
,
predicates
)
updatePromise
.
then
(
async
(
ret
)
=>
{
await
rdbStore
.
update
(
valueBucket
,
predicates
).
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
update done:
"
+
ret
);
expect
(
null
).
assertFail
(
);
expect
(
ret
).
assertEqual
(
0
);
}).
catch
((
err
)
=>
{
console
.
info
(
TAG
+
"
update with wrong condition
"
);
expect
(
null
).
assertFail
();
})
}
}
...
...
@@ -262,6 +260,6 @@ describe('rdbStoreUpdateTest', function () {
console
.
info
(
TAG
+
"
************* testRdbStoreUpdate0004 end *************
"
);
})
console
.
info
(
TAG
+
"
*************Unit Test End*************
"
);
})
})
}
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreAssetResultSetJsunit.test.js
浏览文件 @
4dc6173e
...
...
@@ -501,7 +501,7 @@ export default function relationalStoreAssetResultSetTest() {
done
();
}
catch
(
e
)
{
console
.
log
(
TAG
+
"
testGetAssetUndefined get error
"
+
JSON
.
stringify
(
e
));
expect
(
14800000
).
assertEqual
(
e
.
code
)
expect
(
'
401
'
).
assertEqual
(
e
.
code
)
done
();
}
})
...
...
@@ -531,7 +531,7 @@ export default function relationalStoreAssetResultSetTest() {
done
();
}
catch
(
e
)
{
console
.
log
(
TAG
+
"
testGetAssetNull get error
"
+
JSON
.
stringify
(
e
));
expect
(
14800000
).
assertEqual
(
e
.
code
)
expect
(
'
401
'
).
assertEqual
(
e
.
code
)
done
();
}
})
...
...
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreInsertJsunit.test.js
浏览文件 @
4dc6173e
此差异已折叠。
点击以展开。
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreTransactionJsunit.test.js
浏览文件 @
4dc6173e
...
...
@@ -29,7 +29,7 @@ const STORE_CONFIG = {
var
rdbStore
=
undefined
;
export
default
function
relationalStoreTransactionTest
()
{
describe
(
'
relationalStoreTransactionTest
'
,
function
()
{
describe
(
'
relationalStoreTransactionTest
'
,
function
()
{
beforeAll
(
function
()
{
console
.
info
(
TAG
+
'
beforeAll
'
)
})
...
...
@@ -78,7 +78,7 @@ describe('relationalStoreTransactionTest', function () {
console
.
info
(
TAG
+
"
testRdbTransactionInsert0001 result count
"
+
resultSet
.
rowCount
)
expect
(
1
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
}
catch
(
e
)
{
console
.
info
(
TAG
+
e
);
expect
(
null
).
assertFail
()
...
...
@@ -129,7 +129,7 @@ describe('relationalStoreTransactionTest', function () {
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
expect
(
3
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
}
catch
(
e
)
{
expect
(
null
).
assertFail
()
console
.
info
(
TAG
+
"
testRdbTransactionInsert0002 failed
"
);
...
...
@@ -170,7 +170,7 @@ describe('relationalStoreTransactionTest', function () {
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
const
valueBucket2
=
{
"
name
"
:
"
wangwu
"
,
"
age
"
:
16
,
...
...
@@ -217,7 +217,7 @@ describe('relationalStoreTransactionTest', function () {
console
.
info
(
TAG
+
"
testRdbTransactionRollBack0001 result count
"
+
resultSet
.
rowCount
);
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionRollBack0001 end *************
"
);
...
...
@@ -230,7 +230,7 @@ describe('relationalStoreTransactionTest', function () {
* db returns an exception, we need to catch exception and rollback.
*/
it
(
'
testRdbTransactionMulti0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0001 start *************
"
);
console
.
info
(
'
ttt
'
+
"
************* testRdbTransactionMulti0001 start *************
"
);
var
u8
=
new
Uint8Array
([
1
,
2
,
3
])
try
{
await
rdbStore
.
beginTransaction
()
...
...
@@ -251,25 +251,25 @@ describe('relationalStoreTransactionTest', function () {
"
blobType
"
:
u8
,
}
let
num
=
rdbStore
.
insert
(
"
test
"
,
valueBucket1
)
num
.
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0001 * insert result
"
+
ret
);
expect
(
2
).
assertEqual
(
ret
)
num
.
then
(
async
(
ret1
)
=>
{
console
.
info
(
'
ttt
'
+
"
testRdbTransactionMulti0001 * insert result
"
+
ret1
);
expect
(
2
).
assertEqual
(
ret1
)
})
await
rdbStore
.
commit
()
await
rdbStore
.
commit
()
let
predicates
=
new
data_Rdb
.
RdbPredicates
(
"
test
"
);
num
=
rdbStore
.
query
(
predicates
)
num
.
then
(
async
(
ret
)
=>
{
expect
(
2
).
assertEqual
(
ret
.
rowCount
)
ret
.
close
()
await
rdbStore
.
query
(
predicates
).
then
(
async
(
ret2
)
=>
{
console
.
info
(
'
ttt
'
+
"
testRdbTransactionMulti0001 ret.rowCount =
"
+
ret2
.
rowCount
);
expect
(
2
).
assertEqual
(
ret2
.
rowCount
)
done
()
console
.
info
(
'
ttt
'
+
"
************* testRdbTransactionMulti0001 end *************
"
);
ret2
.
close
()
})
}
catch
(
e
)
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0001 fail *****
"
);
console
.
info
(
'
ttt
'
+
"
testRdbTransactionMulti0001 fail *****
"
);
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0001 end *************
"
);
})
/**
...
...
@@ -280,7 +280,7 @@ describe('relationalStoreTransactionTest', function () {
*/
it
(
'
testRdbTransactionMulti0002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0002 start *************
"
);
var
u8
=
new
Uint8Array
([
1
,
2
,
3
])
let
u8
=
new
Uint8Array
([
1
,
2
,
3
])
try
{
await
rdbStore
.
beginTransaction
()
const
valueBucket
=
{
...
...
@@ -290,9 +290,7 @@ describe('relationalStoreTransactionTest', function () {
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
,
function
(
err
,
ret
){
});
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
)
await
rdbStore
.
beginTransaction
()
const
valueBucket1
=
{
...
...
@@ -301,31 +299,30 @@ describe('relationalStoreTransactionTest', function () {
"
salary
"
:
220.5
,
"
blobType
"
:
u8
,
}
let
num
=
rdbStore
.
insert
(
"
test
"
,
valueBucket1
)
num
.
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * insert result
"
+
ret
);
expect
(
2
).
assertEqual
(
ret
)
ret
.
close
()
})
await
rdbStore
.
insert
(
"
test
"
,
valueBucket1
,
async
function
(
err
,
ret1
){
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * insert result
"
+
ret1
);
expect
(
2
).
assertEqual
(
ret1
);
await
rdbStore
.
rollBack
()
await
rdbStore
.
commit
()
let
predicates
=
new
data_Rdb
.
RdbPredicates
(
"
test
"
);
num
=
rdbStore
.
query
(
predicates
)
num
.
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * final query
"
+
ret
.
rowCount
);
expect
(
1
).
assertEqual
(
ret
.
rowCount
)
ret
.
close
()
await
rdbStore
.
query
(
predicates
).
then
(
async
(
ret2
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 * final query
"
+
ret2
.
rowCount
);
expect
(
1
).
assertEqual
(
ret2
.
rowCount
)
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0002 end *************
"
);
ret2
.
close
()
})
})
}
catch
(
e
)
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0002 fail *****
"
);
expect
().
assertFail
();
done
();
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0002 end *************
"
);
})
/**
* @tc.name RelationalStore insert test
* @tc.number SUB_DDM_AppDataFWK_JSRelationalStore_Multi_0003
...
...
@@ -344,37 +341,41 @@ describe('relationalStoreTransactionTest', function () {
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
,
function
(
err
,
ret
){
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
);
});
await
rdbStore
.
beginTransaction
()
const
valueBucket1
=
{
await
rdbStore
.
beginTransaction
();
const
valueBucket2
=
{
"
name
"
:
"
zhangsan
"
,
"
age
"
:
20
,
"
salary
"
:
220.5
,
"
blobType
"
:
u8
,
}
let
num
=
await
rdbStore
.
insert
(
"
test
"
,
valueBucket1
)
await
rdbStore
.
insert
(
"
test
"
,
valueBucket2
);
await
rdbStore
.
rollBack
()
await
rdbStore
.
rollBack
();
await
rdbStore
.
insert
(
"
test
"
,
valueBucket
)
await
rdbStore
.
commit
()
const
valueBucket3
=
{
"
name
"
:
"
wangwu
"
,
"
age
"
:
18
,
"
salary
"
:
100.5
,
"
blobType
"
:
u8
,
}
await
rdbStore
.
insert
(
"
test
"
,
valueBucket3
);
await
rdbStore
.
commit
();
let
predicates
=
new
data_Rdb
.
RdbPredicates
(
"
test
"
);
num
=
rdbStore
.
query
(
predicates
)
num
.
then
(
async
(
ret
)
=>
{
await
rdbStore
.
query
(
predicates
).
then
(
async
(
ret
)
=>
{
console
.
info
(
TAG
+
"
testRdbTransactionMulti0003 * final query
"
+
ret
.
rowCount
);
expect
(
1
).
assertEqual
(
ret
.
rowCount
)
ret
.
close
()
expect
(
2
).
assertEqual
(
ret
.
rowCount
);
done
();
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0003 end *************
"
);
ret
.
close
();
})
}
catch
(
e
)
{
await
rdbStore
.
rollBack
()
console
.
info
(
TAG
+
"
testRdbTransactionMulti0003 rollback *****
"
);
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionMulti0003 end *************
"
);
})
/**
...
...
@@ -408,7 +409,7 @@ describe('relationalStoreTransactionTest', function () {
let
resultSet
=
await
rdbStore
.
query
(
predicates
)
expect
(
0
).
assertEqual
(
resultSet
.
rowCount
)
resultSet
.
close
()
// resultSet == null;
// resultSet == null;
const
valueBucket2
=
{
"
name
"
:
"
wangwu
"
,
"
age
"
:
16
,
...
...
@@ -425,18 +426,18 @@ describe('relationalStoreTransactionTest', function () {
//删除
{
let
predicates
=
await
new
data_Rdb
.
RdbPredicates
(
"
test
"
)
let
deletePromise
=
rdbStore
.
delete
(
predicates
)
deletePromise
.
then
(
async
(
ret
)
=>
{
expect
(
3
).
assertEqual
(
ret
)
await
rdbStore
.
delete
(
predicates
).
then
(
async
(
ret
)
=>
{
expect
(
3
).
assertEqual
(
ret
);
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionDelete0001 end *************
"
);
console
.
info
(
TAG
+
"
Delete done:
"
+
ret
)
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
()
expect
(
null
).
assertFail
();
done
();
})
await
deletePromise
}
done
()
console
.
info
(
TAG
+
"
************* testRdbTransactionDelete0001 end *************
"
);
})
console
.
info
(
TAG
+
"
*************Unit Test End*************
"
);
})}
})}
distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreUpdateJsunit.test.js
浏览文件 @
4dc6173e
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录