1 /*
2  * Copyright (c) 2023 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 <gtest/gtest.h>
17 
18 #include "executer_factory.h"
19 #include "rule_utils.h"
20 
21 using namespace testing::ext;
22 using namespace testing;
23 using namespace OHOS::EDM::IPTABLES;
24 
25 namespace OHOS {
26 namespace EDM {
27 namespace IPTABLES {
28 namespace TEST {
29 
30 class ExecuterFactoryTest : public testing::Test {};
31 
32 /**
33  * @tc.name: TestGetAllExecuter
34  * @tc.desc: Test GetAllExecuter func.
35  * @tc.type: FUNC
36  */
37 HWTEST_F(ExecuterFactoryTest, TestGetAllExecuter, TestSize.Level1)
38 {
39     EXPECT_TRUE(!ExecuterFactory::GetInstance()->GetAllExecuter().empty());
40 }
41 
42 /**
43  * @tc.name: TestGetExecuter
44  * @tc.desc: Test GetExecuter func.
45  * @tc.type: FUNC
46  */
47 HWTEST_F(ExecuterFactoryTest, TestGetExecuter, TestSize.Level1)
48 {
49     EXPECT_TRUE(ExecuterFactory::GetInstance()->GetExecuter(EDM_DEFAULT_DENY_OUTPUT_CHAIN_NAME) != nullptr);
50     EXPECT_TRUE(ExecuterFactory::GetInstance()->GetExecuter("EDM_DEFAULT_DENY_OUTPUT_CHAIN_NAME") == nullptr);
51 }
52 
53 /**
54  * @tc.name: TestGetInstance
55  * @tc.desc: Test GetInstance func.
56  * @tc.type: FUNC
57  */
58 HWTEST_F(ExecuterFactoryTest, TestGetInstance, TestSize.Level1)
59 {
60     EXPECT_TRUE(ExecuterFactory::GetInstance() != nullptr);
61 }
62 } // namespace TEST
63 } // namespace IPTABLES
64 } // namespace EDM
65 } // namespace OHOS