-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathCreateTestCaseResult.cc
139 lines (126 loc) · 5.63 KB
/
CreateTestCaseResult.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/devops/model/CreateTestCaseResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Devops;
using namespace AlibabaCloud::Devops::Model;
CreateTestCaseResult::CreateTestCaseResult() :
ServiceResult()
{}
CreateTestCaseResult::CreateTestCaseResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
CreateTestCaseResult::~CreateTestCaseResult()
{}
void CreateTestCaseResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto testcaseNode = value["testcase"];
if(!testcaseNode["identifier"].isNull())
testcase_.identifier = testcaseNode["identifier"].asString();
if(!testcaseNode["subject"].isNull())
testcase_.subject = testcaseNode["subject"].asString();
if(!testcaseNode["spaceIdentifier"].isNull())
testcase_.spaceIdentifier = testcaseNode["spaceIdentifier"].asString();
if(!testcaseNode["spaceType"].isNull())
testcase_.spaceType = testcaseNode["spaceType"].asString();
if(!testcaseNode["categoryIdentifier"].isNull())
testcase_.categoryIdentifier = testcaseNode["categoryIdentifier"].asString();
auto assignedToNode = testcaseNode["assignedTo"];
if(!assignedToNode["assignIdentifier"].isNull())
testcase_.assignedTo.assignIdentifier = assignedToNode["assignIdentifier"].asString();
if(!assignedToNode["name"].isNull())
testcase_.assignedTo.name = assignedToNode["name"].asString();
if(!assignedToNode["tbRoleId"].isNull())
testcase_.assignedTo.tbRoleId = assignedToNode["tbRoleId"].asString();
auto creatorNode = testcaseNode["creator"];
if(!creatorNode["createIdentifier"].isNull())
testcase_.creator.createIdentifier = creatorNode["createIdentifier"].asString();
if(!creatorNode["name"].isNull())
testcase_.creator.name = creatorNode["name"].asString();
auto modifierNode = testcaseNode["modifier"];
if(!modifierNode["modifyIdentifier"].isNull())
testcase_.modifier.modifyIdentifier = modifierNode["modifyIdentifier"].asString();
if(!modifierNode["name"].isNull())
testcase_.modifier.name = modifierNode["name"].asString();
auto directoryNode = testcaseNode["directory"];
if(!directoryNode["directoryIdentifier"].isNull())
testcase_.directory.directoryIdentifier = directoryNode["directoryIdentifier"].asString();
if(!directoryNode["name"].isNull())
testcase_.directory.name = directoryNode["name"].asString();
if(!directoryNode["childIdentifier"].isNull())
testcase_.directory.childIdentifier = directoryNode["childIdentifier"].asString();
auto allPathName = directoryNode["pathName"]["idPathDisplayNames"];
for (auto value : allPathName)
testcase_.directory.pathName.push_back(value.asString());
auto detailInfoNode = testcaseNode["detailInfo"];
if(!detailInfoNode["stepType"].isNull())
testcase_.detailInfo.stepType = detailInfoNode["stepType"].asString();
auto preconditionNode = detailInfoNode["precondition"];
if(!preconditionNode["preIdentifier"].isNull())
testcase_.detailInfo.precondition.preIdentifier = preconditionNode["preIdentifier"].asString();
if(!preconditionNode["preContent"].isNull())
testcase_.detailInfo.precondition.preContent = preconditionNode["preContent"].asString();
if(!preconditionNode["preContentType"].isNull())
testcase_.detailInfo.precondition.preContentType = preconditionNode["preContentType"].asString();
auto stepContentNode = detailInfoNode["stepContent"];
if(!stepContentNode["stepIdentifier"].isNull())
testcase_.detailInfo.stepContent.stepIdentifier = stepContentNode["stepIdentifier"].asString();
if(!stepContentNode["stepContent"].isNull())
testcase_.detailInfo.stepContent.stepContent = stepContentNode["stepContent"].asString();
if(!stepContentNode["stepContentType"].isNull())
testcase_.detailInfo.stepContent.stepContentType = stepContentNode["stepContentType"].asString();
auto expectedResultNode = detailInfoNode["expectedResult"];
if(!expectedResultNode["expectIdentifier"].isNull())
testcase_.detailInfo.expectedResult.expectIdentifier = expectedResultNode["expectIdentifier"].asString();
if(!expectedResultNode["expectContent"].isNull())
testcase_.detailInfo.expectedResult.expectContent = expectedResultNode["expectContent"].asString();
if(!expectedResultNode["expectContentType"].isNull())
testcase_.detailInfo.expectedResult.expectContentType = expectedResultNode["expectContentType"].asString();
if(!value["requestId"].isNull())
requestId_ = value["requestId"].asString();
if(!value["errorMsg"].isNull())
errorMsg_ = value["errorMsg"].asString();
if(!value["errorCode"].isNull())
errorCode_ = value["errorCode"].asString();
if(!value["success"].isNull())
success_ = value["success"].asString() == "true";
}
CreateTestCaseResult::Testcase CreateTestCaseResult::getTestcase()const
{
return testcase_;
}
std::string CreateTestCaseResult::getRequestId()const
{
return requestId_;
}
std::string CreateTestCaseResult::getErrorMsg()const
{
return errorMsg_;
}
std::string CreateTestCaseResult::getErrorCode()const
{
return errorCode_;
}
bool CreateTestCaseResult::getSuccess()const
{
return success_;
}