Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
0b85d877
Commit
0b85d877
authored
12 years ago
by
Kieron Taylor
Browse files
Options
Downloads
Patches
Plain Diff
Tests altered to include threaded insertions to test for "transactional" behaviour
parent
6d4dbc50
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/t/dbEntries.t
+75
-7
75 additions, 7 deletions
modules/t/dbEntries.t
with
75 additions
and
7 deletions
modules/t/dbEntries.t
+
75
−
7
View file @
0b85d877
use
strict
;
use
warnings
;
BEGIN
{
$|
=
1
;
use
Test
;
plan
tests
=>
61
;
}
use
Test::
More
;
use
Bio::EnsEMBL::Test::
MultiTestDB
;
use
Bio::EnsEMBL::Test::
TestUtils
;
use
Bio::EnsEMBL::DBSQL::
DBEntryAdaptor
;
use
Bio::EnsEMBL::
DBEntry
;
# switch on the debug prints
our
$verbose
=
0
;
our
$verbose
=
1
;
debug
(
"
Startup test
"
);
#
...
...
@@ -136,6 +133,13 @@ my $oxr_count = count_rows($db, 'object_xref');
$dbEntryAdaptor
->
store
(
$xref
,
$tr
->
dbID
,
"
Transcript
"
);
$oxr_count
=
count_rows
(
$db
,
'
object_xref
');
$dbEntryAdaptor
->
store
(
$ident_xref
,
$tl
->
dbID
,
"
Translation
"
);
#intentional duplicates should be filtered out and not increase row count
$dbEntryAdaptor
->
store
(
$ident_xref
,
$tl
->
dbID
,
"
Translation
"
);
$dbEntryAdaptor
->
store
(
$ident_xref
,
$tl
->
dbID
,
"
Translation
"
);
$dbEntryAdaptor
->
store
(
$ident_xref
,
$tl
->
dbID
,
"
Translation
"
);
$dbEntryAdaptor
->
store
(
$ident_xref
,
$tl
->
dbID
,
"
Translation
"
);
$oxr_count
=
count_rows
(
$db
,
'
object_xref
');
$dbEntryAdaptor
->
store
(
$goref
,
$tl
->
dbID
,
"
Translation
"
);
$oxr_count
=
count_rows
(
$db
,
'
object_xref
');
...
...
@@ -149,6 +153,7 @@ $oxr_count = count_rows($db, 'object_xref');
debug
(
"
object_xref_count =
$oxr_count
"
);
ok
(
$oxr_count
==
4
);
$xref_count
=
count_rows
(
$db
,
'
xref
');
$sth
->
finish
();
...
...
@@ -179,9 +184,69 @@ ok($xref->type() eq 'ARRAY');
$multi
->
restore
();
# test parallel insertions of identical xrefs
$xref
=
Bio::EnsEMBL::
DBEntry
->
new
(
-
primary_id
=>
"
1
",
-
dbname
=>
"
Vega_gene
",
-
release
=>
"
1
",
-
display_id
=>
"
Ens fake thing
",
-
primary_id_linkable
=>
"
0
",
-
display_id_linkable
=>
"
1
",
-
priority
=>
"
5
",
-
db_display_name
=>
"
Nice unfriendly name
",
-
info_type
=>
"
MISC
",
-
info_text
=>
"
Concurrent insert
",
-
type
=>
"
ARRAY
",
-
analysis
=>
$analysis
);
# db connection must be severed for threads to access DB
$dbEntryAdaptor
->
dbc
->
disconnect_if_idle
();
use
threads
;
sub
parallel_store
{
my
$xref_id
=
$dbEntryAdaptor
->
store
(
$xref
,
$tr
->
dbID
,
"
Transcript
"
);
return
$xref_id
}
my
$thread1
=
threads
->
create
(
\
¶llel_store
);
my
$thread2
=
threads
->
create
(
\
¶llel_store
);
my
$thread3
=
threads
->
create
(
\
¶llel_store
);
my
@xref_ids
;
@xref_ids
=
(
$thread1
->
join
,
$thread2
->
join
,
$thread3
->
join
);
debug
("
Threaded xrefs:
"
.
$xref_ids
[
0
]
.
"
"
.
$xref_ids
[
1
]
.
"
"
.
$xref_ids
[
2
]);
# Test 10 - Verify that only one xref has been inserted under parallel inserts
ok
(
$xref_ids
[
0
]
==
1000009
&&
$xref_ids
[
1
]
==
$xref_ids
[
0
]
&&
$xref_ids
[
2
]
==
$xref_ids
[
0
]);
# Test 11 - Exception testing on ->store()
$xref
=
Bio::EnsEMBL::
DBEntry
->
new
(
-
primary_id
=>
"
1
",
-
dbname
=>
"
Vega_gene
",
-
release
=>
"
1
",
-
display_id
=>
"
Ens fakiest thing
",
-
primary_id_linkable
=>
"
0
",
-
display_id_linkable
=>
"
1
",
-
priority
=>
"
5
",
-
db_display_name
=>
"
Nice unfriendly name
",
-
info_type
=>
"
MISC
",
-
info_text
=>
"
Full exception checking
",
-
type
=>
"
ARRAY
",
-
analysis
=>
undef
,
);
my
$xref_id
=
$dbEntryAdaptor
->
store
(
$xref
,
undef
,
"
Transcript
");
debug
("
Xref_id from insert:
"
.
$xref_id
);
ok
(
$xref_id
==
1000010
);
#
# 1
0
-1
2
Test that external synonyms and go evidence tags are retrieved
# 1
2
-1
4
Test that external synonyms and go evidence tags are retrieved
#
my
$ta
=
$db
->
get_TranscriptAdaptor
();
my
$translation
=
$ta
->
fetch_by_dbID
(
21737
)
->
translation
;
...
...
@@ -420,6 +485,7 @@ ok(@{$xrefs} == 23); #test 60
my
$db_name
=
$dbEntryAdaptor
->
get_db_name_from_external_db_id
(
4100
);
ok
(
$db_name
eq
'
UniGene
');
sub
print_dbEntries
{
my
$dbes
=
shift
;
...
...
@@ -440,3 +506,5 @@ sub print_dbEntries {
debug
(
scalar
(
@$dbes
)
.
"
total
");
}
done_testing
();
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
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