2019-01-25 18:35:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Poco/DOM/Document.h>
|
|
|
|
#include <Poco/Util/XMLConfiguration.h>
|
2019-01-28 16:20:29 +00:00
|
|
|
#include <Core/Types.h>
|
2019-01-25 18:35:16 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
using XMLConfiguration = Poco::Util::XMLConfiguration;
|
|
|
|
using XMLConfigurationPtr = Poco::AutoPtr<XMLConfiguration>;
|
|
|
|
using XMLDocumentPtr = Poco::AutoPtr<Poco::XML::Document>;
|
|
|
|
|
|
|
|
class ConfigPreprocessor
|
|
|
|
{
|
|
|
|
public:
|
2019-01-28 16:20:29 +00:00
|
|
|
ConfigPreprocessor(const Strings & paths_)
|
2019-01-25 18:35:16 +00:00
|
|
|
: paths(paths_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
std::vector<XMLConfigurationPtr> processConfig(
|
|
|
|
const Strings & tests_tags,
|
|
|
|
const Strings & tests_names,
|
|
|
|
const Strings & tests_names_regexp,
|
|
|
|
const Strings & skip_tags,
|
|
|
|
const Strings & skip_names,
|
|
|
|
const Strings & skip_names_regexp) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
enum class FilterType
|
|
|
|
{
|
|
|
|
Tag,
|
|
|
|
Name,
|
|
|
|
Name_regexp
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Removes configurations that has a given value.
|
|
|
|
/// If leave is true, the logic is reversed.
|
|
|
|
void removeConfigurationsIf(
|
|
|
|
std::vector<XMLConfigurationPtr> & configs,
|
|
|
|
FilterType filter_type,
|
|
|
|
const Strings & values,
|
|
|
|
bool leave = false) const;
|
|
|
|
|
2019-01-28 16:20:29 +00:00
|
|
|
const Strings paths;
|
2019-01-25 18:35:16 +00:00
|
|
|
};
|
|
|
|
}
|