Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c051220a
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看板
提交
c051220a
编写于
3月 05, 2022
作者:
Y
yanglei1217
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<yanglifeng5@huawei.com>
Signed-off-by:
N
yanglei1217
<
yanglifeng5@huawei.com
>
上级
a37ccecb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
120 addition
and
38 deletion
+120
-38
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/List.test.js
...ppdatamgrjstest/hap/src/main/js/default/test/List.test.js
+1
-1
distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
...st/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
+119
-37
未找到文件。
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/List.test.js
浏览文件 @
c051220a
...
...
@@ -27,5 +27,5 @@ require('./DataAbilityPredicatesJsunit.test.js')
require
(
'
./RdbstoreTransactionJsunit.test.js
'
)
require
(
'
./RdbstorePredicatesJoinJsunit.test.js
'
)
require
(
'
./RdbStoreDistributedJsunit.test.js
'
)
require
(
'
./DataShareJsunit.test.js
'
)
distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
浏览文件 @
c051220a
...
...
@@ -76,8 +76,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testOn001
* @tc.desc: object join session and on,object can receive callback when data has been changed
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_On_001
*/
it
(
'
testOn001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOn001 start *************
"
);
...
...
@@ -108,8 +107,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testOn002
* @tc.desc object join session and no on,obejct can not receive callback when data has been changed
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_On_002
*/
it
(
'
testOn002
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOn002 start *************
"
);
...
...
@@ -139,8 +137,7 @@ describe('objectStoreTest', function () {
* @tc.name: testOn003
* @tc.desc: object join session and on,then object change data twice,
* object can receive two callbacks when data has been changed
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_On_003
*/
it
(
'
testOn003
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOn003 start *************
"
);
...
...
@@ -176,8 +173,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testOn004
* @tc.desc object join session and on,then object do not change data,object can not receive callbacks
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_On_004
*/
it
(
'
testOn004
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOn004 start *************
"
);
...
...
@@ -199,8 +195,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name testOff001
* @tc.desc object join session and on&off,object can not receive callback after off
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Off_001
*/
it
(
'
testOff001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOff001 start *************
"
);
...
...
@@ -243,8 +238,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name:testOff002
* @tc.desc object join session and off,object can not receive callback
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Off_002
*/
it
(
'
testOff002
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOff002 start *************
"
);
...
...
@@ -275,8 +269,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testMultiObjectOn001
* @tc.desc: two objects join session and on,then object change data,user can receive two callbacks from two objects
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Multi_001
*/
it
(
'
testMultiObjectOn001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testMultiObjectOn001 start *************
"
);
...
...
@@ -317,11 +310,108 @@ describe('objectStoreTest', function () {
console
.
log
(
TAG
+
"
************* testMultiObjectOn001 end *************
"
);
})
/**
* @tc.name: testMultiObjectOff001
* @tc.desc: two objects join session and on&off,then two objects can not receive callbacks
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Multi_Off_001
*/
it
(
'
testMultiObjectOff001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testMultiObjectOff001 start *************
"
);
var
objectTest
=
distributedObject
.
createDistributedObject
({
name
:
"
Amy
"
,
age
:
18
,
isVis
:
false
});
objectTest
.
setSessionId
(
"
session8
"
);
if
(
objectTest
!=
undefined
&&
objectTest
!=
null
)
{
expect
(
"
session8
"
==
objectTest
.
__sessionId
);
}
else
{
console
.
log
(
TAG
+
"
testMultiObjectOn002 joinSession failed
"
);
}
var
testObject
=
distributedObject
.
createDistributedObject
({
name
:
"
Eric
"
,
age
:
81
,
isVis
:
true
});
testObject
.
setSessionId
(
"
testSession2
"
);
if
(
testObject
!=
undefined
&&
testObject
!=
null
)
{
expect
(
"
testSession2
"
==
testObject
.
__sessionId
);
}
else
{
console
.
log
(
TAG
+
"
testMultiObjectOn002 joinSession failed
"
);
}
console
.
log
(
TAG
+
"
start call watch change
"
)
objectTest
.
on
(
"
change
"
,
changeCallback
);
testObject
.
on
(
"
change
"
,
changeCallback2
);
console
.
info
(
TAG
+
"
watch success
"
);
if
(
objectTest
!=
undefined
&&
objectTest
!=
null
)
{
objectTest
.
name
=
"
jack1
"
;
objectTest
.
age
=
19
;
objectTest
.
isVis
=
true
;
expect
(
objectTest
.
name
==
"
jack1
"
);
expect
(
objectTest
.
age
==
19
);
console
.
info
(
TAG
+
"
set data success!
"
);
}
else
{
console
.
info
(
TAG
+
"
object is null,set name fail
"
);
}
if
(
testObject
!=
undefined
&&
testObject
!=
null
)
{
testObject
.
name
=
"
jack2
"
;
testObject
.
age
=
20
;
testObject
.
isVis
=
false
;
expect
(
testObject
.
name
==
"
jack2
"
);
expect
(
testObject
.
age
==
20
);
console
.
info
(
TAG
+
"
set data success!
"
);
}
else
{
console
.
info
(
TAG
+
"
object is null,set name fail
"
);
}
objectTest
.
off
(
"
change
"
);
if
(
objectTest
!=
undefined
&&
objectTest
!=
null
)
{
objectTest
.
name
=
"
jack3
"
;
objectTest
.
age
=
21
;
objectTest
.
isVis
=
false
;
expect
(
objectTest
.
name
==
"
jack3
"
);
expect
(
objectTest
.
age
==
21
);
console
.
info
(
TAG
+
"
set data success!
"
);
}
else
{
console
.
info
(
TAG
+
"
object is null,set name fail
"
);
}
testObject
.
off
(
"
change
"
);
if
(
testObject
!=
undefined
&&
testObject
!=
null
)
{
testObject
.
name
=
"
jack4
"
;
testObject
.
age
=
22
;
testObject
.
isVis
=
true
;
expect
(
testObject
.
name
==
"
jack4
"
);
expect
(
testObject
.
age
==
22
);
console
.
info
(
TAG
+
"
set data success!
"
);
}
else
{
console
.
info
(
TAG
+
"
object is null,set name fail
"
);
}
done
()
console
.
log
(
TAG
+
"
************* testMultiObjectOff001 end *************
"
);
})
/**
* @tc.name: testChangeSession001
* @tc.desc: objects join session,then change sessionId
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Session_001
*/
it
(
'
testChangeSession001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testChangeSession001 start *************
"
);
var
objectTest
=
distributedObject
.
createDistributedObject
({
name
:
"
Amy
"
,
age
:
18
,
isVis
:
false
});
objectTest
.
setSessionId
(
"
session9
"
);
if
(
objectTest
!=
undefined
&&
objectTest
!=
null
)
{
expect
(
"
session9
"
==
objectTest
.
__sessionId
);
}
else
{
console
.
log
(
TAG
+
"
testChangeSession001 joinSession failed
"
);
}
console
.
log
(
TAG
+
"
start change sessionId
"
);
setTimeout
(()
=>
objectTest
.
setSessionId
(
"
session9
"
),
1000
);
if
(
objectTest
!=
undefined
&&
objectTest
!=
null
)
{
expect
(
"
session9
"
==
objectTest
.
__sessionId
);
}
else
{
console
.
log
(
TAG
+
"
testChangeSession001 joinSession again failed
"
);
}
done
()
console
.
log
(
TAG
+
"
************* testChangeSession001 end *************
"
);
})
/**
* @tc.name: testUndefinedType001
* @tc.desc: object use undefined type,can not join session
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Type_001
*/
it
(
'
testUndefinedType001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testUndefinedType001 start *************
"
);
...
...
@@ -331,7 +421,7 @@ describe('objectStoreTest', function () {
if
(
object1
!=
undefined
&&
object1
!=
null
)
{
expect
(
"
session11
"
==
object1
.
__sessionId
);
}
else
{
console
.
log
(
TAG
+
"
test
ChangeSession
001 joinSession session11 failed
"
);
console
.
log
(
TAG
+
"
test
UndefinedType
001 joinSession session11 failed
"
);
}
}
catch
(
error
)
{
console
.
error
(
TAG
+
error
);
...
...
@@ -344,8 +434,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testGenSessionId001
* @tc.desc: object generate random sessionId
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_GetSessionId_001
*/
it
(
'
testGenSessionId001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGenSessionId001 start *************
"
);
...
...
@@ -359,11 +448,10 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testGenSessionId002
* @tc.desc: object generate 2 random sessionId and not equal
* @tc.type: FUNC
* @tc.require: I4H3LS
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_GetSessionId_002
*/
it
(
'
testGenSessionId002
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testGenSessionId00
1
start *************
"
);
console
.
log
(
TAG
+
"
************* testGenSessionId00
2
start *************
"
);
var
sessionId1
=
distributedObject
.
genSessionId
();
var
sessionId2
=
distributedObject
.
genSessionId
();
expect
(
sessionId1
!=
sessionId2
);
...
...
@@ -375,8 +463,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testOnStatus001
* @tc.desc: object set a listener to watch another object online/offline
* @tc.type: FUNC
* @tc.require: I4H3M8
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_OnStatus_001
*/
it
(
'
testOnStatus001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOnStatus001 start *************
"
);
...
...
@@ -392,11 +479,10 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testOnStatus002
* @tc.desc: object set several listener and can unset specified listener
* @tc.type: FUNC
* @tc.require: I4H3M8
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_OnStatus_002
*/
it
(
'
testOnStatus002
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOnStatus00
1
start *************
"
);
console
.
log
(
TAG
+
"
************* testOnStatus00
2
start *************
"
);
console
.
log
(
TAG
+
"
start watch status
"
);
var
objectTest
=
distributedObject
.
createDistributedObject
({
name
:
"
Amy
"
,
age
:
18
,
isVis
:
false
});
objectTest
.
on
(
"
status
"
,
statusCallback1
);
...
...
@@ -414,11 +500,10 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testOnStatus003
* @tc.desc: object set several listener and can unWatch all watcher
* @tc.type: FUNC
* @tc.require: I4H3M8
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_OnStatus_003
*/
it
(
'
testOnStatus00
2
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOnStatus00
1
start *************
"
);
it
(
'
testOnStatus00
3
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testOnStatus00
3
start *************
"
);
console
.
log
(
TAG
+
"
start watch status
"
);
var
objectTest
=
distributedObject
.
createDistributedObject
({
name
:
"
Amy
"
,
age
:
18
,
isVis
:
false
});
objectTest
.
on
(
"
status
"
,
statusCallback1
);
...
...
@@ -436,8 +521,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testComplex001
* @tc.desc: object can get/set complex data
* @tc.type: FUNC
* @tc.require: I4H3M8
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Complex_001
*/
it
(
'
testComplex001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testComplex001 start *************
"
);
...
...
@@ -470,8 +554,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testMaxSize001
* @tc.desc: object can get/set data under 4MB size
* @tc.type: FUNC
* @tc.require: I4H3M8
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_MaxSize_001
*/
it
(
'
testMaxSize001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testMaxSize001 start *************
"
);
...
...
@@ -501,8 +584,7 @@ describe('objectStoreTest', function () {
/**
* @tc.name: testPerformance001
* @tc.desc: performanceTest for set/get data
* @tc.type: FUNC
* @tc.require: I4H3M8
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Performance_001
*/
it
(
'
testPerformance001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testPerformance001 start *************
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录