xref: /openbmc/telemetry/tests/src/test_report_manager.cpp (revision b47b7db48c4f883eb191077848d55d96bd884607)
12f9f9b87SWludzik, Jozef #include "dbus_environment.hpp"
2d2238194SKrzysztof Grobelny #include "helpers.hpp"
3b4ef22e4SSzymon Dompke #include "interfaces/trigger_manager.hpp"
4e2362796SWludzik, Jozef #include "mocks/json_storage_mock.hpp"
52f9f9b87SWludzik, Jozef #include "mocks/report_factory_mock.hpp"
6b4ef22e4SSzymon Dompke #include "mocks/trigger_manager_mock.hpp"
7e2362796SWludzik, Jozef #include "params/report_params.hpp"
8e2362796SWludzik, Jozef #include "report.hpp"
92f9f9b87SWludzik, Jozef #include "report_manager.hpp"
10e8fc5751SKrzysztof Grobelny #include "utils/conversion.hpp"
1132305f14SSzymon Dompke #include "utils/dbus_path_utils.hpp"
1232305f14SSzymon Dompke #include "utils/string_utils.hpp"
13e2362796SWludzik, Jozef #include "utils/transform.hpp"
1432305f14SSzymon Dompke #include "utils/tstring.hpp"
15a8182bebSKrzysztof Grobelny #include "utils/variant_utils.hpp"
162f9f9b87SWludzik, Jozef 
172f9f9b87SWludzik, Jozef using namespace testing;
18e8fc5751SKrzysztof Grobelny using namespace std::string_literals;
19e2362796SWludzik, Jozef using namespace std::chrono_literals;
202f9f9b87SWludzik, Jozef 
21cff70c14SKrzysztof Grobelny using AddReportVariantForSet = utils::WithoutMonostate<AddReportVariant>;
22a8182bebSKrzysztof Grobelny 
232f9f9b87SWludzik, Jozef class TestReportManager : public Test
242f9f9b87SWludzik, Jozef {
252f9f9b87SWludzik, Jozef   public:
26e2362796SWludzik, Jozef     ReportParams reportParams;
272f9f9b87SWludzik, Jozef 
282f9f9b87SWludzik, Jozef     std::unique_ptr<ReportFactoryMock> reportFactoryMockPtr =
292f9f9b87SWludzik, Jozef         std::make_unique<StrictMock<ReportFactoryMock>>();
302f9f9b87SWludzik, Jozef     ReportFactoryMock& reportFactoryMock = *reportFactoryMockPtr;
31e2362796SWludzik, Jozef 
32e2362796SWludzik, Jozef     std::unique_ptr<StorageMock> storageMockPtr =
33e2362796SWludzik, Jozef         std::make_unique<NiceMock<StorageMock>>();
34e2362796SWludzik, Jozef     StorageMock& storageMock = *storageMockPtr;
35e2362796SWludzik, Jozef 
36d2238194SKrzysztof Grobelny     std::unique_ptr<ReportMock> reportMockPtr =
37b8cc78ddSKrzysztof Grobelny         std::make_unique<NiceMock<ReportMock>>(reportParams.reportId());
38d2238194SKrzysztof Grobelny     ReportMock& reportMock = *reportMockPtr;
39d2238194SKrzysztof Grobelny 
40e2362796SWludzik, Jozef     std::unique_ptr<ReportManager> sut;
412f9f9b87SWludzik, Jozef 
422f9f9b87SWludzik, Jozef     MockFunction<void(std::string)> checkPoint;
432f9f9b87SWludzik, Jozef 
SetUp()44e2362796SWludzik, Jozef     void SetUp() override
45e2362796SWludzik, Jozef     {
46dcc4e193SKrzysztof Grobelny         EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _))
47dcc4e193SKrzysztof Grobelny             .Times(AnyNumber());
48dcc4e193SKrzysztof Grobelny 
49e6d48874SKrzysztof Grobelny         sut = std::make_unique<ReportManager>(std::move(reportFactoryMockPtr),
50e6d48874SKrzysztof Grobelny                                               std::move(storageMockPtr),
51e6d48874SKrzysztof Grobelny                                               DbusEnvironment::getObjServer());
52e2362796SWludzik, Jozef     }
53e2362796SWludzik, Jozef 
TearDown()542f9f9b87SWludzik, Jozef     void TearDown() override
552f9f9b87SWludzik, Jozef     {
562f9f9b87SWludzik, Jozef         DbusEnvironment::synchronizeIoc();
572f9f9b87SWludzik, Jozef     }
582f9f9b87SWludzik, Jozef 
59cff70c14SKrzysztof Grobelny     template <class... Args>
60cff70c14SKrzysztof Grobelny         requires(sizeof...(Args) > 1)
addReport(Args &&...args)61cff70c14SKrzysztof Grobelny     std::pair<boost::system::error_code, std::string> addReport(Args&&... args)
622f9f9b87SWludzik, Jozef     {
632f9f9b87SWludzik, Jozef         std::promise<std::pair<boost::system::error_code, std::string>>
642f9f9b87SWludzik, Jozef             addReportPromise;
652f9f9b87SWludzik, Jozef         DbusEnvironment::getBus()->async_method_call(
662f9f9b87SWludzik, Jozef             [&addReportPromise](boost::system::error_code ec,
672f9f9b87SWludzik, Jozef                                 const std::string& path) {
682f9f9b87SWludzik, Jozef             addReportPromise.set_value({ec, path});
692f9f9b87SWludzik, Jozef         },
702f9f9b87SWludzik, Jozef             DbusEnvironment::serviceName(), ReportManager::reportManagerPath,
71cff70c14SKrzysztof Grobelny             ReportManager::reportManagerIfaceName, "AddReport",
72cff70c14SKrzysztof Grobelny             std::forward<Args>(args)...);
73f32f6fefSKrzysztof Grobelny         return DbusEnvironment::waitForFuture(addReportPromise.get_future());
742f9f9b87SWludzik, Jozef     }
752f9f9b87SWludzik, Jozef 
addReport(const ReportParams & params)7651497a0cSKrzysztof Grobelny     auto addReport(const ReportParams& params)
7751497a0cSKrzysztof Grobelny     {
78cff70c14SKrzysztof Grobelny         return addReport(
79cff70c14SKrzysztof Grobelny             params.reportId(), params.reportName(),
80cff70c14SKrzysztof Grobelny             utils::enumToString(params.reportingType()),
81cff70c14SKrzysztof Grobelny             utils::enumToString(params.reportUpdates()), params.appendLimit(),
82cff70c14SKrzysztof Grobelny             utils::transform(
83cff70c14SKrzysztof Grobelny                 params.reportActions(),
84cff70c14SKrzysztof Grobelny                 [](const auto v) { return utils::enumToString(v); }),
85cff70c14SKrzysztof Grobelny             params.interval().count(),
86cff70c14SKrzysztof Grobelny             toReadingParameters(params.metricParameters()), params.enabled());
8751497a0cSKrzysztof Grobelny     }
8851497a0cSKrzysztof Grobelny 
892f9f9b87SWludzik, Jozef     template <class T>
getProperty(const std::string & property)90e28aa53dSSzymon Dompke     static T getProperty(const std::string& property)
912f9f9b87SWludzik, Jozef     {
92e28aa53dSSzymon Dompke         return DbusEnvironment::getProperty<T>(
932f9f9b87SWludzik, Jozef             ReportManager::reportManagerPath,
94e28aa53dSSzymon Dompke             ReportManager::reportManagerIfaceName, property);
9532859b63SKarol Niczyj     }
962f9f9b87SWludzik, Jozef };
972f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,minInterval)982f9f9b87SWludzik, Jozef TEST_F(TestReportManager, minInterval)
992f9f9b87SWludzik, Jozef {
1002f9f9b87SWludzik, Jozef     EXPECT_THAT(getProperty<uint64_t>("MinInterval"),
101dcc4e193SKrzysztof Grobelny                 Eq(ReportManager::minInterval.count()));
1022f9f9b87SWludzik, Jozef }
1032f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,maxReports)1042f9f9b87SWludzik, Jozef TEST_F(TestReportManager, maxReports)
1052f9f9b87SWludzik, Jozef {
106503c1589SWludzik, Jozef     EXPECT_THAT(getProperty<size_t>("MaxReports"),
1072f9f9b87SWludzik, Jozef                 Eq(ReportManager::maxReports));
1082f9f9b87SWludzik, Jozef }
1092f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,returnsPropertySupportedOperationTypes)11060fee077SKrzysztof Grobelny TEST_F(TestReportManager, returnsPropertySupportedOperationTypes)
11160fee077SKrzysztof Grobelny {
11260fee077SKrzysztof Grobelny     EXPECT_THAT(
11360fee077SKrzysztof Grobelny         getProperty<std::vector<std::string>>("SupportedOperationTypes"),
114cff70c14SKrzysztof Grobelny         UnorderedElementsAre(utils::enumToString(OperationType::max),
115cff70c14SKrzysztof Grobelny                              utils::enumToString(OperationType::min),
116cff70c14SKrzysztof Grobelny                              utils::enumToString(OperationType::avg),
117cff70c14SKrzysztof Grobelny                              utils::enumToString(OperationType::sum)));
11860fee077SKrzysztof Grobelny }
11960fee077SKrzysztof Grobelny 
TEST_F(TestReportManager,addReport)1202f9f9b87SWludzik, Jozef TEST_F(TestReportManager, addReport)
1212f9f9b87SWludzik, Jozef {
122dcc4e193SKrzysztof Grobelny     EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
123dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock))
1242f9f9b87SWludzik, Jozef         .WillOnce(Return(ByMove(std::move(reportMockPtr))));
1252f9f9b87SWludzik, Jozef 
126e2362796SWludzik, Jozef     auto [ec, path] = addReport(reportParams);
1272f9f9b87SWludzik, Jozef     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
1282f9f9b87SWludzik, Jozef     EXPECT_THAT(path, Eq(reportMock.getPath()));
1292f9f9b87SWludzik, Jozef }
1302f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,addDisabledReport)131a8182bebSKrzysztof Grobelny TEST_F(TestReportManager, addDisabledReport)
132a8182bebSKrzysztof Grobelny {
133a8182bebSKrzysztof Grobelny     reportParams.enabled(false);
134a8182bebSKrzysztof Grobelny 
135a8182bebSKrzysztof Grobelny     EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
136a8182bebSKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock))
137a8182bebSKrzysztof Grobelny         .WillOnce(Return(ByMove(std::move(reportMockPtr))));
138a8182bebSKrzysztof Grobelny 
139a8182bebSKrzysztof Grobelny     auto [ec, path] = addReport(reportParams);
140a8182bebSKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
141a8182bebSKrzysztof Grobelny     EXPECT_THAT(path, Eq(reportMock.getPath()));
142a8182bebSKrzysztof Grobelny }
143a8182bebSKrzysztof Grobelny 
TEST_F(TestReportManager,addReportWithOnlyDefaultParams)144a8182bebSKrzysztof Grobelny TEST_F(TestReportManager, addReportWithOnlyDefaultParams)
145a8182bebSKrzysztof Grobelny {
146a8182bebSKrzysztof Grobelny     EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
147a8182bebSKrzysztof Grobelny     EXPECT_CALL(reportFactoryMock,
148a8182bebSKrzysztof Grobelny                 make("Report"s, "Report"s, ReportingType::onRequest,
14962c08e9bSKrzysztof Grobelny                      std::vector<ReportAction>{}, Milliseconds{}, 256,
150a8182bebSKrzysztof Grobelny                      ReportUpdates::overwrite, _, _,
151a8182bebSKrzysztof Grobelny                      std::vector<LabeledMetricParameters>{}, true, Readings{}))
152a8182bebSKrzysztof Grobelny         .WillOnce(Return(ByMove(std::move(reportMockPtr))));
153a8182bebSKrzysztof Grobelny 
154a8182bebSKrzysztof Grobelny     auto [ec, path] = addReport(
155cff70c14SKrzysztof Grobelny         "", "", "", "", std::numeric_limits<uint64_t>::max(),
156cff70c14SKrzysztof Grobelny         std::vector<std::string>(), std::numeric_limits<uint64_t>::max(),
157cff70c14SKrzysztof Grobelny         ReadingParameters(), true);
158cff70c14SKrzysztof Grobelny 
159a8182bebSKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
160a8182bebSKrzysztof Grobelny     EXPECT_THAT(path, Eq(reportMock.getPath()));
161a8182bebSKrzysztof Grobelny }
162a8182bebSKrzysztof Grobelny 
TEST_F(TestReportManager,addOnChangeReport)163f7ea2997SKrzysztof Grobelny TEST_F(TestReportManager, addOnChangeReport)
164f7ea2997SKrzysztof Grobelny {
165f7ea2997SKrzysztof Grobelny     EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
166f7ea2997SKrzysztof Grobelny     reportFactoryMock
167f7ea2997SKrzysztof Grobelny         .expectMake(reportParams.reportingType(ReportingType::onChange),
168f7ea2997SKrzysztof Grobelny                     Ref(*sut), Ref(storageMock))
169f7ea2997SKrzysztof Grobelny         .WillOnce(Return(ByMove(std::move(reportMockPtr))));
170f7ea2997SKrzysztof Grobelny 
171f7ea2997SKrzysztof Grobelny     auto [ec, path] = addReport(reportParams);
172f7ea2997SKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
173f7ea2997SKrzysztof Grobelny     EXPECT_THAT(path, Eq(reportMock.getPath()));
174f7ea2997SKrzysztof Grobelny }
175f7ea2997SKrzysztof Grobelny 
TEST_F(TestReportManager,nameIsUsedToGenerateIdWhenIdIsEmptyInAddReport)176b8cc78ddSKrzysztof Grobelny TEST_F(TestReportManager, nameIsUsedToGenerateIdWhenIdIsEmptyInAddReport)
17732859b63SKarol Niczyj {
178b8cc78ddSKrzysztof Grobelny     reportParams.reportId("ReportName");
179b8cc78ddSKrzysztof Grobelny     reportParams.reportName("ReportName");
180b8cc78ddSKrzysztof Grobelny 
181b8cc78ddSKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock));
182b8cc78ddSKrzysztof Grobelny 
183b8cc78ddSKrzysztof Grobelny     auto [ec, path] = addReport(reportParams.reportId(""));
184b8cc78ddSKrzysztof Grobelny 
185b8cc78ddSKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
186b8cc78ddSKrzysztof Grobelny     EXPECT_THAT(path, Eq("/ReportName"));
187b8cc78ddSKrzysztof Grobelny }
188b8cc78ddSKrzysztof Grobelny 
TEST_F(TestReportManager,nameIsUsedToGenerateIdWhenIdIsNamespace)189b8cc78ddSKrzysztof Grobelny TEST_F(TestReportManager, nameIsUsedToGenerateIdWhenIdIsNamespace)
190b8cc78ddSKrzysztof Grobelny {
191b8cc78ddSKrzysztof Grobelny     reportParams.reportId("Prefix/ReportName");
192b8cc78ddSKrzysztof Grobelny     reportParams.reportName("ReportName");
193b8cc78ddSKrzysztof Grobelny 
194b8cc78ddSKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock));
195b8cc78ddSKrzysztof Grobelny 
196b8cc78ddSKrzysztof Grobelny     auto [ec, path] = addReport(reportParams.reportId("Prefix/"));
197b8cc78ddSKrzysztof Grobelny 
198b8cc78ddSKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
199b8cc78ddSKrzysztof Grobelny     EXPECT_THAT(path, Eq("/Prefix/ReportName"));
200b8cc78ddSKrzysztof Grobelny }
201b8cc78ddSKrzysztof Grobelny 
TEST_F(TestReportManager,addReportWithMaxLengthId)202b8cc78ddSKrzysztof Grobelny TEST_F(TestReportManager, addReportWithMaxLengthId)
203b8cc78ddSKrzysztof Grobelny {
20432305f14SSzymon Dompke     std::string reportId = utils::string_utils::getMaxId();
205b8cc78ddSKrzysztof Grobelny     reportParams.reportId(reportId);
206dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock));
20732859b63SKarol Niczyj 
20832859b63SKarol Niczyj     auto [ec, path] = addReport(reportParams);
20932859b63SKarol Niczyj 
21032859b63SKarol Niczyj     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
211b8cc78ddSKrzysztof Grobelny     EXPECT_THAT(path, Eq("/"s + reportId));
21232859b63SKarol Niczyj }
21332859b63SKarol Niczyj 
TEST_F(TestReportManager,addReportWithMaxLengthPrefix)21432305f14SSzymon Dompke TEST_F(TestReportManager, addReportWithMaxLengthPrefix)
21532305f14SSzymon Dompke {
21632305f14SSzymon Dompke     std::string reportId = utils::string_utils::getMaxPrefix() + "/MyId";
21732305f14SSzymon Dompke     reportParams.reportId(reportId);
21832305f14SSzymon Dompke     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock));
21932305f14SSzymon Dompke 
22032305f14SSzymon Dompke     auto [ec, path] = addReport(reportParams);
22132305f14SSzymon Dompke 
22232305f14SSzymon Dompke     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
22332305f14SSzymon Dompke     EXPECT_THAT(path, Eq("/"s + reportId));
22432305f14SSzymon Dompke }
22532305f14SSzymon Dompke 
TEST_F(TestReportManager,addReportWithMaxLengthName)22632305f14SSzymon Dompke TEST_F(TestReportManager, addReportWithMaxLengthName)
22732305f14SSzymon Dompke {
22832305f14SSzymon Dompke     reportParams.reportName(utils::string_utils::getMaxName());
22932305f14SSzymon Dompke     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock));
23032305f14SSzymon Dompke 
23132305f14SSzymon Dompke     auto [ec, path] = addReport(reportParams);
23232305f14SSzymon Dompke 
23332305f14SSzymon Dompke     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
23432305f14SSzymon Dompke     EXPECT_THAT(path, Eq("/"s + reportParams.reportId()));
23532305f14SSzymon Dompke }
23632305f14SSzymon Dompke 
TEST_F(TestReportManager,failToAddReportWithTooLongFullId)237*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithTooLongFullId)
23832859b63SKarol Niczyj {
239dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
24032859b63SKarol Niczyj         .Times(0);
24132859b63SKarol Niczyj 
242b8cc78ddSKrzysztof Grobelny     reportParams.reportId(
24332305f14SSzymon Dompke         std::string(utils::constants::maxReportFullIdLength + 1, 'z'));
24432305f14SSzymon Dompke 
24532305f14SSzymon Dompke     auto [ec, path] = addReport(reportParams);
24632305f14SSzymon Dompke 
24732305f14SSzymon Dompke     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
24832305f14SSzymon Dompke     EXPECT_THAT(path, Eq(std::string()));
24932305f14SSzymon Dompke }
25032305f14SSzymon Dompke 
TEST_F(TestReportManager,failToAddReportWithTooLongId)251*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithTooLongId)
25232305f14SSzymon Dompke {
25332305f14SSzymon Dompke     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
25432305f14SSzymon Dompke         .Times(0);
25532305f14SSzymon Dompke 
25632305f14SSzymon Dompke     reportParams.reportId(utils::string_utils::getTooLongId());
25732305f14SSzymon Dompke 
25832305f14SSzymon Dompke     auto [ec, path] = addReport(reportParams);
25932305f14SSzymon Dompke 
26032305f14SSzymon Dompke     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
26132305f14SSzymon Dompke     EXPECT_THAT(path, Eq(std::string()));
26232305f14SSzymon Dompke }
26332305f14SSzymon Dompke 
TEST_F(TestReportManager,failToAddReportWithTooLongPrefix)264*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithTooLongPrefix)
26532305f14SSzymon Dompke {
26632305f14SSzymon Dompke     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
26732305f14SSzymon Dompke         .Times(0);
26832305f14SSzymon Dompke 
26932305f14SSzymon Dompke     reportParams.reportId(utils::string_utils::getTooLongPrefix() + "/MyId");
27032305f14SSzymon Dompke 
27132305f14SSzymon Dompke     auto [ec, path] = addReport(reportParams);
27232305f14SSzymon Dompke 
27332305f14SSzymon Dompke     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
27432305f14SSzymon Dompke     EXPECT_THAT(path, Eq(std::string()));
27532305f14SSzymon Dompke }
27632305f14SSzymon Dompke 
TEST_F(TestReportManager,failToAddReportWithTooManyPrefixes)277*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithTooManyPrefixes)
27832305f14SSzymon Dompke {
27932305f14SSzymon Dompke     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
28032305f14SSzymon Dompke         .Times(0);
28132305f14SSzymon Dompke 
28232305f14SSzymon Dompke     std::string reportId;
28332305f14SSzymon Dompke     for (size_t i = 0; i < utils::constants::maxPrefixesInId + 1; i++)
28432305f14SSzymon Dompke     {
28532305f14SSzymon Dompke         reportId += "prefix/";
28632305f14SSzymon Dompke     }
28732305f14SSzymon Dompke     reportId += "MyId";
28832305f14SSzymon Dompke 
28932305f14SSzymon Dompke     reportParams.reportId(reportId);
29032305f14SSzymon Dompke 
29132305f14SSzymon Dompke     auto [ec, path] = addReport(reportParams);
29232305f14SSzymon Dompke 
29332305f14SSzymon Dompke     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
29432305f14SSzymon Dompke     EXPECT_THAT(path, Eq(std::string()));
29532305f14SSzymon Dompke }
29632305f14SSzymon Dompke 
TEST_F(TestReportManager,failToAddReportWithTooLongName)297*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithTooLongName)
29832305f14SSzymon Dompke {
29932305f14SSzymon Dompke     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
30032305f14SSzymon Dompke         .Times(0);
30132305f14SSzymon Dompke 
30232305f14SSzymon Dompke     reportParams.reportName(utils::string_utils::getTooLongName());
30332305f14SSzymon Dompke 
30432305f14SSzymon Dompke     auto [ec, path] = addReport(reportParams);
30532305f14SSzymon Dompke 
30632305f14SSzymon Dompke     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
30732305f14SSzymon Dompke     EXPECT_THAT(path, Eq(std::string()));
30832305f14SSzymon Dompke }
30932305f14SSzymon Dompke 
TEST_F(TestReportManager,failToAddReportTwice)310*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportTwice)
3112f9f9b87SWludzik, Jozef {
312dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock))
313d2238194SKrzysztof Grobelny         .WillOnce(Return(ByMove(std::move(reportMockPtr))));
3142f9f9b87SWludzik, Jozef 
315e2362796SWludzik, Jozef     addReport(reportParams);
3162f9f9b87SWludzik, Jozef 
317e2362796SWludzik, Jozef     auto [ec, path] = addReport(reportParams);
31832859b63SKarol Niczyj 
3192f9f9b87SWludzik, Jozef     EXPECT_THAT(ec.value(), Eq(boost::system::errc::file_exists));
3202f9f9b87SWludzik, Jozef     EXPECT_THAT(path, Eq(std::string()));
3212f9f9b87SWludzik, Jozef }
3222f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,failToAddReportWithInvalidInterval)323*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithInvalidInterval)
3242f9f9b87SWludzik, Jozef {
325dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
326d2238194SKrzysztof Grobelny         .Times(0);
3272f9f9b87SWludzik, Jozef 
32851497a0cSKrzysztof Grobelny     reportParams.reportingType(ReportingType::periodic);
329973b4bb0SKrzysztof Grobelny     reportParams.interval(ReportManager::minInterval - 1ms);
3302f9f9b87SWludzik, Jozef 
331e2362796SWludzik, Jozef     auto [ec, path] = addReport(reportParams);
33232859b63SKarol Niczyj 
3332f9f9b87SWludzik, Jozef     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
3342f9f9b87SWludzik, Jozef     EXPECT_THAT(path, Eq(std::string()));
3352f9f9b87SWludzik, Jozef }
3362f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,failToAddReportWithInvalidReportingType)337*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithInvalidReportingType)
338bc766b4dSWludzik, Jozef {
339dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
340bc766b4dSWludzik, Jozef         .Times(0);
341bc766b4dSWludzik, Jozef 
342cff70c14SKrzysztof Grobelny     auto [ec, path] = addReport(
343cff70c14SKrzysztof Grobelny         "", "", "InvalidReportingType", "",
344cff70c14SKrzysztof Grobelny         std::numeric_limits<uint64_t>::max(), std::vector<std::string>(),
345cff70c14SKrzysztof Grobelny         std::numeric_limits<uint64_t>::max(), ReadingParameters(), false);
34632859b63SKarol Niczyj 
347bc766b4dSWludzik, Jozef     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
348bc766b4dSWludzik, Jozef     EXPECT_THAT(path, Eq(std::string()));
349bc766b4dSWludzik, Jozef }
350bc766b4dSWludzik, Jozef 
TEST_F(TestReportManager,failToAddReportWithMoreMetricPropertiesThanExpected)351*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithMoreMetricPropertiesThanExpected)
352bc766b4dSWludzik, Jozef {
353dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
354bc766b4dSWludzik, Jozef         .Times(0);
355bc766b4dSWludzik, Jozef 
356cd5b0b7eSAnkita Vilas Gawade     reportParams.metricParameters(
357cd5b0b7eSAnkita Vilas Gawade         std::vector<LabeledMetricParameters>{{LabeledMetricParameters{
35894f71c51SSzymon Dompke             {LabeledSensorInfo{"Service",
359cd5b0b7eSAnkita Vilas Gawade                                "/xyz/openbmc_project/sensors/power/p1",
360cd5b0b7eSAnkita Vilas Gawade                                "Metadata1"}},
36160fee077SKrzysztof Grobelny             OperationType::avg,
362cd5b0b7eSAnkita Vilas Gawade             CollectionTimeScope::point,
363cd5b0b7eSAnkita Vilas Gawade             CollectionDuration(Milliseconds(0u))}}});
364cd5b0b7eSAnkita Vilas Gawade 
365dcc4e193SKrzysztof Grobelny     auto metricParams = reportParams.metricParameters();
366cd5b0b7eSAnkita Vilas Gawade     auto& metricParamsVec =
367cd5b0b7eSAnkita Vilas Gawade         metricParams[0].at_label<utils::tstring::SensorPath>();
368cd5b0b7eSAnkita Vilas Gawade 
369cd5b0b7eSAnkita Vilas Gawade     for (size_t i = 0; i < ReportManager::maxNumberMetrics; i++)
370bc766b4dSWludzik, Jozef     {
37194f71c51SSzymon Dompke         metricParamsVec.emplace_back(LabeledSensorInfo{
372cd5b0b7eSAnkita Vilas Gawade             "Service", "/xyz/openbmc_project/sensors/power/p1", "Metadata1"});
373bc766b4dSWludzik, Jozef     }
374cd5b0b7eSAnkita Vilas Gawade 
375dcc4e193SKrzysztof Grobelny     reportParams.metricParameters(std::move(metricParams));
376bc766b4dSWludzik, Jozef 
377bc766b4dSWludzik, Jozef     auto [ec, path] = addReport(reportParams);
37832859b63SKarol Niczyj 
37962c08e9bSKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
380bc766b4dSWludzik, Jozef     EXPECT_THAT(path, Eq(std::string()));
381bc766b4dSWludzik, Jozef }
382bc766b4dSWludzik, Jozef 
TEST_F(TestReportManager,failToAddReportWithMoreMetricsThanExpected)383*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithMoreMetricsThanExpected)
384cd5b0b7eSAnkita Vilas Gawade {
385cd5b0b7eSAnkita Vilas Gawade     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
386cd5b0b7eSAnkita Vilas Gawade         .Times(0);
387cd5b0b7eSAnkita Vilas Gawade 
388cd5b0b7eSAnkita Vilas Gawade     auto metricParams = std::vector<LabeledMetricParameters>{};
389cd5b0b7eSAnkita Vilas Gawade 
390cd5b0b7eSAnkita Vilas Gawade     for (size_t i = 0; i < ReportManager::maxNumberMetrics + 1; i++)
391cd5b0b7eSAnkita Vilas Gawade     {
392cd5b0b7eSAnkita Vilas Gawade         metricParams.emplace_back(
393cd5b0b7eSAnkita Vilas Gawade             LabeledMetricParameters{{},
39460fee077SKrzysztof Grobelny                                     OperationType::avg,
395cd5b0b7eSAnkita Vilas Gawade                                     CollectionTimeScope::point,
396cd5b0b7eSAnkita Vilas Gawade                                     CollectionDuration(Milliseconds(0u))});
397cd5b0b7eSAnkita Vilas Gawade     }
398cd5b0b7eSAnkita Vilas Gawade 
399cd5b0b7eSAnkita Vilas Gawade     reportParams.metricParameters(std::move(metricParams));
400cd5b0b7eSAnkita Vilas Gawade 
401cd5b0b7eSAnkita Vilas Gawade     auto [ec, path] = addReport(reportParams);
402cd5b0b7eSAnkita Vilas Gawade 
40362c08e9bSKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
404cd5b0b7eSAnkita Vilas Gawade     EXPECT_THAT(path, Eq(std::string()));
405cd5b0b7eSAnkita Vilas Gawade }
406cd5b0b7eSAnkita Vilas Gawade 
TEST_F(TestReportManager,failToAddReportWithAppendLimitGreaterThanMax)407*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWithAppendLimitGreaterThanMax)
408cd5b0b7eSAnkita Vilas Gawade {
409cd5b0b7eSAnkita Vilas Gawade     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
410cd5b0b7eSAnkita Vilas Gawade         .Times(0);
411cd5b0b7eSAnkita Vilas Gawade 
412cd5b0b7eSAnkita Vilas Gawade     reportParams.appendLimit(ReportManager::maxAppendLimit + 1);
413cd5b0b7eSAnkita Vilas Gawade 
414cd5b0b7eSAnkita Vilas Gawade     auto [ec, path] = addReport(reportParams);
415cd5b0b7eSAnkita Vilas Gawade 
416cd5b0b7eSAnkita Vilas Gawade     EXPECT_THAT(ec.value(), Eq(boost::system::errc::invalid_argument));
417cd5b0b7eSAnkita Vilas Gawade     EXPECT_THAT(path, Eq(std::string()));
418cd5b0b7eSAnkita Vilas Gawade }
419cd5b0b7eSAnkita Vilas Gawade 
TEST_F(TestReportManager,addReportWithAppendLimitEqualToUint64MaxIsAllowed)420e6c417cfSKrzysztof Grobelny TEST_F(TestReportManager, addReportWithAppendLimitEqualToUint64MaxIsAllowed)
421e6c417cfSKrzysztof Grobelny {
422e6c417cfSKrzysztof Grobelny     EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
423cff70c14SKrzysztof Grobelny     reportFactoryMock
424cff70c14SKrzysztof Grobelny         .expectMake(reportParams.appendLimit(ReportManager::maxAppendLimit),
425cff70c14SKrzysztof Grobelny                     Ref(*sut), Ref(storageMock))
426e6c417cfSKrzysztof Grobelny         .WillOnce(Return(ByMove(std::move(reportMockPtr))));
427e6c417cfSKrzysztof Grobelny 
428cff70c14SKrzysztof Grobelny     auto [ec, path] = addReport(
429cff70c14SKrzysztof Grobelny         reportParams.appendLimit(std::numeric_limits<uint64_t>::max()));
430e6c417cfSKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
431e6c417cfSKrzysztof Grobelny     EXPECT_THAT(path, Eq(reportMock.getPath()));
432e6c417cfSKrzysztof Grobelny }
433e6c417cfSKrzysztof Grobelny 
TEST_F(TestReportManager,failToAddReportWhenMaxReportIsReached)434*b47b7db4SMichal Orzel TEST_F(TestReportManager, failToAddReportWhenMaxReportIsReached)
4352f9f9b87SWludzik, Jozef {
436dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(std::nullopt, Ref(*sut), Ref(storageMock))
4372f9f9b87SWludzik, Jozef         .Times(ReportManager::maxReports);
4382f9f9b87SWludzik, Jozef 
4392f9f9b87SWludzik, Jozef     for (size_t i = 0; i < ReportManager::maxReports; i++)
4402f9f9b87SWludzik, Jozef     {
441b8cc78ddSKrzysztof Grobelny         reportParams.reportId(reportParams.reportName() + std::to_string(i));
4422f9f9b87SWludzik, Jozef 
443e2362796SWludzik, Jozef         auto [ec, path] = addReport(reportParams);
4442f9f9b87SWludzik, Jozef         EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
4452f9f9b87SWludzik, Jozef     }
4462f9f9b87SWludzik, Jozef 
447b8cc78ddSKrzysztof Grobelny     reportParams.reportId(reportParams.reportName() +
448e2362796SWludzik, Jozef                           std::to_string(ReportManager::maxReports));
449e2362796SWludzik, Jozef     auto [ec, path] = addReport(reportParams);
45032859b63SKarol Niczyj 
4512f9f9b87SWludzik, Jozef     EXPECT_THAT(ec.value(), Eq(boost::system::errc::too_many_files_open));
4522f9f9b87SWludzik, Jozef     EXPECT_THAT(path, Eq(std::string()));
4532f9f9b87SWludzik, Jozef }
4542f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,removeReport)4552f9f9b87SWludzik, Jozef TEST_F(TestReportManager, removeReport)
4562f9f9b87SWludzik, Jozef {
4572f9f9b87SWludzik, Jozef     {
4582f9f9b87SWludzik, Jozef         InSequence seq;
459dcc4e193SKrzysztof Grobelny         EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
460dcc4e193SKrzysztof Grobelny         reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock))
4612f9f9b87SWludzik, Jozef             .WillOnce(Return(ByMove(std::move(reportMockPtr))));
4622f9f9b87SWludzik, Jozef         EXPECT_CALL(reportMock, Die());
4632f9f9b87SWludzik, Jozef         EXPECT_CALL(checkPoint, Call("end"));
4642f9f9b87SWludzik, Jozef     }
4652f9f9b87SWludzik, Jozef 
466e2362796SWludzik, Jozef     addReport(reportParams);
467e2362796SWludzik, Jozef     sut->removeReport(&reportMock);
4682f9f9b87SWludzik, Jozef     checkPoint.Call("end");
4692f9f9b87SWludzik, Jozef }
4702f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,removingReportThatIsNotInContainerHasNoEffect)4712f9f9b87SWludzik, Jozef TEST_F(TestReportManager, removingReportThatIsNotInContainerHasNoEffect)
4722f9f9b87SWludzik, Jozef {
4732f9f9b87SWludzik, Jozef     {
4742f9f9b87SWludzik, Jozef         InSequence seq;
4752f9f9b87SWludzik, Jozef         EXPECT_CALL(checkPoint, Call("end"));
4762f9f9b87SWludzik, Jozef         EXPECT_CALL(reportMock, Die());
4772f9f9b87SWludzik, Jozef     }
4782f9f9b87SWludzik, Jozef 
479e2362796SWludzik, Jozef     sut->removeReport(&reportMock);
4802f9f9b87SWludzik, Jozef     checkPoint.Call("end");
4812f9f9b87SWludzik, Jozef }
4822f9f9b87SWludzik, Jozef 
TEST_F(TestReportManager,removingSameReportTwiceHasNoSideEffect)4832f9f9b87SWludzik, Jozef TEST_F(TestReportManager, removingSameReportTwiceHasNoSideEffect)
4842f9f9b87SWludzik, Jozef {
4852f9f9b87SWludzik, Jozef     {
4862f9f9b87SWludzik, Jozef         InSequence seq;
487dcc4e193SKrzysztof Grobelny         EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _));
488dcc4e193SKrzysztof Grobelny         reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock))
4892f9f9b87SWludzik, Jozef             .WillOnce(Return(ByMove(std::move(reportMockPtr))));
4902f9f9b87SWludzik, Jozef         EXPECT_CALL(reportMock, Die());
4912f9f9b87SWludzik, Jozef         EXPECT_CALL(checkPoint, Call("end"));
4922f9f9b87SWludzik, Jozef     }
4932f9f9b87SWludzik, Jozef 
494e2362796SWludzik, Jozef     addReport(reportParams);
495e2362796SWludzik, Jozef     sut->removeReport(&reportMock);
496e2362796SWludzik, Jozef     sut->removeReport(&reportMock);
4972f9f9b87SWludzik, Jozef     checkPoint.Call("end");
4982f9f9b87SWludzik, Jozef }
499e2362796SWludzik, Jozef 
500e8fc5751SKrzysztof Grobelny class TestReportManagerWithAggregationOperationType :
501e8fc5751SKrzysztof Grobelny     public TestReportManager,
502e8fc5751SKrzysztof Grobelny     public WithParamInterface<OperationType>
503e8fc5751SKrzysztof Grobelny {
504e8fc5751SKrzysztof Grobelny   public:
505e8fc5751SKrzysztof Grobelny     OperationType operationType = GetParam();
506e8fc5751SKrzysztof Grobelny };
507e8fc5751SKrzysztof Grobelny 
508e8fc5751SKrzysztof Grobelny INSTANTIATE_TEST_SUITE_P(_, TestReportManagerWithAggregationOperationType,
50960fee077SKrzysztof Grobelny                          Values(OperationType::max, OperationType::min,
51060fee077SKrzysztof Grobelny                                 OperationType::avg, OperationType::sum));
511e8fc5751SKrzysztof Grobelny 
TEST_P(TestReportManagerWithAggregationOperationType,addReportWithDifferentOperationTypes)512e8fc5751SKrzysztof Grobelny TEST_P(TestReportManagerWithAggregationOperationType,
513e8fc5751SKrzysztof Grobelny        addReportWithDifferentOperationTypes)
514e8fc5751SKrzysztof Grobelny {
515dcc4e193SKrzysztof Grobelny     reportParams.metricParameters(
516dcc4e193SKrzysztof Grobelny         std::vector<LabeledMetricParameters>{{LabeledMetricParameters{
51794f71c51SSzymon Dompke             {LabeledSensorInfo{"Service",
518b8cc78ddSKrzysztof Grobelny                                "/xyz/openbmc_project/sensors/power/p1",
519b8cc78ddSKrzysztof Grobelny                                "Metadata1"}},
520dcc4e193SKrzysztof Grobelny             operationType,
521dcc4e193SKrzysztof Grobelny             CollectionTimeScope::point,
522dcc4e193SKrzysztof Grobelny             CollectionDuration(Milliseconds(0u))}}});
523e8fc5751SKrzysztof Grobelny 
524dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, Ref(*sut), Ref(storageMock))
525e8fc5751SKrzysztof Grobelny         .WillOnce(Return(ByMove(std::move(reportMockPtr))));
526e8fc5751SKrzysztof Grobelny 
527e8fc5751SKrzysztof Grobelny     auto [ec, path] = addReport(reportParams);
52832859b63SKarol Niczyj 
529e8fc5751SKrzysztof Grobelny     EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
530b8cc78ddSKrzysztof Grobelny     EXPECT_THAT(path, Eq("/"s + reportParams.reportId()));
531e8fc5751SKrzysztof Grobelny }
532e8fc5751SKrzysztof Grobelny 
533e2362796SWludzik, Jozef class TestReportManagerStorage : public TestReportManager
534e2362796SWludzik, Jozef {
535e2362796SWludzik, Jozef   public:
536e2362796SWludzik, Jozef     using FilePath = interfaces::JsonStorage::FilePath;
537e2362796SWludzik, Jozef     using DirectoryPath = interfaces::JsonStorage::DirectoryPath;
538e2362796SWludzik, Jozef 
SetUp()539e2362796SWludzik, Jozef     void SetUp() override
540e2362796SWludzik, Jozef     {
541dcc4e193SKrzysztof Grobelny         EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _)).Times(0);
542dcc4e193SKrzysztof Grobelny 
543e2362796SWludzik, Jozef         ON_CALL(storageMock, list())
544e2362796SWludzik, Jozef             .WillByDefault(Return(std::vector<FilePath>{FilePath("report1")}));
545e2362796SWludzik, Jozef         ON_CALL(storageMock, load(FilePath("report1")))
5466ccfcbf5SKrzysztof Grobelny             .WillByDefault(InvokeWithoutArgs([this] { return data; }));
547e2362796SWludzik, Jozef     }
548e2362796SWludzik, Jozef 
makeReportManager()549e2362796SWludzik, Jozef     void makeReportManager()
550e2362796SWludzik, Jozef     {
551e6d48874SKrzysztof Grobelny         sut = std::make_unique<ReportManager>(std::move(reportFactoryMockPtr),
552e6d48874SKrzysztof Grobelny                                               std::move(storageMockPtr),
553e6d48874SKrzysztof Grobelny                                               DbusEnvironment::getObjServer());
554e2362796SWludzik, Jozef     }
555e2362796SWludzik, Jozef 
556e2362796SWludzik, Jozef     nlohmann::json data = nlohmann::json{
5577e098e93SLukasz Kazmierczak         {"Enabled", reportParams.enabled()},
558e2362796SWludzik, Jozef         {"Version", Report::reportVersion},
559b8cc78ddSKrzysztof Grobelny         {"Id", reportParams.reportId()},
560e2362796SWludzik, Jozef         {"Name", reportParams.reportName()},
56151497a0cSKrzysztof Grobelny         {"ReportingType", utils::toUnderlying(reportParams.reportingType())},
56251497a0cSKrzysztof Grobelny         {"ReportActions", reportParams.reportActions()},
563e2362796SWludzik, Jozef         {"Interval", reportParams.interval().count()},
56451497a0cSKrzysztof Grobelny         {"ReportUpdates", utils::toUnderlying(reportParams.reportUpdates())},
5653eb56865SSzymon Dompke         {"AppendLimit", reportParams.appendLimit()},
566dcc4e193SKrzysztof Grobelny         {"ReadingParameters", reportParams.metricParameters()}};
567e2362796SWludzik, Jozef };
568e2362796SWludzik, Jozef 
TEST_F(TestReportManagerStorage,reportManagerCtorAddReportFromStorage)569e2362796SWludzik, Jozef TEST_F(TestReportManagerStorage, reportManagerCtorAddReportFromStorage)
570e2362796SWludzik, Jozef {
571dcc4e193SKrzysztof Grobelny     reportFactoryMock.expectMake(reportParams, _, Ref(storageMock));
572e2362796SWludzik, Jozef 
573e2362796SWludzik, Jozef     makeReportManager();
574e2362796SWludzik, Jozef }
575e2362796SWludzik, Jozef 
TEST_F(TestReportManagerStorage,reportManagerCtorRemoveFileIfVersionDoesNotMatch)576e2362796SWludzik, Jozef TEST_F(TestReportManagerStorage,
577e2362796SWludzik, Jozef        reportManagerCtorRemoveFileIfVersionDoesNotMatch)
578e2362796SWludzik, Jozef {
579e2362796SWludzik, Jozef     data["Version"] = Report::reportVersion - 1;
580e2362796SWludzik, Jozef 
581e2362796SWludzik, Jozef     EXPECT_CALL(storageMock, remove(FilePath("report1")));
582e2362796SWludzik, Jozef 
583e2362796SWludzik, Jozef     makeReportManager();
584e2362796SWludzik, Jozef }
585e2362796SWludzik, Jozef 
TEST_F(TestReportManagerStorage,reportManagerCtorRemoveFileIfIntervalHasWrongType)586e2362796SWludzik, Jozef TEST_F(TestReportManagerStorage,
587e2362796SWludzik, Jozef        reportManagerCtorRemoveFileIfIntervalHasWrongType)
588e2362796SWludzik, Jozef {
589e2362796SWludzik, Jozef     data["Interval"] = "1000";
590e2362796SWludzik, Jozef 
591e2362796SWludzik, Jozef     EXPECT_CALL(storageMock, remove(FilePath("report1")));
592e2362796SWludzik, Jozef 
593e2362796SWludzik, Jozef     makeReportManager();
594e2362796SWludzik, Jozef }
595