PageRenderTime 48ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/aws-cpp-sdk-devicefarm/source/model/TestType.cpp

https://gitlab.com/vectorci/aws-sdk-cpp
C++ | 163 lines | 139 code | 10 blank | 14 comment | 43 complexity | 17db31f2bde2eee2aaf296c821fdec87 MD5 | raw file
  1. /*
  2. * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License").
  5. * You may not use this file except in compliance with the License.
  6. * A copy of the License is located at
  7. *
  8. * http://aws.amazon.com/apache2.0
  9. *
  10. * or in the "license" file accompanying this file. This file is distributed
  11. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  12. * express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. #include <aws/devicefarm/model/TestType.h>
  16. #include <aws/core/utils/HashingUtils.h>
  17. #include <aws/core/Globals.h>
  18. #include <aws/core/utils/EnumParseOverflowContainer.h>
  19. using namespace Aws::Utils;
  20. namespace Aws
  21. {
  22. namespace DeviceFarm
  23. {
  24. namespace Model
  25. {
  26. namespace TestTypeMapper
  27. {
  28. static const int BUILTIN_FUZZ_HASH = HashingUtils::HashString("BUILTIN_FUZZ");
  29. static const int BUILTIN_EXPLORER_HASH = HashingUtils::HashString("BUILTIN_EXPLORER");
  30. static const int APPIUM_JAVA_JUNIT_HASH = HashingUtils::HashString("APPIUM_JAVA_JUNIT");
  31. static const int APPIUM_JAVA_TESTNG_HASH = HashingUtils::HashString("APPIUM_JAVA_TESTNG");
  32. static const int APPIUM_PYTHON_HASH = HashingUtils::HashString("APPIUM_PYTHON");
  33. static const int APPIUM_WEB_JAVA_JUNIT_HASH = HashingUtils::HashString("APPIUM_WEB_JAVA_JUNIT");
  34. static const int APPIUM_WEB_JAVA_TESTNG_HASH = HashingUtils::HashString("APPIUM_WEB_JAVA_TESTNG");
  35. static const int APPIUM_WEB_PYTHON_HASH = HashingUtils::HashString("APPIUM_WEB_PYTHON");
  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. TestType GetTestTypeForName(const Aws::String& name)
  43. {
  44. int hashCode = HashingUtils::HashString(name.c_str());
  45. if (hashCode == BUILTIN_FUZZ_HASH)
  46. {
  47. return TestType::BUILTIN_FUZZ;
  48. }
  49. else if (hashCode == BUILTIN_EXPLORER_HASH)
  50. {
  51. return TestType::BUILTIN_EXPLORER;
  52. }
  53. else if (hashCode == APPIUM_JAVA_JUNIT_HASH)
  54. {
  55. return TestType::APPIUM_JAVA_JUNIT;
  56. }
  57. else if (hashCode == APPIUM_JAVA_TESTNG_HASH)
  58. {
  59. return TestType::APPIUM_JAVA_TESTNG;
  60. }
  61. else if (hashCode == APPIUM_PYTHON_HASH)
  62. {
  63. return TestType::APPIUM_PYTHON;
  64. }
  65. else if (hashCode == APPIUM_WEB_JAVA_JUNIT_HASH)
  66. {
  67. return TestType::APPIUM_WEB_JAVA_JUNIT;
  68. }
  69. else if (hashCode == APPIUM_WEB_JAVA_TESTNG_HASH)
  70. {
  71. return TestType::APPIUM_WEB_JAVA_TESTNG;
  72. }
  73. else if (hashCode == APPIUM_WEB_PYTHON_HASH)
  74. {
  75. return TestType::APPIUM_WEB_PYTHON;
  76. }
  77. else if (hashCode == CALABASH_HASH)
  78. {
  79. return TestType::CALABASH;
  80. }
  81. else if (hashCode == INSTRUMENTATION_HASH)
  82. {
  83. return TestType::INSTRUMENTATION;
  84. }
  85. else if (hashCode == UIAUTOMATION_HASH)
  86. {
  87. return TestType::UIAUTOMATION;
  88. }
  89. else if (hashCode == UIAUTOMATOR_HASH)
  90. {
  91. return TestType::UIAUTOMATOR;
  92. }
  93. else if (hashCode == XCTEST_HASH)
  94. {
  95. return TestType::XCTEST;
  96. }
  97. else if (hashCode == XCTEST_UI_HASH)
  98. {
  99. return TestType::XCTEST_UI;
  100. }
  101. EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
  102. if(overflowContainer)
  103. {
  104. overflowContainer->StoreOverflow(hashCode, name);
  105. return static_cast<TestType>(hashCode);
  106. }
  107. return TestType::NOT_SET;
  108. }
  109. Aws::String GetNameForTestType(TestType enumValue)
  110. {
  111. switch(enumValue)
  112. {
  113. case TestType::BUILTIN_FUZZ:
  114. return "BUILTIN_FUZZ";
  115. case TestType::BUILTIN_EXPLORER:
  116. return "BUILTIN_EXPLORER";
  117. case TestType::APPIUM_JAVA_JUNIT:
  118. return "APPIUM_JAVA_JUNIT";
  119. case TestType::APPIUM_JAVA_TESTNG:
  120. return "APPIUM_JAVA_TESTNG";
  121. case TestType::APPIUM_PYTHON:
  122. return "APPIUM_PYTHON";
  123. case TestType::APPIUM_WEB_JAVA_JUNIT:
  124. return "APPIUM_WEB_JAVA_JUNIT";
  125. case TestType::APPIUM_WEB_JAVA_TESTNG:
  126. return "APPIUM_WEB_JAVA_TESTNG";
  127. case TestType::APPIUM_WEB_PYTHON:
  128. return "APPIUM_WEB_PYTHON";
  129. case TestType::CALABASH:
  130. return "CALABASH";
  131. case TestType::INSTRUMENTATION:
  132. return "INSTRUMENTATION";
  133. case TestType::UIAUTOMATION:
  134. return "UIAUTOMATION";
  135. case TestType::UIAUTOMATOR:
  136. return "UIAUTOMATOR";
  137. case TestType::XCTEST:
  138. return "XCTEST";
  139. case TestType::XCTEST_UI:
  140. return "XCTEST_UI";
  141. default:
  142. EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
  143. if(overflowContainer)
  144. {
  145. return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
  146. }
  147. return "";
  148. }
  149. }
  150. } // namespace TestTypeMapper
  151. } // namespace Model
  152. } // namespace DeviceFarm
  153. } // namespace Aws