Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cppinttest
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-cppinttest
Commits
ad22160a
Commit
ad22160a
authored
3 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Insert of Entity with wrongly named parent should fail.
parent
6b87d2fa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#12801
failed
3 years ago
Stage: info
Stage: setup
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_transaction.cpp
+52
-4
52 additions, 4 deletions
test/test_transaction.cpp
with
52 additions
and
4 deletions
test/test_transaction.cpp
+
52
−
4
View file @
ad22160a
...
@@ -338,6 +338,56 @@ TEST_F(test_transaction, insert_delete_with_parent) {
...
@@ -338,6 +338,56 @@ TEST_F(test_transaction, insert_delete_with_parent) {
ASSERT_FALSE
(
rt_delete_status
.
IsError
());
ASSERT_FALSE
(
rt_delete_status
.
IsError
());
}
}
/*
* Insert a Record with a parent, which has a wrong name.
*
* This must result in a server error.
*/
TEST_F
(
test_transaction
,
insert_parent_with_wrong_name
)
{
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
auto
insert_transaction
(
connection
->
CreateTransaction
());
// insert RT
Entity
rt
;
rt
.
SetRole
(
Role
::
RECORD_TYPE
);
rt
.
SetName
(
"Test_RT_Name"
);
insert_transaction
->
InsertEntity
(
&
rt
);
insert_transaction
->
ExecuteAsynchronously
();
auto
insert_status
=
insert_transaction
->
WaitForIt
();
ASSERT_TRUE
(
insert_status
.
IsTerminated
());
ASSERT_FALSE
(
insert_status
.
IsError
());
const
auto
&
insert_result_set
=
insert_transaction
->
GetResultSet
();
const
auto
&
inserted_rt
=
insert_result_set
.
at
(
0
);
// create Record with parent
Entity
rec
;
rec
.
SetRole
(
Role
::
RECORD
);
rec
.
SetName
(
"TestRec"
);
Parent
parent
;
parent
.
SetId
(
inserted_rt
.
GetId
());
parent
.
SetName
(
rt
.
GetName
()
+
"_wrong"
);
rec
.
AppendParent
(
parent
);
// insert Record
auto
rec_transaction
(
connection
->
CreateTransaction
());
rec_transaction
->
InsertEntity
(
&
rec
);
rec_transaction
->
ExecuteAsynchronously
();
auto
rec_insert_status
=
rec_transaction
->
WaitForIt
();
ASSERT_TRUE
(
rec_insert_status
.
IsTerminated
());
EXPECT_TRUE
(
rec_insert_status
.
IsError
());
const
auto
&
rec_result_set
=
rec_transaction
->
GetResultSet
();
const
auto
&
inserted_rec
=
rec_result_set
.
at
(
0
);
std
::
cout
<<
inserted_rec
.
ToString
()
<<
std
::
endl
;
}
/*
/*
* insert a property, record type with that property and a record with it
* insert a property, record type with that property and a record with it
*/
*/
...
@@ -695,8 +745,7 @@ auto test_numeric_values_impl(AtomicDataType a_type) -> void {
...
@@ -695,8 +745,7 @@ auto test_numeric_values_impl(AtomicDataType a_type) -> void {
auto
insert_transaction
(
connection
->
CreateTransaction
());
auto
insert_transaction
(
connection
->
CreateTransaction
());
Entity
prop
;
Entity
prop
;
prop
.
SetRole
(
Role
::
PROPERTY
);
prop
.
SetRole
(
Role
::
PROPERTY
);
const
auto
name
=
const
auto
name
=
std
::
string
(
"Prop "
)
+
std
::
to_string
(
i
);
std
::
string
(
"Prop "
)
+
std
::
to_string
(
i
);
std
::
cout
<<
"Creating: "
<<
name
<<
std
::
endl
;
std
::
cout
<<
"Creating: "
<<
name
<<
std
::
endl
;
prop
.
SetName
(
name
);
prop
.
SetName
(
name
);
prop
.
SetDataType
(
a_type
);
prop
.
SetDataType
(
a_type
);
...
@@ -717,8 +766,7 @@ auto test_numeric_values_impl(AtomicDataType a_type) -> void {
...
@@ -717,8 +766,7 @@ auto test_numeric_values_impl(AtomicDataType a_type) -> void {
for
(
const
auto
value
:
values_orig
)
{
for
(
const
auto
value
:
values_orig
)
{
auto
retrieve_transaction
(
connection
->
CreateTransaction
());
auto
retrieve_transaction
(
connection
->
CreateTransaction
());
const
auto
prop
=
props_orig
[
i
];
const
auto
prop
=
props_orig
[
i
];
const
auto
name
=
const
auto
name
=
std
::
string
(
"Prop "
)
+
std
::
to_string
(
i
);
std
::
string
(
"Prop "
)
+
std
::
to_string
(
i
);
std
::
cout
<<
"Retrieving: "
<<
name
<<
std
::
endl
;
std
::
cout
<<
"Retrieving: "
<<
name
<<
std
::
endl
;
const
auto
query
=
std
::
string
(
"FIND ENTITY
\"
"
)
+
name
+
"
\"
"
;
const
auto
query
=
std
::
string
(
"FIND ENTITY
\"
"
)
+
name
+
"
\"
"
;
retrieve_transaction
->
Query
(
query
);
retrieve_transaction
->
Query
(
query
);
...
...
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