1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <thread>
17 #include <chrono>
18 #include <sys/time.h>
19 
20 #include "common_event.h"
21 #include "common_event_manager.h"
22 
23 #define private public
24 #define protected public
25 #include "common_event_control_manager.h"
26 #undef private
27 #undef protected
28 
29 #include "datetime_ex.h"
30 #include "iremote_object.h"
31 #include "message_parcel.h"
32 #include "singleton.h"
33 #include "system_ability.h"
34 #include "want.h"
35 
36 #include <gtest/gtest.h>
37 #include <ctime>
38 
39 using namespace testing::ext;
40 using namespace OHOS::EventFwk;
41 using OHOS::Parcel;
42 
43 namespace OHOS {
44 namespace EventFwk {
45 namespace {
46 const std::string EVENTCASE1 = "com.common.event.data.case1";
47 const std::string EVENTCASE2 = "com.common.event.data.case2";
48 const std::string EVENTCASE3 = "com.common.event.data.case3";
49 const std::string EVENTCASE4 = "com.common.event.data.case4";
50 const std::string EVENTCASE5 = "com.common.event.data.case5";
51 const std::string EVENTCASE6 = "com.common.event.data.case6";
52 const std::string EVENTCASE7 = "com.common.event.data.case7";
53 const std::string EVENTCASE8 = "com.common.event.data.case8";
54 const std::string EVENTCASE9 = "com.common.event.data.case9";
55 const std::string EVENTCASE10 = "com.common.event.data.case10";
56 const std::string EVENTCASE11 = "com.common.event.data.case11";
57 const std::string EVENTCASE12 = "com.common.event.data.case12";
58 const std::string EVENTCASE13 = "com.common.event.data.case13";
59 const std::string EVENTCASE14 = "com.common.event.data.case14";
60 const std::string EVENTCASE15 = "com.common.event.data.case15";
61 const std::string EVENTCASE16 = "com.common.event.data.case16";
62 const std::string EVENTCASE17 = "com.common.event.data.case17";
63 const std::string EVENTCASE18 = "com.common.event.data.case18";
64 const std::string EVENTCASE19 = "com.common.event.data.case19";
65 const std::string EVENTCASE20 = "com.common.event.data.case20";
66 const std::string EVENTCASE21 = "com.common.event.data.case21";
67 const std::string EVENTCASE22 = "com.common.event.data.case22";
68 const std::string EVENTCASE23 = "com.common.event.data.case23";
69 
70 const int CODECASE1 = 0;
71 const std::string DATACASE1 = "com.data.case1";
72 
73 const int CODECASE2 = 1;
74 const std::string DATACASE2 = "com.data.case2";
75 
76 const int CODECASE3 = 100;
77 const std::string DATACASE3 = "com.data.case3";
78 
79 const int CODECASE4 = -1;
80 const std::string DATACASE4 = "com.data.case4";
81 
82 const int CODECASE5 = -100;
83 const std::string DATACASE5 = "com.data.case5";
84 
85 const int CODECASE6 = 200;
86 const std::string DATACASE6 = "com.data.case6";
87 
88 const int CODECASE7 = -200;
89 const std::string DATACASE7 = "com.data.case7";
90 
91 const int CODECASE8 = 300;
92 const std::string DATACASE8 = "com.data.case8";
93 
94 const int CODECASE9 = -300;
95 const std::string DATACASE9 = "com.data.case10";
96 
97 const int CODECASE10 = 1000;
98 const std::string DATACASE10 = "com.data.case10";
99 
100 const int CODECASE11 = -1000;
101 const std::string DATACASE11 = "com.data.case11";
102 
103 const int CODECASE12 = 10000;
104 const std::string DATACASE12 = "com.data.case12";
105 
106 const int CODECASE13 = 10000;
107 const std::string DATACASE13 = "com.data.case13";
108 
109 const int CODECASE14 = -10000;
110 const std::string DATACASE14 = "com.data.case14";
111 
112 const int CODECASE15 = 50000;
113 const std::string DATACASE15 = "com.data.case15";
114 
115 const int CODECASE16 = -50000;
116 const std::string DATACASE16 = "com.data.case16";
117 
118 const int CODECASE17 = 100000;
119 const std::string DATACASE17 = "com.data.case17";
120 
121 const int CODECASE18 = -100000;
122 const std::string DATACASE18 = "com.data.case18";
123 
124 const int CODECASE19 = -10000;
125 const std::string DATACASE19 = "com.data.case19";
126 
127 const int CODECASE20 = 50000;
128 const std::string DATACASE20 = "com.data.case20";
129 
130 const int CODECASE21 = -50000;
131 const std::string DATACASE21 = "com.data.case21";
132 
133 const int CODECASE22 = 100000;
134 const std::string DATACASE22 = "com.data.case22";
135 
136 const int CODECASE23 = -100000;
137 const std::string DATACASE23 = "com.data.case23";
138 
139 const int LOWPRIORITY = 0;
140 const int MIDPRIORITY = 50;
141 const int HIGHPRIORITY = 100;
Delay(int sec)142 void Delay(int sec)
143 {
144     time_t starttimeDelay, curtime;
145     time(&starttimeDelay);
146     do {
147         time(&curtime);
148     } while ((curtime - starttimeDelay) < sec);
149 }
150 }  // namespace
151 
152 class ActsCESDataTest : public testing::Test {
153 public:
ActsCESDataTest()154     ActsCESDataTest()
155     {}
~ActsCESDataTest()156     ~ActsCESDataTest()
157     {}
158 
159     static void SetUpTestCase(void);
160     static void TearDownTestCase(void);
161     void SetUp();
162     void TearDown();
163 };
164 
165 class SubscriberFirstTest : public CommonEventSubscriber {
166 public:
SubscriberFirstTest(const CommonEventSubscribeInfo & subscribeInfo)167     explicit SubscriberFirstTest(const CommonEventSubscribeInfo &subscribeInfo) : CommonEventSubscriber(subscribeInfo)
168     {}
169 
~SubscriberFirstTest()170     ~SubscriberFirstTest()
171     {}
172 
OnReceiveEvent(const CommonEventData & data)173     virtual void OnReceiveEvent(const CommonEventData &data)
174     {
175         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent ";
176         std::string action = data.GetWant().GetAction();
177         if (action == EVENTCASE1) {
178             SubscriberFirstTestCase1();
179         } else if (action == EVENTCASE2) {
180             SubscriberFirstTestCase2();
181         } else if (action == EVENTCASE3) {
182             SubscriberFirstTestCase3();
183         } else if (action == EVENTCASE4) {
184             SubscriberFirstTestCase4();
185         } else if (action == EVENTCASE5) {
186             SubscriberFirstTestCase5();
187         } else if (action == EVENTCASE6) {
188             SubscriberFirstTestCase6();
189         } else if (action == EVENTCASE7) {
190             SubscriberFirstTestCase7();
191         } else if (action == EVENTCASE8) {
192             SubscriberFirstTestCaseEight();
193         } else if (action == EVENTCASE9) {
194             SubscriberFirstTestCaseEight();
195         } else if (action == EVENTCASE10) {
196             SubscriberFirstTestCaseEight();
197         } else if (action == EVENTCASE11) {
198             SubscriberFirstTestCaseEight();
199         } else if (action == EVENTCASE12) {
200             SubscriberFirstTestCaseEight();
201         } else if (action == EVENTCASE13) {
202             SubscriberFirstTestCaseThirteen();
203         } else if (action == EVENTCASE14) {
204             SubscriberFirstTestCaseThirteen();
205         } else if (action == EVENTCASE15) {
206             SubscriberFirstTestCaseThirteen();
207         } else if (action == EVENTCASE16) {
208             SubscriberFirstTestCaseThirteen();
209         } else if (action == EVENTCASE17) {
210             SubscriberFirstTestCaseThirteen();
211         } else if (action == EVENTCASE18) {
212             SubscriberFirstTestCaseThirteen();
213         } else if (action == EVENTCASE19) {
214             SubscriberFirstTestCase19();
215         } else if (action == EVENTCASE20) {
216             SubscriberFirstTestCase20();
217         } else if (action == EVENTCASE21) {
218             SubscriberFirstTestCase21();
219         } else if (action == EVENTCASE22) {
220             SubscriberFirstTestCase22();
221         } else if (action == EVENTCASE23) {
222             SubscriberFirstTestCase23();
223         } else {
224             GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest  OnReceiveEvent do nothing";
225         }
226     }
227 
228 private:
SubscriberFirstTestCase1()229     void SubscriberFirstTestCase1()
230     {
231         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase1 ";
232 
233         EXPECT_EQ(GetCode() == CODECASE1, true);
234         EXPECT_EQ(GetData() == DATACASE1, true);
235     }
236 
SubscriberFirstTestCase2()237     void SubscriberFirstTestCase2()
238     {
239         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase2 ";
240 
241         EXPECT_EQ(GetCode() == CODECASE2, true);
242         EXPECT_EQ(GetData() == DATACASE2, true);
243     }
244 
SubscriberFirstTestCase3()245     void SubscriberFirstTestCase3()
246     {
247         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase3 ";
248 
249         EXPECT_EQ(GetCode() == CODECASE3, true);
250         EXPECT_EQ(GetData() == DATACASE3, true);
251     }
252 
SubscriberFirstTestCase4()253     void SubscriberFirstTestCase4()
254     {
255         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase4 ";
256 
257         EXPECT_EQ(GetCode() == CODECASE4, true);
258         EXPECT_EQ(GetData() == DATACASE4, true);
259     }
260 
SubscriberFirstTestCase5()261     void SubscriberFirstTestCase5()
262     {
263         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase5 ";
264 
265         EXPECT_EQ(GetCode() == CODECASE5, true);
266         EXPECT_EQ(GetData() == DATACASE5, true);
267     }
268 
SubscriberFirstTestCase6()269     void SubscriberFirstTestCase6()
270     {
271         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase6 ";
272 
273         EXPECT_EQ(GetCode() == CODECASE6, true);
274         EXPECT_EQ(GetData() == DATACASE6, true);
275     }
276 
SubscriberFirstTestCase7()277     void SubscriberFirstTestCase7()
278     {
279         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase7 ";
280 
281         EXPECT_EQ(GetCode() == CODECASE7, true);
282         EXPECT_EQ(GetData() == DATACASE7, true);
283     }
284 
SubscriberFirstTestCaseEight()285     void SubscriberFirstTestCaseEight()
286     {
287         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase8_12 ";
288         EXPECT_TRUE(AbortCommonEvent());
289         EXPECT_TRUE(GetAbortCommonEvent());
290         EXPECT_TRUE(ClearAbortCommonEvent());
291         EXPECT_FALSE(GetAbortCommonEvent());
292         EXPECT_TRUE(IsOrderedCommonEvent());
293     }
294 
SubscriberFirstTestCaseThirteen()295     void SubscriberFirstTestCaseThirteen()
296     {
297         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberFirstTestcase13_18 ";
298         EXPECT_FALSE(AbortCommonEvent());
299         EXPECT_FALSE(GetAbortCommonEvent());
300         EXPECT_FALSE(ClearAbortCommonEvent());
301         EXPECT_FALSE(GetAbortCommonEvent());
302         EXPECT_FALSE(IsOrderedCommonEvent());
303     }
304 
SubscriberFirstTestCase19()305     void SubscriberFirstTestCase19()
306     {
307         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberThirdTestcase19 ";
308 
309         SetCode(CODECASE1);
310         SetData(DATACASE1);
311         EXPECT_EQ(GetCode() == CODECASE1, true);
312         EXPECT_EQ(GetData() == DATACASE1, true);
313         SetCodeAndData(CODECASE2, DATACASE2);
314         EXPECT_EQ(GetCode() == CODECASE2, true);
315         EXPECT_EQ(GetData() == DATACASE2, true);
316         GoAsyncCommonEvent();
317     }
318 
SubscriberFirstTestCase20()319     void SubscriberFirstTestCase20()
320     {
321         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberThirdTestcase20 ";
322 
323         SetCode(CODECASE3);
324         SetData(DATACASE3);
325         EXPECT_EQ(GetCode() == CODECASE3, true);
326         EXPECT_EQ(GetData() == DATACASE3, true);
327         SetCodeAndData(CODECASE4, DATACASE4);
328         EXPECT_EQ(GetCode() == CODECASE4, true);
329         EXPECT_EQ(GetData() == DATACASE4, true);
330         GoAsyncCommonEvent();
331     }
332 
SubscriberFirstTestCase21()333     void SubscriberFirstTestCase21()
334     {
335         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberThirdTestcase21 ";
336 
337         SetCode(CODECASE5);
338         SetData(DATACASE5);
339         EXPECT_EQ(GetCode() == CODECASE5, true);
340         EXPECT_EQ(GetData() == DATACASE5, true);
341         SetCodeAndData(CODECASE6, DATACASE6);
342         EXPECT_EQ(GetCode() == CODECASE6, true);
343         EXPECT_EQ(GetData() == DATACASE6, true);
344         GoAsyncCommonEvent();
345     }
346 
SubscriberFirstTestCase22()347     void SubscriberFirstTestCase22()
348     {
349         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberThirdTestcase22 ";
350 
351         SetCode(CODECASE7);
352         SetData(DATACASE7);
353         EXPECT_EQ(GetCode() == CODECASE7, true);
354         EXPECT_EQ(GetData() == DATACASE7, true);
355         SetCodeAndData(CODECASE9, DATACASE9);
356         EXPECT_EQ(GetCode() == CODECASE9, true);
357         EXPECT_EQ(GetData() == DATACASE9, true);
358         GoAsyncCommonEvent();
359     }
360 
SubscriberFirstTestCase23()361     void SubscriberFirstTestCase23()
362     {
363         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberFirstTest OnReceiveEvent SubscriberThirdTestcase23 ";
364 
365         SetCode(CODECASE10);
366         SetData(DATACASE10);
367         EXPECT_EQ(GetCode() == CODECASE10, true);
368         EXPECT_EQ(GetData() == DATACASE10, true);
369         SetCodeAndData(CODECASE11, DATACASE11);
370         EXPECT_EQ(GetCode() == CODECASE11, true);
371         EXPECT_EQ(GetData() == DATACASE11, true);
372         GoAsyncCommonEvent();
373     }
374 };
375 
376 class SubscriberSecondTest : public CommonEventSubscriber {
377 public:
SubscriberSecondTest(const CommonEventSubscribeInfo & subscribeInfo)378     explicit SubscriberSecondTest(const CommonEventSubscribeInfo &subscribeInfo)
379         : CommonEventSubscriber(subscribeInfo)
380     {}
381 
~SubscriberSecondTest()382     ~SubscriberSecondTest()
383     {}
384 
OnReceiveEvent(const CommonEventData & data)385     virtual void OnReceiveEvent(const CommonEventData &data)
386     {
387         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent ";
388         std::string action = data.GetWant().GetAction();
389         if (action == EVENTCASE1) {
390             SubscriberFirstTestCase1();
391         } else if (action == EVENTCASE2) {
392             SubscriberFirstTestCase2();
393         } else if (action == EVENTCASE3) {
394             SubscriberFirstTestCase3();
395         } else if (action == EVENTCASE4) {
396             SubscriberFirstTestCase4();
397         } else if (action == EVENTCASE5) {
398             SubscriberFirstTestCase5();
399         } else if (action == EVENTCASE6) {
400             SubscriberFirstTestCase6();
401         } else if (action == EVENTCASE7) {
402             SubscriberFirstTestCase7();
403         } else if (action == EVENTCASE8) {
404             SubscriberFirstTestCaseEight();
405         } else if (action == EVENTCASE9) {
406             SubscriberFirstTestCaseEight();
407         } else if (action == EVENTCASE10) {
408             SubscriberFirstTestCaseEight();
409         } else if (action == EVENTCASE11) {
410             SubscriberFirstTestCaseEight();
411         } else if (action == EVENTCASE12) {
412             SubscriberFirstTestCaseEight();
413         } else if (action == EVENTCASE13) {
414             SubscriberFirstTestCaseThirteen();
415         } else if (action == EVENTCASE14) {
416             SubscriberFirstTestCaseThirteen();
417         } else if (action == EVENTCASE15) {
418             SubscriberFirstTestCaseThirteen();
419         } else if (action == EVENTCASE16) {
420             SubscriberFirstTestCaseThirteen();
421         } else if (action == EVENTCASE17) {
422             SubscriberFirstTestCaseThirteen();
423         } else if (action == EVENTCASE18) {
424             SubscriberFirstTestCaseThirteen();
425         } else if (action == EVENTCASE19) {
426             SubscriberFirstTestCase19();
427         } else if (action == EVENTCASE20) {
428             SubscriberFirstTestCase20();
429         } else if (action == EVENTCASE21) {
430             SubscriberFirstTestCase21();
431         } else if (action == EVENTCASE22) {
432             SubscriberFirstTestCase22();
433         } else if (action == EVENTCASE23) {
434             SubscriberFirstTestCase23();
435         } else {
436             GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest  OnReceiveEvent do nothing";
437         }
438     }
439 
440 private:
SubscriberFirstTestCase1()441     void SubscriberFirstTestCase1()
442     {
443         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberSecondTestcase1 ";
444 
445         EXPECT_EQ(GetCode() == CODECASE1, true);
446         EXPECT_EQ(GetData() == DATACASE1, true);
447     }
SubscriberFirstTestCase2()448     void SubscriberFirstTestCase2()
449     {
450         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberSecondTestcase2 ";
451 
452         EXPECT_EQ(GetCode() == CODECASE2, true);
453         EXPECT_EQ(GetData() == DATACASE2, true);
454     }
SubscriberFirstTestCase3()455     void SubscriberFirstTestCase3()
456     {
457         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberSecondTestcase3 ";
458 
459         EXPECT_EQ(GetCode() == CODECASE3, true);
460         EXPECT_EQ(GetData() == DATACASE3, true);
461     }
SubscriberFirstTestCase4()462     void SubscriberFirstTestCase4()
463     {
464         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberSecondTestcase4 ";
465 
466         EXPECT_EQ(GetCode() == CODECASE4, true);
467         EXPECT_EQ(GetData() == DATACASE4, true);
468     }
SubscriberFirstTestCase5()469     void SubscriberFirstTestCase5()
470     {
471         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberSecondTestcase5 ";
472 
473         EXPECT_EQ(GetCode() == CODECASE5, true);
474         EXPECT_EQ(GetData() == DATACASE5, true);
475     }
SubscriberFirstTestCase6()476     void SubscriberFirstTestCase6()
477     {
478         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberSecondTestcase6 ";
479 
480         EXPECT_EQ(GetCode() == CODECASE6, true);
481         EXPECT_EQ(GetData() == DATACASE6, true);
482     }
SubscriberFirstTestCase7()483     void SubscriberFirstTestCase7()
484     {
485         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberSecondTestcase7 ";
486 
487         EXPECT_EQ(GetCode() == CODECASE7, true);
488         EXPECT_EQ(GetData() == DATACASE7, true);
489     }
SubscriberFirstTestCaseEight()490     void SubscriberFirstTestCaseEight()
491     {
492         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberFirstTestcase8_12 ";
493         EXPECT_TRUE(AbortCommonEvent());
494         EXPECT_TRUE(GetAbortCommonEvent());
495         EXPECT_TRUE(ClearAbortCommonEvent());
496         EXPECT_FALSE(GetAbortCommonEvent());
497         EXPECT_TRUE(IsOrderedCommonEvent());
498     }
499 
SubscriberFirstTestCaseThirteen()500     void SubscriberFirstTestCaseThirteen()
501     {
502         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberFirstTestcase13_18 ";
503         EXPECT_FALSE(AbortCommonEvent());
504         EXPECT_FALSE(GetAbortCommonEvent());
505         EXPECT_FALSE(ClearAbortCommonEvent());
506         EXPECT_FALSE(GetAbortCommonEvent());
507         EXPECT_FALSE(IsOrderedCommonEvent());
508     }
509 
SubscriberFirstTestCase19()510     void SubscriberFirstTestCase19()
511     {
512         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberThirdTestcase19 ";
513     }
514 
SubscriberFirstTestCase20()515     void SubscriberFirstTestCase20()
516     {
517         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberThirdTestcase20 ";
518     }
519 
SubscriberFirstTestCase21()520     void SubscriberFirstTestCase21()
521     {
522         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberThirdTestcase21 ";
523     }
524 
SubscriberFirstTestCase22()525     void SubscriberFirstTestCase22()
526     {
527         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberThirdTestcase22 ";
528     }
529 
SubscriberFirstTestCase23()530     void SubscriberFirstTestCase23()
531     {
532         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberSecondTest OnReceiveEvent SubscriberThirdTestcase23 ";
533     }
534 };
535 
536 class SubscriberThirdTest : public CommonEventSubscriber {
537 public:
SubscriberThirdTest(const CommonEventSubscribeInfo & subscribeInfo)538     explicit SubscriberThirdTest(const CommonEventSubscribeInfo &subscribeInfo) : CommonEventSubscriber(subscribeInfo)
539     {}
540 
~SubscriberThirdTest()541     ~SubscriberThirdTest()
542     {}
543 
OnReceiveEvent(const CommonEventData & data)544     virtual void OnReceiveEvent(const CommonEventData &data)
545     {
546         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent ";
547         std::string action = data.GetWant().GetAction();
548         if (action == EVENTCASE1) {
549             SubscriberFirstTestCase1();
550         } else if (action == EVENTCASE2) {
551             SubscriberFirstTestCase2();
552         } else if (action == EVENTCASE3) {
553             SubscriberFirstTestCase3();
554         } else if (action == EVENTCASE4) {
555             SubscriberFirstTestCase4();
556         } else if (action == EVENTCASE5) {
557             SubscriberFirstTestCase5();
558         } else if (action == EVENTCASE6) {
559             SubscriberFirstTestCase6();
560         } else if (action == EVENTCASE7) {
561             SubscriberFirstTestCase7();
562         } else if (action == EVENTCASE8) {
563             SubscriberFirstTestCaseEight();
564         } else if (action == EVENTCASE9) {
565             SubscriberFirstTestCaseEight();
566         } else if (action == EVENTCASE10) {
567             SubscriberFirstTestCaseEight();
568         } else if (action == EVENTCASE11) {
569             SubscriberFirstTestCaseEight();
570         } else if (action == EVENTCASE12) {
571             SubscriberFirstTestCaseEight();
572         } else if (action == EVENTCASE13) {
573             SubscriberFirstTestCaseThirteen();
574         } else if (action == EVENTCASE14) {
575             SubscriberFirstTestCaseThirteen();
576         } else if (action == EVENTCASE15) {
577             SubscriberFirstTestCaseThirteen();
578         } else if (action == EVENTCASE16) {
579             SubscriberFirstTestCaseThirteen();
580         } else if (action == EVENTCASE17) {
581             SubscriberFirstTestCaseThirteen();
582         } else if (action == EVENTCASE18) {
583             SubscriberFirstTestCaseThirteen();
584         } else if (action == EVENTCASE19) {
585             SubscriberFirstTestCase19();
586         } else if (action == EVENTCASE20) {
587             SubscriberFirstTestCase20();
588         } else if (action == EVENTCASE21) {
589             SubscriberFirstTestCase21();
590         } else if (action == EVENTCASE22) {
591             SubscriberFirstTestCase22();
592         } else if (action == EVENTCASE23) {
593             SubscriberFirstTestCase23();
594         } else {
595             GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdtTest  OnReceiveEvent do nothing";
596         }
597     }
598 
599 private:
SubscriberFirstTestCase1()600     void SubscriberFirstTestCase1()
601     {
602         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase1 ";
603 
604         EXPECT_EQ(GetCode() == CODECASE1, true);
605         EXPECT_EQ(GetData() == DATACASE1, true);
606     }
SubscriberFirstTestCase2()607     void SubscriberFirstTestCase2()
608     {
609         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase2 ";
610 
611         EXPECT_EQ(GetCode() == CODECASE2, true);
612         EXPECT_EQ(GetData() == DATACASE2, true);
613     }
SubscriberFirstTestCase3()614     void SubscriberFirstTestCase3()
615     {
616         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase3 ";
617 
618         EXPECT_EQ(GetCode() == CODECASE3, true);
619         EXPECT_EQ(GetData() == DATACASE3, true);
620     }
SubscriberFirstTestCase4()621     void SubscriberFirstTestCase4()
622     {
623         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase4 ";
624 
625         EXPECT_EQ(GetCode() == CODECASE4, true);
626         EXPECT_EQ(GetData() == DATACASE4, true);
627     }
SubscriberFirstTestCase5()628     void SubscriberFirstTestCase5()
629     {
630         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase5 ";
631 
632         EXPECT_EQ(GetCode() == CODECASE5, true);
633         EXPECT_EQ(GetData() == DATACASE5, true);
634     }
SubscriberFirstTestCase6()635     void SubscriberFirstTestCase6()
636     {
637         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase6 ";
638 
639         EXPECT_EQ(GetCode() == CODECASE6, true);
640         EXPECT_EQ(GetData() == DATACASE6, true);
641     }
SubscriberFirstTestCase7()642     void SubscriberFirstTestCase7()
643     {
644         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase7 ";
645 
646         EXPECT_EQ(GetCode() == CODECASE7, true);
647         EXPECT_EQ(GetData() == DATACASE7, true);
648     }
SubscriberFirstTestCaseEight()649     void SubscriberFirstTestCaseEight()
650     {
651         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberFirstTestcase8_12 ";
652         EXPECT_TRUE(AbortCommonEvent());
653         EXPECT_TRUE(GetAbortCommonEvent());
654         EXPECT_TRUE(ClearAbortCommonEvent());
655         EXPECT_FALSE(GetAbortCommonEvent());
656         EXPECT_TRUE(IsOrderedCommonEvent());
657     }
658 
SubscriberFirstTestCaseThirteen()659     void SubscriberFirstTestCaseThirteen()
660     {
661         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberFirstTestcase13_18 ";
662         EXPECT_FALSE(AbortCommonEvent());
663         EXPECT_FALSE(GetAbortCommonEvent());
664         EXPECT_FALSE(ClearAbortCommonEvent());
665         EXPECT_FALSE(GetAbortCommonEvent());
666         EXPECT_FALSE(IsOrderedCommonEvent());
667     }
668 
SubscriberFirstTestCase19()669     void SubscriberFirstTestCase19()
670     {
671         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase19 ";
672     }
673 
SubscriberFirstTestCase20()674     void SubscriberFirstTestCase20()
675     {
676         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase20 ";
677     }
678 
SubscriberFirstTestCase21()679     void SubscriberFirstTestCase21()
680     {
681         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase21 ";
682     }
683 
SubscriberFirstTestCase22()684     void SubscriberFirstTestCase22()
685     {
686         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase22 ";
687     }
688 
SubscriberFirstTestCase23()689     void SubscriberFirstTestCase23()
690     {
691         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberThirdTest OnReceiveEvent SubscriberThirdTestcase23 ";
692     }
693 };
694 
695 class SubscriberPublishTest : public CommonEventSubscriber {
696 public:
SubscriberPublishTest(const CommonEventSubscribeInfo & subscribeInfo)697     explicit SubscriberPublishTest(const CommonEventSubscribeInfo &subscribeInfo)
698         : CommonEventSubscriber(subscribeInfo)
699     {}
700 
~SubscriberPublishTest()701     ~SubscriberPublishTest()
702     {}
703 
OnReceiveEvent(const CommonEventData & data)704     virtual void OnReceiveEvent(const CommonEventData &data)
705     {
706         GTEST_LOG_(INFO) << "ActsCESDataTest::SubscriberPublishTest OnReceiveEvent ";
707         std::string action = data.GetWant().GetAction();
708     }
709 };
710 
SetUpTestCase(void)711 void ActsCESDataTest::SetUpTestCase(void)
712 {}
713 
TearDownTestCase(void)714 void ActsCESDataTest::TearDownTestCase(void)
715 {}
716 
SetUp(void)717 void ActsCESDataTest::SetUp(void)
718 {}
719 
TearDown(void)720 void ActsCESDataTest::TearDown(void)
721 {}
722 
723 /*
724  * @tc.number: CES_CommonEventData_CodeData_0100
725  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
726  * @tc.desc: 1.Set three Subscriber
727  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
728  * GetData
729  */
730 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeData_0100, Function | MediumTest | Level1)
731 {
732     // the first subscriber
733     MatchingSkills matchingSkills;
734     matchingSkills.AddEvent(EVENTCASE1);
735 
736     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
737 
738     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
739     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
740     EXPECT_TRUE(subscribeFirstResult);
741 
742     // the second subscriber
743     MatchingSkills matchingSkillsSecond;
744     matchingSkillsSecond.AddEvent(EVENTCASE1);
745 
746     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
747 
748     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
749         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
750     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
751     EXPECT_TRUE(subscribeResultSecond);
752 
753     // the third subscriber
754     MatchingSkills matchingSkillsThird;
755     matchingSkillsThird.AddEvent(EVENTCASE1);
756 
757     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
758 
759     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
760         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
761     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
762     EXPECT_TRUE(subscribeResultThird);
763 
764     // publish
765     Want want;
766     want.SetAction(EVENTCASE1);
767 
768     CommonEventData data;
769     data.SetWant(want);
770     data.SetCode(CODECASE1);
771     data.SetData(DATACASE1);
772 
773     EXPECT_EQ(data.GetCode() == CODECASE1, true);
774     EXPECT_EQ(data.GetData() == DATACASE1, true);
775 
776     CommonEventPublishInfo publishInfo;
777     publishInfo.SetOrdered(true);
778 
779     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
780         std::make_shared<SubscriberPublishTest>(subscribeInfo);
781     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
782     Delay(1);
783     EXPECT_TRUE(publishResult);
784 
785     EXPECT_EQ(data.GetCode() == CODECASE1, true);
786     EXPECT_EQ(data.GetData() == DATACASE1, true);
787 }
788 
789 /*
790  * @tc.number: CES_CommonEventData_CodeData_0200
791  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
792  * @tc.desc: 1.Set three Subscriber
793  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
794  * GetData
795  */
796 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeData_0200, Function | MediumTest | Level1)
797 {
798     // the first subscriber
799     MatchingSkills matchingSkills;
800     matchingSkills.AddEvent(EVENTCASE2);
801 
802     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
803 
804     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
805     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
806     EXPECT_TRUE(subscribeFirstResult);
807 
808     // the second subscriber
809     MatchingSkills matchingSkillsSecond;
810     matchingSkillsSecond.AddEvent(EVENTCASE2);
811 
812     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
813 
814     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
815         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
816     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
817     EXPECT_TRUE(subscribeResultSecond);
818 
819     // the third subscriber
820     MatchingSkills matchingSkillsThird;
821     matchingSkillsThird.AddEvent(EVENTCASE2);
822 
823     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
824 
825     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
826         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
827     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
828     EXPECT_TRUE(subscribeResultThird);
829 
830     // publish
831     Want want;
832     want.SetAction(EVENTCASE2);
833 
834     CommonEventData data;
835     data.SetWant(want);
836     data.SetCode(CODECASE2);
837     data.SetData(DATACASE2);
838 
839     EXPECT_EQ(data.GetCode() == CODECASE2, true);
840     EXPECT_EQ(data.GetData() == DATACASE2, true);
841 
842     CommonEventPublishInfo publishInfo;
843     publishInfo.SetOrdered(true);
844 
845     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
846         std::make_shared<SubscriberPublishTest>(subscribeInfo);
847     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
848     Delay(1);
849     EXPECT_TRUE(publishResult);
850 
851     EXPECT_EQ(data.GetCode() == CODECASE2, true);
852     EXPECT_EQ(data.GetData() == DATACASE2, true);
853 }
854 
855 /*
856  * @tc.number: CES_CommonEventData_CodeData_0300
857  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
858  * @tc.desc: 1.Set three Subscriber
859  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
860  * GetData
861  */
862 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeData_0300, Function | MediumTest | Level1)
863 {
864     // the first subscriber
865     MatchingSkills matchingSkills;
866     matchingSkills.AddEvent(EVENTCASE3);
867 
868     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
869     subscribeInfo.SetPriority(LOWPRIORITY);
870 
871     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
872     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
873     EXPECT_TRUE(subscribeFirstResult);
874 
875     // the second subscriber
876     MatchingSkills matchingSkillsSecond;
877     matchingSkillsSecond.AddEvent(EVENTCASE3);
878 
879     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
880     subscribeInfoSecond.SetPriority(MIDPRIORITY);
881 
882     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
883         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
884     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
885     EXPECT_TRUE(subscribeResultSecond);
886 
887     // the third subscriber
888     MatchingSkills matchingSkillsThird;
889     matchingSkillsThird.AddEvent(EVENTCASE3);
890 
891     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
892     subscribeInfoThird.SetPriority(HIGHPRIORITY);
893 
894     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
895         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
896     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
897     EXPECT_TRUE(subscribeResultThird);
898 
899     // publish
900     Want want;
901     want.SetAction(EVENTCASE3);
902 
903     CommonEventData data;
904     data.SetWant(want);
905     data.SetCode(CODECASE3);
906     data.SetData(DATACASE3);
907 
908     EXPECT_EQ(data.GetCode() == CODECASE3, true);
909     EXPECT_EQ(data.GetData() == DATACASE3, true);
910 
911     CommonEventPublishInfo publishInfo;
912     publishInfo.SetOrdered(true);
913 
914     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
915         std::make_shared<SubscriberPublishTest>(subscribeInfo);
916     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
917     Delay(1);
918     EXPECT_TRUE(publishResult);
919 
920     EXPECT_EQ(data.GetCode() == CODECASE3, true);
921     EXPECT_EQ(data.GetData() == DATACASE3, true);
922 }
923 
924 /*
925  * @tc.number: CES_CommonEventData_CodeData_0400
926  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
927  * @tc.desc: 1.Set three Subscriber
928  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
929  * GetData
930  */
931 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeData_0400, Function | MediumTest | Level1)
932 {
933     // the first subscriber
934     MatchingSkills matchingSkills;
935     matchingSkills.AddEvent(EVENTCASE4);
936 
937     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
938     subscribeInfo.SetPriority(LOWPRIORITY);
939 
940     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
941     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
942     EXPECT_TRUE(subscribeFirstResult);
943 
944     // the second subscriber
945     MatchingSkills matchingSkillsSecond;
946     matchingSkillsSecond.AddEvent(EVENTCASE4);
947 
948     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
949     subscribeInfoSecond.SetPriority(MIDPRIORITY);
950 
951     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
952         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
953     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
954     EXPECT_TRUE(subscribeResultSecond);
955 
956     // the third subscriber
957     MatchingSkills matchingSkillsThird;
958     matchingSkillsThird.AddEvent(EVENTCASE4);
959 
960     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
961     subscribeInfoThird.SetPriority(HIGHPRIORITY);
962 
963     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
964         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
965     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
966     EXPECT_TRUE(subscribeResultThird);
967 
968     // publish
969     Want want;
970     want.SetAction(EVENTCASE4);
971 
972     CommonEventData data;
973     data.SetWant(want);
974     data.SetCode(CODECASE4);
975     data.SetData(DATACASE4);
976 
977     EXPECT_EQ(data.GetCode() == CODECASE4, true);
978     EXPECT_EQ(data.GetData() == DATACASE4, true);
979 
980     CommonEventPublishInfo publishInfo;
981     publishInfo.SetOrdered(true);
982 
983     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
984         std::make_shared<SubscriberPublishTest>(subscribeInfo);
985     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
986     Delay(1);
987     EXPECT_TRUE(publishResult);
988 
989     EXPECT_EQ(data.GetCode() == CODECASE4, true);
990     EXPECT_EQ(data.GetData() == DATACASE4, true);
991 }
992 
993 /*
994  * @tc.number: CES_CommonEventData_CodeData_0500
995  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
996  * @tc.desc: 1.Set three Subscriber
997  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
998  * GetData
999  */
1000 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeData_0500, Function | MediumTest | Level1)
1001 {
1002     // the first subscriber
1003     MatchingSkills matchingSkills;
1004     matchingSkills.AddEvent(EVENTCASE5);
1005 
1006     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1007     subscribeInfo.SetPriority(LOWPRIORITY);
1008 
1009     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1010     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1011     EXPECT_TRUE(subscribeFirstResult);
1012 
1013     // the second subscriber
1014     MatchingSkills matchingSkillsSecond;
1015     matchingSkillsSecond.AddEvent(EVENTCASE5);
1016 
1017     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1018     subscribeInfoSecond.SetPriority(MIDPRIORITY);
1019 
1020     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1021         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1022     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1023     EXPECT_TRUE(subscribeResultSecond);
1024 
1025     // the third subscriber
1026     MatchingSkills matchingSkillsThird;
1027     matchingSkillsThird.AddEvent(EVENTCASE5);
1028 
1029     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1030     subscribeInfoThird.SetPriority(HIGHPRIORITY);
1031 
1032     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1033         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1034     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1035     EXPECT_TRUE(subscribeResultThird);
1036 
1037     // publish
1038     Want want;
1039     want.SetAction(EVENTCASE5);
1040 
1041     CommonEventData data;
1042     data.SetWant(want);
1043     data.SetCode(CODECASE5);
1044     data.SetData(DATACASE5);
1045 
1046     EXPECT_EQ(data.GetCode() == CODECASE5, true);
1047     EXPECT_EQ(data.GetData() == DATACASE5, true);
1048 
1049     CommonEventPublishInfo publishInfo;
1050     publishInfo.SetOrdered(true);
1051 
1052     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1053         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1054     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1055     Delay(1);
1056     EXPECT_TRUE(publishResult);
1057 
1058     EXPECT_EQ(data.GetCode() == CODECASE5, true);
1059     EXPECT_EQ(data.GetData() == DATACASE5, true);
1060 }
1061 
1062 /*
1063  * @tc.number: CES_CommonEventData_CodeData_0600
1064  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
1065  * @tc.desc: 1.Set three Subscriber
1066  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
1067  * GetData
1068  */
1069 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeData_0600, Function | MediumTest | Level1)
1070 {
1071     // the first subscriber
1072     MatchingSkills matchingSkills;
1073     matchingSkills.AddEvent(EVENTCASE6);
1074 
1075     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1076 
1077     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1078     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1079     EXPECT_TRUE(subscribeFirstResult);
1080 
1081     // the second subscriber
1082     MatchingSkills matchingSkillsSecond;
1083     matchingSkillsSecond.AddEvent(EVENTCASE6);
1084 
1085     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1086 
1087     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1088         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1089     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1090     EXPECT_TRUE(subscribeResultSecond);
1091 
1092     // the third subscriber
1093     MatchingSkills matchingSkillsThird;
1094     matchingSkillsThird.AddEvent(EVENTCASE6);
1095 
1096     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1097 
1098     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1099         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1100     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1101     EXPECT_TRUE(subscribeResultThird);
1102 
1103     // publish
1104     Want want;
1105     want.SetAction(EVENTCASE6);
1106 
1107     CommonEventData data;
1108     data.SetWant(want);
1109     data.SetCode(CODECASE6);
1110     data.SetData(DATACASE6);
1111 
1112     EXPECT_EQ(data.GetCode() == CODECASE6, true);
1113     EXPECT_EQ(data.GetData() == DATACASE6, true);
1114 
1115     CommonEventPublishInfo publishInfo;
1116     publishInfo.SetOrdered(true);
1117 
1118     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1119         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1120     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1121     Delay(1);
1122     EXPECT_TRUE(publishResult);
1123 
1124     EXPECT_EQ(data.GetCode() == CODECASE6, true);
1125     EXPECT_EQ(data.GetData() == DATACASE6, true);
1126 }
1127 
1128 /*
1129  * @tc.number: CES_CommonEventData_CodeData_0700
1130  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
1131  * @tc.desc: 1.Set three Subscriber
1132  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
1133  * GetData
1134  */
1135 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeData_0700, Function | MediumTest | Level1)
1136 {
1137     // the first subscriber
1138     MatchingSkills matchingSkills;
1139     matchingSkills.AddEvent(EVENTCASE7);
1140 
1141     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1142     subscribeInfo.SetPriority(LOWPRIORITY);
1143 
1144     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1145     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1146     EXPECT_TRUE(subscribeFirstResult);
1147 
1148     // the second subscriber
1149     MatchingSkills matchingSkillsSecond;
1150     matchingSkillsSecond.AddEvent(EVENTCASE7);
1151 
1152     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1153     subscribeInfoSecond.SetPriority(MIDPRIORITY);
1154 
1155     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1156         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1157     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1158     EXPECT_TRUE(subscribeResultSecond);
1159 
1160     // the third subscriber
1161     MatchingSkills matchingSkillsThird;
1162     matchingSkillsThird.AddEvent(EVENTCASE7);
1163 
1164     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1165     subscribeInfoThird.SetPriority(HIGHPRIORITY);
1166 
1167     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1168         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1169     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1170     EXPECT_TRUE(subscribeResultThird);
1171 
1172     // publish
1173     Want want;
1174     want.SetAction(EVENTCASE7);
1175 
1176     CommonEventData data;
1177     data.SetWant(want);
1178     data.SetCode(CODECASE7);
1179     data.SetData(DATACASE7);
1180 
1181     EXPECT_EQ(data.GetCode() == CODECASE7, true);
1182     EXPECT_EQ(data.GetData() == DATACASE7, true);
1183 
1184     CommonEventPublishInfo publishInfo;
1185     publishInfo.SetOrdered(true);
1186 
1187     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1188         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1189     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1190     Delay(1);
1191     EXPECT_TRUE(publishResult);
1192 
1193     EXPECT_EQ(data.GetCode() == CODECASE7, true);
1194     EXPECT_EQ(data.GetData() == DATACASE7, true);
1195 }
1196 
1197 /*
1198  * @tc.number: CES_CommonEventData_Want_0100
1199  * @tc.name: CommonEventData : SetWant and GetWant
1200  * @tc.desc: 1.Set Subscriber
1201  *           2.Verify the function of CommonEventData when publish order event: SetWant and GetWant
1202  */
1203 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0100, Function | MediumTest | Level1)
1204 {
1205     std::string eventName = "TESTEVENT_PUBLISH_ACTION";
1206     std::string eventAction = "TESTEVENT_PUBLISH_ACTION";
1207     bool resultWant = false;
1208 
1209     MatchingSkills matchingSkills;
1210     matchingSkills.AddEvent(eventName);
1211     Want wantTest;
1212     wantTest.SetAction(eventAction);
1213     CommonEventData commonEventData;
1214     commonEventData.SetWant(wantTest);
1215 
1216     CommonEventPublishInfo publishInfo;
1217     publishInfo.SetOrdered(true);
1218     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1219     std::shared_ptr<SubscriberPublishTest> subscriber = std::make_shared<SubscriberPublishTest>(subscribeInfo);
1220 
1221     CommonEventManager::PublishCommonEvent(commonEventData, publishInfo, subscriber);
1222     resultWant = (commonEventData.GetWant().GetAction() == wantTest.GetAction());
1223     EXPECT_TRUE(resultWant);
1224 }
1225 
1226 /*
1227  * @tc.number: CES_CommonEventData_Want_0200
1228  * @tc.name: CommonEventData : GetWant
1229  * @tc.desc: 1.Set Subscriber
1230  *           2.Verify the function of CommonEventData when publish order event: GetWant
1231  */
1232 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0200, Function | MediumTest | Level1)
1233 {
1234     std::string eventName = "TESTEVENT_PUBLISH_ACTION2";
1235     std::string eventAction = "TESTEVENT_PUBLISH_ACTION2";
1236     int codeTest = 1;
1237     std::string dataTest = "DATA_GET_CODE_TEST";
1238     bool resultWant = false;
1239 
1240     MatchingSkills matchingSkills;
1241     matchingSkills.AddEvent(eventName);
1242     Want wantTest;
1243     wantTest.SetAction(eventAction);
1244     CommonEventData commonEventData(wantTest, codeTest, dataTest);
1245 
1246     CommonEventPublishInfo publishInfo;
1247     publishInfo.SetOrdered(true);
1248     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1249     std::shared_ptr<SubscriberPublishTest> subscriber = std::make_shared<SubscriberPublishTest>(subscribeInfo);
1250 
1251     CommonEventManager::PublishCommonEvent(commonEventData, publishInfo, subscriber);
1252     resultWant = (commonEventData.GetWant().GetAction() == wantTest.GetAction());
1253     EXPECT_TRUE(resultWant);
1254 }
1255 
1256 /*
1257  * @tc.number: CES_CommonEventData_Want_0300
1258  * @tc.name: CommonEventData : GetWant
1259  * @tc.desc: 1.Set Subscriber
1260  *           2.Verify the function of CommonEventData when publish order event: GetWant
1261  */
1262 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0300, Function | MediumTest | Level1)
1263 {
1264     Want wantTest;
1265     bool resultWant = false;
1266     CommonEventData commonEventData;
1267     resultWant = (commonEventData.GetWant().GetAction() == wantTest.GetAction());
1268     EXPECT_TRUE(resultWant);
1269 }
1270 
1271 /*
1272  * @tc.number: CES_CommonEventData_Want_0400
1273  * @tc.name: CommonEventData : SetWant and GetWant
1274  * @tc.desc: 1.Set Subscriber
1275  *           2.Verify the function of CommonEventData when publish order event: SetWant and GetWant
1276  */
1277 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0400, Function | MediumTest | Level1)
1278 {
1279     bool resultWant = false;
1280     std::string eventAction = "TESTEVENT_PUBLISH_ACTION1";
1281     std::string eventAction2 = "TESTEVENT_PUBLISH_ACTION2";
1282     std::string dataTest = "DATA_GET_CODE_TEST2";
1283     Want wantTest;
1284     wantTest.SetAction(eventAction);
1285     Want wantTest2;
1286     wantTest2.SetAction(eventAction2);
1287     CommonEventData commonEventData(wantTest);
1288     commonEventData.SetWant(wantTest2);
1289     resultWant = (commonEventData.GetWant().GetAction() == wantTest2.GetAction());
1290     EXPECT_TRUE(resultWant);
1291 }
1292 
1293 /*
1294  * @tc.number: CES_CommonEventData_Want_0500
1295  * @tc.name: CommonEventData : GetWant
1296  * @tc.desc: 1.Set Subscriber
1297  *           2.Verify the function of CommonEventData when publish order event: GetWant
1298  */
1299 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0500, Function | MediumTest | Level1)
1300 {
1301     int codeTest = 2;
1302     bool resultWant = false;
1303     std::string eventAction = "TESTEVENT_PUBLISH_ACTION3";
1304     std::string dataTest = "DATA_GET_CODE_TEST3";
1305     CommonEventData commonEventData;
1306     Want wantTest;
1307     wantTest.SetAction(eventAction);
1308     CommonEventData commonEventData2(wantTest, codeTest, dataTest);
1309     resultWant = (commonEventData2.GetWant().GetAction() == wantTest.GetAction());
1310     EXPECT_TRUE(resultWant);
1311 }
1312 
1313 /*
1314  * @tc.number: CES_CommonEventData_Want_0600
1315  * @tc.name: CommonEventData : SetWant
1316  * @tc.desc: 1.Set Subscriber
1317  *           2.Verify the function of CommonEventData when publish order event: SetWant
1318  */
1319 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0600, Function | MediumTest | Level1)
1320 {
1321     bool resultWant = false;
1322     std::string eventName = "TESTEVENT_PUBLISH_ACTION2";
1323     std::string eventAction = "TESTEVENT_PUBLISH_ACTION2";
1324     std::string eventAction2 = "TESTEVENT_PUBLISH_ACTION3";
1325     int codeTest = 1;
1326     std::string dataTest = "DATA_GET_CODE_TEST";
1327 
1328     MatchingSkills matchingSkills;
1329     matchingSkills.AddEvent(eventName);
1330     Want wantTest;
1331     wantTest.SetAction(eventAction);
1332     Want wantTest2;
1333     wantTest2.SetAction(eventAction2);
1334     CommonEventData commonEventData(wantTest, codeTest, dataTest);
1335     commonEventData.SetWant(wantTest2);
1336     CommonEventPublishInfo publishInfo;
1337     publishInfo.SetOrdered(true);
1338     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1339     std::shared_ptr<SubscriberPublishTest> subscriber = std::make_shared<SubscriberPublishTest>(subscribeInfo);
1340 
1341     CommonEventManager::PublishCommonEvent(commonEventData, publishInfo, subscriber);
1342     resultWant = (commonEventData.GetWant().GetAction() == wantTest2.GetAction());
1343     EXPECT_TRUE(resultWant);
1344 }
1345 
1346 /*
1347  * @tc.number: CES_CommonEventData_Want_0700
1348  * @tc.name: CommonEventData : SetWant
1349  * @tc.desc: 1.Set Subscriber
1350  *           2.Verify the function of CommonEventData when publish order event: SetWant
1351  */
1352 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0700, Function | MediumTest | Level1)
1353 {
1354     bool resultWant = false;
1355     std::string eventAction = "TESTEVENT_PUBLISH_ACTION2";
1356     Want wantTest;
1357     wantTest.SetAction(eventAction);
1358     CommonEventData commonEventData;
1359     commonEventData.SetWant(wantTest);
1360     resultWant = (commonEventData.GetWant().GetAction() == wantTest.GetAction());
1361     EXPECT_TRUE(resultWant);
1362 }
1363 
1364 /*
1365  * @tc.number: CES_CommonEventData_Want_0800
1366  * @tc.name: CommonEventData : SetWant
1367  * @tc.desc: 1.Set Subscriber
1368  *           2.Verify the function of CommonEventData when publish order event: SetWant
1369  */
1370 HWTEST_F(ActsCESDataTest, CES_CommonEventData_Want_0800, Function | MediumTest | Level1)
1371 {
1372     int codeTest = 2;
1373     bool resultWant = false;
1374     std::string eventAction = "TESTEVENT_PUBLISH_ACTION3";
1375     std::string eventAction2 = "TESTEVENT_PUBLISH_ACTION4";
1376     std::string dataTest = "DATA_GET_CODE_TEST3";
1377     CommonEventData commonEventData;
1378     Want wantTest;
1379     wantTest.SetAction(eventAction);
1380     Want wantTest2;
1381     wantTest2.SetAction(eventAction2);
1382     CommonEventData commonEventData2(wantTest, codeTest, dataTest);
1383     commonEventData2.SetWant(wantTest2);
1384     resultWant = (commonEventData2.GetWant().GetAction() == wantTest2.GetAction());
1385     EXPECT_TRUE(resultWant);
1386 }
1387 
1388 /*
1389  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0100
1390  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1391  * @tc.desc: 1.Set three Subscriber
1392  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
1393  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1394  */
1395 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0100, Function | MediumTest | Level1)
1396 {
1397     // the first subscriber
1398     MatchingSkills matchingSkills;
1399     matchingSkills.AddEvent(EVENTCASE8);
1400 
1401     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1402 
1403     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1404     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1405     EXPECT_TRUE(subscribeFirstResult);
1406 
1407     // the second subscriber
1408     MatchingSkills matchingSkillsSecond;
1409     matchingSkillsSecond.AddEvent(EVENTCASE8);
1410 
1411     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1412 
1413     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1414         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1415     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1416     EXPECT_TRUE(subscribeResultSecond);
1417 
1418     // the third subscriber
1419     MatchingSkills matchingSkillsThird;
1420     matchingSkillsThird.AddEvent(EVENTCASE8);
1421 
1422     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1423 
1424     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1425         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1426     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1427     EXPECT_TRUE(subscribeResultThird);
1428 
1429     // publish
1430     Want want;
1431     want.SetAction(EVENTCASE8);
1432 
1433     CommonEventData data;
1434     data.SetWant(want);
1435     data.SetCode(CODECASE8);
1436     data.SetData(DATACASE8);
1437 
1438     CommonEventPublishInfo publishInfo;
1439     publishInfo.SetOrdered(true);
1440 
1441     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1442         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1443     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1444     Delay(1);
1445     EXPECT_TRUE(publishResult);
1446 }
1447 
1448 /*
1449  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0200
1450  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1451  * @tc.desc: 1.Set three Subscriber
1452  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
1453  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1454  */
1455 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0200, Function | MediumTest | Level1)
1456 {
1457     // the first subscriber
1458     MatchingSkills matchingSkills;
1459     matchingSkills.AddEvent(EVENTCASE9);
1460 
1461     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1462 
1463     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1464     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1465     EXPECT_TRUE(subscribeFirstResult);
1466 
1467     // the second subscriber
1468     MatchingSkills matchingSkillsSecond;
1469     matchingSkillsSecond.AddEvent(EVENTCASE9);
1470 
1471     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1472 
1473     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1474         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1475     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1476     EXPECT_TRUE(subscribeResultSecond);
1477 
1478     // the third subscriber
1479     MatchingSkills matchingSkillsThird;
1480     matchingSkillsThird.AddEvent(EVENTCASE9);
1481 
1482     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1483 
1484     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1485         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1486     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1487     EXPECT_TRUE(subscribeResultThird);
1488 
1489     // publish
1490     Want want;
1491     want.SetAction(EVENTCASE9);
1492 
1493     CommonEventData data;
1494     data.SetWant(want);
1495     data.SetCode(CODECASE9);
1496     data.SetData(DATACASE9);
1497 
1498     CommonEventPublishInfo publishInfo;
1499     publishInfo.SetOrdered(true);
1500 
1501     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1502         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1503     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1504     Delay(1);
1505     EXPECT_TRUE(publishResult);
1506 }
1507 
1508 /*
1509  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0300
1510  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1511  * @tc.desc: 1.Set three Subscriber
1512  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
1513  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1514  */
1515 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0300, Function | MediumTest | Level1)
1516 {
1517     // the first subscriber
1518     MatchingSkills matchingSkills;
1519     matchingSkills.AddEvent(EVENTCASE10);
1520 
1521     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1522 
1523     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1524     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1525     EXPECT_TRUE(subscribeFirstResult);
1526 
1527     // the second subscriber
1528     MatchingSkills matchingSkillsSecond;
1529     matchingSkillsSecond.AddEvent(EVENTCASE10);
1530 
1531     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1532 
1533     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1534         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1535     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1536     EXPECT_TRUE(subscribeResultSecond);
1537 
1538     // the third subscriber
1539     MatchingSkills matchingSkillsThird;
1540     matchingSkillsThird.AddEvent(EVENTCASE10);
1541 
1542     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1543 
1544     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1545         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1546     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1547     EXPECT_TRUE(subscribeResultThird);
1548 
1549     // publish
1550     Want want;
1551     want.SetAction(EVENTCASE10);
1552 
1553     CommonEventData data;
1554     data.SetWant(want);
1555     data.SetCode(CODECASE10);
1556     data.SetData(DATACASE10);
1557 
1558     CommonEventPublishInfo publishInfo;
1559     publishInfo.SetOrdered(true);
1560 
1561     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1562         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1563     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1564     Delay(1);
1565     EXPECT_TRUE(publishResult);
1566 }
1567 
1568 /*
1569  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0400
1570  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1571  * @tc.desc: 1.Set three Subscriber
1572  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
1573  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1574  */
1575 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0400, Function | MediumTest | Level1)
1576 {
1577     // the first subscriber
1578     MatchingSkills matchingSkills;
1579     matchingSkills.AddEvent(EVENTCASE11);
1580 
1581     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1582 
1583     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1584     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1585     EXPECT_TRUE(subscribeFirstResult);
1586 
1587     // the second subscriber
1588     MatchingSkills matchingSkillsSecond;
1589     matchingSkillsSecond.AddEvent(EVENTCASE11);
1590 
1591     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1592 
1593     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1594         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1595     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1596     EXPECT_TRUE(subscribeResultSecond);
1597 
1598     // the third subscriber
1599     MatchingSkills matchingSkillsThird;
1600     matchingSkillsThird.AddEvent(EVENTCASE11);
1601 
1602     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1603 
1604     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1605         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1606     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1607     EXPECT_TRUE(subscribeResultThird);
1608 
1609     // publish
1610     Want want;
1611     want.SetAction(EVENTCASE11);
1612 
1613     CommonEventData data;
1614     data.SetWant(want);
1615     data.SetCode(CODECASE11);
1616     data.SetData(DATACASE11);
1617 
1618     CommonEventPublishInfo publishInfo;
1619     publishInfo.SetOrdered(true);
1620 
1621     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1622         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1623     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1624     Delay(1);
1625     EXPECT_TRUE(publishResult);
1626 }
1627 
1628 /*
1629  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0500
1630  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1631  * @tc.desc: 1.Set three Subscriber
1632  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
1633  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1634  */
1635 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0500, Function | MediumTest | Level1)
1636 {
1637     // the first subscriber
1638     MatchingSkills matchingSkills;
1639     matchingSkills.AddEvent(EVENTCASE12);
1640 
1641     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1642 
1643     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1644     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1645     EXPECT_TRUE(subscribeFirstResult);
1646 
1647     // the second subscriber
1648     MatchingSkills matchingSkillsSecond;
1649     matchingSkillsSecond.AddEvent(EVENTCASE12);
1650 
1651     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1652 
1653     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1654         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1655     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1656     EXPECT_TRUE(subscribeResultSecond);
1657 
1658     // the third subscriber
1659     MatchingSkills matchingSkillsThird;
1660     matchingSkillsThird.AddEvent(EVENTCASE12);
1661 
1662     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1663 
1664     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1665         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1666     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1667     EXPECT_TRUE(subscribeResultThird);
1668 
1669     // publish
1670     Want want;
1671     want.SetAction(EVENTCASE12);
1672 
1673     CommonEventData data;
1674     data.SetWant(want);
1675     data.SetCode(CODECASE12);
1676     data.SetData(DATACASE12);
1677 
1678     CommonEventPublishInfo publishInfo;
1679     publishInfo.SetOrdered(true);
1680 
1681     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
1682         std::make_shared<SubscriberPublishTest>(subscribeInfo);
1683     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
1684     Delay(1);
1685     EXPECT_TRUE(publishResult);
1686 }
1687 
1688 /*
1689  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0600
1690  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1691  * @tc.desc: 1.Set three Subscriber
1692  *           2.Verify the function of CommonEventSubscriber when publish no order event: AbortCommonEvent
1693  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1694  */
1695 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0600, Function | MediumTest | Level1)
1696 {
1697     // the first subscriber
1698     MatchingSkills matchingSkills;
1699     matchingSkills.AddEvent(EVENTCASE13);
1700 
1701     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1702 
1703     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1704     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1705     EXPECT_TRUE(subscribeFirstResult);
1706 
1707     // the second subscriber
1708     MatchingSkills matchingSkillsSecond;
1709     matchingSkillsSecond.AddEvent(EVENTCASE13);
1710 
1711     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1712 
1713     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1714         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1715     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1716     EXPECT_TRUE(subscribeResultSecond);
1717 
1718     // the third subscriber
1719     MatchingSkills matchingSkillsThird;
1720     matchingSkillsThird.AddEvent(EVENTCASE13);
1721 
1722     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1723 
1724     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1725         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1726     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1727     EXPECT_TRUE(subscribeResultThird);
1728 
1729     // publish
1730     Want want;
1731     want.SetAction(EVENTCASE13);
1732 
1733     CommonEventData data;
1734     data.SetWant(want);
1735     data.SetCode(CODECASE13);
1736     data.SetData(DATACASE13);
1737 
1738     EXPECT_EQ(data.GetCode() == CODECASE13, true);
1739     EXPECT_EQ(data.GetData() == DATACASE13, true);
1740 
1741     bool publishResult = CommonEventManager::PublishCommonEvent(data);
1742     Delay(1);
1743     EXPECT_TRUE(publishResult);
1744 
1745     EXPECT_EQ(data.GetCode() == CODECASE13, true);
1746     EXPECT_EQ(data.GetData() == DATACASE13, true);
1747 }
1748 
1749 /*
1750  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0700
1751  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1752  * @tc.desc: 1.Set three Subscriber
1753  *           2.Verify the function of CommonEventSubscriber when publish no order event: AbortCommonEvent
1754  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1755  */
1756 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0700, Function | MediumTest | Level1)
1757 {
1758     // the first subscriber
1759     MatchingSkills matchingSkills;
1760     matchingSkills.AddEvent(EVENTCASE14);
1761 
1762     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1763 
1764     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1765     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1766     EXPECT_TRUE(subscribeFirstResult);
1767 
1768     // the second subscriber
1769     MatchingSkills matchingSkillsSecond;
1770     matchingSkillsSecond.AddEvent(EVENTCASE14);
1771 
1772     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1773 
1774     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1775         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1776     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1777     EXPECT_TRUE(subscribeResultSecond);
1778 
1779     // the third subscriber
1780     MatchingSkills matchingSkillsThird;
1781     matchingSkillsThird.AddEvent(EVENTCASE14);
1782 
1783     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1784 
1785     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1786         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1787     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1788     EXPECT_TRUE(subscribeResultThird);
1789 
1790     // publish
1791     Want want;
1792     want.SetAction(EVENTCASE14);
1793 
1794     CommonEventData data;
1795     data.SetWant(want);
1796     data.SetCode(CODECASE14);
1797     data.SetData(DATACASE14);
1798 
1799     EXPECT_EQ(data.GetCode() == CODECASE14, true);
1800     EXPECT_EQ(data.GetData() == DATACASE14, true);
1801 
1802     bool publishResult = CommonEventManager::PublishCommonEvent(data);
1803     Delay(1);
1804     EXPECT_TRUE(publishResult);
1805 
1806     EXPECT_EQ(data.GetCode() == CODECASE14, true);
1807     EXPECT_EQ(data.GetData() == DATACASE14, true);
1808 }
1809 
1810 /*
1811  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0800
1812  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1813  * @tc.desc: 1.Set three Subscriber
1814  *           2.Verify the function of CommonEventSubscriber when publish no order event: AbortCommonEvent
1815  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1816  */
1817 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0800, Function | MediumTest | Level1)
1818 {
1819     // the first subscriber
1820     MatchingSkills matchingSkills;
1821     matchingSkills.AddEvent(EVENTCASE15);
1822 
1823     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1824 
1825     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1826     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1827     EXPECT_TRUE(subscribeFirstResult);
1828 
1829     // the second subscriber
1830     MatchingSkills matchingSkillsSecond;
1831     matchingSkillsSecond.AddEvent(EVENTCASE15);
1832 
1833     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1834 
1835     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1836         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1837     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1838     EXPECT_TRUE(subscribeResultSecond);
1839 
1840     // the third subscriber
1841     MatchingSkills matchingSkillsThird;
1842     matchingSkillsThird.AddEvent(EVENTCASE15);
1843 
1844     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1845 
1846     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1847         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1848     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1849     EXPECT_TRUE(subscribeResultThird);
1850 
1851     // publish
1852     Want want;
1853     want.SetAction(EVENTCASE15);
1854 
1855     CommonEventData data;
1856     data.SetWant(want);
1857     data.SetCode(CODECASE15);
1858     data.SetData(DATACASE15);
1859 
1860     EXPECT_EQ(data.GetCode() == CODECASE15, true);
1861     EXPECT_EQ(data.GetData() == DATACASE15, true);
1862 
1863     bool publishResult = CommonEventManager::PublishCommonEvent(data);
1864     Delay(1);
1865     EXPECT_TRUE(publishResult);
1866 
1867     EXPECT_EQ(data.GetCode() == CODECASE15, true);
1868     EXPECT_EQ(data.GetData() == DATACASE15, true);
1869 }
1870 
1871 /*
1872  * @tc.number: CES_CommonEventSubscriber_CommonEvent_0900
1873  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1874  * @tc.desc: 1.Set three Subscriber
1875  *           2.Verify the function of CommonEventSubscriber when publish no order event: AbortCommonEvent
1876  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1877  */
1878 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_0900, Function | MediumTest | Level1)
1879 {
1880     // the first subscriber
1881     MatchingSkills matchingSkills;
1882     matchingSkills.AddEvent(EVENTCASE16);
1883 
1884     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1885 
1886     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1887     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1888     EXPECT_TRUE(subscribeFirstResult);
1889 
1890     // the second subscriber
1891     MatchingSkills matchingSkillsSecond;
1892     matchingSkillsSecond.AddEvent(EVENTCASE16);
1893 
1894     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1895 
1896     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1897         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1898     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1899     EXPECT_TRUE(subscribeResultSecond);
1900 
1901     // the third subscriber
1902     MatchingSkills matchingSkillsThird;
1903     matchingSkillsThird.AddEvent(EVENTCASE16);
1904 
1905     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1906 
1907     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1908         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1909     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1910     EXPECT_TRUE(subscribeResultThird);
1911 
1912     // publish
1913     Want want;
1914     want.SetAction(EVENTCASE16);
1915 
1916     CommonEventData data;
1917     data.SetWant(want);
1918     data.SetCode(CODECASE16);
1919     data.SetData(DATACASE16);
1920 
1921     EXPECT_EQ(data.GetCode() == CODECASE16, true);
1922     EXPECT_EQ(data.GetData() == DATACASE16, true);
1923 
1924     bool publishResult = CommonEventManager::PublishCommonEvent(data);
1925     Delay(1);
1926     EXPECT_TRUE(publishResult);
1927 
1928     EXPECT_EQ(data.GetCode() == CODECASE16, true);
1929     EXPECT_EQ(data.GetData() == DATACASE16, true);
1930 }
1931 
1932 /*
1933  * @tc.number: CES_CommonEventSubscriber_CommonEvent_1000
1934  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1935  * @tc.desc: 1.Set three Subscriber
1936  *           2.Verify the function of CommonEventSubscriber when publish no order event: AbortCommonEvent
1937  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1938  */
1939 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_1000, Function | MediumTest | Level1)
1940 {
1941     // the first subscriber
1942     MatchingSkills matchingSkills;
1943     matchingSkills.AddEvent(EVENTCASE17);
1944 
1945     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
1946 
1947     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
1948     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
1949     EXPECT_TRUE(subscribeFirstResult);
1950 
1951     // the second subscriber
1952     MatchingSkills matchingSkillsSecond;
1953     matchingSkillsSecond.AddEvent(EVENTCASE17);
1954 
1955     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
1956 
1957     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
1958         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
1959     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
1960     EXPECT_TRUE(subscribeResultSecond);
1961 
1962     // the third subscriber
1963     MatchingSkills matchingSkillsThird;
1964     matchingSkillsThird.AddEvent(EVENTCASE17);
1965 
1966     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
1967 
1968     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
1969         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
1970     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
1971     EXPECT_TRUE(subscribeResultThird);
1972 
1973     // publish
1974     Want want;
1975     want.SetAction(EVENTCASE17);
1976 
1977     CommonEventData data;
1978     data.SetWant(want);
1979     data.SetCode(CODECASE17);
1980     data.SetData(DATACASE17);
1981 
1982     EXPECT_EQ(data.GetCode() == CODECASE17, true);
1983     EXPECT_EQ(data.GetData() == DATACASE17, true);
1984 
1985     bool publishResult = CommonEventManager::PublishCommonEvent(data);
1986     Delay(1);
1987     EXPECT_TRUE(publishResult);
1988 
1989     EXPECT_EQ(data.GetCode() == CODECASE17, true);
1990     EXPECT_EQ(data.GetData() == DATACASE17, true);
1991 }
1992 
1993 /*
1994  * @tc.number: CES_CommonEventSubscriber_CommonEvent_1100
1995  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1996  * @tc.desc: 1.Set three Subscriber
1997  *           2.Verify the function of CommonEventSubscriber when publish no order event: AbortCommonEvent
1998  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
1999  */
2000 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEvent_1100, Function | MediumTest | Level1)
2001 {
2002     // the first subscriber
2003     MatchingSkills matchingSkills;
2004     matchingSkills.AddEvent(EVENTCASE18);
2005 
2006     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2007 
2008     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2009     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2010     EXPECT_TRUE(subscribeFirstResult);
2011 
2012     // the second subscriber
2013     MatchingSkills matchingSkillsSecond;
2014     matchingSkillsSecond.AddEvent(EVENTCASE18);
2015 
2016     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2017 
2018     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2019         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2020     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2021     EXPECT_TRUE(subscribeResultSecond);
2022 
2023     // the third subscriber
2024     MatchingSkills matchingSkillsThird;
2025     matchingSkillsThird.AddEvent(EVENTCASE18);
2026 
2027     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2028 
2029     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2030         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2031     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2032     EXPECT_TRUE(subscribeResultThird);
2033 
2034     // publish
2035     Want want;
2036     want.SetAction(EVENTCASE18);
2037 
2038     CommonEventData data;
2039     data.SetWant(want);
2040     data.SetCode(CODECASE18);
2041     data.SetData(DATACASE18);
2042 
2043     EXPECT_EQ(data.GetCode() == CODECASE18, true);
2044     EXPECT_EQ(data.GetData() == DATACASE18, true);
2045 
2046     bool publishResult = CommonEventManager::PublishCommonEvent(data);
2047     Delay(1);
2048     EXPECT_TRUE(publishResult);
2049 
2050     EXPECT_EQ(data.GetCode() == CODECASE18, true);
2051     EXPECT_EQ(data.GetData() == DATACASE18, true);
2052 }
2053 
2054 /*
2055  * @tc.number: CES_CommonEventSubscriber_CodeDataAsync_0100
2056  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
2057  * @tc.desc: 1.Set three Subscriber
2058  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
2059  *           SetData GetCode GetData and GoAsyncCommonEvent
2060  */
2061 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsync_0100, Function | MediumTest | Level1)
2062 {
2063     // the first subscriber
2064     MatchingSkills matchingSkills;
2065     matchingSkills.AddEvent(EVENTCASE19);
2066 
2067     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2068 
2069     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2070     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2071     EXPECT_TRUE(subscribeFirstResult);
2072 
2073     // the second subscriber
2074     MatchingSkills matchingSkillsSecond;
2075     matchingSkillsSecond.AddEvent(EVENTCASE19);
2076 
2077     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2078 
2079     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2080         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2081     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2082     EXPECT_TRUE(subscribeResultSecond);
2083 
2084     // the third subscriber
2085     MatchingSkills matchingSkillsThird;
2086     matchingSkillsThird.AddEvent(EVENTCASE19);
2087 
2088     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2089 
2090     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2091         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2092     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2093     EXPECT_TRUE(subscribeResultThird);
2094 
2095     // publish
2096     Want want;
2097     want.SetAction(EVENTCASE19);
2098 
2099     CommonEventData data;
2100     data.SetWant(want);
2101     data.SetCode(CODECASE19);
2102     data.SetData(DATACASE19);
2103 
2104     CommonEventPublishInfo publishInfo;
2105     publishInfo.SetOrdered(true);
2106 
2107     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
2108         std::make_shared<SubscriberPublishTest>(subscribeInfo);
2109     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
2110     Delay(2);
2111     EXPECT_TRUE(publishResult);
2112 }
2113 
2114 /*
2115  * @tc.number: CES_CommonEventSubscriber_CodeDataAsync_0200
2116  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
2117  * @tc.desc: 1.Set three Subscriber
2118  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
2119  *           SetData GetCode GetData and GoAsyncCommonEvent
2120  */
2121 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsync_0200, Function | MediumTest | Level1)
2122 {
2123     // the first subscriber
2124     MatchingSkills matchingSkills;
2125     matchingSkills.AddEvent(EVENTCASE20);
2126 
2127     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2128 
2129     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2130     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2131     EXPECT_TRUE(subscribeFirstResult);
2132 
2133     // the second subscriber
2134     MatchingSkills matchingSkillsSecond;
2135     matchingSkillsSecond.AddEvent(EVENTCASE20);
2136 
2137     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2138 
2139     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2140         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2141     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2142     EXPECT_TRUE(subscribeResultSecond);
2143 
2144     // the third subscriber
2145     MatchingSkills matchingSkillsThird;
2146     matchingSkillsThird.AddEvent(EVENTCASE20);
2147 
2148     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2149 
2150     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2151         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2152     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2153     EXPECT_TRUE(subscribeResultThird);
2154 
2155     // publish
2156     Want want;
2157     want.SetAction(EVENTCASE20);
2158 
2159     CommonEventData data;
2160     data.SetWant(want);
2161     data.SetCode(CODECASE20);
2162     data.SetData(DATACASE20);
2163 
2164     CommonEventPublishInfo publishInfo;
2165     publishInfo.SetOrdered(true);
2166 
2167     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
2168         std::make_shared<SubscriberPublishTest>(subscribeInfo);
2169     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
2170     Delay(1);
2171     EXPECT_TRUE(publishResult);
2172 }
2173 
2174 /*
2175  * @tc.number: CES_CommonEventSubscriber_CodeDataAsync_0300
2176  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
2177  * @tc.desc: 1.Set three Subscriber
2178  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
2179  *           SetData GetCode GetData and GoAsyncCommonEvent
2180  */
2181 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsync_0300, Function | MediumTest | Level1)
2182 {
2183     // the first subscriber
2184     MatchingSkills matchingSkills;
2185     matchingSkills.AddEvent(EVENTCASE21);
2186 
2187     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2188 
2189     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2190     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2191     EXPECT_TRUE(subscribeFirstResult);
2192 
2193     // the second subscriber
2194     MatchingSkills matchingSkillsSecond;
2195     matchingSkillsSecond.AddEvent(EVENTCASE21);
2196 
2197     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2198 
2199     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2200         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2201     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2202     EXPECT_TRUE(subscribeResultSecond);
2203 
2204     // the third subscriber
2205     MatchingSkills matchingSkillsThird;
2206     matchingSkillsThird.AddEvent(EVENTCASE21);
2207 
2208     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2209 
2210     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2211         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2212     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2213     EXPECT_TRUE(subscribeResultThird);
2214 
2215     // publish
2216     Want want;
2217     want.SetAction(EVENTCASE21);
2218 
2219     CommonEventData data;
2220     data.SetWant(want);
2221     data.SetCode(CODECASE21);
2222     data.SetData(DATACASE21);
2223 
2224     CommonEventPublishInfo publishInfo;
2225     publishInfo.SetOrdered(true);
2226 
2227     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
2228         std::make_shared<SubscriberPublishTest>(subscribeInfo);
2229     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
2230     Delay(1);
2231     EXPECT_TRUE(publishResult);
2232 }
2233 
2234 /*
2235  * @tc.number: CES_CommonEventSubscriber_CodeDataAsync_0400
2236  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
2237  * @tc.desc: 1.Set three Subscriber
2238  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
2239  *           SetData GetCode GetData and GoAsyncCommonEvent
2240  */
2241 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsync_0400, Function | MediumTest | Level1)
2242 {
2243     // the first subscriber
2244     MatchingSkills matchingSkills;
2245     matchingSkills.AddEvent(EVENTCASE22);
2246 
2247     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2248 
2249     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2250     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2251     EXPECT_TRUE(subscribeFirstResult);
2252 
2253     // the second subscriber
2254     MatchingSkills matchingSkillsSecond;
2255     matchingSkillsSecond.AddEvent(EVENTCASE22);
2256 
2257     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2258 
2259     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2260         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2261     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2262     EXPECT_TRUE(subscribeResultSecond);
2263 
2264     // the third subscriber
2265     MatchingSkills matchingSkillsThird;
2266     matchingSkillsThird.AddEvent(EVENTCASE22);
2267 
2268     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2269 
2270     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2271         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2272     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2273     EXPECT_TRUE(subscribeResultThird);
2274 
2275     // publish
2276     Want want;
2277     want.SetAction(EVENTCASE22);
2278 
2279     CommonEventData data;
2280     data.SetWant(want);
2281     data.SetCode(CODECASE22);
2282     data.SetData(DATACASE22);
2283 
2284     CommonEventPublishInfo publishInfo;
2285     publishInfo.SetOrdered(true);
2286 
2287     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
2288         std::make_shared<SubscriberPublishTest>(subscribeInfo);
2289     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
2290     Delay(1);
2291     EXPECT_TRUE(publishResult);
2292 }
2293 
2294 /*
2295  * @tc.number: CES_CommonEventSubscriber_CodeDataAsync_0500
2296  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
2297  * @tc.desc: 1.Set three Subscriber
2298  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
2299  *           SetData GetCode GetData and GoAsyncCommonEvent
2300  */
2301 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsync_0500, Function | MediumTest | Level1)
2302 {
2303     // the first subscriber
2304     MatchingSkills matchingSkills;
2305     matchingSkills.AddEvent(EVENTCASE23);
2306 
2307     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2308 
2309     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2310     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2311     EXPECT_TRUE(subscribeFirstResult);
2312 
2313     // the second subscriber
2314     MatchingSkills matchingSkillsSecond;
2315     matchingSkillsSecond.AddEvent(EVENTCASE23);
2316 
2317     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2318 
2319     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2320         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2321     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2322     EXPECT_TRUE(subscribeResultSecond);
2323 
2324     // the third subscriber
2325     MatchingSkills matchingSkillsThird;
2326     matchingSkillsThird.AddEvent(EVENTCASE23);
2327 
2328     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2329 
2330     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2331         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2332     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2333     EXPECT_TRUE(subscribeResultThird);
2334 
2335     // publish
2336     Want want;
2337     want.SetAction(EVENTCASE23);
2338 
2339     CommonEventData data;
2340     data.SetWant(want);
2341     data.SetCode(CODECASE23);
2342     data.SetData(DATACASE23);
2343 
2344     CommonEventPublishInfo publishInfo;
2345     publishInfo.SetOrdered(true);
2346 
2347     std::shared_ptr<SubscriberPublishTest> subscriberPublishTest =
2348         std::make_shared<SubscriberPublishTest>(subscribeInfo);
2349     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo, subscriberPublishTest);
2350     Delay(1);
2351     EXPECT_TRUE(publishResult);
2352 }
2353 
2354 /*
2355  * @tc.number: CES_CommonEventData_CodeDataInfo_0100
2356  * @tc.name: CommonEventData : SetCode SetData etCode and GetData
2357  * @tc.desc: 1.Set three Subscriber
2358  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
2359  *           GetData
2360  */
2361 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeDataInfo_0100, Function | MediumTest | Level1)
2362 {
2363     // the first subscriber
2364     MatchingSkills matchingSkills;
2365     matchingSkills.AddEvent(EVENTCASE1);
2366 
2367     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2368 
2369     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2370     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2371     EXPECT_TRUE(subscribeFirstResult);
2372 
2373     // the second subscriber
2374     MatchingSkills matchingSkillsSecond;
2375     matchingSkillsSecond.AddEvent(EVENTCASE1);
2376 
2377     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2378 
2379     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2380         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2381     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2382     EXPECT_TRUE(subscribeResultSecond);
2383 
2384     // the third subscriber
2385     MatchingSkills matchingSkillsThird;
2386     matchingSkillsThird.AddEvent(EVENTCASE1);
2387 
2388     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2389 
2390     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2391         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2392     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2393     EXPECT_TRUE(subscribeResultThird);
2394 
2395     // publish
2396     Want want;
2397     want.SetAction(EVENTCASE1);
2398 
2399     CommonEventData data;
2400     data.SetWant(want);
2401     data.SetCode(CODECASE1);
2402     data.SetData(DATACASE1);
2403 
2404     EXPECT_EQ(data.GetCode() == CODECASE1, true);
2405     EXPECT_EQ(data.GetData() == DATACASE1, true);
2406 
2407     CommonEventPublishInfo publishInfo;
2408     publishInfo.SetOrdered(true);
2409 
2410     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2411     Delay(1);
2412     EXPECT_TRUE(publishResult);
2413 
2414     EXPECT_EQ(data.GetCode() == CODECASE1, true);
2415     EXPECT_EQ(data.GetData() == DATACASE1, true);
2416 }
2417 
2418 /*
2419  * @tc.number: CES_CommonEventData_CodeDataInfo_0200
2420  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
2421  * @tc.desc: 1.Set three Subscriber
2422  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
2423  *           GetData
2424  */
2425 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeDataInfo_0200, Function | MediumTest | Level1)
2426 {
2427     // the first subscriber
2428     MatchingSkills matchingSkills;
2429     matchingSkills.AddEvent(EVENTCASE2);
2430 
2431     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2432 
2433     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2434     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2435     EXPECT_TRUE(subscribeFirstResult);
2436 
2437     // the second subscriber
2438     MatchingSkills matchingSkillsSecond;
2439     matchingSkillsSecond.AddEvent(EVENTCASE2);
2440 
2441     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2442 
2443     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2444         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2445     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2446     EXPECT_TRUE(subscribeResultSecond);
2447 
2448     // the third subscriber
2449     MatchingSkills matchingSkillsThird;
2450     matchingSkillsThird.AddEvent(EVENTCASE2);
2451 
2452     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2453 
2454     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2455         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2456     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2457     EXPECT_TRUE(subscribeResultThird);
2458 
2459     // publish
2460     Want want;
2461     want.SetAction(EVENTCASE2);
2462 
2463     CommonEventData data;
2464     data.SetWant(want);
2465     data.SetCode(CODECASE2);
2466     data.SetData(DATACASE2);
2467 
2468     EXPECT_EQ(data.GetCode() == CODECASE2, true);
2469     EXPECT_EQ(data.GetData() == DATACASE2, true);
2470 
2471     CommonEventPublishInfo publishInfo;
2472     publishInfo.SetOrdered(true);
2473 
2474     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2475     Delay(1);
2476     EXPECT_TRUE(publishResult);
2477 
2478     EXPECT_EQ(data.GetCode() == CODECASE2, true);
2479     EXPECT_EQ(data.GetData() == DATACASE2, true);
2480 }
2481 
2482 /*
2483  * @tc.number: CES_CommonEventData_CodeDataInfo_0300
2484  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
2485  * @tc.desc: 1.Set three Subscriber
2486  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
2487  *           GetData
2488  */
2489 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeDataInfo_0300, Function | MediumTest | Level1)
2490 {
2491     // the first subscriber
2492     MatchingSkills matchingSkills;
2493     matchingSkills.AddEvent(EVENTCASE3);
2494 
2495     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2496     subscribeInfo.SetPriority(LOWPRIORITY);
2497 
2498     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2499     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2500     EXPECT_TRUE(subscribeFirstResult);
2501 
2502     // the second subscriber
2503     MatchingSkills matchingSkillsSecond;
2504     matchingSkillsSecond.AddEvent(EVENTCASE3);
2505 
2506     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2507     subscribeInfoSecond.SetPriority(MIDPRIORITY);
2508 
2509     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2510         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2511     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2512     EXPECT_TRUE(subscribeResultSecond);
2513 
2514     // the third subscriber
2515     MatchingSkills matchingSkillsThird;
2516     matchingSkillsThird.AddEvent(EVENTCASE3);
2517 
2518     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2519     subscribeInfoThird.SetPriority(HIGHPRIORITY);
2520 
2521     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2522         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2523     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2524     EXPECT_TRUE(subscribeResultThird);
2525 
2526     // publish
2527     Want want;
2528     want.SetAction(EVENTCASE3);
2529 
2530     CommonEventData data;
2531     data.SetWant(want);
2532     data.SetCode(CODECASE3);
2533     data.SetData(DATACASE3);
2534 
2535     EXPECT_EQ(data.GetCode() == CODECASE3, true);
2536     EXPECT_EQ(data.GetData() == DATACASE3, true);
2537 
2538     CommonEventPublishInfo publishInfo;
2539     publishInfo.SetOrdered(true);
2540 
2541     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2542     Delay(1);
2543     EXPECT_TRUE(publishResult);
2544 
2545     EXPECT_EQ(data.GetCode() == CODECASE3, true);
2546     EXPECT_EQ(data.GetData() == DATACASE3, true);
2547 }
2548 
2549 /*
2550  * @tc.number: CES_CommonEventData_CodeDataInfo_0400
2551  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
2552  * @tc.desc: 1.Set three Subscriber
2553  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
2554  *           GetData
2555  */
2556 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeDataInfo_0400, Function | MediumTest | Level1)
2557 {
2558     // the first subscriber
2559     MatchingSkills matchingSkills;
2560     matchingSkills.AddEvent(EVENTCASE4);
2561 
2562     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2563     subscribeInfo.SetPriority(LOWPRIORITY);
2564 
2565     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2566     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2567     EXPECT_TRUE(subscribeFirstResult);
2568 
2569     // the second subscriber
2570     MatchingSkills matchingSkillsSecond;
2571     matchingSkillsSecond.AddEvent(EVENTCASE4);
2572 
2573     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2574     subscribeInfoSecond.SetPriority(MIDPRIORITY);
2575 
2576     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2577         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2578     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2579     EXPECT_TRUE(subscribeResultSecond);
2580 
2581     // the third subscriber
2582     MatchingSkills matchingSkillsThird;
2583     matchingSkillsThird.AddEvent(EVENTCASE4);
2584 
2585     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2586     subscribeInfoThird.SetPriority(HIGHPRIORITY);
2587 
2588     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2589         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2590     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2591     EXPECT_TRUE(subscribeResultThird);
2592 
2593     // publish
2594     Want want;
2595     want.SetAction(EVENTCASE4);
2596 
2597     CommonEventData data;
2598     data.SetWant(want);
2599     data.SetCode(CODECASE4);
2600     data.SetData(DATACASE4);
2601 
2602     EXPECT_EQ(data.GetCode() == CODECASE4, true);
2603     EXPECT_EQ(data.GetData() == DATACASE4, true);
2604 
2605     CommonEventPublishInfo publishInfo;
2606     publishInfo.SetOrdered(true);
2607 
2608     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2609     Delay(1);
2610     EXPECT_TRUE(publishResult);
2611 
2612     EXPECT_EQ(data.GetCode() == CODECASE4, true);
2613     EXPECT_EQ(data.GetData() == DATACASE4, true);
2614 }
2615 
2616 /*
2617  * @tc.number: CES_CommonEventData_CodeDataInfo_0500
2618  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
2619  * @tc.desc: 1.Set three Subscriber
2620  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
2621  *           GetData
2622  */
2623 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeDataInfo_0500, Function | MediumTest | Level1)
2624 {
2625     // the first subscriber
2626     MatchingSkills matchingSkills;
2627     matchingSkills.AddEvent(EVENTCASE5);
2628 
2629     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2630     subscribeInfo.SetPriority(LOWPRIORITY);
2631 
2632     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2633     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2634     EXPECT_TRUE(subscribeFirstResult);
2635 
2636     // the second subscriber
2637     MatchingSkills matchingSkillsSecond;
2638     matchingSkillsSecond.AddEvent(EVENTCASE5);
2639 
2640     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2641     subscribeInfoSecond.SetPriority(MIDPRIORITY);
2642 
2643     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2644         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2645     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2646     EXPECT_TRUE(subscribeResultSecond);
2647 
2648     // the third subscriber
2649     MatchingSkills matchingSkillsThird;
2650     matchingSkillsThird.AddEvent(EVENTCASE5);
2651 
2652     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2653     subscribeInfoThird.SetPriority(HIGHPRIORITY);
2654 
2655     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2656         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2657     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2658     EXPECT_TRUE(subscribeResultThird);
2659 
2660     // publish
2661     Want want;
2662     want.SetAction(EVENTCASE5);
2663 
2664     CommonEventData data;
2665     data.SetWant(want);
2666     data.SetCode(CODECASE5);
2667     data.SetData(DATACASE5);
2668 
2669     EXPECT_EQ(data.GetCode() == CODECASE5, true);
2670     EXPECT_EQ(data.GetData() == DATACASE5, true);
2671 
2672     CommonEventPublishInfo publishInfo;
2673     publishInfo.SetOrdered(true);
2674 
2675     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2676     Delay(1);
2677     EXPECT_TRUE(publishResult);
2678 
2679     EXPECT_EQ(data.GetCode() == CODECASE5, true);
2680     EXPECT_EQ(data.GetData() == DATACASE5, true);
2681 }
2682 
2683 /*
2684  * @tc.number: CES_CommonEventData_CodeDataInfo_0600
2685  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
2686  * @tc.desc: 1.Set three Subscriber
2687  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
2688  *           GetData
2689  */
2690 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeDataInfo_0600, Function | MediumTest | Level1)
2691 {
2692     // the first subscriber
2693     MatchingSkills matchingSkills;
2694     matchingSkills.AddEvent(EVENTCASE6);
2695 
2696     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2697 
2698     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2699     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2700     EXPECT_TRUE(subscribeFirstResult);
2701 
2702     // the second subscriber
2703     MatchingSkills matchingSkillsSecond;
2704     matchingSkillsSecond.AddEvent(EVENTCASE6);
2705 
2706     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2707 
2708     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2709         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2710     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2711     EXPECT_TRUE(subscribeResultSecond);
2712 
2713     // the third subscriber
2714     MatchingSkills matchingSkillsThird;
2715     matchingSkillsThird.AddEvent(EVENTCASE6);
2716 
2717     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2718 
2719     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2720         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2721     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2722     EXPECT_TRUE(subscribeResultThird);
2723 
2724     // publish
2725     Want want;
2726     want.SetAction(EVENTCASE6);
2727 
2728     CommonEventData data;
2729     data.SetWant(want);
2730     data.SetCode(CODECASE6);
2731     data.SetData(DATACASE6);
2732 
2733     EXPECT_EQ(data.GetCode() == CODECASE6, true);
2734     EXPECT_EQ(data.GetData() == DATACASE6, true);
2735 
2736     CommonEventPublishInfo publishInfo;
2737     publishInfo.SetOrdered(true);
2738 
2739     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2740     Delay(1);
2741     EXPECT_TRUE(publishResult);
2742 
2743     EXPECT_EQ(data.GetCode() == CODECASE6, true);
2744     EXPECT_EQ(data.GetData() == DATACASE6, true);
2745 }
2746 
2747 /*
2748  * @tc.number: CES_CommonEventData_CodeDataInfo_0700
2749  * @tc.name: CommonEventData : SetCode SetData GetCode and GetData
2750  * @tc.desc: 1.Set three Subscriber
2751  *           2.Verify the function of CommonEventData when publish order event: SetCode SetData GetCode and
2752  *           GetData
2753  */
2754 HWTEST_F(ActsCESDataTest, CES_CommonEventData_CodeDataInfo_0700, Function | MediumTest | Level1)
2755 {
2756     // the first subscriber
2757     MatchingSkills matchingSkills;
2758     matchingSkills.AddEvent(EVENTCASE7);
2759 
2760     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2761     subscribeInfo.SetPriority(LOWPRIORITY);
2762 
2763     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2764     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2765     EXPECT_TRUE(subscribeFirstResult);
2766 
2767     // the second subscriber
2768     MatchingSkills matchingSkillsSecond;
2769     matchingSkillsSecond.AddEvent(EVENTCASE7);
2770 
2771     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2772     subscribeInfoSecond.SetPriority(MIDPRIORITY);
2773 
2774     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2775         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2776     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2777     EXPECT_TRUE(subscribeResultSecond);
2778 
2779     // the third subscriber
2780     MatchingSkills matchingSkillsThird;
2781     matchingSkillsThird.AddEvent(EVENTCASE7);
2782 
2783     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2784     subscribeInfoThird.SetPriority(HIGHPRIORITY);
2785 
2786     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2787         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2788     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2789     EXPECT_TRUE(subscribeResultThird);
2790 
2791     // publish
2792     Want want;
2793     want.SetAction(EVENTCASE7);
2794 
2795     CommonEventData data;
2796     data.SetWant(want);
2797     data.SetCode(CODECASE7);
2798     data.SetData(DATACASE7);
2799 
2800     EXPECT_EQ(data.GetCode() == CODECASE7, true);
2801     EXPECT_EQ(data.GetData() == DATACASE7, true);
2802 
2803     CommonEventPublishInfo publishInfo;
2804     publishInfo.SetOrdered(true);
2805 
2806     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2807     Delay(1);
2808     EXPECT_TRUE(publishResult);
2809 
2810     EXPECT_EQ(data.GetCode() == CODECASE7, true);
2811     EXPECT_EQ(data.GetData() == DATACASE7, true);
2812 }
2813 
2814 /*
2815  * @tc.number: CES_CommonEventData_WantInfo_0100
2816  * @tc.name: CommonEventData : SetWant and GetWant
2817  * @tc.desc: 1.Set Subscriber
2818  *           2.Verify the function of CommonEventData when publish order event: SetWant and GetWant
2819  */
2820 HWTEST_F(ActsCESDataTest, CES_CommonEventData_WantInfo_0100, Function | MediumTest | Level1)
2821 {
2822     std::string eventName = "TESTEVENT_PUBLISH_ACTION";
2823     std::string eventAction = "TESTEVENT_PUBLISH_ACTION";
2824     bool resultWant = false;
2825 
2826     MatchingSkills matchingSkills;
2827     matchingSkills.AddEvent(eventName);
2828     Want wantTest;
2829     wantTest.SetAction(eventAction);
2830     CommonEventData commonEventData;
2831     commonEventData.SetWant(wantTest);
2832 
2833     CommonEventPublishInfo publishInfo;
2834     publishInfo.SetOrdered(true);
2835     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2836 
2837     CommonEventManager::PublishCommonEvent(commonEventData, publishInfo);
2838     resultWant = (commonEventData.GetWant().GetAction() == wantTest.GetAction());
2839     EXPECT_TRUE(resultWant);
2840 }
2841 
2842 /*
2843  * @tc.number: CES_CommonEventData_WantInfo_0200
2844  * @tc.name: CommonEventData : GetWant
2845  * @tc.desc: 1.Set Subscriber
2846  *           2.Verify the function of CommonEventData when publish order event: GetWant
2847  */
2848 HWTEST_F(ActsCESDataTest, CES_CommonEventData_WantInfo_0200, Function | MediumTest | Level1)
2849 {
2850     std::string eventName = "TESTEVENT_PUBLISH_ACTION2";
2851     std::string eventAction = "TESTEVENT_PUBLISH_ACTION2";
2852     int codeTest = 1;
2853     std::string dataTest = "DATA_GET_CODE_TEST";
2854     bool resultWant = false;
2855 
2856     MatchingSkills matchingSkills;
2857     matchingSkills.AddEvent(eventName);
2858     Want wantTest;
2859     wantTest.SetAction(eventAction);
2860     CommonEventData commonEventData(wantTest, codeTest, dataTest);
2861 
2862     CommonEventPublishInfo publishInfo;
2863     publishInfo.SetOrdered(true);
2864     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2865 
2866     CommonEventManager::PublishCommonEvent(commonEventData, publishInfo);
2867     resultWant = (commonEventData.GetWant().GetAction() == wantTest.GetAction());
2868     EXPECT_TRUE(resultWant);
2869 }
2870 
2871 /*
2872  * @tc.number: CES_CommonEventData_WantInfo_0300
2873  * @tc.name: CommonEventData : SetWant
2874  * @tc.desc: 1.Set Subscriber
2875  *           2.Verify the function of CommonEventData when publish order event: SetWant
2876  */
2877 HWTEST_F(ActsCESDataTest, CES_CommonEventData_WantInfo_0300, Function | MediumTest | Level1)
2878 {
2879     bool resultWant = false;
2880     std::string eventName = "TESTEVENT_PUBLISH_ACTION2";
2881     std::string eventAction = "TESTEVENT_PUBLISH_ACTION2";
2882     std::string eventAction2 = "TESTEVENT_PUBLISH_ACTION3";
2883     int codeTest = 1;
2884     std::string dataTest = "DATA_GET_CODE_TEST";
2885 
2886     MatchingSkills matchingSkills;
2887     matchingSkills.AddEvent(eventName);
2888     Want wantTest;
2889     wantTest.SetAction(eventAction);
2890     Want wantTest2;
2891     wantTest2.SetAction(eventAction2);
2892     CommonEventData commonEventData(wantTest, codeTest, dataTest);
2893     commonEventData.SetWant(wantTest2);
2894     CommonEventPublishInfo publishInfo;
2895     publishInfo.SetOrdered(true);
2896     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2897 
2898     CommonEventManager::PublishCommonEvent(commonEventData, publishInfo);
2899     resultWant = (commonEventData.GetWant().GetAction() == wantTest2.GetAction());
2900     EXPECT_TRUE(resultWant);
2901 }
2902 
2903 /*
2904  * @tc.number: CES_CommonEventSubscriber_CommonEventInfo_0100
2905  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
2906  * @tc.desc: 1.Set three Subscriber
2907  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
2908  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
2909  */
2910 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEventInfo_0100, Function | MediumTest | Level1)
2911 {
2912     // the first subscriber
2913     MatchingSkills matchingSkills;
2914     matchingSkills.AddEvent(EVENTCASE8);
2915 
2916     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2917 
2918     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2919     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2920     EXPECT_TRUE(subscribeFirstResult);
2921 
2922     // the second subscriber
2923     MatchingSkills matchingSkillsSecond;
2924     matchingSkillsSecond.AddEvent(EVENTCASE8);
2925 
2926     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2927 
2928     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2929         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2930     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2931     EXPECT_TRUE(subscribeResultSecond);
2932 
2933     // the third subscriber
2934     MatchingSkills matchingSkillsThird;
2935     matchingSkillsThird.AddEvent(EVENTCASE8);
2936 
2937     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2938 
2939     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2940         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2941     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
2942     EXPECT_TRUE(subscribeResultThird);
2943 
2944     // publish
2945     Want want;
2946     want.SetAction(EVENTCASE8);
2947 
2948     CommonEventData data;
2949     data.SetWant(want);
2950     data.SetCode(CODECASE8);
2951     data.SetData(DATACASE8);
2952 
2953     CommonEventPublishInfo publishInfo;
2954     publishInfo.SetOrdered(true);
2955 
2956     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
2957     Delay(1);
2958     EXPECT_TRUE(publishResult);
2959 }
2960 
2961 /*
2962  * @tc.number: CES_CommonEventSubscriber_CommonEventInfo_0200
2963  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
2964  * @tc.desc: 1.Set three Subscriber
2965  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
2966  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
2967  */
2968 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEventInfo_0200, Function | MediumTest | Level1)
2969 {
2970     // the first subscriber
2971     MatchingSkills matchingSkills;
2972     matchingSkills.AddEvent(EVENTCASE9);
2973 
2974     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
2975 
2976     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
2977     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
2978     EXPECT_TRUE(subscribeFirstResult);
2979 
2980     // the second subscriber
2981     MatchingSkills matchingSkillsSecond;
2982     matchingSkillsSecond.AddEvent(EVENTCASE9);
2983 
2984     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
2985 
2986     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
2987         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
2988     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
2989     EXPECT_TRUE(subscribeResultSecond);
2990 
2991     // the third subscriber
2992     MatchingSkills matchingSkillsThird;
2993     matchingSkillsThird.AddEvent(EVENTCASE9);
2994 
2995     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
2996 
2997     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
2998         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
2999     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3000     EXPECT_TRUE(subscribeResultThird);
3001 
3002     // publish
3003     Want want;
3004     want.SetAction(EVENTCASE9);
3005 
3006     CommonEventData data;
3007     data.SetWant(want);
3008     data.SetCode(CODECASE9);
3009     data.SetData(DATACASE9);
3010 
3011     CommonEventPublishInfo publishInfo;
3012     publishInfo.SetOrdered(true);
3013 
3014     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3015     Delay(1);
3016     EXPECT_TRUE(publishResult);
3017 }
3018 
3019 /*
3020  * @tc.number: CES_CommonEventSubscriber_CommonEventInfo_0300
3021  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
3022  * @tc.desc: 1.Set three Subscriber
3023  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
3024  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
3025  */
3026 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEventInfo_0300, Function | MediumTest | Level1)
3027 {
3028     // the first subscriber
3029     MatchingSkills matchingSkills;
3030     matchingSkills.AddEvent(EVENTCASE10);
3031 
3032     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3033 
3034     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3035     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3036     EXPECT_TRUE(subscribeFirstResult);
3037 
3038     // the second subscriber
3039     MatchingSkills matchingSkillsSecond;
3040     matchingSkillsSecond.AddEvent(EVENTCASE10);
3041 
3042     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3043 
3044     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3045         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3046     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3047     EXPECT_TRUE(subscribeResultSecond);
3048 
3049     // the third subscriber
3050     MatchingSkills matchingSkillsThird;
3051     matchingSkillsThird.AddEvent(EVENTCASE10);
3052 
3053     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3054 
3055     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3056         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3057     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3058     EXPECT_TRUE(subscribeResultThird);
3059 
3060     // publish
3061     Want want;
3062     want.SetAction(EVENTCASE10);
3063 
3064     CommonEventData data;
3065     data.SetWant(want);
3066     data.SetCode(CODECASE10);
3067     data.SetData(DATACASE10);
3068 
3069     CommonEventPublishInfo publishInfo;
3070     publishInfo.SetOrdered(true);
3071 
3072     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3073     Delay(1);
3074     EXPECT_TRUE(publishResult);
3075 }
3076 
3077 /*
3078  * @tc.number: CES_CommonEventSubscriber_CommonEventInfo_0400
3079  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
3080  * @tc.desc: 1.Set three Subscriber
3081  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
3082  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
3083  */
3084 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEventInfo_0400, Function | MediumTest | Level1)
3085 {
3086     // the first subscriber
3087     MatchingSkills matchingSkills;
3088     matchingSkills.AddEvent(EVENTCASE11);
3089 
3090     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3091 
3092     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3093     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3094     EXPECT_TRUE(subscribeFirstResult);
3095 
3096     // the second subscriber
3097     MatchingSkills matchingSkillsSecond;
3098     matchingSkillsSecond.AddEvent(EVENTCASE11);
3099 
3100     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3101 
3102     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3103         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3104     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3105     EXPECT_TRUE(subscribeResultSecond);
3106 
3107     // the third subscriber
3108     MatchingSkills matchingSkillsThird;
3109     matchingSkillsThird.AddEvent(EVENTCASE11);
3110 
3111     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3112 
3113     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3114         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3115     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3116     EXPECT_TRUE(subscribeResultThird);
3117 
3118     // publish
3119     Want want;
3120     want.SetAction(EVENTCASE11);
3121 
3122     CommonEventData data;
3123     data.SetWant(want);
3124     data.SetCode(CODECASE11);
3125     data.SetData(DATACASE11);
3126 
3127     CommonEventPublishInfo publishInfo;
3128     publishInfo.SetOrdered(true);
3129 
3130     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3131     Delay(1);
3132     EXPECT_TRUE(publishResult);
3133 }
3134 
3135 /*
3136  * @tc.number: CES_CommonEventSubscriber_CommonEventInfo_0500
3137  * @tc.name: CommonEventSubscriber : AbortCommonEvent GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
3138  * @tc.desc: 1.Set three Subscriber
3139  *           2.Verify the function of CommonEventSubscriber when publish order event: AbortCommonEvent
3140  *           GetAbortCommonEvent ClearAbortCommonEvent and IsOrderedCommonEvent
3141  */
3142 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CommonEventInfo_0500, Function | MediumTest | Level1)
3143 {
3144     // the first subscriber
3145     MatchingSkills matchingSkills;
3146     matchingSkills.AddEvent(EVENTCASE12);
3147 
3148     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3149 
3150     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3151     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3152     EXPECT_TRUE(subscribeFirstResult);
3153 
3154     // the second subscriber
3155     MatchingSkills matchingSkillsSecond;
3156     matchingSkillsSecond.AddEvent(EVENTCASE12);
3157 
3158     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3159 
3160     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3161         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3162     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3163     EXPECT_TRUE(subscribeResultSecond);
3164 
3165     // the third subscriber
3166     MatchingSkills matchingSkillsThird;
3167     matchingSkillsThird.AddEvent(EVENTCASE12);
3168 
3169     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3170 
3171     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3172         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3173     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3174     EXPECT_TRUE(subscribeResultThird);
3175 
3176     // publish
3177     Want want;
3178     want.SetAction(EVENTCASE12);
3179 
3180     CommonEventData data;
3181     data.SetWant(want);
3182     data.SetCode(CODECASE12);
3183     data.SetData(DATACASE12);
3184 
3185     CommonEventPublishInfo publishInfo;
3186     publishInfo.SetOrdered(true);
3187 
3188     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3189     Delay(1);
3190     EXPECT_TRUE(publishResult);
3191 }
3192 
3193 /*
3194  * @tc.number: CES_CommonEventSubscriber_CodeDataAsyncInfo_0100
3195  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
3196  * @tc.desc: 1.Set three Subscriber
3197  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
3198  *           SetData GetCode GetData and GoAsyncCommonEvent
3199  */
3200 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsyncInfo_0100, Function | MediumTest | Level1)
3201 {
3202     // the first subscriber
3203     MatchingSkills matchingSkills;
3204     matchingSkills.AddEvent(EVENTCASE19);
3205 
3206     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3207 
3208     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3209     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3210     EXPECT_TRUE(subscribeFirstResult);
3211 
3212     // the second subscriber
3213     MatchingSkills matchingSkillsSecond;
3214     matchingSkillsSecond.AddEvent(EVENTCASE19);
3215 
3216     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3217 
3218     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3219         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3220     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3221     EXPECT_TRUE(subscribeResultSecond);
3222 
3223     // the third subscriber
3224     MatchingSkills matchingSkillsThird;
3225     matchingSkillsThird.AddEvent(EVENTCASE19);
3226 
3227     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3228 
3229     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3230         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3231     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3232     EXPECT_TRUE(subscribeResultThird);
3233 
3234     // publish
3235     Want want;
3236     want.SetAction(EVENTCASE19);
3237 
3238     CommonEventData data;
3239     data.SetWant(want);
3240     data.SetCode(CODECASE19);
3241     data.SetData(DATACASE19);
3242 
3243     CommonEventPublishInfo publishInfo;
3244     publishInfo.SetOrdered(true);
3245 
3246     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3247     Delay(2);
3248     EXPECT_TRUE(publishResult);
3249 }
3250 
3251 /*
3252  * @tc.number: CES_CommonEventSubscriber_CodeDataAsyncInfo_0200
3253  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
3254  * @tc.desc: 1.Set three Subscriber
3255  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
3256  *           SetData GetCode GetData and GoAsyncCommonEvent
3257  */
3258 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsyncInfo_0200, Function | MediumTest | Level1)
3259 {
3260     // the first subscriber
3261     MatchingSkills matchingSkills;
3262     matchingSkills.AddEvent(EVENTCASE20);
3263 
3264     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3265 
3266     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3267     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3268     EXPECT_TRUE(subscribeFirstResult);
3269 
3270     // the second subscriber
3271     MatchingSkills matchingSkillsSecond;
3272     matchingSkillsSecond.AddEvent(EVENTCASE20);
3273 
3274     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3275 
3276     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3277         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3278     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3279     EXPECT_TRUE(subscribeResultSecond);
3280 
3281     // the third subscriber
3282     MatchingSkills matchingSkillsThird;
3283     matchingSkillsThird.AddEvent(EVENTCASE20);
3284 
3285     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3286 
3287     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3288         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3289     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3290     EXPECT_TRUE(subscribeResultThird);
3291 
3292     // publish
3293     Want want;
3294     want.SetAction(EVENTCASE20);
3295 
3296     CommonEventData data;
3297     data.SetWant(want);
3298     data.SetCode(CODECASE20);
3299     data.SetData(DATACASE20);
3300 
3301     CommonEventPublishInfo publishInfo;
3302     publishInfo.SetOrdered(true);
3303 
3304     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3305     Delay(1);
3306     EXPECT_TRUE(publishResult);
3307 }
3308 
3309 /*
3310  * @tc.number: CES_CommonEventSubscriber_CodeDataAsyncInfo_0300
3311  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
3312  * @tc.desc: 1.Set three Subscriber
3313  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
3314  *           SetData GetCode GetData and GoAsyncCommonEvent
3315  */
3316 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsyncInfo_0300, Function | MediumTest | Level1)
3317 {
3318     // the first subscriber
3319     MatchingSkills matchingSkills;
3320     matchingSkills.AddEvent(EVENTCASE21);
3321 
3322     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3323 
3324     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3325     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3326     EXPECT_TRUE(subscribeFirstResult);
3327 
3328     // the second subscriber
3329     MatchingSkills matchingSkillsSecond;
3330     matchingSkillsSecond.AddEvent(EVENTCASE21);
3331 
3332     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3333 
3334     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3335         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3336     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3337     EXPECT_TRUE(subscribeResultSecond);
3338 
3339     // the third subscriber
3340     MatchingSkills matchingSkillsThird;
3341     matchingSkillsThird.AddEvent(EVENTCASE21);
3342 
3343     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3344 
3345     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3346         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3347     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3348     EXPECT_TRUE(subscribeResultThird);
3349 
3350     // publish
3351     Want want;
3352     want.SetAction(EVENTCASE21);
3353 
3354     CommonEventData data;
3355     data.SetWant(want);
3356     data.SetCode(CODECASE21);
3357     data.SetData(DATACASE21);
3358 
3359     CommonEventPublishInfo publishInfo;
3360     publishInfo.SetOrdered(true);
3361 
3362     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3363     Delay(1);
3364     EXPECT_TRUE(publishResult);
3365 }
3366 
3367 /*
3368  * @tc.number: CES_CommonEventSubscriber_CodeDataAsyncInfo_0400
3369  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
3370  * @tc.desc: 1.Set three Subscriber
3371  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
3372  *           SetData GetCode GetData and GoAsyncCommonEvent
3373  */
3374 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsyncInfo_0400, Function | MediumTest | Level1)
3375 {
3376     // the first subscriber
3377     MatchingSkills matchingSkills;
3378     matchingSkills.AddEvent(EVENTCASE22);
3379 
3380     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3381 
3382     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3383     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3384     EXPECT_TRUE(subscribeFirstResult);
3385 
3386     // the second subscriber
3387     MatchingSkills matchingSkillsSecond;
3388     matchingSkillsSecond.AddEvent(EVENTCASE22);
3389 
3390     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3391 
3392     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3393         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3394     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3395     EXPECT_TRUE(subscribeResultSecond);
3396 
3397     // the third subscriber
3398     MatchingSkills matchingSkillsThird;
3399     matchingSkillsThird.AddEvent(EVENTCASE22);
3400 
3401     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3402 
3403     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3404         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3405     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3406     EXPECT_TRUE(subscribeResultThird);
3407 
3408     // publish
3409     Want want;
3410     want.SetAction(EVENTCASE22);
3411 
3412     CommonEventData data;
3413     data.SetWant(want);
3414     data.SetCode(CODECASE22);
3415     data.SetData(DATACASE22);
3416 
3417     CommonEventPublishInfo publishInfo;
3418     publishInfo.SetOrdered(true);
3419 
3420     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3421     Delay(1);
3422     EXPECT_TRUE(publishResult);
3423 }
3424 
3425 /*
3426  * @tc.number: CES_CommonEventSubscriber_CodeDataAsyncInfo_0500
3427  * @tc.name: CommonEventSubscriber : SetCode SetData GetCode GetData and GoAsyncCommonEvent
3428  * @tc.desc: 1.Set three Subscriber
3429  *           2.Verify the function of CommonEventSubscriber when publish order event: SetCode
3430  *           SetData GetCode GetData and GoAsyncCommonEvent
3431  */
3432 HWTEST_F(ActsCESDataTest, CES_CommonEventSubscriber_CodeDataAsyncInfo_0500, Function | MediumTest | Level1)
3433 {
3434     // the first subscriber
3435     MatchingSkills matchingSkills;
3436     matchingSkills.AddEvent(EVENTCASE23);
3437 
3438     CommonEventSubscribeInfo subscribeInfo(matchingSkills);
3439 
3440     std::shared_ptr<SubscriberFirstTest> subscriberFirstTest = std::make_shared<SubscriberFirstTest>(subscribeInfo);
3441     bool subscribeFirstResult = CommonEventManager::SubscribeCommonEvent(subscriberFirstTest);
3442     EXPECT_TRUE(subscribeFirstResult);
3443 
3444     // the second subscriber
3445     MatchingSkills matchingSkillsSecond;
3446     matchingSkillsSecond.AddEvent(EVENTCASE23);
3447 
3448     CommonEventSubscribeInfo subscribeInfoSecond(matchingSkillsSecond);
3449 
3450     std::shared_ptr<SubscriberSecondTest> subscriberSecondTest =
3451         std::make_shared<SubscriberSecondTest>(subscribeInfoSecond);
3452     bool subscribeResultSecond = CommonEventManager::SubscribeCommonEvent(subscriberSecondTest);
3453     EXPECT_TRUE(subscribeResultSecond);
3454 
3455     // the third subscriber
3456     MatchingSkills matchingSkillsThird;
3457     matchingSkillsThird.AddEvent(EVENTCASE23);
3458 
3459     CommonEventSubscribeInfo subscribeInfoThird(matchingSkillsThird);
3460 
3461     std::shared_ptr<SubscriberThirdTest> subscriberThirdTest =
3462         std::make_shared<SubscriberThirdTest>(subscribeInfoThird);
3463     bool subscribeResultThird = CommonEventManager::SubscribeCommonEvent(subscriberThirdTest);
3464     EXPECT_TRUE(subscribeResultThird);
3465 
3466     // publish
3467     Want want;
3468     want.SetAction(EVENTCASE23);
3469 
3470     CommonEventData data;
3471     data.SetWant(want);
3472     data.SetCode(CODECASE23);
3473     data.SetData(DATACASE23);
3474 
3475     CommonEventPublishInfo publishInfo;
3476     publishInfo.SetOrdered(true);
3477 
3478     bool publishResult = CommonEventManager::PublishCommonEvent(data, publishInfo);
3479     Delay(1);
3480     EXPECT_TRUE(publishResult);
3481 }
3482 } // namespace EventFwk
3483 } // namespace OHOS