Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
681d060f
Commit
681d060f
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Warnings
parent
8d56a257
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
ENH: Allow insertion and deletion of single entities
Pipeline
#10980
failed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/caosdb/entity.h
+4
-3
4 additions, 3 deletions
include/caosdb/entity.h
src/caosdb/configuration.cpp
+4
-2
4 additions, 2 deletions
src/caosdb/configuration.cpp
test/test_entity.cpp
+20
-0
20 additions, 0 deletions
test/test_entity.cpp
with
28 additions
and
5 deletions
include/caosdb/entity.h
+
4
−
3
View file @
681d060f
...
...
@@ -317,9 +317,10 @@ public:
[[
nodiscard
]]
inline
auto
HasErrors
()
const
->
bool
{
return
this
->
errors
.
wrapped
->
size
()
>
0
;
}
// TODO(fspreck) These two need implementations...
[[
nodiscard
]]
auto
GetWarnings
()
const
->
const
Messages
&
;
[[
nodiscard
]]
auto
GetInfos
()
const
->
const
Messages
&
;
[[
nodiscard
]]
auto
GetWarnings
()
const
->
const
Messages
&
{
return
warnings
;
}
[[
nodiscard
]]
auto
GetInfos
()
const
->
const
Messages
&
{
return
infos
;
}
inline
auto
ToString
()
const
->
const
std
::
string
{
google
::
protobuf
::
util
::
JsonOptions
options
;
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/configuration.cpp
+
4
−
2
View file @
681d060f
...
...
@@ -463,7 +463,8 @@ auto ConfigurationManager::GetConnection(const std::string &name) const
"' has not been defined."
);
}
auto
ConfigurationManager
::
InitializeDefaults
()
->
int
{
// TODO(tf) This has apparently a cognitive complexity of 34>25 (threshold).
auto
ConfigurationManager
::
InitializeDefaults
()
->
int
{
// NOLINT
// find the configuration file...
std
::
unique_ptr
<
path
>
configuration_file_path
;
...
...
@@ -471,7 +472,8 @@ auto ConfigurationManager::InitializeDefaults() -> int {
caosdb
::
LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE
)
{
if
(
configuration_file
==
"$CAOSDB_CLIENT_CONFIGURATION"
)
{
// user specified a file via the environment variable
const
auto
*
from_env_var
=
getenv
(
"CAOSDB_CLIENT_CONFIGURATION"
);
// TODO(tf) make this thread-secure (concurrency-mt-unsafe)
const
auto
*
from_env_var
=
getenv
(
"CAOSDB_CLIENT_CONFIGURATION"
);
// NOLINT
if
(
from_env_var
!=
nullptr
)
{
configuration_file_path
=
std
::
make_unique
<
path
>
(
from_env_var
);
if
(
exists
(
*
configuration_file_path
))
{
...
...
This diff is collapsed.
Click to expand it.
test/test_entity.cpp
+
20
−
0
View file @
681d060f
...
...
@@ -88,6 +88,26 @@ TEST(test_entity, test_from_id_response) {
EXPECT_EQ
(
entity
.
GetErrors
().
At
(
0
).
GetDescription
(),
"error_desc"
);
EXPECT_EQ
(
entity
.
GetErrors
().
At
(
0
).
GetCode
(),
MessageCode
::
ENTITY_DOES_NOT_EXIST
);
IdResponse
idr_warnings_and_infos
;
idr_warnings_and_infos
.
set_id
(
"other_entity_id"
);
auto
*
warning
=
idr_warnings_and_infos
.
add_entity_warnings
();
warning
->
set_description
(
"warning_desc"
);
warning
->
set_code
(
MessageCode
::
ENTITY_HAS_NO_PROPERTIES
);
auto
*
info
=
idr_warnings_and_infos
.
add_entity_infos
();
info
->
set_description
(
"info_desc"
);
info
->
set_code
(
MessageCode
::
UNSPECIFIED
);
Entity
other_ent
(
&
idr_warnings_and_infos
);
EXPECT_EQ
(
entity
.
GetId
(),
"other_entity_id"
);
EXPECT_EQ
(
entity
.
GetWarnings
().
Size
(),
1
);
EXPECT_EQ
(
entity
.
GetWarnings
().
At
(
0
).
GetDescription
(),
"warning_desc"
);
EXPECT_EQ
(
entity
.
GetWarnings
().
At
(
0
).
GetCode
(),
MessageCode
::
ENTITY_HAS_NO_PROPERTIES
);
EXPECT_EQ
(
entity
.
GetInfos
().
Size
(),
1
);
EXPECT_EQ
(
entity
.
GetInfos
().
At
(
0
).
GetDescription
(),
"info_desc"
);
EXPECT_EQ
(
entity
.
GetInfos
().
At
(
0
).
GetCode
(),
MessageCode
::
UNSPECIFIED
);
}
}
// namespace caosdb::entity
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment