-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathMocking.h
More file actions
55 lines (50 loc) · 2.16 KB
/
Mocking.h
File metadata and controls
55 lines (50 loc) · 2.16 KB
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
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "test_HelperMacros.h"
#include "Framework/ConfigContext.h"
#include "Framework/WorkflowSpec.h"
#include "Framework/DataSpecUtils.h"
#include "Framework/SimpleOptionsRetriever.h"
#include "Framework/WorkflowCustomizationHelpers.h"
#include "Framework/ChannelConfigurationPolicy.h"
std::unique_ptr<o2::framework::ConfigContext> makeEmptyConfigContext()
{
using namespace o2::framework;
// FIXME: Ugly... We need to fix ownership and make sure the ConfigContext
// either owns or shares ownership of the registry.
std::vector<std::unique_ptr<ParamRetriever>> retrievers;
static std::vector<ConfigParamSpec> specs = WorkflowCustomizationHelpers::requiredWorkflowOptions();
for (auto& spec : specs) {
if (spec.name == "timeframes-rate-limit-ipcid") {
spec.defaultValue = "1";
}
}
auto store = std::make_unique<ConfigParamStore>(specs, std::move(retrievers));
store->preload();
store->activate();
static ConfigParamRegistry registry(std::move(store));
auto context = std::make_unique<ConfigContext>(registry, 0, nullptr);
return context;
}
using namespace o2::framework;
std::vector<ChannelConfigurationPolicy> makeTrivialChannelPolicies(ConfigContext const& configContext)
{
ChannelConfigurationPolicy defaultPolicy;
FairMQChannelConfigSpec spec;
spec.rateLogging = 0;
spec.recvBufferSize = 1;
spec.sendBufferSize = 1;
spec.ipcPrefix = "@";
defaultPolicy.match = ChannelConfigurationPolicyHelpers::matchAny;
defaultPolicy.modifyInput = ChannelConfigurationPolicyHelpers::pullInput(spec);
defaultPolicy.modifyOutput = ChannelConfigurationPolicyHelpers::pushOutput(spec);
return {defaultPolicy};
}