Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8ee30b83
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看板
提交
8ee30b83
编写于
11月 11, 2021
作者:
Z
zhaoyuan17
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix codex
Signed-off-by:
N
zhaoyuan17
<
zhaoyuan17@huawei.com
>
上级
ecc3df88
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
129 addition
and
133 deletion
+129
-133
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/js/test/ActsSubscriber_test_ordered.js
...est/entry/src/main/js/test/ActsSubscriber_test_ordered.js
+129
-133
未找到文件。
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/js/test/ActsSubscriber_test_ordered.js
浏览文件 @
8ee30b83
...
...
@@ -21,14 +21,14 @@ describe('ActsSubscriberTestOrder', function () {
var
order
=
false
;
var
commonEventSubscriber0100
;
var
commonEventSubscriber0101
;
var
commonEventSubscriber0200
_1
;
var
commonEventSubscriber020
0_2
;
var
commonEventSubscriber0300
_1
;
var
commonEventSubscriber030
0_2
;
var
commonEventSubscriber0400
_1
;
var
commonEventSubscriber040
0_2
;
var
commonEventSubscriber0500
_1
;
var
commonEventSubscriber050
0_2
;
var
commonEventSubscriber0200
;
var
commonEventSubscriber020
1
;
var
commonEventSubscriber0300
;
var
commonEventSubscriber030
1
;
var
commonEventSubscriber0400
;
var
commonEventSubscriber040
1
;
var
commonEventSubscriber0500
;
var
commonEventSubscriber050
1
;
function
publishCallback
(
err
)
{
console
.
info
(
"
===============>publishCallback
"
);
...
...
@@ -46,12 +46,12 @@ describe('ActsSubscriberTestOrder', function () {
it
(
'
ActsSubscriberTestOrder_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100===============>
"
);
var
commonEventSubscribeInfo
_
1
=
{
var
commonEventSubscribeInfo1
=
{
events
:
[
"
publish_event0100
"
],
priority
:
10
};
var
commonEventSubscribeInfo
_
2
=
{
var
commonEventSubscribeInfo2
=
{
events
:
[
"
publish_event0100
"
],
priority
:
9
};
...
...
@@ -61,7 +61,6 @@ describe('ActsSubscriberTestOrder', function () {
code
:
1
,
data
:
"
publish_event1001_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
async
function
subscriberCallBack0100
(
err
,
data
)
{
...
...
@@ -75,29 +74,29 @@ describe('ActsSubscriberTestOrder', function () {
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0100_bundleName
"
);
commonEventSubscriber0100
.
setCode
(
2
).
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0100 setCode
CallBack
promise
"
);
console
.
info
(
"
===============>subscriberCallBack0100 setCode promise
"
);
})
commonEventSubscriber0100
.
setData
(
"
publish_event1001_change
"
).
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0100 setData
CallBack
promise
"
);
console
.
info
(
"
===============>subscriberCallBack0100 setData promise
"
);
})
commonEventSubscriber0100
.
setCodeAndData
(
2
,
"
publish_event1001_change
"
).
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0100 setCodeAndData
Callback
promise
"
);
console
.
info
(
"
===============>subscriberCallBack0100 setCodeAndData promise
"
);
})
commonEventSubscriber0100
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
===============>subscriberCallBack0100 getAbortCommonEvent
Callback1
promise abort:
"
+
data
);
"
===============>subscriberCallBack0100 getAbortCommonEvent promise abort:
"
+
data
);
})
commonEventSubscriber0100
.
clearAbortCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0100 clearAbortCommonEvent
Callback
promise
"
);
console
.
info
(
"
===============>subscriberCallBack0100 clearAbortCommonEvent promise
"
);
})
commonEventSubscriber0100
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
===============>subscriberCallBack0100 getAbortCommonEvent
Callback2
promise abort:
"
+
data
);
"
===============>subscriberCallBack0100 getAbortCommonEvent promise abort:
"
+
data
);
})
commonEventSubscriber0100
.
finishCommonEvent
().
then
(()
=>
{
...
...
@@ -115,11 +114,11 @@ describe('ActsSubscriberTestOrder', function () {
console
.
info
(
"
===============>subscriberCallBack0101=========1 code
"
+
data
.
code
);
expect
(
data
.
code
).
assertEqual
(
2
);
commonEventSubscriber0101
.
getCode
().
then
(
function
(
data
)
{
console
.
info
(
"
===============>subscriberCallBack0101 getCode
CallBack
promise code:
"
+
data
);
console
.
info
(
"
===============>subscriberCallBack0101 getCode promise code:
"
+
data
);
})
expect
(
data
.
data
).
assertEqual
(
"
publish_event1001_change
"
);
commonEventSubscriber0100
.
getData
().
then
(
function
(
data
)
{
console
.
info
(
"
===============>subscriberCallBack010
0 getDataCallBack
promise data:
"
+
data
);
console
.
info
(
"
===============>subscriberCallBack010
1 getData
promise data:
"
+
data
);
})
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0100_bundleName
"
);
commonEventSubscriber0101
.
finishCommonEvent
().
then
(()
=>
{
...
...
@@ -129,7 +128,7 @@ describe('ActsSubscriberTestOrder', function () {
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
1
commonEventSubscribeInfo1
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise1
"
);
commonEventSubscriber0100
=
data
;
...
...
@@ -140,7 +139,7 @@ describe('ActsSubscriberTestOrder', function () {
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
2
commonEventSubscribeInfo2
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise2
"
);
commonEventSubscriber0101
=
data
;
...
...
@@ -164,13 +163,13 @@ describe('ActsSubscriberTestOrder', function () {
it
(
'
ActsSubscriberTestOrder_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200===============>
"
);
var
commonEventSubscribeInfo
_
1
=
{
var
commonEventSubscribeInfo1
=
{
events
:
[
"
publish_event0200
"
,
"
publish_event0201
"
],
priority
:
10
};
var
commonEventSubscribeInfo
_
2
=
{
var
commonEventSubscribeInfo2
=
{
events
:
[
"
publish_event0201
"
],
priority
:
9
};
...
...
@@ -180,7 +179,6 @@ describe('ActsSubscriberTestOrder', function () {
code
:
1
,
data
:
"
publish_event0200_init
"
,
isOrdered
:
false
,
isSticky
:
false
,
}
var
commonEventPublishData2
=
{
...
...
@@ -188,72 +186,71 @@ describe('ActsSubscriberTestOrder', function () {
code
:
1
,
data
:
"
publish_event0201_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
async
function
subscriberCallBack0200
_1
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack0200
_1
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack0200
_1
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0200
_1
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0200
_1
=========data:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0200
_1
=========num2:
"
+
num2
);
async
function
subscriberCallBack0200
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack0200========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack0200========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0200=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0200=========data:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0200=========num2:
"
+
num2
);
if
(
num2
==
0
)
{
num2
++
;
expect
(
data
.
event
).
assertEqual
(
"
publish_event0200
"
);
console
.
info
(
"
===============>subscriberCallBack0200
_1
=====num2:0====code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0200=====num2:0====code:
"
+
data
.
code
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0200_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0200_bundleName
"
);
}
else
{
num2
=
0
;
expect
(
data
.
event
).
assertEqual
(
"
publish_event0201
"
);
console
.
info
(
"
===============>subscriberCallBack0200
_1
=====num2:1====code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0200=====num2:1====code:
"
+
data
.
code
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0201_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0201_bundleName
"
);
commonEventSubscriber0200
_1
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0200
_1:num:1:finishCommonEventCallBack
"
);
commonEventSubscriber0200
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0200
:num:1:finishCommonEvent promise
"
);
})
}
}
async
function
subscriberCallBack020
0_2
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack020
0_2
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack020
0_2
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack020
0_2
=========code=:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack020
0_2
=========data:
"
+
data
.
data
);
async
function
subscriberCallBack020
1
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack020
1
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack020
1
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack020
1
=========code=:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack020
1
=========data:
"
+
data
.
data
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0201
"
);
console
.
info
(
"
===============>subscriberCallBack020
0_2
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack020
1
=========code:
"
+
data
.
code
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0201_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0201_bundleName
"
);
commonEventSubscriber020
0_2
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack020
0_2:finishCommonEventCallBack
"
);
commonEventSubscriber020
1
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack020
1:finishCommonEvent promise
"
);
})
done
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
1
,
commonEventSubscribeInfo1
,
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise1
"
);
commonEventSubscriber0200
_1
=
data
;
commonEventSubscriber0200
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0200
_1
,
subscriberCallBack0200_1
);
Subscriber
.
subscribe
(
commonEventSubscriber0200
,
subscriberCallBack0200
);
});
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
2
,
commonEventSubscribeInfo2
,
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise2
"
);
commonEventSubscriber020
0_2
=
data
;
commonEventSubscriber020
1
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber020
0_2
,
subscriberCallBack0200_2
);
Subscriber
.
unsubscribe
(
commonEventSubscriber0200
_1
,
unsubscribeCallback
);
Subscriber
.
subscribe
(
commonEventSubscriber020
1
,
subscriberCallBack0201
);
Subscriber
.
unsubscribe
(
commonEventSubscriber0200
,
unsubscribeCallback
);
Subscriber
.
publish
(
"
publish_event0200
"
,
commonEventPublishData1
,
publishCallback
);
Subscriber
.
publish
(
"
publish_event0201
"
,
commonEventPublishData2
,
publishCallback
);
...
...
@@ -273,12 +270,12 @@ describe('ActsSubscriberTestOrder', function () {
it
(
'
ActsSubscriberTestOrder_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300===============>
"
);
var
commonEventSubscribeInfo
_
1
=
{
var
commonEventSubscribeInfo1
=
{
events
:
[
"
publish_event0301
"
],
priority
:
9
};
var
commonEventSubscribeInfo
_
2
=
{
var
commonEventSubscribeInfo2
=
{
events
:
[
"
publish_event0301
"
],
priority
:
10
};
...
...
@@ -288,15 +285,14 @@ describe('ActsSubscriberTestOrder', function () {
code
:
1
,
data
:
"
publish_event0301_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
async
function
subscriberCallBack0300
_1
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack0300
_1
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack0300
_1
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0300
_1
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0300
_1
=========dat:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0300
_1
=========order:
"
+
order
);
async
function
subscriberCallBack0300
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack0300========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack0300========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0300=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0300=========dat:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0300=========order:
"
+
order
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0301
"
);
expect
(
data
.
code
).
assertEqual
(
1
);
...
...
@@ -308,23 +304,22 @@ describe('ActsSubscriberTestOrder', function () {
order
=
false
;
}
commonEventSubscriber0300_1
.
isOrderedCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
========>subscriberCallBack0300_1 publish_event0301 isOrderedCommonEvent promise
"
+
data
);
commonEventSubscriber0300
.
isOrderedCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
========>subscriberCallBack0300 isOrderedCommonEvent promise
"
+
data
);
expect
(
data
).
assertEqual
(
true
);
})
commonEventSubscriber0300
_1
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0300
_1 publish_event0301 finishCommonEventCallBack
"
);
commonEventSubscriber0300
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0300
finishCommonEvent promise
"
);
})
done
();
}
async
function
subscriberCallBack030
0_2
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack030
0_2
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack030
0_2
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack030
0_2
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack030
0_2
=========data:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack030
0_2
=========order:
"
+
order
);
async
function
subscriberCallBack030
1
(
err
,
data
)
{
console
.
info
(
"
===============>subscriberCallBack030
1
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>subscriberCallBack030
1
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack030
1
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack030
1
=========data:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack030
1
=========order:
"
+
order
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0301
"
);
expect
(
data
.
code
).
assertEqual
(
1
);
...
...
@@ -335,34 +330,34 @@ describe('ActsSubscriberTestOrder', function () {
order
=
true
;
}
commonEventSubscriber030
0_2
.
isOrderedCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
===============>subscriberCallBack030
0_2 isOrderedCommonEvent promise
"
+
data
);
commonEventSubscriber030
1
.
isOrderedCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
===============>subscriberCallBack030
1 isOrderedCommonEvent promise
"
+
data
);
expect
(
data
).
assertEqual
(
true
);
})
commonEventSubscriber030
0_2
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack030
0_2 publish_event0301 finishCommonEventCallBack
"
);
commonEventSubscriber030
1
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack030
1 finishCommonEvent promise
"
);
})
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
1
,
commonEventSubscribeInfo1
,
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise1
"
);
commonEventSubscriber0300
_1
=
data
;
commonEventSubscriber0300
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0300
_1
,
subscriberCallBack0300_1
);
Subscriber
.
subscribe
(
commonEventSubscriber0300
,
subscriberCallBack0300
);
});
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
2
,
commonEventSubscribeInfo2
,
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise2
"
);
commonEventSubscriber030
0_2
=
data
;
commonEventSubscriber030
1
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber030
0_2
,
subscriberCallBack0300_2
);
Subscriber
.
subscribe
(
commonEventSubscriber030
1
,
subscriberCallBack0301
);
var
numindex
=
0
;
for
(;
numindex
<
3
;
++
numindex
)
{
Subscriber
.
publish
(
"
publish_event0301
"
,
commonEventPublishData2
,
publishCallback
);
...
...
@@ -384,12 +379,12 @@ describe('ActsSubscriberTestOrder', function () {
it
(
'
ActsSubscriberTestOrder_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0400===============>
"
);
var
commonEventSubscribeInfo
_
1
=
{
var
commonEventSubscribeInfo1
=
{
events
:
[
"
publish_event0400
"
],
priority
:
10
};
var
commonEventSubscribeInfo
_
2
=
{
var
commonEventSubscribeInfo2
=
{
events
:
[
"
publish_event0400
"
],
priority
:
9
};
...
...
@@ -399,60 +394,59 @@ describe('ActsSubscriberTestOrder', function () {
code
:
1
,
data
:
"
publish_event0400_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
async
function
subscriberCallBack0400
_1
(
err
,
data
)
{
console
.
info
(
"
===============>
SubscriberPromise0400_1
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>
SubscriberPromise0400_1
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>
SubscriberPromise0400_1
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>
SubscriberPromise0400_1
=========data:
"
+
data
.
data
);
async
function
subscriberCallBack0400
(
err
,
data
)
{
console
.
info
(
"
===============>
subscriberCallBack0400
========event:
"
+
data
.
event
);
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
.
code
).
assertEqual
(
1
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0400_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0400_bundleName
"
);
commonEventSubscriber0400
_1
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
====
>SubscriberPromise0400_1======>getAbortCommonEventPromise0400_1:1
abort2:
"
+
data
);
commonEventSubscriber0400
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
====
===========>subscriberCallBack0400 getAbortCommonEvent promise
abort2:
"
+
data
);
});
commonEventSubscriber0400
_1
.
abortCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>
SubscriberPromise0400_1=========>AbortCommonEventPromise0400_1
"
);
commonEventSubscriber0400
.
abortCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>
subscriberCallBack0400 abortCommonEvent promise
"
);
});
commonEventSubscriber0400
_1
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
commonEventSubscriber0400
.
getAbortCommonEvent
().
then
(
function
(
data
)
{
console
.
info
(
"
===
>SubscriberPromise0400_1===========>getAbortCommonEventPromise0400_1:2
abort2:
"
+
data
);
"
===
============>subscriberCallBack0400 getAbortCommonEvent promise
abort2:
"
+
data
);
});
commonEventSubscriber0400
_1
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>
SubscriberPromise0400_1==========>finishCommonEventPromise0400_1
"
);
commonEventSubscriber0400
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>
subscriberCallBack0400 finishCommonEvent promise
"
);
});
done
();
}
async
function
subscriberCallBack040
0_2
(
err
,
data
)
{
console
.
info
(
"
===============>
SubscriberPromise0400_2
========event:
"
+
data
.
event
);
async
function
subscriberCallBack040
1
(
err
,
data
)
{
console
.
info
(
"
===============>
subscriberCallBack0401
========event:
"
+
data
.
event
);
expect
().
assertFail
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
1
commonEventSubscribeInfo1
).
then
(
function
(
data
)
{
console
.
info
(
"
===============
createSubscriberPromise0400_1:
1
"
);
commonEventSubscriber0400
_1
=
data
;
console
.
info
(
"
===============
ActsSubscriberTestOrder_0400==========createSubscriber promise
1
"
);
commonEventSubscriber0400
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
=============
GetSubscribeInfoPromisek0400_1 data.events[0]:
"
+
data
.
events
[
0
]
);
console
.
info
(
"
=============
==ActsSubscriberTestOrder_0400=========getSubscribeInfo promise1
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0400
_1
,
subscriberCallBack0400_1
);
Subscriber
.
subscribe
(
commonEventSubscriber0400
,
subscriberCallBack0400
);
})
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
2
commonEventSubscribeInfo2
).
then
(
function
(
data
)
{
console
.
info
(
"
===============
===createSubscriberPromise0400_1:
2
"
);
commonEventSubscriber040
0_2
=
data
;
console
.
info
(
"
===============
ActsSubscriberTestOrder_0400==========createSubscriber promise
2
"
);
commonEventSubscriber040
1
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
==============
GetSubscribeInfoPromisek0400_1 data.events[0] :
"
+
data
.
events
[
0
]
);
console
.
info
(
"
==============
=ActsSubscriberTestOrder_0400=========getSubscribeInfo promise2
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
Subscriber
.
subscribe
(
commonEventSubscriber040
0_2
,
subscriberCallBack0400_2
);
Subscriber
.
subscribe
(
commonEventSubscriber040
1
,
subscriberCallBack0401
);
Subscriber
.
publish
(
"
publish_event0400
"
,
commonEventPublishData
,
publishCallback
);
})
})
...
...
@@ -471,12 +465,12 @@ describe('ActsSubscriberTestOrder', function () {
it
(
'
ActsSubscriberTestOrder_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0500===============>
"
);
var
commonEventSubscribeInfo
_
1
=
{
var
commonEventSubscribeInfo1
=
{
events
:
[
"
publish_event0500
"
],
priority
:
1001
};
var
commonEventSubscribeInfo
_
2
=
{
var
commonEventSubscribeInfo2
=
{
events
:
[
"
publish_event0500
"
],
priority
:
-
101
};
...
...
@@ -486,56 +480,58 @@ describe('ActsSubscriberTestOrder', function () {
code
:
10
,
data
:
"
publish_event0500_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
async
function
subscriberCallBack0500
_1
(
err
,
data
)
{
console
.
info
(
"
===============>
SubscriberPromise0500_1
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>
SubscriberPromise0500_1
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>
SubscriberPromise0500_1
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>
SubscriberPromise0500_1
=========data:
"
+
data
.
data
);
async
function
subscriberCallBack0500
(
err
,
data
)
{
console
.
info
(
"
===============>
subscriberCallBack0500
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>
subscriberCallBack0500
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>
subscriberCallBack0500
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>
subscriberCallBack0500
=========data:
"
+
data
.
data
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0500
"
);
expect
(
data
.
code
).
assertEqual
(
10
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0500_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0500_bundleName
"
);
commonEventSubscriber0500
_1
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>
SubscriberPromise0500_1==========>finishCommonEventPromise0500_1
"
);
commonEventSubscriber0500
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>
subscriberCallBack0500 finishCommonEvent promise
"
);
});
}
async
function
subscriberCallBack050
0_2
(
err
,
data
)
{
console
.
info
(
"
===============>
SubscriberPromise0500_2
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>
SubscriberPromise0500_2
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>
SubscriberPromise0500_2
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>
SubscriberPromise0500_2
========data:
"
+
data
.
data
);
async
function
subscriberCallBack050
1
(
err
,
data
)
{
console
.
info
(
"
===============>
subscriberCallBack0501
========event:
"
+
data
.
event
);
console
.
info
(
"
===============>
subscriberCallBack0501
========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>
subscriberCallBack0501
=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>
subscriberCallBack0501
========data:
"
+
data
.
data
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0500
"
);
expect
(
data
.
code
).
assertEqual
(
10
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0500_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0500_bundleName
"
);
commonEventSubscriber0501
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0501 finishCommonEvent promise
"
);
});
done
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
1
commonEventSubscribeInfo1
).
then
(
function
(
data
)
{
console
.
info
(
"
===============
createSubscriberPromise0500_1:
1
"
);
commonEventSubscriber0500
_1
=
data
;
console
.
info
(
"
===============
ActsSubscriberTestOrder_0500==========createSubscriber promise
1
"
);
commonEventSubscriber0500
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
=============
GetSubscribeInfoPromisek0500_1:1 data.events[0]:
"
+
data
.
events
[
0
]
);
console
.
info
(
"
=============
==ActsSubscriberTestOrder_0500==========getSubscribeInfo promise1
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0500
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0500
_1
,
subscriberCallBack0500_1
);
Subscriber
.
subscribe
(
commonEventSubscriber0500
,
subscriberCallBack0500
);
})
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
_
2
commonEventSubscribeInfo2
).
then
(
function
(
data
)
{
console
.
info
(
"
===============
===createSubscriberPromise0500_1:
2
"
);
commonEventSubscriber050
0_2
=
data
;
console
.
info
(
"
===============
ActsSubscriberTestOrder_0500==========createSubscriber promise
2
"
);
commonEventSubscriber050
1
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
==============
GetSubscribeInfoPromisek0500_1:2 data.events[0] :
"
+
data
.
events
[
0
]
);
console
.
info
(
"
==============
=ActsSubscriberTestOrder_0500==========getSubscribeInfo promise2
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0500
"
);
Subscriber
.
subscribe
(
commonEventSubscriber050
0_2
,
subscriberCallBack0500_2
);
Subscriber
.
subscribe
(
commonEventSubscriber050
1
,
subscriberCallBack0501
);
Subscriber
.
publish
(
"
publish_event0500
"
,
commonEventPublishData
,
publishCallback
);
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录