Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b37a615e
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看板
提交
b37a615e
编写于
9月 23, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 23, 2021
浏览文件
操作
浏览文件
下载
差异文件
!696 modify ces js
Merge pull request !696 from blackleon/ces_branch
上级
9c89e346
688c7878
变更
3
展开全部
显示空白变更内容
内联
并排
Showing
3 changed file
with
517 addition
and
472 deletion
+517
-472
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/js/test/ActsSubscriber_test_ordered.js
...est/entry/src/main/js/test/ActsSubscriber_test_ordered.js
+193
-82
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/config.json
...lish/actssubscriberunordertest/entry/src/main/config.json
+3
-12
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
...est/entry/src/main/js/test/ActsSubscriber_test_unorder.js
+321
-378
未找到文件。
notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/entry/src/main/js/test/ActsSubscriber_test_ordered.js
浏览文件 @
b37a615e
...
@@ -18,6 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
...
@@ -18,6 +18,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe
(
'
ActsSubscriberTestOrder
'
,
function
()
{
describe
(
'
ActsSubscriberTestOrder
'
,
function
()
{
console
.
info
(
"
===========ActsSubscriberTestOrder start====================>
"
);
console
.
info
(
"
===========ActsSubscriberTestOrder start====================>
"
);
var
num
=
0
,
num2
=
0
;
var
num
=
0
,
num2
=
0
;
var
order
=
false
;
var
commonEventSubscriber0100
;
var
commonEventSubscriber0100
;
var
commonEventSubscriber0101
;
var
commonEventSubscriber0101
;
var
commonEventSubscriber0200_1
;
var
commonEventSubscriber0200_1
;
...
@@ -26,6 +27,8 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -26,6 +27,8 @@ describe('ActsSubscriberTestOrder', function () {
var
commonEventSubscriber0300_2
;
var
commonEventSubscriber0300_2
;
var
commonEventSubscriber0400_1
;
var
commonEventSubscriber0400_1
;
var
commonEventSubscriber0400_2
;
var
commonEventSubscriber0400_2
;
var
commonEventSubscriber0500_1
;
var
commonEventSubscriber0500_2
;
async
function
unsubscriber2_
()
async
function
unsubscriber2_
()
{
{
...
@@ -74,7 +77,7 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -74,7 +77,7 @@ describe('ActsSubscriberTestOrder', function () {
console
.
info
(
"
===============>subscriberCallBack0100 getAbortCommonEventCallback2 promise abort:
"
+
data
);
console
.
info
(
"
===============>subscriberCallBack0100 getAbortCommonEventCallback2 promise abort:
"
+
data
);
})
})
await
commonEventSubscriber0100
.
finishCommonEvent
().
then
(()
=>
{
commonEventSubscriber0100
.
finishCommonEvent
().
then
(()
=>
{
console
.
info
(
"
===============>subscriberCallBack0100 finishCommonEvent promise
"
);
console
.
info
(
"
===============>subscriberCallBack0100 finishCommonEvent promise
"
);
})
})
}
}
...
@@ -148,11 +151,17 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -148,11 +151,17 @@ describe('ActsSubscriberTestOrder', function () {
console
.
info
(
"
===============>subscriberCallBack0300_1========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0300_1========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0300_1=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0300_1=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0300_1=========dat:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0300_1=========dat:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0300_1=========order:
"
+
order
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0301
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0301
"
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0301_init
"
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0301_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0301_bundleName
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0301_bundleName
"
);
expect
(
order
).
assertEqual
(
1
);
if
(
order
==
true
)
{
order
=
false
;
}
await
commonEventSubscriber0300_1
.
isOrderedCommonEvent
().
then
((
data
)
=>
{
await
commonEventSubscriber0300_1
.
isOrderedCommonEvent
().
then
((
data
)
=>
{
console
.
info
(
"
========>subscriberCallBack0300_1 publish_event0301 isOrderedCommonEvent promise
"
+
data
);
console
.
info
(
"
========>subscriberCallBack0300_1 publish_event0301 isOrderedCommonEvent promise
"
+
data
);
expect
(
data
).
assertEqual
(
1
);
expect
(
data
).
assertEqual
(
1
);
...
@@ -167,11 +176,17 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -167,11 +176,17 @@ describe('ActsSubscriberTestOrder', function () {
console
.
info
(
"
===============>subscriberCallBack0300_2========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0300_2========bundleName:
"
+
data
.
bundleName
);
console
.
info
(
"
===============>subscriberCallBack0300_2=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0300_2=========code:
"
+
data
.
code
);
console
.
info
(
"
===============>subscriberCallBack0300_2=========data:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0300_2=========data:
"
+
data
.
data
);
console
.
info
(
"
===============>subscriberCallBack0300_2=========order:
"
+
order
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0301
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0301
"
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
code
).
assertEqual
(
1
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0301_init
"
);
expect
(
data
.
data
).
assertEqual
(
"
publish_event0301_init
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0301_bundleName
"
);
expect
(
data
.
bundleName
).
assertEqual
(
"
publish_event0301_bundleName
"
);
if
(
order
==
false
)
{
order
=
true
;
}
await
commonEventSubscriber0300_2
.
isOrderedCommonEvent
().
then
((
data
)
=>
{
await
commonEventSubscriber0300_2
.
isOrderedCommonEvent
().
then
((
data
)
=>
{
console
.
info
(
"
===============>subscriberCallBack0300_2 isOrderedCommonEvent promise
"
+
data
);
console
.
info
(
"
===============>subscriberCallBack0300_2 isOrderedCommonEvent promise
"
+
data
);
expect
(
data
).
assertEqual
(
1
);
expect
(
data
).
assertEqual
(
1
);
...
@@ -209,6 +224,31 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -209,6 +224,31 @@ describe('ActsSubscriberTestOrder', function () {
expect
().
assertFail
();
expect
().
assertFail
();
}
}
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
);
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
"
);
});
}
async
function
subscriberCallBack0500_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
);
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
"
);
}
async
function
GetSubscribeInfoCallBack
(
data
)
{
async
function
GetSubscribeInfoCallBack
(
data
)
{
console
.
info
(
"
===============>GetSubscribeInfoCallBack event =
"
+
data
.
events
[
0
]);
console
.
info
(
"
===============>GetSubscribeInfoCallBack event =
"
+
data
.
events
[
0
]);
switch
(
data
.
events
[
0
])
{
switch
(
data
.
events
[
0
])
{
...
@@ -279,38 +319,41 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -279,38 +319,41 @@ describe('ActsSubscriberTestOrder', function () {
priority
:
9
priority
:
9
};
};
await
Subscriber
.
createSubscriber
(
var
commonEventPublishData
=
{
bundleName
:
"
publish_event0100_bundleName
"
,
code
:
1
,
data
:
"
publish_event1001_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_1
commonEventSubscribeInfo_1
).
then
(
async
(
data
)
=>
{
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise1
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise1
"
);
commonEventSubscriber0100
=
data
;
commonEventSubscriber0100
=
data
;
await
commonEventSubscriber0100
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise1
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise1
"
);
await
GetSubscribeInfoCallBack
(
data
);
Subscriber
.
subscribe
(
commonEventSubscriber0100
,
subscriberCallBack0100
);
});
});
})
})
await
Subscriber
.
createSubscriber
(
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_2
commonEventSubscribeInfo_2
).
then
(
async
(
data
)
=>
{
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise2
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0100==========createSubscriber promise2
"
);
commonEventSubscriber0101
=
data
;
commonEventSubscriber0101
=
data
;
await
commonEventSubscriber0100
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise2
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0100=========getSubscribeInfo promise2
"
);
await
GetSubscribeInfoCallBack
(
data
);
Subscriber
.
subscribe
(
commonEventSubscriber0101
,
subscriberCallBack0101
);
Subscriber
.
publish
(
"
publish_event0100
"
,
commonEventPublishData
,
publishCallback
);
});
});
})
})
var
commonEventPublishData
=
{
setTimeout
(
function
(){
bundleName
:
"
publish_event0100_bundleName
"
,
console
.
debug
(
"
===================ActsSubscriberTestOrder_0100 end==================
"
);
code
:
1
,
data
:
"
publish_event1001_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
Subscriber
.
publish
(
"
publish_event0100
"
,
commonEventPublishData
,
publishCallback
);
done
();
done
();
},
30000
);
})
})
/*
/*
...
@@ -333,28 +376,6 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -333,28 +376,6 @@ describe('ActsSubscriberTestOrder', function () {
priority
:
9
priority
:
9
};
};
await
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_1
,
).
then
(
async
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise1
"
);
commonEventSubscriber0200_1
=
data
;
await
data
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise1
"
);
await
getSubscribeInfoCallBack0200_1
(
data
);
});
})
await
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_2
,
).
then
(
async
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise2
"
);
commonEventSubscriber0200_2
=
data
;
await
data
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise2
"
);
await
getSubscribeInfoCallBack0200_2
(
data
);
});
})
var
commonEventPublishData1
=
{
var
commonEventPublishData1
=
{
bundleName
:
"
publish_event0200_bundleName
"
,
bundleName
:
"
publish_event0200_bundleName
"
,
code
:
1
,
code
:
1
,
...
@@ -371,11 +392,36 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -371,11 +392,36 @@ describe('ActsSubscriberTestOrder', function () {
isSticky
:
false
,
isSticky
:
false
,
}
}
await
unsubscriber2_
();
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_1
,
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise1
"
);
commonEventSubscriber0200_1
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise1
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0200_1
,
subscriberCallBack0200_1
);
});
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_2
,
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200==========createSubscriber promise2
"
);
commonEventSubscriber0200_2
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0200=========getSubscribeInfo promise2
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0200_2
,
subscriberCallBack0200_2
);
Subscriber
.
unsubscribe
(
commonEventSubscriber0200_1
,
unsubscribeCallback
);
Subscriber
.
publish
(
"
publish_event0200
"
,
commonEventPublishData1
,
publishCallback
);
Subscriber
.
publish
(
"
publish_event0200
"
,
commonEventPublishData1
,
publishCallback
);
Subscriber
.
publish
(
"
publish_event0201
"
,
commonEventPublishData2
,
publishCallback
);
Subscriber
.
publish
(
"
publish_event0201
"
,
commonEventPublishData2
,
publishCallback
);
});
})
setTimeout
(
function
(){
console
.
debug
(
"
===================ActsSubscriberTestOrder_0200 end==================
"
);
done
();
done
();
},
30000
);
})
})
/*
/*
...
@@ -397,41 +443,44 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -397,41 +443,44 @@ describe('ActsSubscriberTestOrder', function () {
priority
:
10
priority
:
10
};
};
await
Subscriber
.
createSubscriber
(
var
commonEventPublishData2
=
{
bundleName
:
"
publish_event0301_bundleName
"
,
code
:
1
,
data
:
"
publish_event0301_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_1
,
commonEventSubscribeInfo_1
,
).
then
(
async
(
data
)
=>
{
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise1
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise1
"
);
commonEventSubscriber0300_1
=
data
;
commonEventSubscriber0300_1
=
data
;
await
data
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise1
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise1
"
);
await
getSubscribeInfoCallBack0300_1
(
data
);
Subscriber
.
subscribe
(
commonEventSubscriber0300_1
,
subscriberCallBack0300_1
);
});
});
})
})
await
Subscriber
.
createSubscriber
(
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_2
,
commonEventSubscribeInfo_2
,
).
then
(
async
(
data
)
=>
{
).
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise2
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0300==========createSubscriber promise2
"
);
commonEventSubscriber0300_2
=
data
;
commonEventSubscriber0300_2
=
data
;
await
data
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise2
"
);
console
.
info
(
"
===============ActsSubscriberTestOrder_0300=========getSubscribeInfo promise2
"
);
await
getSubscribeInfoCallBack0300_2
(
data
);
Subscriber
.
subscribe
(
commonEventSubscriber0300_2
,
subscriberCallBack0300_2
);
});
})
var
commonEventPublishData2
=
{
bundleName
:
"
publish_event0301_bundleName
"
,
code
:
1
,
data
:
"
publish_event0301_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
var
numindex
=
0
;
var
numindex
=
0
;
for
(;
numindex
<
3
;
++
numindex
)
{
for
(;
numindex
<
3
;
++
numindex
)
{
Subscriber
.
publish
(
"
publish_event0301
"
,
commonEventPublishData2
,
publishCallback
);
Subscriber
.
publish
(
"
publish_event0301
"
,
commonEventPublishData2
,
publishCallback
);
}
}
done
();
});
})
setTimeout
(
function
(){
console
.
debug
(
"
===================ActsSubscriberTestOrder_0300 end==================
"
);
done
();
},
30000
);
})
})
/*
/*
...
@@ -453,38 +502,100 @@ describe('ActsSubscriberTestOrder', function () {
...
@@ -453,38 +502,100 @@ describe('ActsSubscriberTestOrder', function () {
priority
:
9
priority
:
9
};
};
await
Subscriber
.
createSubscriber
(
var
commonEventPublishData
=
{
bundleName
:
"
publish_event0400_bundleName
"
,
code
:
1
,
data
:
"
publish_event0400_init
"
,
isOrdered
:
true
,
isSticky
:
false
,
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_1
commonEventSubscribeInfo_1
).
then
(
async
(
data
)
=>
{
).
then
(
function
(
data
)
{
console
.
info
(
"
===============createSubscriberPromise0400_1:1
"
);
console
.
info
(
"
===============createSubscriberPromise0400_1:1
"
);
commonEventSubscriber0400_1
=
data
;
commonEventSubscriber0400_1
=
data
;
await
data
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
=============GetSubscribeInfoPromisek0400_1 data.events[0]:
"
+
data
.
events
[
0
]);
console
.
info
(
"
=============GetSubscribeInfoPromisek0400_1 data.events[0]:
"
+
data
.
events
[
0
]);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
await
Subscriber
.
subscribe
(
commonEventSubscriber0400_1
,
subscriberCallBack0400_1
);
Subscriber
.
subscribe
(
commonEventSubscriber0400_1
,
subscriberCallBack0400_1
);
})
})
})
})
await
Subscriber
.
createSubscriber
(
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_2
commonEventSubscribeInfo_2
).
then
(
async
(
data
)
=>
{
).
then
(
function
(
data
)
{
console
.
info
(
"
==================createSubscriberPromise0400_1:2
"
);
console
.
info
(
"
==================createSubscriberPromise0400_1:2
"
);
commonEventSubscriber0400_2
=
data
;
commonEventSubscriber0400_2
=
data
;
await
data
.
getSubscribeInfo
().
then
(
async
(
data
)
=>
{
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
==============GetSubscribeInfoPromisek0400_1 data.events[0] :
"
+
data
.
events
[
0
]);
console
.
info
(
"
==============GetSubscribeInfoPromisek0400_1 data.events[0] :
"
+
data
.
events
[
0
]);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0400
"
);
await
Subscriber
.
subscribe
(
commonEventSubscriber0400_2
,
subscriberCallBack0400_2
);
Subscriber
.
subscribe
(
commonEventSubscriber0400_2
,
subscriberCallBack0400_2
);
Subscriber
.
publish
(
"
publish_event0400
"
,
commonEventPublishData
,
publishCallback
);
})
})
})
})
setTimeout
(
function
(){
console
.
debug
(
"
===================ActsSubscriberTestOrder_0400 end==================
"
);
done
();
},
30000
);
})
/*
* @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
)
{
console
.
info
(
"
===============ActsSubscriberTestOrder_0500===============>
"
);
var
commonEventSubscribeInfo_1
=
{
events
:
[
"
publish_event0500
"
],
priority
:
1001
};
var
commonEventSubscribeInfo_2
=
{
events
:
[
"
publish_event0500
"
],
priority
:
-
101
};
var
commonEventPublishData
=
{
var
commonEventPublishData
=
{
bundleName
:
"
publish_event0
4
00_bundleName
"
,
bundleName
:
"
publish_event0
5
00_bundleName
"
,
code
:
1
,
code
:
1
0
,
data
:
"
publish_event0
4
00_init
"
,
data
:
"
publish_event0
5
00_init
"
,
isOrdered
:
true
,
isOrdered
:
true
,
isSticky
:
false
,
isSticky
:
false
,
}
}
Subscriber
.
publish
(
"
publish_event0400
"
,
commonEventPublishData
,
publishCallback
);
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_1
).
then
(
function
(
data
)
{
console
.
info
(
"
===============createSubscriberPromise0500_1:1
"
);
commonEventSubscriber0500_1
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
=============GetSubscribeInfoPromisek0500_1:1 data.events[0]:
"
+
data
.
events
[
0
]);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0500
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0500_1
,
subscriberCallBack0500_1
);
})
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo_2
).
then
(
function
(
data
)
{
console
.
info
(
"
==================createSubscriberPromise0500_1:2
"
);
commonEventSubscriber0500_2
=
data
;
data
.
getSubscribeInfo
().
then
(
function
(
data
)
{
console
.
info
(
"
==============GetSubscribeInfoPromisek0500_1:2 data.events[0] :
"
+
data
.
events
[
0
]);
expect
(
data
.
events
[
0
]).
assertEqual
(
"
publish_event0500
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0500_2
,
subscriberCallBack0500_2
);
Subscriber
.
publish
(
"
publish_event0500
"
,
commonEventPublishData
,
publishCallback
);
})
})
setTimeout
(
function
(){
console
.
debug
(
"
===================ActsSubscriberTestOrder_0500 end==================
"
);
done
();
done
();
},
30000
);
})
})
})
})
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/config.json
浏览文件 @
b37a615e
...
@@ -29,11 +29,6 @@
...
@@ -29,11 +29,6 @@
"availableScope"
:
[],
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0800_permission"
"name"
:
"publish_event0800_permission"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"publish_event0900_subscriberPermissions"
},
},
{
{
"availableScope"
:
[],
"availableScope"
:
[],
...
@@ -48,7 +43,7 @@
...
@@ -48,7 +43,7 @@
{
{
"availableScope"
:
[],
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"grantMode"
:
"system_grant"
,
"name"
:
"permission.COMMONEVENT_STICKY"
"name"
:
"
ohos.
permission.COMMONEVENT_STICKY"
}
}
],
],
"reqPermissions"
:
[
"reqPermissions"
:
[
...
@@ -56,10 +51,6 @@
...
@@ -56,10 +51,6 @@
"name"
:
"publish_event0800_permission"
,
"name"
:
"publish_event0800_permission"
,
"reason"
:
"ceshi"
"reason"
:
"ceshi"
},
},
{
"name"
:
"publish_event0900_subscriberPermissions"
,
"reason"
:
"ceshi"
},
{
{
"name"
:
"publish_event0900_publisherPermission"
,
"name"
:
"publish_event0900_publisherPermission"
,
"reason"
:
"ceshi"
"reason"
:
"ceshi"
...
@@ -69,7 +60,7 @@
...
@@ -69,7 +60,7 @@
"reason"
:
"ceshi"
"reason"
:
"ceshi"
},
},
{
{
"name"
:
"permission.COMMONEVENT_STICKY"
,
"name"
:
"
ohos.
permission.COMMONEVENT_STICKY"
,
"reason"
:
"ceshi"
"reason"
:
"ceshi"
}
}
],
],
...
...
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
浏览文件 @
b37a615e
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录