1e0857b17Sopenharmony_ci/*
2e0857b17Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3e0857b17Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4e0857b17Sopenharmony_ci * you may not use this file except in compliance with the License.
5e0857b17Sopenharmony_ci * You may obtain a copy of the License at
6e0857b17Sopenharmony_ci *
7e0857b17Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8e0857b17Sopenharmony_ci *
9e0857b17Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10e0857b17Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11e0857b17Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e0857b17Sopenharmony_ci * See the License for the specific language governing permissions and
13e0857b17Sopenharmony_ci * limitations under the License.
14e0857b17Sopenharmony_ci */
15e0857b17Sopenharmony_ci
16e0857b17Sopenharmony_ci#include <gtest/gtest.h>
17e0857b17Sopenharmony_ci
18e0857b17Sopenharmony_ci#define private public
19e0857b17Sopenharmony_ci#define protected public
20e0857b17Sopenharmony_ci#include "operation.h"
21e0857b17Sopenharmony_ci#include "operation_builder.h"
22e0857b17Sopenharmony_ci#undef private
23e0857b17Sopenharmony_ci#undef protected
24e0857b17Sopenharmony_ci
25e0857b17Sopenharmony_ciusing namespace testing::ext;
26e0857b17Sopenharmony_ciusing namespace OHOS::AAFwk;
27e0857b17Sopenharmony_ciusing OHOS::Parcel;
28e0857b17Sopenharmony_ciusing Uri = OHOS::Uri;
29e0857b17Sopenharmony_ciclass OperationBaseTest : public testing::Test {
30e0857b17Sopenharmony_cipublic:
31e0857b17Sopenharmony_ci    OperationBaseTest()
32e0857b17Sopenharmony_ci    {}
33e0857b17Sopenharmony_ci    ~OperationBaseTest()
34e0857b17Sopenharmony_ci    {}
35e0857b17Sopenharmony_ci    static void SetUpTestCase(void);
36e0857b17Sopenharmony_ci    static void TearDownTestCase(void);
37e0857b17Sopenharmony_ci    void SetUp();
38e0857b17Sopenharmony_ci    void TearDown();
39e0857b17Sopenharmony_ci
40e0857b17Sopenharmony_ci    std::shared_ptr<OperationBuilder> operationbuilder_ = nullptr;
41e0857b17Sopenharmony_ci};
42e0857b17Sopenharmony_ci
43e0857b17Sopenharmony_civoid OperationBaseTest::SetUpTestCase(void)
44e0857b17Sopenharmony_ci{}
45e0857b17Sopenharmony_ci
46e0857b17Sopenharmony_civoid OperationBaseTest::TearDownTestCase(void)
47e0857b17Sopenharmony_ci{}
48e0857b17Sopenharmony_ci
49e0857b17Sopenharmony_civoid OperationBaseTest::SetUp(void)
50e0857b17Sopenharmony_ci{
51e0857b17Sopenharmony_ci    operationbuilder_ = std::make_shared<OperationBuilder>();
52e0857b17Sopenharmony_ci}
53e0857b17Sopenharmony_ci
54e0857b17Sopenharmony_civoid OperationBaseTest::TearDown(void)
55e0857b17Sopenharmony_ci{}
56e0857b17Sopenharmony_ci
57e0857b17Sopenharmony_ci/**
58e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetAbilityName_0100
59e0857b17Sopenharmony_ci * @tc.name: WithAbilityName/GetAbilityName.
60e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string contains special characters.
61e0857b17Sopenharmony_ci */
62e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetAbilityName_0100, Function | MediumTest | Level1)
63e0857b17Sopenharmony_ci{
64e0857b17Sopenharmony_ci    std::string value = "enter";
65e0857b17Sopenharmony_ci    GTEST_LOG_(INFO) << "AaFwk_Operation_GetAbilityName_0100 start";
66e0857b17Sopenharmony_ci
67e0857b17Sopenharmony_ci    operationbuilder_->WithAbilityName(value);
68e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
69e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetAbilityName().c_str());
70e0857b17Sopenharmony_ci
71e0857b17Sopenharmony_ci    GTEST_LOG_(INFO) << "AaFwk_Operation_GetAbilityName_0100 end";
72e0857b17Sopenharmony_ci}
73e0857b17Sopenharmony_ci
74e0857b17Sopenharmony_ci/**
75e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetAbilityName_0200
76e0857b17Sopenharmony_ci * @tc.name: WithAbilityName/GetAbilityName.
77e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string is empty.
78e0857b17Sopenharmony_ci */
79e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetAbilityName_0200, Function | MediumTest | Level3)
80e0857b17Sopenharmony_ci{
81e0857b17Sopenharmony_ci    std::string value = "";
82e0857b17Sopenharmony_ci    operationbuilder_->WithAbilityName(value);
83e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
84e0857b17Sopenharmony_ci
85e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetAbilityName().c_str());
86e0857b17Sopenharmony_ci}
87e0857b17Sopenharmony_ci
88e0857b17Sopenharmony_ci/**
89e0857b17Sopenharmony_ci * @tc.number:  AaFwk_Operation_GetBundleName_0100
90e0857b17Sopenharmony_ci * @tc.name: WithBundleName/GetBundleName
91e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string contains special characters.
92e0857b17Sopenharmony_ci */
93e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetBundleName_0100, Function | MediumTest | Level1)
94e0857b17Sopenharmony_ci{
95e0857b17Sopenharmony_ci    std::string value = "value";
96e0857b17Sopenharmony_ci    operationbuilder_->WithBundleName(value);
97e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
98e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetBundleName().c_str());
99e0857b17Sopenharmony_ci}
100e0857b17Sopenharmony_ci
101e0857b17Sopenharmony_ci/**
102e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetBundleName_0200
103e0857b17Sopenharmony_ci * @tc.name: WithBundleName/GetBundleName
104e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string is empty.
105e0857b17Sopenharmony_ci */
106e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetBundleName_0200, Function | MediumTest | Level3)
107e0857b17Sopenharmony_ci{
108e0857b17Sopenharmony_ci    std::string value = "";
109e0857b17Sopenharmony_ci    operationbuilder_->WithBundleName(value);
110e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
111e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetBundleName().c_str());
112e0857b17Sopenharmony_ci}
113e0857b17Sopenharmony_ci
114e0857b17Sopenharmony_ci/**
115e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetDeviceId_0100
116e0857b17Sopenharmony_ci * @tc.name: WithDeviceId/GetDeviceId
117e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string contains special characters.
118e0857b17Sopenharmony_ci */
119e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetDeviceId_0100, Function | MediumTest | Level1)
120e0857b17Sopenharmony_ci{
121e0857b17Sopenharmony_ci    std::string value = "value";
122e0857b17Sopenharmony_ci    operationbuilder_->WithDeviceId(value);
123e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
124e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetDeviceId().c_str());
125e0857b17Sopenharmony_ci}
126e0857b17Sopenharmony_ci
127e0857b17Sopenharmony_ci/**
128e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetDeviceId_0200
129e0857b17Sopenharmony_ci * @tc.name: WithDeviceId/GetDeviceId
130e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string is empty.
131e0857b17Sopenharmony_ci */
132e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetDeviceId_0200, Function | MediumTest | Level3)
133e0857b17Sopenharmony_ci{
134e0857b17Sopenharmony_ci    std::string value = "";
135e0857b17Sopenharmony_ci    operationbuilder_->WithDeviceId(value);
136e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
137e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetDeviceId().c_str());
138e0857b17Sopenharmony_ci}
139e0857b17Sopenharmony_ci
140e0857b17Sopenharmony_ci/**
141e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetAction_0100
142e0857b17Sopenharmony_ci * @tc.name: WithAction/GetAction
143e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string contains special characters.
144e0857b17Sopenharmony_ci */
145e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetAction_0100, Function | MediumTest | Level1)
146e0857b17Sopenharmony_ci{
147e0857b17Sopenharmony_ci    std::string value = "value";
148e0857b17Sopenharmony_ci    operationbuilder_->WithAction(value);
149e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
150e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetAction().c_str());
151e0857b17Sopenharmony_ci}
152e0857b17Sopenharmony_ci
153e0857b17Sopenharmony_ci/**
154e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetAction_0200
155e0857b17Sopenharmony_ci * @tc.name: WithAction/GetAction
156e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string is empty.
157e0857b17Sopenharmony_ci */
158e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetAction_0200, Function | MediumTest | Level3)
159e0857b17Sopenharmony_ci{
160e0857b17Sopenharmony_ci    std::string value = "";
161e0857b17Sopenharmony_ci    operationbuilder_->WithAction(value);
162e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
163e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetAction().c_str());
164e0857b17Sopenharmony_ci}
165e0857b17Sopenharmony_ci
166e0857b17Sopenharmony_ci/**
167e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetEntities_0100
168e0857b17Sopenharmony_ci * @tc.name: WithEntities/GetEntities
169e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string contains special characters.
170e0857b17Sopenharmony_ci */
171e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetEntities_0100, Function | MediumTest | Level1)
172e0857b17Sopenharmony_ci{
173e0857b17Sopenharmony_ci    std::vector<std::string> value;
174e0857b17Sopenharmony_ci    value.push_back("string1");
175e0857b17Sopenharmony_ci    operationbuilder_->WithEntities(value);
176e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
177e0857b17Sopenharmony_ci
178e0857b17Sopenharmony_ci    std::vector<std::string> revValue = operation->GetEntities();
179e0857b17Sopenharmony_ci
180e0857b17Sopenharmony_ci    if (value.size() > 0 && revValue.size() > 0) {
181e0857b17Sopenharmony_ci        EXPECT_STREQ(value.at(0).c_str(), operation->GetEntities().at(0).c_str());
182e0857b17Sopenharmony_ci    } else {
183e0857b17Sopenharmony_ci        EXPECT_EQ(true, revValue.size() > 0);
184e0857b17Sopenharmony_ci    }
185e0857b17Sopenharmony_ci}
186e0857b17Sopenharmony_ci
187e0857b17Sopenharmony_ci/**
188e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetEntities_0200
189e0857b17Sopenharmony_ci * @tc.name: WithEntities/GetEntities
190e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string is empty.
191e0857b17Sopenharmony_ci */
192e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetEntities_0200, Function | MediumTest | Level3)
193e0857b17Sopenharmony_ci{
194e0857b17Sopenharmony_ci    std::vector<std::string> value;
195e0857b17Sopenharmony_ci    operationbuilder_->WithEntities(value);
196e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
197e0857b17Sopenharmony_ci    EXPECT_EQ(true, operation->GetEntities().size() == 0);
198e0857b17Sopenharmony_ci}
199e0857b17Sopenharmony_ci
200e0857b17Sopenharmony_ci/**
201e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetFlags_0100
202e0857b17Sopenharmony_ci * @tc.name: WithFlags/GetFlags
203e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string contains special characters.
204e0857b17Sopenharmony_ci */
205e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetFlags_0100, Function | MediumTest | Level1)
206e0857b17Sopenharmony_ci{
207e0857b17Sopenharmony_ci    unsigned int value = 1;
208e0857b17Sopenharmony_ci    operationbuilder_->WithFlags(value);
209e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
210e0857b17Sopenharmony_ci    EXPECT_EQ(value, operation->GetFlags());
211e0857b17Sopenharmony_ci}
212e0857b17Sopenharmony_ci
213e0857b17Sopenharmony_ci/**
214e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetFlags_0200
215e0857b17Sopenharmony_ci * @tc.name: WithFlags/GetFlags
216e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string is empty.
217e0857b17Sopenharmony_ci */
218e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetFlags_0200, Function | MediumTest | Level3)
219e0857b17Sopenharmony_ci{
220e0857b17Sopenharmony_ci    unsigned int value = 0;
221e0857b17Sopenharmony_ci    operationbuilder_->WithFlags(value);
222e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
223e0857b17Sopenharmony_ci    EXPECT_EQ(value, operation->GetFlags());
224e0857b17Sopenharmony_ci}
225e0857b17Sopenharmony_ci
226e0857b17Sopenharmony_ci/**
227e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetUri_0100
228e0857b17Sopenharmony_ci * @tc.name: WithUri/GetUri
229e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string contains special characters.
230e0857b17Sopenharmony_ci */
231e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetUri_0100, Function | MediumTest | Level1)
232e0857b17Sopenharmony_ci{
233e0857b17Sopenharmony_ci    std::string value = "scheme://authority/path1/path2/path3?id = 1&name = mingming&old#fragment";
234e0857b17Sopenharmony_ci    OHOS::Uri uri(value);
235e0857b17Sopenharmony_ci    operationbuilder_->WithUri(uri);
236e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
237e0857b17Sopenharmony_ci
238e0857b17Sopenharmony_ci    EXPECT_EQ(uri, operation->GetUri());
239e0857b17Sopenharmony_ci}
240e0857b17Sopenharmony_ci
241e0857b17Sopenharmony_ci/**
242e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_GetUri_0200
243e0857b17Sopenharmony_ci * @tc.name: WithUri/GetUri
244e0857b17Sopenharmony_ci * @tc.desc: Verify the function when the input string is empty.
245e0857b17Sopenharmony_ci */
246e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_GetUri_0200, Function | MediumTest | Level3)
247e0857b17Sopenharmony_ci{
248e0857b17Sopenharmony_ci    std::string value = "";
249e0857b17Sopenharmony_ci    OHOS::Uri uri(value);
250e0857b17Sopenharmony_ci    operationbuilder_->WithUri(uri);
251e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
252e0857b17Sopenharmony_ci    EXPECT_EQ(uri, operation->GetUri());
253e0857b17Sopenharmony_ci}
254e0857b17Sopenharmony_ci
255e0857b17Sopenharmony_ci/**
256e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_build_0100
257e0857b17Sopenharmony_ci * @tc.name: build
258e0857b17Sopenharmony_ci * @tc.desc: Verify that the parameters are correct.
259e0857b17Sopenharmony_ci */
260e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_build_0100, Function | MediumTest | Level1)
261e0857b17Sopenharmony_ci{
262e0857b17Sopenharmony_ci    std::string value = "value";
263e0857b17Sopenharmony_ci    OHOS::Uri uri(value);
264e0857b17Sopenharmony_ci    std::vector<std::string> columns;
265e0857b17Sopenharmony_ci    columns.push_back("string1");
266e0857b17Sopenharmony_ci    operationbuilder_->WithUri(uri);
267e0857b17Sopenharmony_ci    operationbuilder_->WithAction(value);
268e0857b17Sopenharmony_ci    operationbuilder_->WithEntities(columns);
269e0857b17Sopenharmony_ci    operationbuilder_->WithDeviceId(value);
270e0857b17Sopenharmony_ci    operationbuilder_->WithBundleName(value);
271e0857b17Sopenharmony_ci    operationbuilder_->WithAbilityName(value);
272e0857b17Sopenharmony_ci
273e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
274e0857b17Sopenharmony_ci
275e0857b17Sopenharmony_ci    EXPECT_EQ(uri, operation->GetUri());
276e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetAction().c_str());
277e0857b17Sopenharmony_ci
278e0857b17Sopenharmony_ci    std::vector<std::string> revValue = operation->GetEntities();
279e0857b17Sopenharmony_ci
280e0857b17Sopenharmony_ci    if (columns.size() > 0 && revValue.size() > 0) {
281e0857b17Sopenharmony_ci        EXPECT_STREQ(columns.at(0).c_str(), operation->GetEntities().at(0).c_str());
282e0857b17Sopenharmony_ci    } else {
283e0857b17Sopenharmony_ci        EXPECT_EQ(true, revValue.size() > 0);
284e0857b17Sopenharmony_ci    }
285e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetDeviceId().c_str());
286e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetBundleName().c_str());
287e0857b17Sopenharmony_ci    EXPECT_STREQ(value.c_str(), operation->GetAbilityName().c_str());
288e0857b17Sopenharmony_ci}
289e0857b17Sopenharmony_ci
290e0857b17Sopenharmony_ci/**
291e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_Marshalling_0100
292e0857b17Sopenharmony_ci * @tc.name: Marshalling/Unmarshalling
293e0857b17Sopenharmony_ci * @tc.desc: Validation serialization.
294e0857b17Sopenharmony_ci */
295e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_Marshalling_0100, Function | MediumTest | Level1)
296e0857b17Sopenharmony_ci{
297e0857b17Sopenharmony_ci    std::string value = "value";
298e0857b17Sopenharmony_ci    OHOS::Uri uri(value);
299e0857b17Sopenharmony_ci    std::vector<std::string> columns;
300e0857b17Sopenharmony_ci    columns.push_back("string1");
301e0857b17Sopenharmony_ci    operationbuilder_->WithUri(uri);
302e0857b17Sopenharmony_ci    operationbuilder_->WithAction(value);
303e0857b17Sopenharmony_ci    operationbuilder_->WithEntities(columns);
304e0857b17Sopenharmony_ci    operationbuilder_->WithDeviceId(value);
305e0857b17Sopenharmony_ci    operationbuilder_->WithBundleName(value);
306e0857b17Sopenharmony_ci    operationbuilder_->WithAbilityName(value);
307e0857b17Sopenharmony_ci
308e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
309e0857b17Sopenharmony_ci    Parcel in;
310e0857b17Sopenharmony_ci    operation->Marshalling(in);
311e0857b17Sopenharmony_ci
312e0857b17Sopenharmony_ci    Operation *pOperation = operation->Unmarshalling(in);
313e0857b17Sopenharmony_ci    if (pOperation != nullptr) {
314e0857b17Sopenharmony_ci        EXPECT_EQ(true, *pOperation == *(operation.get()));
315e0857b17Sopenharmony_ci    } else {
316e0857b17Sopenharmony_ci        EXPECT_EQ(true, pOperation != nullptr);
317e0857b17Sopenharmony_ci    }
318e0857b17Sopenharmony_ci}
319e0857b17Sopenharmony_ci
320e0857b17Sopenharmony_ci/**
321e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_Operator_0100
322e0857b17Sopenharmony_ci * @tc.name: Operator
323e0857b17Sopenharmony_ci * @tc.desc: Verify string overload.
324e0857b17Sopenharmony_ci */
325e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_Operator_0100, Function | MediumTest | Level1)
326e0857b17Sopenharmony_ci{
327e0857b17Sopenharmony_ci    Operation operation_;
328e0857b17Sopenharmony_ci    std::string value = "value";
329e0857b17Sopenharmony_ci    OHOS::Uri uri(value);
330e0857b17Sopenharmony_ci    std::vector<std::string> columns;
331e0857b17Sopenharmony_ci    columns.push_back("string1");
332e0857b17Sopenharmony_ci    operationbuilder_->WithUri(uri);
333e0857b17Sopenharmony_ci    operationbuilder_->WithAction(value);
334e0857b17Sopenharmony_ci    operationbuilder_->WithEntities(columns);
335e0857b17Sopenharmony_ci    operationbuilder_->WithDeviceId(value);
336e0857b17Sopenharmony_ci    operationbuilder_->WithBundleName(value);
337e0857b17Sopenharmony_ci    operationbuilder_->WithAbilityName(value);
338e0857b17Sopenharmony_ci
339e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
340e0857b17Sopenharmony_ci    operation_ = *(operation.get());
341e0857b17Sopenharmony_ci
342e0857b17Sopenharmony_ci    EXPECT_EQ(true, operation_ == *(operation.get()));
343e0857b17Sopenharmony_ci}
344e0857b17Sopenharmony_ci
345e0857b17Sopenharmony_ci/**
346e0857b17Sopenharmony_ci * @tc.number: AaFwk_Operation_DumpInfo_0100
347e0857b17Sopenharmony_ci * @tc.name: DumpInfo
348e0857b17Sopenharmony_ci * @tc.desc: Verify string overload.
349e0857b17Sopenharmony_ci */
350e0857b17Sopenharmony_ciHWTEST_F(OperationBaseTest, AaFwk_Operation_DumpInfo_0100, Function | MediumTest | Level1)
351e0857b17Sopenharmony_ci{
352e0857b17Sopenharmony_ci    GTEST_LOG_(INFO) << "AaFwk_Operation_DumpInfo_0100 start";
353e0857b17Sopenharmony_ci    std::shared_ptr<Operation> operation = operationbuilder_->Build();
354e0857b17Sopenharmony_ci    int level = 10;
355e0857b17Sopenharmony_ci    operation->entities_.push_back("a");
356e0857b17Sopenharmony_ci    operation->entities_.push_back("b");
357e0857b17Sopenharmony_ci    operation->DumpInfo(level);
358e0857b17Sopenharmony_ci    EXPECT_EQ(true, operation->GetEntities().size() == 2);
359e0857b17Sopenharmony_ci    GTEST_LOG_(INFO) << "AaFwk_Operation_DumpInfo_0100 end";
360e0857b17Sopenharmony_ci}
361