Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
446
Issues
446
List
Boards
Labels
Service Desk
Milestones
Merge Requests
72
Merge Requests
72
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
bed3c88c
Commit
bed3c88c
authored
Jan 10, 2013
by
Jelte Jansen
Browse files
Options
Browse Files
Download
Plain Diff
[master] Merge branch 'trac2619_merge'
parents
0c40d70c
2d95931b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
src/lib/config/config_data.cc
src/lib/config/config_data.cc
+1
-1
src/lib/config/config_data.h
src/lib/config/config_data.h
+6
-6
src/lib/config/tests/config_data_unittests.cc
src/lib/config/tests/config_data_unittests.cc
+7
-4
No files found.
src/lib/config/config_data.cc
View file @
bed3c88c
...
...
@@ -235,7 +235,7 @@ ConfigData::getItemList(const std::string& identifier, bool recurse) const {
ConstElementPtr
ConfigData
::
getFullConfig
()
const
{
ElementPtr
result
=
Element
::
createMap
();
ConstElementPtr
items
=
getItemList
(
""
,
tru
e
);
ConstElementPtr
items
=
getItemList
(
""
,
fals
e
);
BOOST_FOREACH
(
ConstElementPtr
item
,
items
->
listValue
())
{
result
->
set
(
item
->
stringValue
(),
getValue
(
item
->
stringValue
()));
}
...
...
src/lib/config/config_data.h
View file @
bed3c88c
...
...
@@ -110,11 +110,11 @@ public:
isc
::
data
::
ConstElementPtr
getItemList
(
const
std
::
string
&
identifier
=
""
,
bool
recurse
=
false
)
const
;
/// Returns all current configuration settings (both non-default and default).
/// Returns a map of the top-level configuration items, as currently
/// set or their defaults
///
/// \return An ElementPtr pointing to a MapElement containing
/// string->value elements, where the string is the
/// full identifier of the configuration option and the
/// value is an ElementPtr with the value.
/// the top-level configuration items
isc
::
data
::
ConstElementPtr
getFullConfig
()
const
;
private:
...
...
@@ -126,6 +126,6 @@ private:
}
#endif
// Local Variables:
// Local Variables:
// mode: c++
// End:
// End:
src/lib/config/tests/config_data_unittests.cc
View file @
bed3c88c
...
...
@@ -118,7 +118,7 @@ TEST(ConfigData, getLocalConfig) {
ModuleSpec
spec2
=
moduleSpecFromFile
(
std
::
string
(
TEST_DATA_PATH
)
+
"/spec2.spec"
);
ConfigData
cd
=
ConfigData
(
spec2
);
EXPECT_EQ
(
"{ }"
,
cd
.
getLocalConfig
()
->
str
());
ElementPtr
my_config
=
Element
::
fromJSON
(
"{
\"
item1
\"
: 2 }"
);
cd
.
setLocalConfig
(
my_config
);
EXPECT_EQ
(
"{
\"
item1
\"
: 2 }"
,
cd
.
getLocalConfig
()
->
str
());
...
...
@@ -141,12 +141,15 @@ TEST(ConfigData, getFullConfig) {
ModuleSpec
spec2
=
moduleSpecFromFile
(
std
::
string
(
TEST_DATA_PATH
)
+
"/spec2.spec"
);
ConfigData
cd
=
ConfigData
(
spec2
);
EXPECT_EQ
(
"{
\"
item1
\"
: 1,
\"
item2
\"
: 1.1,
\"
item3
\"
: true,
\"
item4
\"
:
\"
test
\"
,
\"
item5
\"
: [
\"
a
\"
,
\"
b
\"
],
\"
item6
/value1
\"
:
\"
default
\"
,
\"
item6/value2
\"
: None
}"
,
cd
.
getFullConfig
()
->
str
());
EXPECT_EQ
(
"{
\"
item1
\"
: 1,
\"
item2
\"
: 1.1,
\"
item3
\"
: true,
\"
item4
\"
:
\"
test
\"
,
\"
item5
\"
: [
\"
a
\"
,
\"
b
\"
],
\"
item6
\"
: { }
}"
,
cd
.
getFullConfig
()
->
str
());
ElementPtr
my_config
=
Element
::
fromJSON
(
"{
\"
item1
\"
: 2 }"
);
cd
.
setLocalConfig
(
my_config
);
EXPECT_EQ
(
"{
\"
item1
\"
: 2,
\"
item2
\"
: 1.1,
\"
item3
\"
: true,
\"
item4
\"
:
\"
test
\"
,
\"
item5
\"
: [
\"
a
\"
,
\"
b
\"
],
\"
item6
/value1
\"
:
\"
default
\"
,
\"
item6/value2
\"
: None
}"
,
cd
.
getFullConfig
()
->
str
());
EXPECT_EQ
(
"{
\"
item1
\"
: 2,
\"
item2
\"
: 1.1,
\"
item3
\"
: true,
\"
item4
\"
:
\"
test
\"
,
\"
item5
\"
: [
\"
a
\"
,
\"
b
\"
],
\"
item6
\"
: { }
}"
,
cd
.
getFullConfig
()
->
str
());
ElementPtr
my_config2
=
Element
::
fromJSON
(
"{
\"
item6
\"
: {
\"
value1
\"
:
\"
a
\"
} }"
);
cd
.
setLocalConfig
(
my_config2
);
EXPECT_EQ
(
"{
\"
item1
\"
: 1,
\"
item2
\"
: 1.1,
\"
item3
\"
: true,
\"
item4
\"
:
\"
test
\"
,
\"
item5
\"
: [
\"
a
\"
,
\"
b
\"
],
\"
item6/value1
\"
:
\"
a
\"
,
\"
item6/value2
\"
: None }"
,
cd
.
getFullConfig
()
->
str
());
EXPECT_EQ
(
"{
\"
item1
\"
: 1,
\"
item2
\"
: 1.1,
\"
item3
\"
: true,
\"
item4
\"
:
\"
test
\"
,
\"
item5
\"
: [
\"
a
\"
,
\"
b
\"
],
\"
item6
\"
: {
\"
value1
\"
:
\"
a
\"
} }"
,
cd
.
getFullConfig
()
->
str
());
ElementPtr
my_config3
=
Element
::
fromJSON
(
"{
\"
item6
\"
: {
\"
value2
\"
: 123 } }"
);
cd
.
setLocalConfig
(
my_config3
);
EXPECT_EQ
(
"{
\"
item1
\"
: 1,
\"
item2
\"
: 1.1,
\"
item3
\"
: true,
\"
item4
\"
:
\"
test
\"
,
\"
item5
\"
: [
\"
a
\"
,
\"
b
\"
],
\"
item6
\"
: {
\"
value2
\"
: 123 } }"
,
cd
.
getFullConfig
()
->
str
());
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment