Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2245adb5
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2245adb5
编写于
3月 17, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2598 Format Xts code 同步到Release分支
Merge pull request !2598 from kirl75/update_release_0317_33
上级
2870ba4a
4a7dcfea
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
100 addition
and
272 deletion
+100
-272
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/config.json
...lish/actssubscriberorderedtest/entry/src/main/config.json
+0
-49
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/js/test/ActsSubscriber_test_ordered.js
...est/entry/src/main/js/test/ActsSubscriber_test_ordered.js
+53
-54
notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
...est/entry/src/main/js/test/ActsSubscriber_test_unorder.js
+17
-15
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/config.json
...lish/actssubscriberunordertest/entry/src/main/config.json
+3
-28
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
...est/entry/src/main/js/test/ActsSubscriber_test_unorder.js
+27
-126
未找到文件。
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/config.json
浏览文件 @
2245adb5
...
...
@@ -24,55 +24,6 @@
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0800_permission"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0900_subscriberPermissions"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0900_publisherPermission"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event1000_permission"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"permission.COMMONEVENT_STICKY"
}
],
"reqPermissions"
:
[
{
"name"
:
"publish_event0800_permission"
,
"reason"
:
"ceshi"
},
{
"name"
:
"publish_event0900_subscriberPermissions"
,
"reason"
:
"ceshi"
},
{
"name"
:
"publish_event0900_publisherPermission"
,
"reason"
:
"ceshi"
},
{
"name"
:
"publish_event1000_permission"
,
"reason"
:
"ceshi"
},
{
"name"
:
"permission.COMMONEVENT_STICKY"
,
"reason"
:
"ceshi"
}
],
"abilities"
:
[
{
"skills"
:
[
...
...
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/js/test/ActsSubscriber_test_ordered.js
浏览文件 @
2245adb5
...
...
@@ -85,7 +85,7 @@ describe('ActsSubscriberTestOrder', function () {
console
.
info
(
"
===============>subscriberCallBack0100 setCodeAndData promise
"
);
})
commonEventSubscriber0100
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
commonEventSubscriber0100
.
getAbortCommonEvent
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0100 getAbortCommonEvent promise abort:
"
+
data
);
})
...
...
@@ -94,7 +94,7 @@ describe('ActsSubscriberTestOrder', function () {
console
.
info
(
"
===============>subscriberCallBack0100 clearAbortCommonEvent promise
"
);
})
commonEventSubscriber0100
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
commonEventSubscriber0100
.
getAbortCommonEvent
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0100 getAbortCommonEvent promise abort:
"
+
data
);
})
...
...
@@ -113,26 +113,26 @@ describe('ActsSubscriberTestOrder', function () {
expect
(
data
.
event
).
assertEqual
(
"
publish_event0100
"
);
console
.
info
(
"
===============>subscriberCallBack0101=========1 code
"
+
data
.
code
);
expect
(
data
.
code
).
assertEqual
(
2
);
commonEventSubscriber0101
.
getCode
().
then
(
function
(
data
)
{
commonEventSubscriber0101
.
getCode
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0101 getCode promise code:
"
+
data
);
})
expect
(
data
.
data
).
assertEqual
(
"
publish_event1001_change
"
);
commonEventSubscriber0100
.
getData
().
then
(
function
(
data
)
{
commonEventSubscriber0100
.
getData
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0101 getData promise data:
"
+
data
);
})
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0100_bundleName
"
);
commonEventSubscriber0101
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0101 finishCommonEvent promise
"
);
done
();
})
done
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise1
"
);
commonEventSubscriber0100
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0100
,
subscriberCallBack0100
);
});
...
...
@@ -140,16 +140,16 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise2
"
);
commonEventSubscriber0101
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0101
,
subscriberCallBack0101
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
console
.
debug
(
"
===================ActsSubscriberTestOrder_0100 delay 100ms==================
"
);
Subscriber
.
publish
(
"
publish_event0100
"
,
commonEventPublishData
,
publishCallback
);
},
100
);
},
100
);
});
})
})
...
...
@@ -227,16 +227,16 @@ describe('ActsSubscriberTestOrder', function () {
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0201_bundleName
"
);
commonEventSubscriber0201
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0201:finishCommonEvent promise
"
);
done
();
})
done
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
,
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise1
"
);
commonEventSubscriber0200
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0200
,
subscriberCallBack0200
);
});
...
...
@@ -244,24 +244,24 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
,
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise2
"
);
commonEventSubscriber0201
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0201
,
subscriberCallBack0201
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
console
.
debug
(
"
===================ActsSubscriberTestOrder_0200 delay 100ms==================
"
);
Subscriber
.
unsubscribe
(
commonEventSubscriber0200
,
unsubscribeCallback
);
},
100
);
setTimeout
(
function
()
{
},
100
);
setTimeout
(
function
()
{
console
.
debug
(
"
===================ActsSubscriberTestOrder_0200 delay 100ms==================
"
);
Subscriber
.
publish
(
"
publish_event0200
"
,
commonEventPublishData1
,
publishCallback
);
},
100
);
setTimeout
(
function
()
{
},
100
);
setTimeout
(
function
()
{
console
.
debug
(
"
===================ActsSubscriberTestOrder_0200 delay 100ms==================
"
);
Subscriber
.
publish
(
"
publish_event0201
"
,
commonEventPublishData2
,
publishCallback
);
},
100
);
},
100
);
});
})
})
...
...
@@ -310,7 +310,7 @@ describe('ActsSubscriberTestOrder', function () {
order
=
false
;
}
commonEventSubscriber0300
.
isOrderedCommonEvent
().
then
(
function
(
data
)
{
commonEventSubscriber0300
.
isOrderedCommonEvent
().
then
(
(
data
)
=>
{
console
.
info
(
"
========>subscriberCallBack0300 isOrderedCommonEvent promise
"
+
data
);
expect
(
data
).
assertEqual
(
true
);
})
...
...
@@ -340,7 +340,7 @@ describe('ActsSubscriberTestOrder', function () {
order
=
true
;
}
commonEventSubscriber0301
.
isOrderedCommonEvent
().
then
(
function
(
data
)
{
commonEventSubscriber0301
.
isOrderedCommonEvent
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0301 isOrderedCommonEvent promise
"
+
data
);
expect
(
data
).
assertEqual
(
true
);
})
...
...
@@ -351,10 +351,10 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
,
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise1
"
);
commonEventSubscriber0300
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0300
,
subscriberCallBack0300
);
});
...
...
@@ -362,18 +362,18 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
,
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise2
"
);
commonEventSubscriber0301
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0301
,
subscriberCallBack0301
);
var
numindex
=
0
;
for
(;
numindex
<
3
;
++
numindex
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
console
.
debug
(
"
===================ActsSubscriberTestOrder_0300 delay 100ms==================
"
);
Subscriber
.
publish
(
"
publish_event0301
"
,
commonEventPublishData2
,
publishCallback
);
},
100
);
},
100
);
}
});
})
...
...
@@ -383,18 +383,18 @@ describe('ActsSubscriberTestOrder', function () {
* @tc.number : ActsSubscriberTestOrder_0400
* @tc.name : verify subscribe and publish : Check subscribe same events
* and publish common ordered events and check abort event
* @tc.desc : Check the subscriber can receive event "publish_event
0400" type of the interface (by promise)
* @tc.desc : Check the subscriber can receive event "publish_event
Order0400" type of the interface by promise
*/
it
(
'
ActsSubscriberTestOrder_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0400===============>
"
);
var
commonEventSubscribeInfo1
=
{
events
:
[
"
publish_event0400
"
],
events
:
[
"
publish_event
Order
0400
"
],
priority
:
10
};
var
commonEventSubscribeInfo2
=
{
events
:
[
"
publish_event0400
"
],
events
:
[
"
publish_event
Order
0400
"
],
priority
:
9
};
...
...
@@ -410,24 +410,24 @@ describe('ActsSubscriberTestOrder', function () {
console
.
info
(
"
===============>subscriberCallBack0400========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0400=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0400=========data:
"
+
data
.
data
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event
Order
0400
"
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0400_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0400_bundleName
"
);
commonEventSubscriber0400
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
commonEventSubscriber0400
.
getAbortCommonEvent
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0400 getAbortCommonEvent promise abort2:
"
+
data
);
});
commonEventSubscriber0400
.
abortCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0400 abortCommonEvent promise
"
);
});
commonEventSubscriber0400
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
commonEventSubscriber0400
.
getAbortCommonEvent
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0400 getAbortCommonEvent promise abort2:
"
+
data
);
});
commonEventSubscriber0400
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0400 finishCommonEvent promise
"
);
done
();
});
done
();
}
async
function
subscriberCallBack0401
(
err
,
data
)
{
...
...
@@ -437,29 +437,29 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0400==========createSubscriber promise1
"
);
commonEventSubscriber0400
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise1
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event
Order
0400
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0400
,
subscriberCallBack0400
);
})
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0400==========createSubscriber promise2
"
);
commonEventSubscriber0401
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0400=========getSubscribeInfo promise2
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event
Order
0400
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0401
,
subscriberCallBack0401
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
console
.
debug
(
"
===================ActsSubscriberTestOrder_0400 delay 100mss==================
"
);
Subscriber
.
publish
(
"
publish_event0400
"
,
commonEventPublishData
,
publishCallback
);
},
100
);
Subscriber
.
publish
(
"
publish_event
Order
0400
"
,
commonEventPublishData
,
publishCallback
);
},
100
);
})
})
})
...
...
@@ -467,7 +467,6 @@ describe('ActsSubscriberTestOrder', function () {
/*
* @tc.number : ActsSubscriberTestOrder_0500
* @tc.name : verify subscribe and publish : Check subscriber same events
* and publish common ordered events and check subscriberInfo priority
* @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by promise)
*/
it
(
'
ActsSubscriberTestOrder_0500
'
,
0
,
async
function
(
done
)
{
...
...
@@ -515,16 +514,16 @@ describe('ActsSubscriberTestOrder', function () {
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0500_bundleName
"
);
commonEventSubscriber0501
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0501 finishCommonEvent promise
"
);
done
();
});
done
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0500==========createSubscriber promise1
"
);
commonEventSubscriber0500
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise1
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0500
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0500
,
subscriberCallBack0500
);
...
...
@@ -533,17 +532,17 @@ describe('ActsSubscriberTestOrder', function () {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0500==========createSubscriber promise2
"
);
commonEventSubscriber0501
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0500==========getSubscribeInfo promise2
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0500
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0501
,
subscriberCallBack0501
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
console
.
debug
(
"
===================ActsSubscriberTestOrder_0500 delay 100ms==================
"
);
Subscriber
.
publish
(
"
publish_event0500
"
,
commonEventPublishData
,
publishCallback
);
},
100
);
},
100
);
})
})
})
...
...
notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
浏览文件 @
2245adb5
...
...
@@ -107,6 +107,8 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber
.
Support
.
COMMON_EVENT_AIRPLANE_MODE_CHANGED
,
Subscriber
.
Support
.
COMMON_EVENT_SMS_RECEIVE_COMPLETED
,
Subscriber
.
Support
.
COMMON_EVENT_SPN_INFO_UPDATED
,
Subscriber
.
Support
.
COMMON_EVENT_BOOT_COMPLETED
,
Subscriber
.
Support
.
COMMON_EVENT_SPLIT_SCREEN
];
function
publishCallback
(
err
)
{
...
...
@@ -204,15 +206,15 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============>ActsSubscriberTestUnorderSystem_0100=========createSubscriber promise
"
);
commonEventSubscriber1
=
data
;
Subscriber
.
subscribe
(
commonEventSubscriber1
,
subscriberCallBack001
);
for
(
var
i
=
0
;
i
<
50
;
++
i
)
{
console
.
debug
(
"
===============>ActsSubscriberTestUnorderSystem_0100 delay 1s==================
"
);
console
.
info
(
"
Subscriber.publish is run at:
"
+
commonEventSubscribeInfo
.
events
[
i
]
);
console
.
info
(
"
Subscriber type:
"
+
typeof
(
commonEventSubscribeInfo
.
events
[
i
])
);
Subscriber
.
publish
(
commonEventSubscribeInfo
.
events
[
i
],
publishCallback
);
for
(
let
i
=
0
;
i
<
50
;
++
i
)
{
setTimeout
(
function
(){
console
.
debug
(
"
===============>ActsSubscriberTestUnorderSystem_0100 delay 1s=========i:
"
+
i
);
Subscriber
.
publish
(
commonEventSubscribeInfo
.
events
[
i
],
publishCallback
);
},
1000
);
}
})
})
...
...
@@ -281,22 +283,22 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============>ActsSubscriberTestUnorderSystem_0200=========createSubscriber promise
"
);
commonEventSubscriber2
=
data
;
Subscriber
.
subscribe
(
commonEventSubscriber2
,
subscriberCallBack002
);
for
(
var
i
=
0
;
i
<
36
;
++
i
)
{
console
.
debug
(
"
===============>ActsSubscriberTestUnorderSystem_0200 delay 1s==================
"
);
console
.
info
(
"
Subscriber.publish is run at:
"
+
commonEventSubscribeInfo
.
events
[
i
]
);
console
.
info
(
"
Subscriber type:
"
+
typeof
(
commonEventSubscribeInfo
.
events
[
i
])
);
Subscriber
.
publish
(
commonEventSubscribeInfo
.
events
[
i
],
publishCallback
);
for
(
let
i
=
0
;
i
<
36
;
++
i
)
{
setTimeout
(
function
(){
console
.
debug
(
"
===============>ActsSubscriberTestUnorderSystem_0200 delay 1s===========i:
"
+
i
);
Subscriber
.
publish
(
commonEventSubscribeInfo
.
events
[
i
],
publishCallback
);
},
1000
);
}
})
})
/*
* @tc.number : ActsSubscriberTestUnorderSystem_0300
* @tc.name : verify subscribe and publish : Check subscribe and publish system event data with
permission
* @tc.name : verify subscribe and publish : Check subscribe and publish system event data with
out permission
* : including multiple permissions
* @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise)
*/
...
...
@@ -375,14 +377,14 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============>ActsSubscriberTestUnorderSystem_0300=========createSubscriber promise
"
);
commonEventSubscriber3
=
data
;
Subscriber
.
subscribe
(
commonEventSubscriber3
,
subscriberCallBack003
);
setTimeout
(
function
(){
console
.
debug
(
"
===============>ActsSubscriberTestUnorderSystem_0300 delay 3s==================
"
);
Subscriber
.
unsubscribe
(
commonEventSubscriber3
,
unsubscribeCallback
);
},
3000
);
},
3000
);
})
})
})
...
...
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/config.json
浏览文件 @
2245adb5
...
...
@@ -24,41 +24,16 @@
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0700_permission"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0800_publisherPermission"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0900_permission"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"ohos.permission.COMMONEVENT_STICKY"
}
],
"reqPermissions"
:
[
{
"name"
:
"
publish_event0700_permission
"
,
"reason"
:
"
ceshi
"
"name"
:
"
ohos.permission.USE_BLUETOOTH
"
,
"reason"
:
"
use ohos.permission.USE_BLUETOOTH
"
},
{
"name"
:
"publish_event0800_publisherPermission"
,
"reason"
:
"ceshi"
},
{
"name"
:
"publish_event0900_permission"
,
"reason"
:
"ceshi"
},
{
"name"
:
"ohos.permission.COMMONEVENT_STICKY"
,
"reason"
:
"ceshi"
...
...
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
浏览文件 @
2245adb5
...
...
@@ -24,9 +24,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
var
commonEventSubscriber0051
;
var
commonEventSubscriber0052
;
var
commonEventSubscriber006
;
var
commonEventSubscriber007
;
var
commonEventSubscriber008
;
var
commonEventSubscriber009
;
var
commonEventSubscriber0101
;
var
commonEventSubscriber0102
;
var
commonEventSubscriber011
;
...
...
@@ -70,10 +68,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=========createSubscriber promise
"
);
commonEventSubscriber001
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber001
,
subscriberCallBack001
);
setTimeout
(
function
(){
...
...
@@ -108,10 +106,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200=========createSubscriber promise
"
);
commonEventSubscriber002
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber002
,
subscriberCallBack002
);
setTimeout
(
function
(){
...
...
@@ -160,10 +158,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300=========createSubscriber promise
"
);
commonEventSubscriber003
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber003
,
subscriberCallBack003
);
setTimeout
(
function
(){
...
...
@@ -182,7 +180,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
it
(
'
ActsSubscriberTestUnorder_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400==========================>
"
);
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0400
"
]
events
:
[
"
publish_event
Sticky
0400
"
]
};
var
commonEventPublishData
=
{
...
...
@@ -198,7 +196,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
function
subscriberCallBack004
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0400
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event
Sticky
0400
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
...
...
@@ -207,15 +205,15 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400=========createSubscriber promise
"
);
commonEventSubscriber004
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber004
,
subscriberCallBack004
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0400 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0400
"
,
commonEventPublishData
,
publishCallback
);
Subscriber
.
publish
(
"
publish_event
Sticky
0400
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
})
...
...
@@ -249,10 +247,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_1=========createSubscriber promise
"
);
commonEventSubscriber0051
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_1=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0051
,
subscriberCallBack005
);
});
...
...
@@ -260,10 +258,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_2=========createSubscriber promise
"
);
commonEventSubscriber0052
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_2=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0052
,
subscriberCallBack005
);
Subscriber
.
unsubscribe
(
commonEventSubscriber0051
,
unsubscriberCallBack
);
...
...
@@ -309,11 +307,11 @@ describe('ActsSubscriberTestUnorder', async function (done) {
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600 11111111111111==========================>
"
);
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600=========createSubscriber promise
"
);
commonEventSubscriber006
=
data
;
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600 22222222222222==========================>
"
);
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0700=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber006
,
subscriberCallBack006
);
setTimeout
(
function
(){
...
...
@@ -325,49 +323,6 @@ describe('ActsSubscriberTestUnorder', async function (done) {
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0700
* @tc.name : verify subscribe and publish : Check subscribe and publish common event with permission
* @tc.desc : Check the subscriber can receive event "publish_event0700" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0700==========================>
"
);
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0700
"
],
publisherPermission
:
"
publish_event0700_permission
"
};
var
commonEventPublishData
=
{
subscriberPermissions
:[
"
publish_event0700_permission
"
],
isOrdered
:
false
,
isSticky
:
false
,
}
function
subscriberCallBack007
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0700
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0700
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
done
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
console
.
info
(
"
=================ActsSubscriberTestUnorder_0700=========createSubscriberPromise0700
"
);
commonEventSubscriber007
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0700=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber007
,
subscriberCallBack007
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0700 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0700
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
});
})
/*
* @tc.number : ActsSubscriberTestUnorder_0800
* @tc.name : verify subscribe and publish : Check subscribe and publish common event
...
...
@@ -395,8 +350,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
continue
;
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
}
done
();
}
...
...
@@ -413,10 +367,10 @@ describe('ActsSubscriberTestUnorder', async function (done) {
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
).
then
(
(
data
)
=>
{
console
.
info
(
"
==========================>createSubscriberPromise0800=======================>
"
);
commonEventSubscriber008
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0800=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber008
,
subscriberCallBack008
);
setTimeout
(
function
(){
...
...
@@ -429,55 +383,6 @@ describe('ActsSubscriberTestUnorder', async function (done) {
sleep
(
1000
);
})
/*
* @tc.number : ActsSubscriberTestUnorder_0900
* @tc.name : verify subscribe and publish : Check subscribe and publish sticky event
* with publishpermission and check IsStickyCommonEvent
* @tc.desc : Check the subscriber can receive event "publish_event0900" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0900==========================>
"
);
var
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0900
"
]
};
var
commonEventPublishData
=
{
subscriberPermissions
:[
"
publish_event0900_permission
"
],
isOrdered
:
false
,
isSticky
:
true
}
function
isStickyCommonEventCallback009
(
err
,
data
)
{
console
.
info
(
"
==========================>isStickyCommonEventCallback009
"
);
expect
(
data
).
assertEqual
(
true
);
done
();
}
function
subscriberCallBack009
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0900
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0900
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
commonEventSubscriber009
.
isStickyCommonEvent
(
isStickyCommonEventCallback009
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
(
function
(
data
)
{
console
.
info
(
"
==========================>createSubscriberPromise0900=======================>
"
);
commonEventSubscriber009
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0900=========getSubscribeInfo promise=
"
);
Subscriber
.
subscribe
(
commonEventSubscriber009
,
subscriberCallBack009
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0900 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0900
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
});
})
/*
* @tc.number : ActsSubscriberTestUnorder_1000
* @tc.name : verify subscribe and publish : Check different subscribes and publish different common event
...
...
@@ -524,7 +429,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
expect
(
data
.
data
).
assertEqual
(
"
publish_event1000_data
"
);
if
(
num
==
0
)
{
num
++
;
}
else
if
(
num
==
1
)
{
}
else
if
(
num
==
1
)
{
done
();
}
}
...
...
@@ -539,28 +444,24 @@ describe('ActsSubscriberTestUnorder', async function (done) {
expect
(
data
.
data
).
assertEqual
(
"
publish_event1000_data
"
);
if
(
num
==
0
)
{
num
++
;
}
else
if
(
num
==
1
)
{
}
else
if
(
num
==
1
)
{
done
();
}
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
).
then
(
function
(
data
)
{
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo1
).
then
((
data
)
=>
{
console
.
info
(
"
=================ActsSubscriberTestUnorder_1000=========>createSubscriber Promise1000_1
"
);
commonEventSubscriber0101
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1000=========getSubscribeInfo promise1000_1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0101
,
subscriberCallBack0101
);
});
});
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
).
then
(
function
(
data
)
{
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo2
).
then
((
data
)
=>
{
console
.
info
(
"
=================ActsSubscriberTestUnorder_1000=========>createSubscriber Promise1000_2
"
);
commonEventSubscriber0102
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
data
.
getSubscribeInfo
().
then
(
()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1000=========getSubscribeInfo promise1000_2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0102
,
subscriberCallBack0102
);
setTimeout
(
function
(){
...
...
@@ -616,7 +517,7 @@ describe('ActsSubscriberTestUnorder', async function (done) {
* @tc.name : verify subscribe and publish : Check one subscribes and publish one common event with parameters
* @tc.desc : Check the subscriber can receive event "publish_event1200" type of the callback interface
*/
it
(
'
ActsSubscriberTestUnorder_1200
'
,
0
,
async
function
(
done
)
{
it
(
'
ActsSubscriberTestUnorder_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_1200==========================>
"
);
function
subscriberCallBack012
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack012
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录