2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file test_results_collector.h
18 * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
20 * @brief Implementation file some concrete TestResulstsCollector
22 #include <dpl/test/statistic.h>
23 #include <dpl/test/test_results_collector.h>
24 #include <dpl/test/test_results_collector_console.h>
25 #include <dpl/test/test_results_collector_html.h>
26 #include <dpl/test/test_results_collector_summary.h>
27 #include <dpl/test/test_results_collector_xml.h>
32 void TestResultsCollectorBase::RegisterCollectorConstructor(
33 const std::string& name,
34 TestResultsCollectorBase::CollectorConstructorFunc func)
36 Assert(m_constructorsMap.find(name) == m_constructorsMap.end());
37 m_constructorsMap[name] = func;
40 TestResultsCollectorBase* TestResultsCollectorBase::Create(
41 const std::string& name)
43 ConstructorsMap::iterator found = m_constructorsMap.find(name);
44 if (found != m_constructorsMap.end()) {
45 return found->second();
51 std::vector<std::string> TestResultsCollectorBase::GetCollectorsNames()
53 std::vector<std::string> list;
54 for (auto &constructor : m_constructorsMap)
56 list.push_back(constructor.first);
61 TestResultsCollectorBase::ConstructorsMap TestResultsCollectorBase::
65 static int RegisterCollectorConstructors();
66 static const int RegisterHelperVariable = RegisterCollectorConstructors();
67 int RegisterCollectorConstructors()
69 (void)RegisterHelperVariable;
71 TestResultsCollectorBase::RegisterCollectorConstructor(
73 &ConsoleCollector::Constructor);
74 TestResultsCollectorBase::RegisterCollectorConstructor(
76 &HtmlCollector::Constructor);
77 TestResultsCollectorBase::RegisterCollectorConstructor(
79 &SummaryCollector::Constructor);
80 TestResultsCollectorBase::RegisterCollectorConstructor(
82 &XmlCollector::Constructor);