Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8b3bf7f9
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看板
未验证
提交
8b3bf7f9
编写于
7月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4364 【XTS】【事件通知子系统】isSticky+Support补
Merge pull request !4364 from 郅建文/master
上级
f89c3512
67845c4e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
341 addition
and
291 deletion
+341
-291
notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
...est/entry/src/main/js/test/ActsSubscriber_test_unorder.js
+7
-4
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
...est/entry/src/main/js/test/ActsSubscriber_test_unorder.js
+334
-287
未找到文件。
notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
浏览文件 @
8b3bf7f9
...
@@ -115,7 +115,8 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
...
@@ -115,7 +115,8 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_MOUNTED
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_MOUNTED
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_BAD_REMOVAL
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_BAD_REMOVAL
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_EJECT
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_EJECT
,
Subscriber
.
Support
.
COMMON_EVENT_SLOT_CHANGE
Subscriber
.
Support
.
COMMON_EVENT_SLOT_CHANGE
,
Subscriber
.
Support
.
COMMON_EVENT_SPN_INFO_CHANGED
];
];
function
publishCallback
(
err
)
{
function
publishCallback
(
err
)
{
...
@@ -200,8 +201,9 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
...
@@ -200,8 +201,9 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_MOUNTED
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_MOUNTED
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_BAD_REMOVAL
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_BAD_REMOVAL
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_EJECT
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_EJECT
,
Subscriber
.
Support
.
COMMON_EVENT_SLOT_CHANGE
Subscriber
.
Support
.
COMMON_EVENT_SLOT_CHANGE
,
],
Subscriber
.
Support
.
COMMON_EVENT_SPN_INFO_CHANGED
],
};
};
let
result
=
0
;
let
result
=
0
;
...
@@ -309,7 +311,8 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
...
@@ -309,7 +311,8 @@ describe('ActsSubscriberTestUnorderSystem', async function (done) {
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_MOUNTED
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_MOUNTED
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_BAD_REMOVAL
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_BAD_REMOVAL
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_EJECT
,
Subscriber
.
Support
.
COMMON_EVENT_VOLUME_EJECT
,
Subscriber
.
Support
.
COMMON_EVENT_SLOT_CHANGE
Subscriber
.
Support
.
COMMON_EVENT_SLOT_CHANGE
,
Subscriber
.
Support
.
COMMON_EVENT_SPN_INFO_CHANGED
],
],
};
};
...
...
notification/ces_standard/subscribeandpublish/actssubscriberunordertest/entry/src/main/js/test/ActsSubscriber_test_unorder.js
浏览文件 @
8b3bf7f9
...
@@ -12,313 +12,360 @@
...
@@ -12,313 +12,360 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
Subscriber
from
'
@ohos.commonEvent
'
import
Subscriber
from
"
@ohos.commonEvent
"
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,}
from
"
deccjsunit/index
"
;
describe
(
'
ActsSubscriberTestUnorder
'
,
async
function
(
done
)
{
describe
(
"
ActsSubscriberTestUnorder
"
,
async
function
(
done
)
{
console
.
info
(
"
===========ActsSubscriberTestUnorder start====================>
"
);
console
.
info
(
let
commonEventSubscriber001
;
"
===========ActsSubscriberTestUnorder start====================>
"
let
commonEventSubscriber002
;
);
let
commonEventSubscriber003
;
let
commonEventSubscriber001
;
let
commonEventSubscriber004
;
let
commonEventSubscriber002
;
let
commonEventSubscriber0051
;
let
commonEventSubscriber003
;
let
commonEventSubscriber0052
;
let
commonEventSubscriber004
;
let
commonEventSubscriber006
;
let
commonEventSubscriber0051
;
let
commonEventSubscriber008
;
let
commonEventSubscriber0052
;
let
commonEventSubscriber0101
;
let
commonEventSubscriber006
;
let
commonEventSubscriber0102
;
let
commonEventSubscriber007
;
let
commonEventSubscriber011
;
let
commonEventSubscriber008
;
let
commonEventSubscriber012
;
let
commonEventSubscriber0101
;
let
commonEventSubscriber0102
;
function
publishCallback
(
err
)
{
let
commonEventSubscriber011
;
console
.
info
(
"
==========================>publishCallback
"
);
let
commonEventSubscriber012
;
function
publishCallback
(
err
)
{
console
.
info
(
"
==========================>publishCallback
"
);
}
function
publishCallback10001
(
err
)
{
console
.
info
(
"
==========================>publishCallback
"
);
}
function
publishCallback10002
(
err
)
{
console
.
info
(
"
==========================>publishCallback
"
);
}
function
unsubscriberCallBack
(
err
)
{
console
.
info
(
"
==========================>unsubscriberCallBack
"
);
}
/*
* @tc.number : ActsSubscriberTestUnorder_0100
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
* @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise)
*/
it
(
"
ActsSubscriberTestUnorder_0100
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=============================>
"
);
function
subscriberCallBack001
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack001
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0100
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
done
();
}
}
function
publishCallback10001
(
err
)
{
let
commonEventSubscribeInfo
=
{
console
.
info
(
"
==========================>publishCallback
"
);
events
:
[
"
publish_event0100
"
],
};
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=========createSubscriber promise
"
);
commonEventSubscriber001
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber001
,
subscriberCallBack001
);
setTimeout
(
function
()
{
console
.
info
(
"
==========ActsSubscriberTestUnorder_0100 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0100
"
,
publishCallback
);
},
1000
);
});
});
});
/*
* @tc.number : ActsSubscriberTestUnorder_0200
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
* of containing special characters
* @tc.desc : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by Promise)
*/
it
(
"
ActsSubscriberTestUnorder_0200
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200==========================>
"
);
function
subscriberCallBack002
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack002
"
);
expect
(
data
.
event
).
assertEqual
(
"
@#¥#3243adsafdf_
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
done
();
}
}
function
publishCallback10002
(
err
)
{
let
commonEventSubscribeInfo
=
{
console
.
info
(
"
==========================>publishCallback
"
);
events
:
[
"
@#¥#3243adsafdf_
"
],
};
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200=========createSubscriber promise
"
);
commonEventSubscriber002
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber002
,
subscriberCallBack002
);
setTimeout
(
function
()
{
console
.
info
(
"
==========ActsSubscriberTestUnorder_0200 publish start============
"
);
Subscriber
.
publish
(
"
@#¥#3243adsafdf_
"
,
publishCallback
);
},
1000
);
});
});
});
/*
* @tc.number : ActsSubscriberTestUnorder_0300
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
* with publishInfo data
* @tc.desc : Check the subscriber can receive event "publish_event0300" type of the interface (by Promise)
*/
it
(
"
ActsSubscriberTestUnorder_0300
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300==========================>
"
);
let
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0300
"
],
publisherDeviceId
:
"
PublishDeviceId0300
"
,
priority
:
10
,
};
let
commonEventPublishData
=
{
isOrdered
:
false
,
code
:
55
,
data
:
"
PublishData0300
"
,
};
function
isOrderedCommonEventCallback003
(
err
,
data
)
{
console
.
info
(
"
==========================>isOrderedCommonEventCallback003
"
);
expect
(
data
).
assertEqual
(
false
);
done
();
}
}
function
unsubscriberCallBack
(
err
)
{
function
subscriberCallBack003
(
err
,
data
)
{
console
.
info
(
"
==========================>unsubscriberCallBack
"
);
console
.
info
(
"
==========================>subscriberCallBack003
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0300
"
);
expect
(
data
.
code
).
assertEqual
(
55
);
expect
(
data
.
data
).
assertEqual
(
"
PublishData0300
"
);
commonEventSubscriber003
.
isOrderedCommonEvent
(
isOrderedCommonEventCallback003
);
}
}
/*
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
* @tc.number : ActsSubscriberTestUnorder_0100
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300=========createSubscriber promise
"
);
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
commonEventSubscriber003
=
data
;
* @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise)
data
.
getSubscribeInfo
().
then
(()
=>
{
*/
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300=========getSubscribeInfo promise
"
);
it
(
'
ActsSubscriberTestUnorder_0100
'
,
0
,
async
function
(
done
)
{
Subscriber
.
subscribe
(
commonEventSubscriber003
,
subscriberCallBack003
);
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=============================>
"
);
setTimeout
(
function
()
{
function
subscriberCallBack001
(
err
,
data
)
{
console
.
info
(
"
==========ActsSubscriberTestUnorder_0300 publish start============
"
);
console
.
info
(
"
==========================>subscriberCallBack001
"
);
Subscriber
.
publish
(
"
publish_event0300
"
,
commonEventPublishData
,
publishCallback
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0100
"
);
},
1000
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
});
expect
(
data
.
code
).
assertEqual
(
0
);
});
expect
(
data
.
data
).
assertEqual
(
""
);
});
done
();
}
/*
* @tc.number : ActsSubscriberTestUnorder_0400
let
commonEventSubscribeInfo
=
{
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
events
:
[
"
publish_event0100
"
],
* with publishInfo data
};
* @tc.desc : Check the subscriber can receive event "publish_event0300" type of the interface (by Promise)
*/
Subscriber
.
createSubscriber
(
it
(
"
ActsSubscriberTestUnorder_0400
"
,
0
,
async
function
(
done
)
{
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=========createSubscriber promise
"
);
commonEventSubscriber001
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0100=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber001
,
subscriberCallBack001
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0100 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0100
"
,
publishCallback
);
},
1000
);
});
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0200
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
* of containing special characters
* @tc.desc : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200==========================>
"
);
function
subscriberCallBack002
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack002
"
);
expect
(
data
.
event
).
assertEqual
(
"
@#¥#3243adsafdf_
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
done
();
}
let
commonEventSubscribeInfo
=
{
events
:
[
"
@#¥#3243adsafdf_
"
],
};
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200=========createSubscriber promise
"
);
commonEventSubscriber002
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0200=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber002
,
subscriberCallBack002
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0200 publish start============
"
);
Subscriber
.
publish
(
"
@#¥#3243adsafdf_
"
,
publishCallback
);
},
1000
);
});
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0300
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
* with publishInfo data
* @tc.desc : Check the subscriber can receive event "publish_event0300" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300==========================>
"
);
let
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0300
"
],
publisherDeviceId
:
"
PublishDeviceId0300
"
,
priority
:
10
,
};
let
commonEventPublishData
=
{
isOrdered
:
false
,
code
:
55
,
data
:
"
PublishData0300
"
,
}
function
isOrderedCommonEventCallback003
(
err
,
data
)
{
console
.
info
(
"
==========================>isOrderedCommonEventCallback003
"
);
expect
(
data
).
assertEqual
(
false
);
done
();
}
function
subscriberCallBack003
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack003
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0300
"
);
expect
(
data
.
code
).
assertEqual
(
55
);
expect
(
data
.
data
).
assertEqual
(
"
PublishData0300
"
);
commonEventSubscriber003
.
isOrderedCommonEvent
(
isOrderedCommonEventCallback003
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300=========createSubscriber promise
"
);
commonEventSubscriber003
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0300=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber003
,
subscriberCallBack003
);
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0300 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0300
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
})
})
/*
* @tc.number : ActsSubscriberTestUnorder_0400
* @tc.name : verify subscribe and publish : Check subscribe and publish common event data
* with publishInfo data
* @tc.desc : Check the subscriber can receive event "publish_event0300" type of the interface (by Promise)
*/
it
(
'
ActsSubscriberTestUnorder_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400==========================>
"
);
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400==========================>
"
);
let
commonEventSubscribeInfo
=
{
let
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0400
"
],
events
:
[
"
publish_event0400
"
],
publisherDeviceId
:
"
PublishDeviceId0400
"
,
publisherDeviceId
:
"
PublishDeviceId0400
"
,
priority
:
10
,
priority
:
10
,
};
};
let
commonEventPublishData
=
{
let
commonEventPublishData
=
{
isOrdered
:
false
,
isOrdered
:
false
,
bundleName
:
"
com.example.actssubscribertestunorder
"
,
bundleName
:
"
com.example.actssubscribertestunorder
"
,
code
:
55
,
code
:
55
,
data
:
"
PublishData0400
"
,
data
:
"
PublishData0400
"
,
}
}
;
function
isOrderedCommonEventCallback004
(
err
,
data
)
{
function
isOrderedCommonEventCallback004
(
err
,
data
)
{
console
.
info
(
"
==========================>isOrderedCommonEventCallback003
"
);
console
.
info
(
"
==========================>isOrderedCommonEventCallback003
"
);
expect
(
data
).
assertEqual
(
false
);
expect
(
data
).
assertEqual
(
false
);
done
();
done
();
}
}
function
subscriberCallBack004
(
err
,
data
)
{
function
subscriberCallBack004
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack004
"
);
console
.
info
(
"
==========================>subscriberCallBack004
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0400
"
);
expect
(
data
.
code
).
assertEqual
(
55
);
expect
(
data
.
code
).
assertEqual
(
55
);
expect
(
data
.
data
).
assertEqual
(
"
PublishData0400
"
);
expect
(
data
.
data
).
assertEqual
(
"
PublishData0400
"
);
commonEventSubscriber004
.
isOrderedCommonEvent
(
isOrderedCommonEventCallback004
);
commonEventSubscriber004
.
isOrderedCommonEvent
(
isOrderedCommonEventCallback004
);
}
}
Subscriber
.
createSubscriber
(
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
commonEventSubscribeInfo
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400=========createSubscriber promise
"
);
).
then
((
data
)
=>
{
commonEventSubscriber004
=
data
;
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400=========createSubscriber promise
"
);
data
.
getSubscribeInfo
().
then
(()
=>
{
commonEventSubscriber004
=
data
;
console
.
info
(
data
.
getSubscribeInfo
().
then
(()
=>
{
"
===============ActsSubscriberTestUnorder_0400=========getSubscribeInfo promise
"
console
.
info
(
"
===============ActsSubscriberTestUnorder_0400=========getSubscribeInfo promise
"
);
);
Subscriber
.
subscribe
(
commonEventSubscriber004
,
subscriberCallBack004
);
Subscriber
.
subscribe
(
commonEventSubscriber004
,
subscriberCallBack004
);
setTimeout
(
function
(){
setTimeout
(
function
()
{
console
.
info
(
"
==========ActsSubscriberTestUnorder_0400 publish start============
"
);
console
.
info
(
"
==========ActsSubscriberTestUnorder_0400 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0400
"
,
commonEventPublishData
,
publishCallback
);
Subscriber
.
publish
(
},
1000
);
"
publish_event0400
"
,
});
commonEventPublishData
,
})
publishCallback
})
);
},
1000
);
/*
});
* @tc.number : ActsSubscriberTestUnorder_0500
});
* @tc.name : verify subscribe and publish : Check the two different subscribe and one publish,
});
* and check unsubscribe event
* @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by Promise)
/*
*/
* @tc.number : ActsSubscriberTestUnorder_0500
it
(
'
ActsSubscriberTestUnorder_0500
'
,
0
,
async
function
(
done
)
{
* @tc.name : verify subscribe and publish : Check the two different subscribe and one publish,
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500==========================>
"
);
* and check unsubscribe event
let
commonEventSubscribeInfo
=
{
* @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by Promise)
events
:
[
"
publish_event0500
"
]
*/
};
it
(
"
ActsSubscriberTestUnorder_0500
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500==========================>
"
);
let
commonEventPublishData
=
{
let
commonEventSubscribeInfo
=
{
isOrdered
:
false
,
events
:
[
"
publish_event0500
"
],
isSticky
:
false
,
};
}
function
subscriberCallBack005
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack0500
"
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0500
"
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
expect
(
data
.
code
).
assertEqual
(
0
);
expect
(
data
.
data
).
assertEqual
(
""
);
done
();
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_1=========createSubscriber promise
"
);
commonEventSubscriber0051
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_1=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0051
,
subscriberCallBack005
);
});
})
Subscriber
.
createSubscriber
(
let
commonEventPublishData
=
{
commonEventSubscribeInfo
isOrdered
:
false
,
).
then
((
data
)
=>
{
isSticky
:
false
,
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_2=========createSubscriber promise
"
);
};
commonEventSubscriber0052
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
function
subscriberCallBack005
(
err
,
data
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_2=========getSubscribeInfo promise
"
);
console
.
info
(
"
==========================>subscriberCallBack0500
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0052
,
subscriberCallBack005
);
expect
(
data
.
event
).
assertEqual
(
"
publish_event0500
"
);
Subscriber
.
unsubscribe
(
commonEventSubscriber0051
,
unsubscriberCallBack
);
expect
(
data
.
bundleName
).
assertEqual
(
""
);
setTimeout
(
function
(){
expect
(
data
.
code
).
assertEqual
(
0
);
console
.
info
(
"
==========ActsSubscriberTestUnorder_0500 publish start============
"
);
expect
(
data
.
data
).
assertEqual
(
""
);
Subscriber
.
publish
(
"
publish_event0500
"
,
commonEventPublishData
,
publishCallback
);
done
();
},
1000
);
}
});
})
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
})
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_1=========createSubscriber promise
"
);
commonEventSubscriber0051
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
/*
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_1=========getSubscribeInfo promise
"
);
* @tc.number : ActsSubscriberTestUnorder_0600
Subscriber
.
subscribe
(
commonEventSubscriber0051
,
subscriberCallBack005
);
* @tc.name : verify subscribe and publish : Check whether the current public event is a sticky event
});
* @tc.desc : isStickyCommonEvent(callback: AsyncCallback<boolean>): void
});
*/
it
(
'
ActsSubscriberTestUnorder_0600
'
,
0
,
async
function
(
done
)
{
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600==========================>
"
);
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_2=========createSubscriber promise
"
);
let
commonEventSubscribeInfo
=
{
commonEventSubscriber0052
=
data
;
events
:
[
"
publish_event0600
"
]
data
.
getSubscribeInfo
().
then
(()
=>
{
};
console
.
info
(
"
===============ActsSubscriberTestUnorder_0500_2=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber0052
,
subscriberCallBack005
);
let
commonEventPublishData
=
{
Subscriber
.
unsubscribe
(
commonEventSubscriber0051
,
unsubscriberCallBack
);
isOrdered
:
false
,
setTimeout
(
function
()
{
isSticky
:
false
,
console
.
info
(
}
"
==========ActsSubscriberTestUnorder_0500 publish start============
"
);
function
isStickyCallback
(
err
,
data
)
{
Subscriber
.
publish
(
console
.
info
(
"
==========================>isStickyCallback
"
);
"
publish_event0500
"
,
expect
(
data
).
assertEqual
(
false
);
commonEventPublishData
,
done
();
publishCallback
}
);
},
1000
);
function
subscriberCallBack006
(
err
,
data
)
{
});
console
.
info
(
"
==========================>subscriberCallBack006
"
);
});
commonEventSubscriber006
.
isStickyCommonEvent
(
isStickyCallback
);
});
}
/*
Subscriber
.
createSubscriber
(
* @tc.number : ActsSubscriberTestUnorder_0600
commonEventSubscribeInfo
* @tc.name : verify subscribe and publish : Check whether the current public event is a sticky event
).
then
((
data
)
=>
{
* @tc.desc : isStickyCommonEvent(callback: AsyncCallback<boolean>): void
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600=========createSubscriber promise
"
);
*/
commonEventSubscriber006
=
data
;
it
(
"
ActsSubscriberTestUnorder_0600
"
,
0
,
async
function
(
done
)
{
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600==========================>
"
);
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600=========getSubscribeInfo promise
"
);
let
commonEventSubscribeInfo
=
{
Subscriber
.
subscribe
(
commonEventSubscriber006
,
subscriberCallBack006
);
events
:
[
"
publish_event0600
"
],
Subscriber
.
unsubscribe
(
commonEventSubscriber006
,
unsubscriberCallBack
);
};
setTimeout
(
function
(){
console
.
info
(
"
==========ActsSubscriberTestUnorder_0600 publish start============
"
);
let
commonEventPublishData
=
{
Subscriber
.
publish
(
"
publish_event0600
"
,
commonEventPublishData
,
publishCallback
);
isOrdered
:
false
,
},
1000
);
isSticky
:
false
,
});
};
})
})
function
isStickyCallback
(
err
,
isSticky
)
{
console
.
info
(
"
==========================>isStickyCallback
"
);
expect
(
isSticky
).
assertEqual
(
false
);
done
();
}
})
function
subscriberCallBack006
(
err
,
data
)
{
console
.
info
(
"
==========================>subscriberCallBack006
"
);
commonEventSubscriber006
.
isStickyCommonEvent
(
isStickyCallback
);
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600=========createSubscriber promise
"
);
commonEventSubscriber006
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0600=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber006
,
subscriberCallBack006
);
Subscriber
.
unsubscribe
(
commonEventSubscriber006
,
unsubscriberCallBack
);
setTimeout
(
function
()
{
console
.
info
(
"
==========ActsSubscriberTestUnorder_0600 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0600
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
});
});
/*
* @tc.number : ActsSubscriberTestUnorder_0700
* @tc.name : verify subscribe and publish : Check whether the current public event is a sticky event
* @tc.desc : isStickyCommonEvent(): Promise<boolean>
*/
it
(
"
ActsSubscriberTestUnorder_0700
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0700==========================>
"
);
let
commonEventSubscribeInfo
=
{
events
:
[
"
publish_event0700
"
],
};
let
commonEventPublishData
=
{
isOrdered
:
false
,
isSticky
:
false
,
};
function
subscriberCallBack007
(
err
,
data
)
{
console
.
info
(
"
subscriberCallBack007
"
);
commonEventSubscriber007
.
isStickyCommonEvent
()
.
then
((
isSticky
)
=>
{
console
.
info
(
"
isSticky
"
+
JSON
.
stringify
(
isSticky
));
expect
(
isSticky
).
assertEqual
(
false
);
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
"
isSticky failed
"
+
JSON
.
stringify
(
err
));
});
}
Subscriber
.
createSubscriber
(
commonEventSubscribeInfo
).
then
((
data
)
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0700=========createSubscriber promise
"
);
commonEventSubscriber007
=
data
;
data
.
getSubscribeInfo
().
then
(()
=>
{
console
.
info
(
"
===============ActsSubscriberTestUnorder_0700=========getSubscribeInfo promise
"
);
Subscriber
.
subscribe
(
commonEventSubscriber007
,
subscriberCallBack007
);
Subscriber
.
unsubscribe
(
commonEventSubscriber007
,
unsubscriberCallBack
);
setTimeout
(
function
()
{
console
.
info
(
"
==========ActsSubscriberTestUnorder_0700 publish start============
"
);
Subscriber
.
publish
(
"
publish_event0700
"
,
commonEventPublishData
,
publishCallback
);
},
1000
);
});
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录