1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/devicefarm/model/TestType.h>
7 #include <aws/core/utils/HashingUtils.h>
8 #include <aws/core/Globals.h>
9 #include <aws/core/utils/EnumParseOverflowContainer.h>
10 
11 using namespace Aws::Utils;
12 
13 
14 namespace Aws
15 {
16   namespace DeviceFarm
17   {
18     namespace Model
19     {
20       namespace TestTypeMapper
21       {
22 
23         static const int BUILTIN_FUZZ_HASH = HashingUtils::HashString("BUILTIN_FUZZ");
24         static const int BUILTIN_EXPLORER_HASH = HashingUtils::HashString("BUILTIN_EXPLORER");
25         static const int WEB_PERFORMANCE_PROFILE_HASH = HashingUtils::HashString("WEB_PERFORMANCE_PROFILE");
26         static const int APPIUM_JAVA_JUNIT_HASH = HashingUtils::HashString("APPIUM_JAVA_JUNIT");
27         static const int APPIUM_JAVA_TESTNG_HASH = HashingUtils::HashString("APPIUM_JAVA_TESTNG");
28         static const int APPIUM_PYTHON_HASH = HashingUtils::HashString("APPIUM_PYTHON");
29         static const int APPIUM_NODE_HASH = HashingUtils::HashString("APPIUM_NODE");
30         static const int APPIUM_RUBY_HASH = HashingUtils::HashString("APPIUM_RUBY");
31         static const int APPIUM_WEB_JAVA_JUNIT_HASH = HashingUtils::HashString("APPIUM_WEB_JAVA_JUNIT");
32         static const int APPIUM_WEB_JAVA_TESTNG_HASH = HashingUtils::HashString("APPIUM_WEB_JAVA_TESTNG");
33         static const int APPIUM_WEB_PYTHON_HASH = HashingUtils::HashString("APPIUM_WEB_PYTHON");
34         static const int APPIUM_WEB_NODE_HASH = HashingUtils::HashString("APPIUM_WEB_NODE");
35         static const int APPIUM_WEB_RUBY_HASH = HashingUtils::HashString("APPIUM_WEB_RUBY");
36         static const int CALABASH_HASH = HashingUtils::HashString("CALABASH");
37         static const int INSTRUMENTATION_HASH = HashingUtils::HashString("INSTRUMENTATION");
38         static const int UIAUTOMATION_HASH = HashingUtils::HashString("UIAUTOMATION");
39         static const int UIAUTOMATOR_HASH = HashingUtils::HashString("UIAUTOMATOR");
40         static const int XCTEST_HASH = HashingUtils::HashString("XCTEST");
41         static const int XCTEST_UI_HASH = HashingUtils::HashString("XCTEST_UI");
42         static const int REMOTE_ACCESS_RECORD_HASH = HashingUtils::HashString("REMOTE_ACCESS_RECORD");
43         static const int REMOTE_ACCESS_REPLAY_HASH = HashingUtils::HashString("REMOTE_ACCESS_REPLAY");
44 
45 
GetTestTypeForName(const Aws::String & name)46         TestType GetTestTypeForName(const Aws::String& name)
47         {
48           int hashCode = HashingUtils::HashString(name.c_str());
49           if (hashCode == BUILTIN_FUZZ_HASH)
50           {
51             return TestType::BUILTIN_FUZZ;
52           }
53           else if (hashCode == BUILTIN_EXPLORER_HASH)
54           {
55             return TestType::BUILTIN_EXPLORER;
56           }
57           else if (hashCode == WEB_PERFORMANCE_PROFILE_HASH)
58           {
59             return TestType::WEB_PERFORMANCE_PROFILE;
60           }
61           else if (hashCode == APPIUM_JAVA_JUNIT_HASH)
62           {
63             return TestType::APPIUM_JAVA_JUNIT;
64           }
65           else if (hashCode == APPIUM_JAVA_TESTNG_HASH)
66           {
67             return TestType::APPIUM_JAVA_TESTNG;
68           }
69           else if (hashCode == APPIUM_PYTHON_HASH)
70           {
71             return TestType::APPIUM_PYTHON;
72           }
73           else if (hashCode == APPIUM_NODE_HASH)
74           {
75             return TestType::APPIUM_NODE;
76           }
77           else if (hashCode == APPIUM_RUBY_HASH)
78           {
79             return TestType::APPIUM_RUBY;
80           }
81           else if (hashCode == APPIUM_WEB_JAVA_JUNIT_HASH)
82           {
83             return TestType::APPIUM_WEB_JAVA_JUNIT;
84           }
85           else if (hashCode == APPIUM_WEB_JAVA_TESTNG_HASH)
86           {
87             return TestType::APPIUM_WEB_JAVA_TESTNG;
88           }
89           else if (hashCode == APPIUM_WEB_PYTHON_HASH)
90           {
91             return TestType::APPIUM_WEB_PYTHON;
92           }
93           else if (hashCode == APPIUM_WEB_NODE_HASH)
94           {
95             return TestType::APPIUM_WEB_NODE;
96           }
97           else if (hashCode == APPIUM_WEB_RUBY_HASH)
98           {
99             return TestType::APPIUM_WEB_RUBY;
100           }
101           else if (hashCode == CALABASH_HASH)
102           {
103             return TestType::CALABASH;
104           }
105           else if (hashCode == INSTRUMENTATION_HASH)
106           {
107             return TestType::INSTRUMENTATION;
108           }
109           else if (hashCode == UIAUTOMATION_HASH)
110           {
111             return TestType::UIAUTOMATION;
112           }
113           else if (hashCode == UIAUTOMATOR_HASH)
114           {
115             return TestType::UIAUTOMATOR;
116           }
117           else if (hashCode == XCTEST_HASH)
118           {
119             return TestType::XCTEST;
120           }
121           else if (hashCode == XCTEST_UI_HASH)
122           {
123             return TestType::XCTEST_UI;
124           }
125           else if (hashCode == REMOTE_ACCESS_RECORD_HASH)
126           {
127             return TestType::REMOTE_ACCESS_RECORD;
128           }
129           else if (hashCode == REMOTE_ACCESS_REPLAY_HASH)
130           {
131             return TestType::REMOTE_ACCESS_REPLAY;
132           }
133           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
134           if(overflowContainer)
135           {
136             overflowContainer->StoreOverflow(hashCode, name);
137             return static_cast<TestType>(hashCode);
138           }
139 
140           return TestType::NOT_SET;
141         }
142 
GetNameForTestType(TestType enumValue)143         Aws::String GetNameForTestType(TestType enumValue)
144         {
145           switch(enumValue)
146           {
147           case TestType::BUILTIN_FUZZ:
148             return "BUILTIN_FUZZ";
149           case TestType::BUILTIN_EXPLORER:
150             return "BUILTIN_EXPLORER";
151           case TestType::WEB_PERFORMANCE_PROFILE:
152             return "WEB_PERFORMANCE_PROFILE";
153           case TestType::APPIUM_JAVA_JUNIT:
154             return "APPIUM_JAVA_JUNIT";
155           case TestType::APPIUM_JAVA_TESTNG:
156             return "APPIUM_JAVA_TESTNG";
157           case TestType::APPIUM_PYTHON:
158             return "APPIUM_PYTHON";
159           case TestType::APPIUM_NODE:
160             return "APPIUM_NODE";
161           case TestType::APPIUM_RUBY:
162             return "APPIUM_RUBY";
163           case TestType::APPIUM_WEB_JAVA_JUNIT:
164             return "APPIUM_WEB_JAVA_JUNIT";
165           case TestType::APPIUM_WEB_JAVA_TESTNG:
166             return "APPIUM_WEB_JAVA_TESTNG";
167           case TestType::APPIUM_WEB_PYTHON:
168             return "APPIUM_WEB_PYTHON";
169           case TestType::APPIUM_WEB_NODE:
170             return "APPIUM_WEB_NODE";
171           case TestType::APPIUM_WEB_RUBY:
172             return "APPIUM_WEB_RUBY";
173           case TestType::CALABASH:
174             return "CALABASH";
175           case TestType::INSTRUMENTATION:
176             return "INSTRUMENTATION";
177           case TestType::UIAUTOMATION:
178             return "UIAUTOMATION";
179           case TestType::UIAUTOMATOR:
180             return "UIAUTOMATOR";
181           case TestType::XCTEST:
182             return "XCTEST";
183           case TestType::XCTEST_UI:
184             return "XCTEST_UI";
185           case TestType::REMOTE_ACCESS_RECORD:
186             return "REMOTE_ACCESS_RECORD";
187           case TestType::REMOTE_ACCESS_REPLAY:
188             return "REMOTE_ACCESS_REPLAY";
189           default:
190             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
191             if(overflowContainer)
192             {
193               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
194             }
195 
196             return {};
197           }
198         }
199 
200       } // namespace TestTypeMapper
201     } // namespace Model
202   } // namespace DeviceFarm
203 } // namespace Aws
204