[Bio] / Sprout / AttributeTest.pl Repository:
ViewVC logotype

Diff of /Sprout/AttributeTest.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4, Thu Dec 6 14:58:03 2007 UTC revision 1.5, Wed Jan 23 00:54:45 2008 UTC
# Line 46  Line 46 
46    
47  use strict;  use strict;
48  use Tracer;  use Tracer;
 use DocUtils;  
 use TestUtils;  
49  use Cwd;  use Cwd;
50  use File::Copy;  use File::Copy;
51  use File::Path;  use File::Path;
# Line 56  Line 54 
54  use Time::HiRes qw ( time alarm sleep );  use Time::HiRes qw ( time alarm sleep );
55    
56  # Get the command-line options and parameters.  # Get the command-line options and parameters.
57  my ($options, @parameters) = StandardSetup([qw(CustomAttributes) ],  my ($options, @parameters) = StandardSetup([qw(CustomAttributes ERDB DBKernel) ],
58                                             {                                             {
59                                                trace => [2, "trace level"],                                                trace => [2, "trace level"],
60                                                phone => ["", "phone number (international format) to call when load finishes"],                                                phone => ["", "phone number (international format) to call when load finishes"],
# Line 65  Line 63 
63                                             @ARGV);                                             @ARGV);
64  # Set a variable to contain return type information.  # Set a variable to contain return type information.
65  my $rtype;  my $rtype;
 # Get a FIG object.  
 my $fig = FIG->new();  
66  # Get the CustomAttributes object.  # Get the CustomAttributes object.
67  my $ca = $fig->{_ca};  my $ca = CustomAttributes->new();
68  # Insure we catch errors.  # Insure we catch errors.
69  eval {  eval {
70      # Insure the attribute server is local.      # Insure the attribute server is local.
# Line 135  Line 131 
131          Trace("Loading Frog data.") if T(3);          Trace("Loading Frog data.") if T(3);
132          my $stats = $ca->LoadAttributesFrom($loadFileName);          my $stats = $ca->LoadAttributesFrom($loadFileName);
133          # Now we need to test the data against what's in the hash. First we get the data.          # Now we need to test the data against what's in the hash. First we get the data.
134          my @attributes = $fig->get_attributes(undef, 'Frog');          my @attributes = $ca->GetAttributes(undef, 'Frog');
135          # Loop through the attributes, checking against the hash. As we find an attribute,          # Loop through the attributes, checking against the hash. As we find an attribute,
136          # we delete it from the hash. When we're done, the hash should be empty.          # we delete it from the hash. When we're done, the hash should be empty.
137          for my $attributeRow (@attributes) {          for my $attributeRow (@attributes) {
# Line 186  Line 182 
182              # Create an attribute row.              # Create an attribute row.
183              my @testArray = ('Reaction:R00001', 'Frog', 'simplicity');              my @testArray = ('Reaction:R00001', 'Frog', 'simplicity');
184              # Insert it into the database.              # Insert it into the database.
185              $fig->add_attribute(@testArray);              $ca->AddAttribute(@testArray);
186              # Verify that it's there.              # Verify that it's there.
187              my @tuple = $fig->get_attributes(@testArray);              my @tuple = $ca->GetAttributes(@testArray);
188              if (! @tuple) {              if (! @tuple) {
189                  Confess("Insert failed.");                  Confess("Insert failed.");
190              } else {              } else {
191                  # Delete it.                  # Delete it.
192                  $fig->delete_attribute(@testArray);                  $ca->DeleteAttribute(@testArray);
193                  # Verify that it's gone.                  # Verify that it's gone.
194                  my @nonTuple = $fig->get_attributes(@testArray);                  my @nonTuple = $ca->GetAttributes(@testArray);
195                  if (@nonTuple) {                  if (@nonTuple) {
196                      Confess("Delete failed.");                      Confess("Delete failed.");
197                  } else {                  } else {
# Line 203  Line 199 
199                      # don't want to delete it.                      # don't want to delete it.
200                      $ca->EraseAttribute('Frog');                      $ca->EraseAttribute('Frog');
201                      # Verify that it has no values.                      # Verify that it has no values.
202                      my @values = $fig->get_attributes(undef, 'Frog');                      my @values = $ca->GetAttributes(undef, 'Frog');
203                      if (@values) {                      if (@values) {
204                          Confess("Not all Frog attributes were deleted.");                          Confess("Not all Frog attributes were deleted.");
205                      }                      }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3