7 test_begin(-tests => 21);
9 use_ok('DBTestHarness');
11 use_ok('Bio::DB::Persistent::BioNamespace');
14 $biosql = DBTestHarness->new("biosql");
15 $db = $biosql->get_DBAdaptor();
18 my $seqio = Bio::SeqIO->new('-format' => 'genbank',
19 '-file' => test_input_file('parkin.gb'));
20 my $seq = $seqio->next_seq();
22 my $pseq = $db->create_persistent($seq);
23 $pseq->namespace("mytestnamespace");
25 ok $pseq->primary_key();
27 my $adp = $db->get_object_adaptor($seq);
30 my $seqfact = Bio::Seq::SeqFactory->new(-type => "Bio::Seq::RichSeq");
35 my $dbseq = $adp->find_by_primary_key($pseq->primary_key, $seqfact);
38 is ($dbseq->display_id, $seq->display_id);
39 is ($dbseq->accession_number, $seq->accession_number);
40 is ($dbseq->namespace, $seq->namespace);
41 is ($dbseq->version, $seq->version);
42 is ($dbseq->seq_version, 1);
43 is ($dbseq->seq_version, $seq->seq_version);
44 is ($dbseq->version, 1);
45 is ($dbseq->version, $seq->version);
48 print STDERR $@ if $@;
51 is ($pseq->remove(), 1);
52 my $ns = Bio::DB::Persistent::BioNamespace->new(-identifiable => $pseq);
53 ok $ns = $db->get_object_adaptor($ns)->find_by_unique_key($ns);
54 ok $ns->primary_key();
55 is ($ns->remove(), 1);