1 | // |
2 | // AbstractConfigurationTest.h |
3 | // |
4 | // Definition of the AbstractConfigurationTest class. |
5 | // |
6 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
7 | // and Contributors. |
8 | // |
9 | // SPDX-License-Identifier: BSL-1.0 |
10 | // |
11 | |
12 | |
13 | #ifndef AbstractConfigurationTest_INCLUDED |
14 | #define AbstractConfigurationTest_INCLUDED |
15 | |
16 | |
17 | #include "Poco/Util/Util.h" |
18 | #include "Poco/CppUnit/TestCase.h" |
19 | #include "Poco/AutoPtr.h" |
20 | #include "Poco/Util/AbstractConfiguration.h" |
21 | |
22 | |
23 | class AbstractConfigurationTest: public CppUnit::TestCase |
24 | { |
25 | public: |
26 | AbstractConfigurationTest(const std::string& name); |
27 | virtual ~AbstractConfigurationTest(); |
28 | |
29 | void testHasProperty(); |
30 | void testGetString(); |
31 | void testGetInt(); |
32 | void testGetInt64(); |
33 | void testGetDouble(); |
34 | void testGetBool(); |
35 | void testExpand(); |
36 | void testSetString(); |
37 | void testSetInt(); |
38 | void testSetUInt(); |
39 | void testSetInt64(); |
40 | void testSetUInt64(); |
41 | void testSetDouble(); |
42 | void testSetBool(); |
43 | void testKeys(); |
44 | void testRemove(); |
45 | void testChangeEvents(); |
46 | void testRemoveEvents(); |
47 | |
48 | void setUp(); |
49 | void tearDown(); |
50 | |
51 | void onPropertyChanging(const void*, Poco::Util::AbstractConfiguration::KeyValue& kv); |
52 | void onPropertyChanged(const void*, const Poco::Util::AbstractConfiguration::KeyValue& kv); |
53 | void onPropertyRemoving(const void*, const std::string& key); |
54 | void onPropertyRemoved(const void*, const std::string& key); |
55 | |
56 | protected: |
57 | virtual Poco::Util::AbstractConfiguration::Ptr allocConfiguration() const = 0; |
58 | virtual Poco::Util::AbstractConfiguration::Ptr createConfiguration() const; |
59 | |
60 | std::string _changingKey; |
61 | std::string _changingValue; |
62 | std::string _changedKey; |
63 | std::string _changedValue; |
64 | std::string _removingKey; |
65 | std::string _removedKey; |
66 | }; |
67 | |
68 | |
69 | #define AbstractConfigurationTest_addTests(suite, cls) \ |
70 | do { \ |
71 | CppUnit_addTest(suite, cls, testHasProperty); \ |
72 | CppUnit_addTest(suite, cls, testGetString); \ |
73 | CppUnit_addTest(suite, cls, testGetInt); \ |
74 | CppUnit_addTest(suite, cls, testGetInt64); \ |
75 | CppUnit_addTest(suite, cls, testGetDouble); \ |
76 | CppUnit_addTest(suite, cls, testGetBool); \ |
77 | CppUnit_addTest(suite, cls, testExpand); \ |
78 | CppUnit_addTest(suite, cls, testSetString); \ |
79 | CppUnit_addTest(suite, cls, testSetInt); \ |
80 | CppUnit_addTest(suite, cls, testSetInt64); \ |
81 | CppUnit_addTest(suite, cls, testSetDouble); \ |
82 | CppUnit_addTest(suite, cls, testSetBool); \ |
83 | CppUnit_addTest(suite, cls, testKeys); \ |
84 | CppUnit_addTest(suite, cls, testRemove); \ |
85 | CppUnit_addTest(suite, cls, testChangeEvents); \ |
86 | CppUnit_addTest(suite, cls, testRemoveEvents); \ |
87 | } while(0) |
88 | |
89 | |
90 | #endif // AbstractConfigurationTest_INCLUDED |
91 | |