From 3e1afde938bef3635c4f9b906a1f0da00a485f48 Mon Sep 17 00:00:00 2001 From: "ghendricks%novell.com" Date: Thu, 14 Jun 2007 15:32:05 +0000 Subject: [PATCH] Removed tabs git-svn-id: svn://10.0.0.236/trunk@228049 18797224-902f-48f8-a5cc-f745e15eee43 --- .../testopia/Bugzilla/Testopia/Environment.pm | 74 +- .../Bugzilla/Testopia/Environment/Category.pm | 106 +- .../Bugzilla/Testopia/Environment/Element.pm | 82 +- .../Bugzilla/Testopia/Environment/Property.pm | 26 +- .../testopia/Bugzilla/Testopia/Product.pm | 6 +- .../testopia/Bugzilla/Testopia/TestCase.pm | 10 +- .../testopia/Bugzilla/Testopia/Xml.pm | 984 +++++++++--------- .../Bugzilla/Testopia/XmlReferences.pm | 12 +- .../testopia/Bugzilla/Testopia/XmlTestCase.pm | 548 +++++----- .../webtools/testopia/Bugzilla/WebService.pm | 2 +- .../Bugzilla/WebService/Testopia/Build.pm | 68 +- .../Bugzilla/WebService/Testopia/Product.pm | 26 +- .../Bugzilla/WebService/Testopia/TestCase.pm | 568 +++++----- .../WebService/Testopia/TestCaseRun.pm | 146 +-- .../Bugzilla/WebService/Testopia/TestPlan.pm | 362 +++---- .../Bugzilla/WebService/Testopia/TestRun.pm | 310 +++--- .../testopia/skins/standard/testopia.css | 16 +- .../version/testopia.html.tmpl | 21 +- .../caserun/short-form-header.html.tmpl | 2 +- .../en/default/testopia/text.png.tmpl | 20 + mozilla/webtools/testopia/testopia.dtd | 30 +- mozilla/webtools/testopia/testopia/ChangeLog | 214 ++-- .../webtools/testopia/testopia/css/print.css | 38 +- .../testopia/testopia/environment.dtd | 8 +- .../testopia/testopia/js/DocumentManager.js | 96 +- .../webtools/testopia/testopia/js/caserun.js | 322 +++--- mozilla/webtools/testopia/testopia/js/tags.js | 2 +- mozilla/webtools/testopia/testopia/patch-2.22 | 44 +- .../webtools/testopia/testopia/patch-2.22.1 | 44 +- mozilla/webtools/testopia/tr_csv2xml.pl | 872 ++++++++-------- mozilla/webtools/testopia/tr_importxml.pl | 10 +- mozilla/webtools/testopia/tr_list_cases.cgi | 18 +- mozilla/webtools/testopia/tr_query.cgi | 14 +- mozilla/webtools/testopia/tr_show_case.cgi | 18 +- .../webtools/testopia/tr_show_environment.cgi | 14 +- mozilla/webtools/testopia/tr_show_plan.cgi | 22 +- mozilla/webtools/testopia/tr_xmlrpc.cgi | 2 +- 37 files changed, 2599 insertions(+), 2558 deletions(-) diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment.pm index 5a6fa30d214..dcc7ab81c10 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment.pm @@ -169,17 +169,17 @@ sub get_environment_elements{ my $id = $self->{'environment_id'}; my $ref = $dbh->selectcol_arrayref(qq{ - SELECT DISTINCT tee.element_id - FROM test_environment_map as tem - JOIN test_environment_element as tee - ON tem.element_id = tee.element_id - WHERE tem.environment_id = ?},undef,$id); + SELECT DISTINCT tee.element_id + FROM test_environment_map as tem + JOIN test_environment_element as tee + ON tem.element_id = tee.element_id + WHERE tem.environment_id = ?},undef,$id); my @elements; - foreach my $val (@$ref){ - push @elements, Bugzilla::Testopia::Environment::Element->new($val); - } + foreach my $val (@$ref){ + push @elements, Bugzilla::Testopia::Environment::Element->new($val); + } $self->{'elements'} = \@elements; return \@elements; @@ -222,18 +222,18 @@ Returns a selected value for the specified environment element property instance =cut sub get_value_selected{ - my $dbh = Bugzilla->dbh; + my $dbh = Bugzilla->dbh; my $self = shift; my ($environment,$element,$property) = (@_); my ($var) = $dbh->selectrow_array( - "SELECT value_selected - FROM test_environment_map - WHERE environment_id = ? - AND element_id = ? - AND property_id = ?", - undef,($environment,$element,$property)); + "SELECT value_selected + FROM test_environment_map + WHERE environment_id = ? + AND element_id = ? + AND property_id = ?", + undef,($environment,$element,$property)); return $var; } @@ -249,8 +249,8 @@ sub get_environments{ my $self = shift; my $ref = $dbh->selectall_arrayref( - "SELECT environment_id, name - FROM test_environments"); + "SELECT environment_id, name + FROM test_environments"); return $ref; } @@ -325,20 +325,20 @@ sub get_all_elements{ my $dbh = Bugzilla->dbh; my $self = shift; - my $ref = $dbh->selectcol_arrayref( - "SELECT tee.element_id - FROM test_environment_map as tem - JOIN test_environment_element as tee - ON tem.element_id = tee.element_id", - undef); + my $ref = $dbh->selectcol_arrayref( + "SELECT tee.element_id + FROM test_environment_map as tem + JOIN test_environment_element as tee + ON tem.element_id = tee.element_id", + undef); my @elements; - foreach my $val (@$ref){ - push @elements, Bugzilla::Testopia::Environment::Element->new($val); - } + foreach my $val (@$ref){ + push @elements, Bugzilla::Testopia::Environment::Element->new($val); + } - return \@elements; + return \@elements; } =head2 check environment name @@ -354,10 +354,10 @@ sub check_environment{ my $dbh = Bugzilla->dbh; my ($used) = $dbh->selectrow_array( - "SELECT environment_id - FROM test_environments - WHERE name = ? AND product_id = ?", - undef, ($name, $product_id)); + "SELECT environment_id + FROM test_environments + WHERE name = ? AND product_id = ?", + undef, ($name, $product_id)); return $used; } @@ -412,7 +412,7 @@ sub store { $self->persist_environment_element_and_children(1, $element, "store"); } - return $key; + return $key; } @@ -423,7 +423,7 @@ Serializes the property values to the database =cut sub store_property_value { - my $self = shift; + my $self = shift; my ($prop_id,$elem_id,$value_selected) = @_; @@ -448,8 +448,8 @@ sub store_environment_name { # Exclude the auto-incremented field from the column list. my $columns = join(", ", grep {$_ ne 'environment_id'} DB_COLUMNS); - return undef if $self->check_environment($name, $product_id); - + return undef if $self->check_environment($name, $product_id); + my $dbh = Bugzilla->dbh; $dbh->do("INSERT INTO test_environments ($columns) VALUES (?,?,?)", undef, ($product_id, $name, 1)); @@ -545,7 +545,7 @@ Updates the property of the element in the database sub update_property_value { - my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); + my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); my $self = shift; my ($propID, $elemID, $valueSelected) = (@_); @@ -688,7 +688,7 @@ Returns the name of this object sub id { return $_[0]->{'environment_id'}; } sub product_id { return $_[0]->{'product_id'}; } -sub isactive { return $_[0]->{'isactive'}; } +sub isactive { return $_[0]->{'isactive'}; } sub name { return $_[0]->{'name'}; } =head2 product diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Category.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Category.pm index dda2de85ee8..32b5e290bd9 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Category.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Category.pm @@ -126,21 +126,21 @@ Returns an array of element objects for a category =cut sub get_elements_by_category{ - my $self = shift; - + my $self = shift; + my $dbh = Bugzilla->dbh; my $ref = $dbh->selectcol_arrayref(qq{ - SELECT element_id + SELECT element_id FROM test_environment_element - WHERE env_category_id = ?}, undef, $self->{'env_category_id'}); - - my @elements; + WHERE env_category_id = ?}, undef, $self->{'env_category_id'}); + + my @elements; - foreach my $val (@$ref){ - push @elements, Bugzilla::Testopia::Environment::Element->new($val); - }; - + foreach my $val (@$ref){ + push @elements, Bugzilla::Testopia::Environment::Element->new($val); + }; + return \@elements; } @@ -151,15 +151,15 @@ Returns an array of parent elements by category =cut sub get_parent_elements{ - my $self = shift; - + my $self = shift; + my $dbh = Bugzilla->dbh; ################## original # Matches null for parent id # # my $ref = $dbh->selectcol_arrayref(qq{ -# SELECT element_id +# SELECT element_id # FROM test_environment_element # WHERE env_category_id = ? AND parent_id is null }, undef, $self->{'env_category_id'}); # @@ -170,7 +170,7 @@ sub get_parent_elements{ # Matches 0 for parent id # # my $ref = $dbh->selectcol_arrayref(qq{ -# SELECT element_id +# SELECT element_id # FROM test_environment_element # WHERE env_category_id = ? AND parent_id = 0 }, undef, $self->{'env_category_id'}); # @@ -178,19 +178,19 @@ sub get_parent_elements{ ########### temp fix to address issues with 0 or null in test_envrionment_element parent_id column -##### matching null OR 0 - my $ref = $dbh->selectcol_arrayref(qq{ - SELECT element_id +##### matching null OR 0 + my $ref = $dbh->selectcol_arrayref(qq{ + SELECT element_id FROM test_environment_element WHERE env_category_id = ? AND (parent_id is null or parent_id = 0) }, undef, $self->{'env_category_id'}); -########### end temp fix.... delete when ready +########### end temp fix.... delete when ready - my @elements; + my @elements; - foreach my $val (@$ref){ - push @elements, Bugzilla::Testopia::Environment::Element->new($val); - }; - + foreach my $val (@$ref){ + push @elements, Bugzilla::Testopia::Environment::Element->new($val); + }; + return \@elements; } @@ -201,14 +201,14 @@ Returns 1 if a category has any elements =cut sub check_for_elements{ - my $self = shift; - my $dbh = Bugzilla->dbh; + my $self = shift; + my $dbh = Bugzilla->dbh; my $ref = $dbh->selectrow_array(qq{ - SELECT 1 + SELECT 1 FROM test_environment_element - WHERE env_category_id = ?}, undef, $self->{'env_category_id'}); - + WHERE env_category_id = ?}, undef, $self->{'env_category_id'}); + return $ref; } @@ -219,14 +219,14 @@ Returns the product_id, product name, and count of categories =cut sub get_env_product_list{ - my $self = shift; - my ($class_id) = @_; + my $self = shift; + my ($class_id) = @_; my $dbh = Bugzilla->dbh; my $query = "SELECT p.id, p.name, COUNT(tec.env_category_id) AS cat_count - FROM products p - LEFT JOIN group_control_map - ON group_control_map.product_id = p.id "; + FROM products p + LEFT JOIN group_control_map + ON group_control_map.product_id = p.id "; if (Bugzilla->params->{'useentrygroupdefault'}) { $query .= "AND group_control_map.entry != 0 "; @@ -238,7 +238,7 @@ sub get_env_product_list{ $query .= "AND group_id NOT IN(" . join(',', values(%{Bugzilla->user->groups})) . ") "; } - + $query .= "LEFT OUTER JOIN test_environment_category AS tec ON p.id = tec.product_id "; $query .= "WHERE group_id IS NULL "; @@ -267,7 +267,7 @@ sub get_all_child_count { FROM test_environment_category WHERE product_id = 0"); - return $all_count; + return $all_count; } sub product_categories_to_json { @@ -373,15 +373,15 @@ Returns category id if a category exists sub check_category{ my $dbh = Bugzilla->dbh; my $self = shift; - my ($name, $prodID) = (@_); - - $prodID ||= $self->product_id; - + my ($name, $prodID) = (@_); + + $prodID ||= $self->product_id; + my ($used) = $dbh->selectrow_array( "SELECT env_category_id - FROM test_environment_category - WHERE name = ? AND product_id = ?", - undef,($name,$prodID)); + FROM test_environment_category + WHERE name = ? AND product_id = ?", + undef,($name,$prodID)); return $used; } @@ -394,13 +394,13 @@ Returns category name if a category id exists sub check_category_by_id{ my $dbh = Bugzilla->dbh; - my $self = shift; + my $self = shift; my ($id) = (@_); - my ($used) = $dbh->selectrow_arrayref(qq{ - SELECT name - FROM test_environment_category - WHERE env_category_id = ?},undef,$id); + my ($used) = $dbh->selectrow_arrayref(qq{ + SELECT name + FROM test_environment_category + WHERE env_category_id = ?},undef,$id); return $used; } @@ -419,7 +419,7 @@ sub store { my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); return 0 if $self->check_category($self->{'name'},$self->{'product_id'}); - + my $dbh = Bugzilla->dbh; $dbh->do("INSERT INTO test_environment_category ($columns) VALUES (?, ?)", undef, ($self->{'product_id'}, $self->{'name'})); @@ -474,11 +474,11 @@ Completely removes the element category entry from the database. sub obliterate { my $self = shift; - my $dbh = Bugzilla->dbh; - my $children = $dbh->selectcol_arrayref( - "SELECT element_id FROM test_environment_element - WHERE env_category_id = ?", undef, $self->id); - + my $dbh = Bugzilla->dbh; + my $children = $dbh->selectcol_arrayref( + "SELECT element_id FROM test_environment_element + WHERE env_category_id = ?", undef, $self->id); + foreach my $id (@$children){ my $element = Bugzilla::Testopia::Environment::Element->new($id); $element->obliterate; diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Element.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Element.pm index 2a73c5d0875..b6b18de28af 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Element.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Element.pm @@ -111,8 +111,8 @@ sub _init { $obj = $dbh->selectrow_hashref( "SELECT $columns - FROM test_environment_element - WHERE element_id = ?", undef, $id); + FROM test_environment_element + WHERE element_id = ?", undef, $id); } elsif (ref $param eq 'HASH'){ $obj = $param; } @@ -136,7 +136,7 @@ gets all of their children until exhausted. =cut sub get_children{ - my $dbh = Bugzilla->dbh; + my $dbh = Bugzilla->dbh; my $self = shift; return $self->{'children'} if exists $self->{'children'}; @@ -146,7 +146,7 @@ sub get_children{ if(%newvalues) { - $depth = $newvalues{'depth'}; + $depth = $newvalues{'depth'}; } $depth--; @@ -157,20 +157,20 @@ sub get_children{ my $id = $self->{'element_id'}; my $ref = $dbh->selectcol_arrayref(qq{ - SELECT tee.element_id - FROM test_environment_element as tee - WHERE tee.parent_id = ?},undef,$id); + SELECT tee.element_id + FROM test_environment_element as tee + WHERE tee.parent_id = ?},undef,$id); my @children; - foreach my $val (@$ref){ - my $child = Bugzilla::Testopia::Environment::Element->new($val); - $child->get_children('depth'=>$depth); - push(@children,$child); - } - - $self->{'children'} = \@children; - + foreach my $val (@$ref){ + my $child = Bugzilla::Testopia::Environment::Element->new($val); + $child->get_children('depth'=>$depth); + push(@children,$child); + } + + $self->{'children'} = \@children; + } =head2 get_properties @@ -180,24 +180,24 @@ Returns an array of the property objects for an element. =cut sub get_properties{ - my $dbh = Bugzilla->dbh; + my $dbh = Bugzilla->dbh; my $self = shift; my $ref = $dbh->selectcol_arrayref(qq{ - SELECT tep.property_id - FROM test_environment_property as tep - WHERE tep.element_id = ?},undef,($self->{'element_id'})); + SELECT tep.property_id + FROM test_environment_property as tep + WHERE tep.element_id = ?},undef,($self->{'element_id'})); my @properties; - foreach my $val (@$ref){ - my $property = Bugzilla::Testopia::Environment::Property->new($val); - push(@properties,$property); - } - - $self->{'properties'} = \@properties; - return $self->{'properties'}; - + foreach my $val (@$ref){ + my $property = Bugzilla::Testopia::Environment::Property->new($val); + push(@properties,$property); + } + + $self->{'properties'} = \@properties; + return $self->{'properties'}; + } =head2 check_element @@ -210,8 +210,8 @@ sub check_element{ my $dbh = Bugzilla->dbh; my $self = shift; my ($name, $cat_id) = @_; - - # Since categories are uniquely identified by product_id we don't have to check by join on the product_id. + + # Since categories are uniquely identified by product_id we don't have to check by join on the product_id. my ($used) = $dbh->selectrow_array( "SELECT element_id FROM test_environment_element @@ -233,13 +233,13 @@ sub check_for_children{ my $self = shift; my ($has_element) = $dbh->selectrow_array( - "SELECT 1 + "SELECT 1 FROM test_environment_element WHERE parent_id = ?", undef, $self->{'element_id'}); my ($has_property) = $dbh->selectrow_array( - "SELECT 1 + "SELECT 1 FROM test_environment_property WHERE element_id = ?", undef, $self->{'element_id'}); @@ -320,7 +320,7 @@ sub check_for_properties{ my $self = shift; my ($used) = $dbh->selectrow_array(qq{ - SELECT 1 + SELECT 1 FROM test_environment_property WHERE element_id = ? },undef,$self->{'element_id'}); @@ -361,7 +361,7 @@ Updates the element in the database sub update_element_name { my $self = shift; - my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); + my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); my ($name) = (@_); @@ -381,7 +381,7 @@ Updates the category of the element in the database sub update_element_category { my $self = shift; - my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); + my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); my ($catid) = (@_); @@ -400,7 +400,7 @@ Updates the parent_id of the element in the database sub update_element_parent { my $self = shift; - my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); + my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); my ($parent_id) = (@_); @@ -419,12 +419,12 @@ Completely removes the element entry from the database. sub obliterate { my $self = shift; my $dbh = Bugzilla->dbh; - - foreach my $p (@{$self->get_properties}){ - $p->obliterate; - } - - $dbh->do("DELETE FROM test_environment_map + + foreach my $p (@{$self->get_properties}){ + $p->obliterate; + } + + $dbh->do("DELETE FROM test_environment_map WHERE element_id = ?", undef, $self->id); $dbh->do("DELETE FROM test_environment_element WHERE element_id = ?", undef, $self->{'element_id'}); diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Property.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Property.pm index 9f6dcd1f55e..968d7e6679d 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Property.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/Environment/Property.pm @@ -137,9 +137,9 @@ sub check_property{ } my ($used) = $dbh->selectrow_array(qq{ - SELECT property_id - FROM test_environment_property - WHERE name = ? AND element_id = ?},undef,$name,$element_id); + SELECT property_id + FROM test_environment_property + WHERE name = ? AND element_id = ?},undef,$name,$element_id); return $used; } @@ -156,9 +156,9 @@ sub check_for_validexp{ my $dbh = Bugzilla->dbh; my ($used) = $dbh->selectrow_array(qq{ - SELECT 1 - FROM test_environment_property - WHERE property_id = ? AND (validexp IS NOT NULL AND validexp <> '')},undef,$self->{'property_id'}); + SELECT 1 + FROM test_environment_property + WHERE property_id = ? AND (validexp IS NOT NULL AND validexp <> '')},undef,$self->{'property_id'}); return $used; } @@ -197,9 +197,9 @@ sub get_validexp{ my $dbh = Bugzilla->dbh; my $validexp = $dbh->selectrow_arrayref(qq{ - SELECT validexp - FROM test_environment_property - WHERE property_id = ? },undef,$self->{'property_id'}); + SELECT validexp + FROM test_environment_property + WHERE property_id = ? },undef,$self->{'property_id'}); return $validexp; } @@ -219,7 +219,7 @@ sub store { # Verify name is available return undef if $self->check_property($self->{'name'}, $self->{'element_id'}); - + my $dbh = Bugzilla->dbh; $dbh->do("INSERT INTO test_environment_property ($columns) VALUES (?,?,?)", undef, ($self->{'element_id'}, $self->{'name'}, $self->{'validexp'})); @@ -234,7 +234,7 @@ Updates the property name in the database =cut sub set_name { - my $self = shift; + my $self = shift; my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); my ($name) = (@_); @@ -253,7 +253,7 @@ Updates the elmnt_id in the database =cut sub set_element { - my $self = shift; + my $self = shift; my $timestamp = Bugzilla::Testopia::Util::get_time_stamp(); my ($id) = (@_); @@ -321,7 +321,7 @@ Completely removes the element property entry from the database. sub obliterate { my $self = shift; my $dbh = Bugzilla->dbh; - + $dbh->do("DELETE FROM test_environment_map WHERE property_id = ?", undef, $self->id); $dbh->do("DELETE FROM test_environment_property diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm index 5ca2341cc40..5fd1b46706e 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm @@ -120,9 +120,9 @@ sub check_product_by_name { my ($name) = @_; my $dbh = Bugzilla->dbh; my ($used) = $dbh->selectrow_array(qq{ - SELECT id - FROM products - WHERE name = ?},undef,$name); + SELECT id + FROM products + WHERE name = ?},undef,$name); return $used; } diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm index de434da7717..5fab71758f5 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/TestCase.pm @@ -647,7 +647,7 @@ sub link_plan { # Update the plans array to include new plan added. - push @{$self->{'plans'}}, Bugzilla::Testopia::TestPlan->new($plan_id); + push @{$self->{'plans'}}, Bugzilla::Testopia::TestPlan->new($plan_id); } @@ -688,7 +688,7 @@ sub unlink_plan { # Update the plans array. delete $self->{'plans'}; - return 1; + return 1; } =head2 copy @@ -1504,9 +1504,9 @@ sub components { my @comps; foreach my $id (@$comps){ - my $comp = Bugzilla::Component->new($id); - my $prod = Bugzilla::Product->new($comp->product_id); - $comp->{'product_name'} = $prod->name; + my $comp = Bugzilla::Component->new($id); + my $prod = Bugzilla::Product->new($comp->product_id); + $comp->{'product_name'} = $prod->name; push @comps, $comp; } $self->{'components'} = \@comps; diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/Xml.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/Xml.pm index 22f6a293e0c..b5be209beb6 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/Xml.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/Xml.pm @@ -105,26 +105,26 @@ use Class::Struct; # struct ( - 'Bugzilla::Testopia::Xml', - { - # Array of attachments read for xml source. - attachments => '@', -#TODO builds => '@', - # Array of categories read from xml source. Categories - categories => '@', - tags => '@', -#TODO testenvironments => '@', - # Array of testcases read from xml source. - testcases => '@', - # Hash of testcase aliases indexed by testcase summary. Used during verfication to - # insure that alias does not exist and that new aliases are used in only one testcase. - testcase_aliases => '%', - # Array of testplans read from xml source. - testplans => '@', - # If true indicates some type of error has occurred processing the XML. Used to prevent - # updating Testopia with contents of current XML. - parse_error => '$', - } + 'Bugzilla::Testopia::Xml', + { + # Array of attachments read for xml source. + attachments => '@', +#TODO builds => '@', + # Array of categories read from xml source. Categories + categories => '@', + tags => '@', +#TODO testenvironments => '@', + # Array of testcases read from xml source. + testcases => '@', + # Hash of testcase aliases indexed by testcase summary. Used during verfication to + # insure that alias does not exist and that new aliases are used in only one testcase. + testcase_aliases => '%', + # Array of testplans read from xml source. + testplans => '@', + # If true indicates some type of error has occurred processing the XML. Used to prevent + # updating Testopia with contents of current XML. + parse_error => '$', + } ); #TODO: Add this to checksetup @@ -154,15 +154,15 @@ use Text::Diff; sub entity_replace_testopia { - my ($string) = @_; - - return undef if ( ! defined $string ); - - $string =~ s/$TESTOPIA_GT/>/g; - $string =~ s/$TESTOPIA_LT//g; - - return $string; + my ($string) = @_; + + return undef if ( ! defined $string ); + + $string =~ s/$TESTOPIA_GT/>/g; + $string =~ s/$TESTOPIA_LT//g; + + return $string; } =pod @@ -186,481 +186,481 @@ sub entity_replace_testopia sub entity_replace_xml { - my ($string,$strip) = @_; - - return undef if ( ! defined $string ); - - $string =~ s/^\s+// if ( $strip & STRIP_LEFT ); - $string =~ s/\s+$// if ( $strip & STRIP_RIGHT ); - $string =~ s/$XML_GT/>/g; - $string =~ s/$XML_LT//g; + $string =~ s/$XML_LT/parse_error("TRUE"); + my ($self, $message) = @_; + + print STDERR $message . "\n"; + + $self->parse_error("TRUE"); } sub parse() { - my ($self, $xml, $filename) = @_; + my ($self, $xml, $filename) = @_; - my $twig = XML::Twig->new( load_DTD => 1, keep_encoding => 1 ); + my $twig = XML::Twig->new( load_DTD => 1, keep_encoding => 1 ); - if ( defined($xml) ) - { - $twig->parse($xml); - } - elsif ( defined($filename) ) - { - $twig->parsefile($filename); - } - else - { - $self->error("Bugzilla::Testopia::Xml::parse has no XML input source") - } - - my $root = $twig->root; - - # Check for unimplemented tags. - my @twig_builds = $root->children('build'); - $self->error("Support for tags has not been implemented.") if ( $#twig_builds != -1 ); - my @twig_testenvironments = $root->children('testenvironment'); - $self->error("Support for tags has not been implemented.") if ( $#twig_testenvironments != -1 ); - my @twig_testruns = $root->children('testrun'); - $self->error("Support for tags has not been implemented.") if ( $#twig_testruns != -1 ); - my @twig_testrunlogs = $root->children('testrunlog'); - $self->error("Support for tags has not been implemented.") if ( $#twig_testrunlogs != -1 ); - - foreach my $twig_category ($root->children('category')) - { - my $category_name = entity_replace_xml($twig_category->field('name'),STRIP_BOTH); - my $product_name = entity_replace_xml($twig_category->att('product'),STRIP_BOTH); - my $description = entity_replace_xml($twig_category->field('description'),STRIP_BOTH); - if ( $category_name eq "" ) - { - $self->error("Category name cannot be empty, product='" . $product_name . "', description='" . $description . "'."); - next; - } - - $description = "FIX ME. Created during category import with no description supplied." if ( $description eq "" ); - - if ( $product_name eq REQUIRE ) - { - $self->error("Must supply a product for category '" . $category_name . "'." ); - next; - } - - my $product = new Bugzilla::Product({name => $product_name}); - if ( ! $product ) - { - $self->error("Cannot find product '" . $product_name . "' for category '" . $category_name . "'."); - $self->{"parser_error"} = 1; - next; - } - - my $category = new Bugzilla::Testopia::Category - ({ - name => $category_name, - product_id => $product->id(), - description => $description, - }); - - # Only create the category if it does not exist. - push @{$self->categories}, $category if ( ! $category->check_name($category_name) ); - } - - my $testplan = Bugzilla::Testopia::TestPlan->new({ 'name' => 'dummy' }); - my %plantype_ids; - my @temparray = @{$testplan->get_plan_types()}; - foreach my $arrayelement (@temparray) - { - my %temphash = %{$arrayelement}; - $plantype_ids{$temphash{"name"}} = $temphash{"id"}; - } - - foreach my $twig_testplan ($root->children('testplan')) - { - my $author = $twig_testplan->att('author'); - # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed - # are 'id' and 'login'. - my $author_ref = Bugzilla::User::match($author, 1, 0); - my $author_id = -1; - if ( ! $author_ref->[0] ) - { - $self->error("Cannot find author '" . $author . "' in test plan '" . $twig_testplan->field('name') . "'."); - } - else - { - my $author_user = $author_ref->[0]; - bless($author_user,"Bugzilla::User"); - $author_id = $author_user->id(); - } - - my $product_id = Bugzilla::Testopia::TestPlan::lookup_product_by_name($twig_testplan->field('product')); - if ( ! defined($product_id) ) - { - $self->error("Cannot find product '" . $twig_testplan->field('product') . "' in test plan '" . $twig_testplan->field('name') . "'."); - } - - my $name = entity_replace_xml($twig_testplan->field('name'),STRIP_BOTH) || undef; - $self->error("Found empty Test Plan name.") if ( ! defined($name) ); - $self->error("Length of Test Plan name '" . $name . "' must be " . Bugzilla::Testopia::TestPlan->NAME_MAX_LENGTH . " characters or less.") if ( defined($name) && ( length($name) > Bugzilla::Testopia::TestPlan->NAME_MAX_LENGTH ) ); - - $testplan = Bugzilla::Testopia::TestPlan->new({ - 'name' => $name, - 'product_id' => $product_id, - 'default_product_version' => entity_replace_xml($twig_testplan->field('productversion'),STRIP_BOTH), - 'type_id' => $plantype_ids{$twig_testplan->att('type')}, - 'text' => entity_replace_testopia($twig_testplan->field('document')), - 'author_id' => $author_id, - 'isactive' => entity_replace_xml($twig_testplan->field('archive'),STRIP_BOTH), - 'creation_date' => entity_replace_xml($twig_testplan->field('created'),STRIP_BOTH) - }); - push @{$self->testplans}, $testplan; - - my @tags = $twig_testplan->children('tag'); - foreach my $twig_tag (@tags) - { - push @{$self->tags}, entity_replace_xml($twig_tag->text(),STRIP_BOTH); - } - - my @attachments = $twig_testplan->children('attachment'); - foreach my $twig_attachments (@attachments) - { - my $submitter = $twig_attachments->field('submitter'); - # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed - # are 'id' and 'login'. - my $submitter_ref = Bugzilla::User::match($submitter, 1, 0); - my $submitter_id = -1; - if ( ! $submitter_ref->[0] ) - { - $self->error("Cannot find submitter '" . $submitter . "' in test plan '" . $twig_testplan->field('name') . "' attachment '" . $twig_attachments->field('description') . "'."); - } - else - { - my $submitter_user = $submitter_ref->[0]; - bless($submitter_user,"Bugzilla::User"); - $submitter_id = $submitter_user->id(); - } - my $attachment = Bugzilla::Testopia::Attachment->new({ - 'description' => entity_replace_xml($twig_attachments->field('description'),STRIP_BOTH), - 'filename' => entity_replace_xml($twig_attachments->field('filename'),STRIP_BOTH), - 'submitter_id' => $submitter_id, - 'mime_type' => entity_replace_xml($twig_attachments->field('mimetype'),STRIP_BOTH), - 'contents' => entity_replace_xml($twig_attachments->field('data'),STRIP_BOTH) - }); - push @{$self->attachments}, $attachment; - } - } - - my $testcase = Bugzilla::Testopia::TestCase->new({ 'name' => 'dummy' }); - my %priority_ids; - @temparray = @{$testcase->get_priority_list()}; - foreach my $arrayelement (@temparray) - { - my %temphash = %{$arrayelement}; - my $longname = $temphash{"name"}; - # The long name. "P1 - Urgent" - $priority_ids{$longname} = $temphash{"id"}; - # The short name. "P1" - my $shortname = $longname; - $shortname =~ s/ - .*//; - $priority_ids{$shortname} = $temphash{"id"} if ( $longname ne $shortname ); - } - foreach my $twig_testcase ($root->children('testcase')) - { - my $summary = entity_replace_xml($twig_testcase->field('summary'),STRIP_BOTH) || undef; - $self->error("Found empty Test Case summary.") if ( ! defined($summary) ); - $self->error("Length of summary '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->SUMMARY_MAX_LENGTH . " characters or less.") if ( defined($summary) && ( length($summary) > Bugzilla::Testopia::TestCase->SUMMARY_MAX_LENGTH ) ); - my $author = $twig_testcase->att('author'); - # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed - # are 'id' and 'login'. - my $author_ref = Bugzilla::User::match($author, 1, 0); - my $author_id = -1; - if ( ! $author_ref->[0] ) - { - $self->error("Cannot find author '" . $author . "' in test case '" . $summary . "'."); - } - else - { - my $author_user = $author_ref->[0]; - bless($author_user,"Bugzilla::User"); - $author_id = $author_user->id(); - } - my $tester = entity_replace_xml($twig_testcase->field('defaulttester'),STRIP_BOTH); - # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed - # are 'id' and 'login'. - my $tester_ref = Bugzilla::User::match($tester, 1, 0); - my $tester_id = -1; - if ( ! $tester_ref->[0] ) - { - $self->error("Cannot find default tester '" . $tester . "' in test case '" . $summary . "'."); - } - else - { - my $tester_user = $tester_ref->[0]; - bless($tester_user,"Bugzilla::User"); - $tester_id = $tester_user->id(); - } - my $status_id = Bugzilla::Testopia::TestCase::lookup_status_by_name($twig_testcase->att('status')); - $self->error("Cannot find status '" . $twig_testcase->att('status') . "' in test case '" . $summary . "'.") if ( ! defined($status_id) ); - - my $xml_testcase = new Bugzilla::Testopia::XmlTestCase; - $xml_testcase->blocks(Bugzilla::Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS)); - $xml_testcase->dependson(Bugzilla::Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS)); - $xml_testcase->testplan(Bugzilla::Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS)); - push @{$self->testcases}, $xml_testcase; - my $alias = entity_replace_xml($twig_testcase->field('alias'),STRIP_BOTH) || undef; - $self->error("Length of alias '" . $alias . "' in test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->ALIAS_MAX_LENGTH . " characters or less.") if ( defined($alias) && ( length($alias) > Bugzilla::Testopia::TestCase->ALIAS_MAX_LENGTH ) ); - my $requirement = entity_replace_xml($twig_testcase->field('requirement'),STRIP_BOTH) || undef; - $self->error("Length of requirement '" . $requirement . "' in test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->REQUIREMENT_MAX_LENGTH . " characters or less.") if ( defined($requirement) && ( length($requirement) > Bugzilla::Testopia::TestCase->REQUIREMENT_MAX_LENGTH ) ); - - $xml_testcase->testcase(Bugzilla::Testopia::TestCase->new({ - 'action' => entity_replace_testopia($twig_testcase->field('action')), - 'alias' => $alias, - 'arguments' => entity_replace_xml($twig_testcase->field('arguments'),STRIP_NONE), - 'author_id' => $author_id, - 'blocks' => undef, - 'breakdown' => entity_replace_testopia($twig_testcase->field('breakdown')), - 'case_status_id' => $status_id, - 'category_id' => undef, - 'default_tester_id' => $tester_id, - 'dependson' => undef, - 'effect' => entity_replace_testopia($twig_testcase->field('expectedresults')), - 'isautomated' => ( uc $twig_testcase->att('automated') ) eq AUTOMATIC, - 'plans' => undef, - 'priority_id' => $priority_ids{$twig_testcase->att('priority')}, - 'requirement' => $requirement, - 'setup' => entity_replace_testopia($twig_testcase->field('setup')), - 'script' => entity_replace_xml($twig_testcase->field('script'),STRIP_NONE), - 'summary' => $summary, - })); - foreach my $twig_testplan_reference ( $twig_testcase->children(TESTPLAN_REFERENCE) ) - { - my $testplan_reference = $twig_testplan_reference->children_text(PCDATA); - if ( $testplan_reference eq "" ) - { - $self->error("No test plan included for type '" - . $twig_testplan_reference->att('type') - . "' in test case '" . $twig_testcase->field('summary') . "'." ); - } - elsif ( length($testplan_reference) > Bugzilla::Testopia::TestPlan->NAME_MAX_LENGTH ) - { - $self->error("Length of Test Plan name '" . $testplan_reference . "' for test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->REQUIREMENT_MAX_LENGTH . " characters or less."); - } - elsif ( ! $xml_testcase->testplan->add($twig_testplan_reference->att('type'),entity_replace_xml($testplan_reference,STRIP_BOTH)) ) - { - $self->error("Do not know how to handle test plan of type '" - . $twig_testplan_reference->att('type') - . "' in test case '" . $twig_testcase->field('summary') . "'." - . "\nKnown types are: (" . uc XMLREFERENCES_FIELDS . ")."); - } - } - # Keep track of this testcase's alias. Used during verification to insure aliases are unique. - $self->testcase_aliases(entity_replace_xml($twig_testcase->field('summary'),STRIP_BOTH),$alias) if ( defined $alias ); - # Keep track of this testcase's category. To create a category at this time would require - # getting the product from the Test Plan that this Test Case is associated with. The category - # will created when each Test Case is stored. - my $categoryname = entity_replace_xml($twig_testcase->field('categoryname'),STRIP_BOTH); - if ( $categoryname ne "" ) - { - $xml_testcase->category($categoryname); - } - else - { - $self->error("Empty category name for test case '" . $summary . "'."); - } - - my @attachments = $twig_testcase->children('attachment'); - foreach my $twig_attachments (@attachments) - { - my $submitter = $twig_attachments->field('submitter'); - # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed - # are 'id' and 'login'. - my $submitter_ref = Bugzilla::User::match($submitter, 1, 0); - my $submitter_id = -1; - if ( ! $submitter_ref->[0] ) - { - $self->error("Cannot find submitter '" . $submitter . "' in test case '" . $twig_testcase->field('summary') . "' attachment '" . $twig_attachments->field('description') . "'."); - } - else - { - my $submitter_user = $submitter_ref->[0]; - bless($submitter_user,"Bugzilla::User"); - $submitter_id = $submitter_user->id(); - } - my $attachment = Bugzilla::Testopia::Attachment->new({ - 'description' => entity_replace_xml($twig_attachments->field('description'),STRIP_BOTH), - 'filename' => entity_replace_xml($twig_attachments->field('filename'),STRIP_BOTH), - 'submitter_id' => $submitter_id, - 'mime_type' => entity_replace_xml($twig_attachments->field('mimetype'),STRIP_BOTH), - 'contents' => entity_replace_xml($twig_attachments->field('data'),STRIP_BOTH) - }); - $xml_testcase->add_attachment($attachment); - } - - my @tags = $twig_testcase->children('tag'); - foreach my $twig_tag ( @tags ) - { - my $tag = entity_replace_xml($twig_tag->text(),STRIP_BOTH); - $self->error("Length of tag '" . $tag . "' in test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->TAG_MAX_LENGTH . " characters or less.") if ( defined($tag) && ( length($tag) > Bugzilla::Testopia::TestCase->TAG_MAX_LENGTH ) ); - $xml_testcase->add_tag($tag); - } + if ( defined($xml) ) + { + $twig->parse($xml); + } + elsif ( defined($filename) ) + { + $twig->parsefile($filename); + } + else + { + $self->error("Bugzilla::Testopia::Xml::parse has no XML input source") + } - my @components = $twig_testcase->children('component'); - foreach my $twig_component ( @components ) - { - my $results = $xml_testcase->add_component(entity_replace_xml($twig_component->children_text(PCDATA),STRIP_BOTH),$twig_component->att('product')); - $self->error($results) if ( $results ne "" ); - } - - foreach my $twig_blocks ( $twig_testcase->children(BLOCKS) ) - { - if ( ! $xml_testcase->blocks->add($twig_blocks->att('type'),entity_replace_xml($twig_blocks->children_text(PCDATA),STRIP_BOTH)) ) - { - $self->error("Do not know how to handle a blocking test case of type '" . $twig_blocks->att('type') . "' in test case '" . $xml_testcase->testcase->summary() . "'.") - } - } + my $root = $twig->root; + + # Check for unimplemented tags. + my @twig_builds = $root->children('build'); + $self->error("Support for tags has not been implemented.") if ( $#twig_builds != -1 ); + my @twig_testenvironments = $root->children('testenvironment'); + $self->error("Support for tags has not been implemented.") if ( $#twig_testenvironments != -1 ); + my @twig_testruns = $root->children('testrun'); + $self->error("Support for tags has not been implemented.") if ( $#twig_testruns != -1 ); + my @twig_testrunlogs = $root->children('testrunlog'); + $self->error("Support for tags has not been implemented.") if ( $#twig_testrunlogs != -1 ); + + foreach my $twig_category ($root->children('category')) + { + my $category_name = entity_replace_xml($twig_category->field('name'),STRIP_BOTH); + my $product_name = entity_replace_xml($twig_category->att('product'),STRIP_BOTH); + my $description = entity_replace_xml($twig_category->field('description'),STRIP_BOTH); + if ( $category_name eq "" ) + { + $self->error("Category name cannot be empty, product='" . $product_name . "', description='" . $description . "'."); + next; + } + + $description = "FIX ME. Created during category import with no description supplied." if ( $description eq "" ); + + if ( $product_name eq REQUIRE ) + { + $self->error("Must supply a product for category '" . $category_name . "'." ); + next; + } + + my $product = new Bugzilla::Product({name => $product_name}); + if ( ! $product ) + { + $self->error("Cannot find product '" . $product_name . "' for category '" . $category_name . "'."); + $self->{"parser_error"} = 1; + next; + } + + my $category = new Bugzilla::Testopia::Category + ({ + name => $category_name, + product_id => $product->id(), + description => $description, + }); + + # Only create the category if it does not exist. + push @{$self->categories}, $category if ( ! $category->check_name($category_name) ); + } + + my $testplan = Bugzilla::Testopia::TestPlan->new({ 'name' => 'dummy' }); + my %plantype_ids; + my @temparray = @{$testplan->get_plan_types()}; + foreach my $arrayelement (@temparray) + { + my %temphash = %{$arrayelement}; + $plantype_ids{$temphash{"name"}} = $temphash{"id"}; + } + + foreach my $twig_testplan ($root->children('testplan')) + { + my $author = $twig_testplan->att('author'); + # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed + # are 'id' and 'login'. + my $author_ref = Bugzilla::User::match($author, 1, 0); + my $author_id = -1; + if ( ! $author_ref->[0] ) + { + $self->error("Cannot find author '" . $author . "' in test plan '" . $twig_testplan->field('name') . "'."); + } + else + { + my $author_user = $author_ref->[0]; + bless($author_user,"Bugzilla::User"); + $author_id = $author_user->id(); + } - foreach my $twig_dependson ( $twig_testcase->children(DEPENDSON) ) - { - if ( ! $xml_testcase->dependson->add($twig_dependson->att('type'),entity_replace_xml($twig_dependson->children_text(PCDATA),STRIP_BOTH)) ) - { - $self->error("Do not know how to handle dependency of type '" . $twig_dependson->att('type') . "' in test case '" . entity_replace_xml($xml_testcase->testcase->summary(),STRIP_BOTH) . "'.") - } - } - } - - # - # Start of data integrity check. - # - # Run through the Test Plans and Test Cases looking for integrity errors. - # - - # Check for duplicate aliases. Loop though all testcases that have a alias. - my %used_alias; - my %duplicate_alias; - foreach my $summary ( keys %{$self->testcase_aliases} ) - { - # Get the alias. - my $alias = $self->testcase_aliases($summary); - # Is the alias used by a testcase in the database already? If so add it to the duplicate list - # and move onto next testcase. - my $alias_testcase_id = Bugzilla::Testopia::TestCase::class_check_alias($alias); - if ( $alias_testcase_id ) - { - $duplicate_alias{$alias} = $alias_testcase_id; - next; - } - # Is the alias in the used_alias array? - if ( defined( $used_alias{$alias} ) ) - { - # If so then another testcase being created also used the alias. Add the alias to the - # duplicate list. - $duplicate_alias{$alias} = "import"; - } - else - { - # Alias has not been seen yet. Add it to the used_alias list to keep track of it. - $used_alias{$alias} = ""; - } - } - # The @duplicate_alias list contains aliases used by more that one test case. Display them and set - # error condition - foreach my $summary ( keys %{$self->testcase_aliases} ) - { - my $alias = $self->testcase_aliases($summary); - if ( exists $duplicate_alias{$alias} ) - { - my $error_message = "Test Case '" . $summary . "' has a non-unique alias '" . $alias . "'."; - if ( $duplicate_alias{$alias} ne "import" ) - { - $error_message .= " Test Case " . $duplicate_alias{$alias} . " already uses the alias '" . $alias . "'."; - } - else - { - $error_message .= " Additional test cases being imported are using the alias '" . $alias . "'."; - } - $self->error($error_message); - } - } - - # - # Start of data store. - # - # No data has been written prior to this point. If parse_error has not been set the XML is valid - # and no integrity errors were found. It's time to start storing the Test Plans and Test Cases. - # - - if ( ! defined $self->parse_error ) - { - # Store new categories. - foreach my $category ( @{$self->categories} ) - { - # Make sure category still does not exist. We don't check for uniqueness above so - # the same category could be defined multiple times. - if ( ! $category->check_name($category->name()) ) - { - $category->store(); - my $product_name = Bugzilla::Testopia::Product->new($category->product_id())->name(); - print "Created category '" . $category->name() . "': " . $category->description() . " for product " . $product_name . ".\n"; - } - } - - # Store new testplans. - foreach my $testplan ( @{$self->testplans} ) - { - my $plan_id = $testplan->store(); - $testplan->{'plan_id'} = $plan_id; - foreach my $asciitag ( @{$self->tags} ) - { - my $classtag = Bugzilla::Testopia::TestTag->new({'tag_name' => $asciitag}); - my $tagid = $classtag->store; - $testplan->{'tag_id'} = $tagid; - $testplan->add_tag($tagid); - } - foreach my $attachment ( @{$self->attachments} ) - { - $attachment->{'plan_id'} = $plan_id; - $attachment->store(); - } - print "Created Test Plan $plan_id: " . $testplan->name() . "\n"; - } - - # Store new testcases. - foreach my $testcase ( @{$self->testcases} ) - { - bless($testcase,"Bugzilla::Testopia::XmlTestCase"); - my $result = $testcase->store(@{$self->testplans}); - if ( $result ne "" ) - { - $self->error($result); - } - else - { - print "Created Test Case " . $testcase->testcase->id() . ": " . $testcase->testcase->summary() . "\n"; - } - } - - # Now that each testcase has been stored we loop though them again and create - # relationships like blocks or dependson. - foreach my $testcase ( @{$self->testcases} ) - { - $testcase->store_relationships(@{$self->testcases}); - } - } - - $twig->purge; + my $product_id = Bugzilla::Testopia::TestPlan::lookup_product_by_name($twig_testplan->field('product')); + if ( ! defined($product_id) ) + { + $self->error("Cannot find product '" . $twig_testplan->field('product') . "' in test plan '" . $twig_testplan->field('name') . "'."); + } + + my $name = entity_replace_xml($twig_testplan->field('name'),STRIP_BOTH) || undef; + $self->error("Found empty Test Plan name.") if ( ! defined($name) ); + $self->error("Length of Test Plan name '" . $name . "' must be " . Bugzilla::Testopia::TestPlan->NAME_MAX_LENGTH . " characters or less.") if ( defined($name) && ( length($name) > Bugzilla::Testopia::TestPlan->NAME_MAX_LENGTH ) ); + + $testplan = Bugzilla::Testopia::TestPlan->new({ + 'name' => $name, + 'product_id' => $product_id, + 'default_product_version' => entity_replace_xml($twig_testplan->field('productversion'),STRIP_BOTH), + 'type_id' => $plantype_ids{$twig_testplan->att('type')}, + 'text' => entity_replace_testopia($twig_testplan->field('document')), + 'author_id' => $author_id, + 'isactive' => entity_replace_xml($twig_testplan->field('archive'),STRIP_BOTH), + 'creation_date' => entity_replace_xml($twig_testplan->field('created'),STRIP_BOTH) + }); + push @{$self->testplans}, $testplan; + + my @tags = $twig_testplan->children('tag'); + foreach my $twig_tag (@tags) + { + push @{$self->tags}, entity_replace_xml($twig_tag->text(),STRIP_BOTH); + } + + my @attachments = $twig_testplan->children('attachment'); + foreach my $twig_attachments (@attachments) + { + my $submitter = $twig_attachments->field('submitter'); + # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed + # are 'id' and 'login'. + my $submitter_ref = Bugzilla::User::match($submitter, 1, 0); + my $submitter_id = -1; + if ( ! $submitter_ref->[0] ) + { + $self->error("Cannot find submitter '" . $submitter . "' in test plan '" . $twig_testplan->field('name') . "' attachment '" . $twig_attachments->field('description') . "'."); + } + else + { + my $submitter_user = $submitter_ref->[0]; + bless($submitter_user,"Bugzilla::User"); + $submitter_id = $submitter_user->id(); + } + my $attachment = Bugzilla::Testopia::Attachment->new({ + 'description' => entity_replace_xml($twig_attachments->field('description'),STRIP_BOTH), + 'filename' => entity_replace_xml($twig_attachments->field('filename'),STRIP_BOTH), + 'submitter_id' => $submitter_id, + 'mime_type' => entity_replace_xml($twig_attachments->field('mimetype'),STRIP_BOTH), + 'contents' => entity_replace_xml($twig_attachments->field('data'),STRIP_BOTH) + }); + push @{$self->attachments}, $attachment; + } + } + + my $testcase = Bugzilla::Testopia::TestCase->new({ 'name' => 'dummy' }); + my %priority_ids; + @temparray = @{$testcase->get_priority_list()}; + foreach my $arrayelement (@temparray) + { + my %temphash = %{$arrayelement}; + my $longname = $temphash{"name"}; + # The long name. "P1 - Urgent" + $priority_ids{$longname} = $temphash{"id"}; + # The short name. "P1" + my $shortname = $longname; + $shortname =~ s/ - .*//; + $priority_ids{$shortname} = $temphash{"id"} if ( $longname ne $shortname ); + } + foreach my $twig_testcase ($root->children('testcase')) + { + my $summary = entity_replace_xml($twig_testcase->field('summary'),STRIP_BOTH) || undef; + $self->error("Found empty Test Case summary.") if ( ! defined($summary) ); + $self->error("Length of summary '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->SUMMARY_MAX_LENGTH . " characters or less.") if ( defined($summary) && ( length($summary) > Bugzilla::Testopia::TestCase->SUMMARY_MAX_LENGTH ) ); + my $author = $twig_testcase->att('author'); + # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed + # are 'id' and 'login'. + my $author_ref = Bugzilla::User::match($author, 1, 0); + my $author_id = -1; + if ( ! $author_ref->[0] ) + { + $self->error("Cannot find author '" . $author . "' in test case '" . $summary . "'."); + } + else + { + my $author_user = $author_ref->[0]; + bless($author_user,"Bugzilla::User"); + $author_id = $author_user->id(); + } + my $tester = entity_replace_xml($twig_testcase->field('defaulttester'),STRIP_BOTH); + # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed + # are 'id' and 'login'. + my $tester_ref = Bugzilla::User::match($tester, 1, 0); + my $tester_id = -1; + if ( ! $tester_ref->[0] ) + { + $self->error("Cannot find default tester '" . $tester . "' in test case '" . $summary . "'."); + } + else + { + my $tester_user = $tester_ref->[0]; + bless($tester_user,"Bugzilla::User"); + $tester_id = $tester_user->id(); + } + my $status_id = Bugzilla::Testopia::TestCase::lookup_status_by_name($twig_testcase->att('status')); + $self->error("Cannot find status '" . $twig_testcase->att('status') . "' in test case '" . $summary . "'.") if ( ! defined($status_id) ); + + my $xml_testcase = new Bugzilla::Testopia::XmlTestCase; + $xml_testcase->blocks(Bugzilla::Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS)); + $xml_testcase->dependson(Bugzilla::Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS)); + $xml_testcase->testplan(Bugzilla::Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS)); + push @{$self->testcases}, $xml_testcase; + my $alias = entity_replace_xml($twig_testcase->field('alias'),STRIP_BOTH) || undef; + $self->error("Length of alias '" . $alias . "' in test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->ALIAS_MAX_LENGTH . " characters or less.") if ( defined($alias) && ( length($alias) > Bugzilla::Testopia::TestCase->ALIAS_MAX_LENGTH ) ); + my $requirement = entity_replace_xml($twig_testcase->field('requirement'),STRIP_BOTH) || undef; + $self->error("Length of requirement '" . $requirement . "' in test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->REQUIREMENT_MAX_LENGTH . " characters or less.") if ( defined($requirement) && ( length($requirement) > Bugzilla::Testopia::TestCase->REQUIREMENT_MAX_LENGTH ) ); + + $xml_testcase->testcase(Bugzilla::Testopia::TestCase->new({ + 'action' => entity_replace_testopia($twig_testcase->field('action')), + 'alias' => $alias, + 'arguments' => entity_replace_xml($twig_testcase->field('arguments'),STRIP_NONE), + 'author_id' => $author_id, + 'blocks' => undef, + 'breakdown' => entity_replace_testopia($twig_testcase->field('breakdown')), + 'case_status_id' => $status_id, + 'category_id' => undef, + 'default_tester_id' => $tester_id, + 'dependson' => undef, + 'effect' => entity_replace_testopia($twig_testcase->field('expectedresults')), + 'isautomated' => ( uc $twig_testcase->att('automated') ) eq AUTOMATIC, + 'plans' => undef, + 'priority_id' => $priority_ids{$twig_testcase->att('priority')}, + 'requirement' => $requirement, + 'setup' => entity_replace_testopia($twig_testcase->field('setup')), + 'script' => entity_replace_xml($twig_testcase->field('script'),STRIP_NONE), + 'summary' => $summary, + })); + foreach my $twig_testplan_reference ( $twig_testcase->children(TESTPLAN_REFERENCE) ) + { + my $testplan_reference = $twig_testplan_reference->children_text(PCDATA); + if ( $testplan_reference eq "" ) + { + $self->error("No test plan included for type '" + . $twig_testplan_reference->att('type') + . "' in test case '" . $twig_testcase->field('summary') . "'." ); + } + elsif ( length($testplan_reference) > Bugzilla::Testopia::TestPlan->NAME_MAX_LENGTH ) + { + $self->error("Length of Test Plan name '" . $testplan_reference . "' for test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->REQUIREMENT_MAX_LENGTH . " characters or less."); + } + elsif ( ! $xml_testcase->testplan->add($twig_testplan_reference->att('type'),entity_replace_xml($testplan_reference,STRIP_BOTH)) ) + { + $self->error("Do not know how to handle test plan of type '" + . $twig_testplan_reference->att('type') + . "' in test case '" . $twig_testcase->field('summary') . "'." + . "\nKnown types are: (" . uc XMLREFERENCES_FIELDS . ")."); + } + } + # Keep track of this testcase's alias. Used during verification to insure aliases are unique. + $self->testcase_aliases(entity_replace_xml($twig_testcase->field('summary'),STRIP_BOTH),$alias) if ( defined $alias ); + # Keep track of this testcase's category. To create a category at this time would require + # getting the product from the Test Plan that this Test Case is associated with. The category + # will created when each Test Case is stored. + my $categoryname = entity_replace_xml($twig_testcase->field('categoryname'),STRIP_BOTH); + if ( $categoryname ne "" ) + { + $xml_testcase->category($categoryname); + } + else + { + $self->error("Empty category name for test case '" . $summary . "'."); + } + + my @attachments = $twig_testcase->children('attachment'); + foreach my $twig_attachments (@attachments) + { + my $submitter = $twig_attachments->field('submitter'); + # Bugzilla::User::match returns a array with a user hash. Fields of the hash needed + # are 'id' and 'login'. + my $submitter_ref = Bugzilla::User::match($submitter, 1, 0); + my $submitter_id = -1; + if ( ! $submitter_ref->[0] ) + { + $self->error("Cannot find submitter '" . $submitter . "' in test case '" . $twig_testcase->field('summary') . "' attachment '" . $twig_attachments->field('description') . "'."); + } + else + { + my $submitter_user = $submitter_ref->[0]; + bless($submitter_user,"Bugzilla::User"); + $submitter_id = $submitter_user->id(); + } + my $attachment = Bugzilla::Testopia::Attachment->new({ + 'description' => entity_replace_xml($twig_attachments->field('description'),STRIP_BOTH), + 'filename' => entity_replace_xml($twig_attachments->field('filename'),STRIP_BOTH), + 'submitter_id' => $submitter_id, + 'mime_type' => entity_replace_xml($twig_attachments->field('mimetype'),STRIP_BOTH), + 'contents' => entity_replace_xml($twig_attachments->field('data'),STRIP_BOTH) + }); + $xml_testcase->add_attachment($attachment); + } + + my @tags = $twig_testcase->children('tag'); + foreach my $twig_tag ( @tags ) + { + my $tag = entity_replace_xml($twig_tag->text(),STRIP_BOTH); + $self->error("Length of tag '" . $tag . "' in test case '" . $summary . "' must be " . Bugzilla::Testopia::TestCase->TAG_MAX_LENGTH . " characters or less.") if ( defined($tag) && ( length($tag) > Bugzilla::Testopia::TestCase->TAG_MAX_LENGTH ) ); + $xml_testcase->add_tag($tag); + } + + my @components = $twig_testcase->children('component'); + foreach my $twig_component ( @components ) + { + my $results = $xml_testcase->add_component(entity_replace_xml($twig_component->children_text(PCDATA),STRIP_BOTH),$twig_component->att('product')); + $self->error($results) if ( $results ne "" ); + } + + foreach my $twig_blocks ( $twig_testcase->children(BLOCKS) ) + { + if ( ! $xml_testcase->blocks->add($twig_blocks->att('type'),entity_replace_xml($twig_blocks->children_text(PCDATA),STRIP_BOTH)) ) + { + $self->error("Do not know how to handle a blocking test case of type '" . $twig_blocks->att('type') . "' in test case '" . $xml_testcase->testcase->summary() . "'.") + } + } + + foreach my $twig_dependson ( $twig_testcase->children(DEPENDSON) ) + { + if ( ! $xml_testcase->dependson->add($twig_dependson->att('type'),entity_replace_xml($twig_dependson->children_text(PCDATA),STRIP_BOTH)) ) + { + $self->error("Do not know how to handle dependency of type '" . $twig_dependson->att('type') . "' in test case '" . entity_replace_xml($xml_testcase->testcase->summary(),STRIP_BOTH) . "'.") + } + } + } + + # + # Start of data integrity check. + # + # Run through the Test Plans and Test Cases looking for integrity errors. + # + + # Check for duplicate aliases. Loop though all testcases that have a alias. + my %used_alias; + my %duplicate_alias; + foreach my $summary ( keys %{$self->testcase_aliases} ) + { + # Get the alias. + my $alias = $self->testcase_aliases($summary); + # Is the alias used by a testcase in the database already? If so add it to the duplicate list + # and move onto next testcase. + my $alias_testcase_id = Bugzilla::Testopia::TestCase::class_check_alias($alias); + if ( $alias_testcase_id ) + { + $duplicate_alias{$alias} = $alias_testcase_id; + next; + } + # Is the alias in the used_alias array? + if ( defined( $used_alias{$alias} ) ) + { + # If so then another testcase being created also used the alias. Add the alias to the + # duplicate list. + $duplicate_alias{$alias} = "import"; + } + else + { + # Alias has not been seen yet. Add it to the used_alias list to keep track of it. + $used_alias{$alias} = ""; + } + } + # The @duplicate_alias list contains aliases used by more that one test case. Display them and set + # error condition + foreach my $summary ( keys %{$self->testcase_aliases} ) + { + my $alias = $self->testcase_aliases($summary); + if ( exists $duplicate_alias{$alias} ) + { + my $error_message = "Test Case '" . $summary . "' has a non-unique alias '" . $alias . "'."; + if ( $duplicate_alias{$alias} ne "import" ) + { + $error_message .= " Test Case " . $duplicate_alias{$alias} . " already uses the alias '" . $alias . "'."; + } + else + { + $error_message .= " Additional test cases being imported are using the alias '" . $alias . "'."; + } + $self->error($error_message); + } + } + + # + # Start of data store. + # + # No data has been written prior to this point. If parse_error has not been set the XML is valid + # and no integrity errors were found. It's time to start storing the Test Plans and Test Cases. + # + + if ( ! defined $self->parse_error ) + { + # Store new categories. + foreach my $category ( @{$self->categories} ) + { + # Make sure category still does not exist. We don't check for uniqueness above so + # the same category could be defined multiple times. + if ( ! $category->check_name($category->name()) ) + { + $category->store(); + my $product_name = Bugzilla::Testopia::Product->new($category->product_id())->name(); + print "Created category '" . $category->name() . "': " . $category->description() . " for product " . $product_name . ".\n"; + } + } + + # Store new testplans. + foreach my $testplan ( @{$self->testplans} ) + { + my $plan_id = $testplan->store(); + $testplan->{'plan_id'} = $plan_id; + foreach my $asciitag ( @{$self->tags} ) + { + my $classtag = Bugzilla::Testopia::TestTag->new({'tag_name' => $asciitag}); + my $tagid = $classtag->store; + $testplan->{'tag_id'} = $tagid; + $testplan->add_tag($tagid); + } + foreach my $attachment ( @{$self->attachments} ) + { + $attachment->{'plan_id'} = $plan_id; + $attachment->store(); + } + print "Created Test Plan $plan_id: " . $testplan->name() . "\n"; + } + + # Store new testcases. + foreach my $testcase ( @{$self->testcases} ) + { + bless($testcase,"Bugzilla::Testopia::XmlTestCase"); + my $result = $testcase->store(@{$self->testplans}); + if ( $result ne "" ) + { + $self->error($result); + } + else + { + print "Created Test Case " . $testcase->testcase->id() . ": " . $testcase->testcase->summary() . "\n"; + } + } + + # Now that each testcase has been stored we loop though them again and create + # relationships like blocks or dependson. + foreach my $testcase ( @{$self->testcases} ) + { + $testcase->store_relationships(@{$self->testcases}); + } + } + + $twig->purge; } =head1 SEE ALSO diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/XmlReferences.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/XmlReferences.pm index 006eee6272a..94ece3ed1cc 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/XmlReferences.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/XmlReferences.pm @@ -40,7 +40,7 @@ package Bugzilla::Testopia::XmlReferences; use constant IGNORECASE => "ignorecase"; -#use strict; +use strict; sub new { @@ -49,10 +49,10 @@ sub new my $class = ref($invocant) || $invocant; my $self = {}; bless($self, $class); - $self{IGNORECASE} = $ignorecase; + $self->{IGNORECASE} = $ignorecase; for my $field ( split(/ /, $fields) ) { - $field = uc $field if ( $self{IGNORECASE} ); + $field = uc $field if ( $self->{IGNORECASE} ); $self->{$field} = []; } return $self; @@ -62,7 +62,7 @@ sub add { my ($self, $type, $object) = @_; - $type = uc $type if ( $self{IGNORECASE} ); + $type = uc $type if ( $self->{IGNORECASE} ); return 0 if ( ! exists $self->{$type} ); @@ -74,7 +74,7 @@ sub display my ($self) = @_; print "display() self=" . $self . "\n"; - foreach $key (keys %$self) + foreach my $key (keys %$self) { if ( defined $self->{$key} ) { @@ -91,7 +91,7 @@ sub get { my ($self, $type) = @_; - $type = uc $type if ( $self{IGNORECASE} ); + $type = uc $type if ( $self->{IGNORECASE} ); return 0 if ( ! exists $self->{$type} ); diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/XmlTestCase.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/XmlTestCase.pm index 81dc42f8151..c1c1ff3c12e 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/XmlTestCase.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/XmlTestCase.pm @@ -62,31 +62,31 @@ use Class::Struct; # struct ( - 'Bugzilla::Testopia::XmlTestCase', - { - attachments => '@', - blocks => 'Bugzilla::Testopia::XmlReferences', - category => '$', - component_ids => '@', - dependson => 'Bugzilla::Testopia::XmlReferences', - tags => '@', - testcase => 'Bugzilla::Testopia::TestCase', - testplan => 'Bugzilla::Testopia::XmlReferences', - } + 'Bugzilla::Testopia::XmlTestCase', + { + attachments => '@', + blocks => 'Bugzilla::Testopia::XmlReferences', + category => '$', + component_ids => '@', + dependson => 'Bugzilla::Testopia::XmlReferences', + tags => '@', + testcase => 'Bugzilla::Testopia::TestCase', + testplan => 'Bugzilla::Testopia::XmlReferences', + } ); sub add_attachment() { - my ($self,$tag) = @_; - - push @{$self->attachments}, $tag; + my ($self,$tag) = @_; + + push @{$self->attachments}, $tag; } sub add_tag() { - my ($self,$tag) = @_; - - push @{$self->tags}, $tag; + my ($self,$tag) = @_; + + push @{$self->tags}, $tag; } =head2 get_available_products @@ -109,155 +109,155 @@ sub get_available_products { sub add_component() { - my ($self,$component,$component_product) = @_; - my $component_id = ""; - my $product_id = ""; - - return "Component $component needs to provide a product." if ( $component_product eq "" ); - - # Find the product identifier. - my $products_ref = get_available_products(); - foreach my $product (@$products_ref) - { - if ( $component_product eq $product->{name} ) - { - $product_id = $product->{id}; - last; - } - } - return "Cannot find product $component_product for component $component." if ( $product_id eq "" ); - - # Find the component identifier for the product's componet - my $product = Bugzilla::Testopia::Product->new($product_id); - my $components_ref = $product->components; - foreach my $product_component ( @$components_ref ) - { - if ( $component eq $product_component->name ) - { - $component_id = $product_component->id; - last; - } - } - return "Product $component_product does not have a component named $component." if ( $component_id eq "" ); - - # Save the component identifier for this Test Case. - push @{$self->component_ids}, $component_id; - - return ""; + my ($self,$component,$component_product) = @_; + my $component_id = ""; + my $product_id = ""; + + return "Component $component needs to provide a product." if ( $component_product eq "" ); + + # Find the product identifier. + my $products_ref = get_available_products(); + foreach my $product (@$products_ref) + { + if ( $component_product eq $product->{name} ) + { + $product_id = $product->{id}; + last; + } + } + return "Cannot find product $component_product for component $component." if ( $product_id eq "" ); + + # Find the component identifier for the product's componet + my $product = Bugzilla::Testopia::Product->new($product_id); + my $components_ref = $product->components; + foreach my $product_component ( @$components_ref ) + { + if ( $component eq $product_component->name ) + { + $component_id = $product_component->id; + last; + } + } + return "Product $component_product does not have a component named $component." if ( $component_id eq "" ); + + # Save the component identifier for this Test Case. + push @{$self->component_ids}, $component_id; + + return ""; } sub debug_display() -{ - my ($self) = @_; - my $display_variable = ""; +{ + my ($self) = @_; + my $display_variable = ""; my %text = %{$self->testcase->text()} if ( defined $self->testcase->text() ); - print STDERR "Testcase: " . $self->testcase->summary() . "\n"; - my $testcase_id = "null"; - $testcase_id = $self->testcase->id() if ( $self->testcase->id() ); - print STDERR " ID " . $testcase_id . "\n"; - print STDERR " Action\n"; - if ( defined $text{'action'} ) - { - my @results = split(/\n/,$text{'action'}); - foreach my $result (@results) - { - print STDERR " $result\n"; - } - } - my $alias = "null"; - $alias = $self->testcase-alias() if ( $self->testcase->alias() ); - print STDERR " Alias " . $alias . "\n"; - my %author = %{$self->testcase->author()}; - my $author_id = $author{"id"}; - my $author_login = $author{"login"}; - print STDERR " Author " . $author_login . " (id=" . $author_id . ", hash=" . $self->testcase->author() . ")\n"; - print STDERR " Blocks " . $self->blocks->display() . "\n"; - print STDERR " Category " . $self->category . "\n"; - print STDERR " Depends On " . $self->dependson->display() . "\n"; - print STDERR " Expected Results\n"; - if ( defined $text{'effect'} ) - { - my @results = split(/\n/,$text{'effect'}); - foreach my $result (@results) - { - print STDERR " $result\n"; - } - } - print STDERR " Summary " . $self->testcase->summary() . "\n"; - #TODO:print STDERR " Default Product Version " . $self->testcase->product_version() . "\n"; - #TODO:print STDERR " Document " . $self->testcase->text() . "\n"; - my %tester = %{$self->testcase->default_tester()}; - my $tester_id = $tester{"id"}; - my $tester_login = $tester{"login"}; - print STDERR " Tester " . $tester_login . " (id=" . $tester_id . ", hash=" . $self->testcase->default_tester() . ")\n"; - print STDERR " Is Automated " . $self->testcase->isautomated() . "\n"; - #TODO:print STDERR " Plans " . $self->testcase->plans() . "\n"; - #TODO:print STDERR " Priority " . $self->testcase->priority_id() . "\n"; - #TODO:print STDERR " Product " . $self->testcase->product_id() . "\n"; - print STDERR " Requirement " . $self->testcase->requirement() . "\n"; + print STDERR "Testcase: " . $self->testcase->summary() . "\n"; + my $testcase_id = "null"; + $testcase_id = $self->testcase->id() if ( $self->testcase->id() ); + print STDERR " ID " . $testcase_id . "\n"; + print STDERR " Action\n"; + if ( defined $text{'action'} ) + { + my @results = split(/\n/,$text{'action'}); + foreach my $result (@results) + { + print STDERR " $result\n"; + } + } + my $alias = "null"; + $alias = $self->testcase-alias() if ( $self->testcase->alias() ); + print STDERR " Alias " . $alias . "\n"; + my %author = %{$self->testcase->author()}; + my $author_id = $author{"id"}; + my $author_login = $author{"login"}; + print STDERR " Author " . $author_login . " (id=" . $author_id . ", hash=" . $self->testcase->author() . ")\n"; + print STDERR " Blocks " . $self->blocks->display() . "\n"; + print STDERR " Category " . $self->category . "\n"; + print STDERR " Depends On " . $self->dependson->display() . "\n"; + print STDERR " Expected Results\n"; + if ( defined $text{'effect'} ) + { + my @results = split(/\n/,$text{'effect'}); + foreach my $result (@results) + { + print STDERR " $result\n"; + } + } + print STDERR " Summary " . $self->testcase->summary() . "\n"; + #TODO:print STDERR " Default Product Version " . $self->testcase->product_version() . "\n"; + #TODO:print STDERR " Document " . $self->testcase->text() . "\n"; + my %tester = %{$self->testcase->default_tester()}; + my $tester_id = $tester{"id"}; + my $tester_login = $tester{"login"}; + print STDERR " Tester " . $tester_login . " (id=" . $tester_id . ", hash=" . $self->testcase->default_tester() . ")\n"; + print STDERR " Is Automated " . $self->testcase->isautomated() . "\n"; + #TODO:print STDERR " Plans " . $self->testcase->plans() . "\n"; + #TODO:print STDERR " Priority " . $self->testcase->priority_id() . "\n"; + #TODO:print STDERR " Product " . $self->testcase->product_id() . "\n"; + print STDERR " Requirement " . $self->testcase->requirement() . "\n"; - print STDERR " Script " . $self->testcase->script() . "\n"; - print STDERR " Script Arguments " . $self->testcase->arguments() . "\n"; - print STDERR " Status " . $self->testcase->status() . "\n"; - - foreach my $tag (@{$self->tags}) - { - print STDERR " Tag " . $tag . "\n"; - } - - my @attachments = @{$self->testcase->attachments()}; - foreach my $attachment (@attachments) - { - my %submitter = %{$self->testcase->submitter()}; - $author_login = $author{"login"}; - print STDERR " Attachment " . $attachment->description() . "\n"; - print STDERR " Filename " . $attachment->filename() . "\n"; - print STDERR " Mime Type " . $attachment->mime_type(). "\n"; - print STDERR " Submitter " . $author_login . "\n"; - } + print STDERR " Script " . $self->testcase->script() . "\n"; + print STDERR " Script Arguments " . $self->testcase->arguments() . "\n"; + print STDERR " Status " . $self->testcase->status() . "\n"; + + foreach my $tag (@{$self->tags}) + { + print STDERR " Tag " . $tag . "\n"; + } + + my @attachments = @{$self->testcase->attachments()}; + foreach my $attachment (@attachments) + { + my %submitter = %{$self->testcase->submitter()}; + $author_login = $author{"login"}; + print STDERR " Attachment " . $attachment->description() . "\n"; + print STDERR " Filename " . $attachment->filename() . "\n"; + print STDERR " Mime Type " . $attachment->mime_type(). "\n"; + print STDERR " Submitter " . $author_login . "\n"; + } } sub get_testcase_ids() { - my ($self, $field, @new_testcases) = @_; - my $error_message = ""; - - my @testcase_id = @{$self->$field->get(uc $Bugzilla::Testopia::Xml::DATABASE_ID)}; - - foreach my $testcase_summary ( @{$self->$field->get(uc $Bugzilla::Testopia::Xml::XML_DESCRIPTION)} ) - { - foreach my $testcase (@new_testcases) - { - push @testcase_id, $testcase->testcase->id() if ( $testcase->testcase->summary() eq $testcase_summary ); - } - } - - #TODO Testplans using Database_Description - foreach my $testcase_summary ( @{$self->$field->get(uc $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION)} ) - { - $error_message .= "\n" if ( $error_message ne "" ); - $error_message .= "Have not implemented code for $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION lookup for blocking test case " . $testcase_summary . "' for Test Case '". $self->testcase->summary . "'."; - } - return $error_message if ( $error_message ne "" ); - - my @return_testcase_id; - foreach my $testcase_id (@testcase_id) - { - my $testcase = Bugzilla::Testopia::TestCase->new($testcase_id); - if ( ! defined($testcase) ) - { - $error_message .= "\n" if ( $error_message ne "" ); - $error_message .= "Could not find blocking Test Case '" . $testcase_id . "' for Test Case '". $self->testcase->summary . "'."; - } - else - { - push @return_testcase_id, $testcase->id(); - } - } - return $error_message if ( $error_message ne "" ); - - return @return_testcase_id; + my ($self, $field, @new_testcases) = @_; + my $error_message = ""; + + my @testcase_id = @{$self->$field->get(uc $Bugzilla::Testopia::Xml::DATABASE_ID)}; + + foreach my $testcase_summary ( @{$self->$field->get(uc $Bugzilla::Testopia::Xml::XML_DESCRIPTION)} ) + { + foreach my $testcase (@new_testcases) + { + push @testcase_id, $testcase->testcase->id() if ( $testcase->testcase->summary() eq $testcase_summary ); + } + } + + #TODO Testplans using Database_Description + foreach my $testcase_summary ( @{$self->$field->get(uc $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION)} ) + { + $error_message .= "\n" if ( $error_message ne "" ); + $error_message .= "Have not implemented code for $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION lookup for blocking test case " . $testcase_summary . "' for Test Case '". $self->testcase->summary . "'."; + } + return $error_message if ( $error_message ne "" ); + + my @return_testcase_id; + foreach my $testcase_id (@testcase_id) + { + my $testcase = Bugzilla::Testopia::TestCase->new($testcase_id); + if ( ! defined($testcase) ) + { + $error_message .= "\n" if ( $error_message ne "" ); + $error_message .= "Could not find blocking Test Case '" . $testcase_id . "' for Test Case '". $self->testcase->summary . "'."; + } + else + { + push @return_testcase_id, $testcase->id(); + } + } + return $error_message if ( $error_message ne "" ); + + return @return_testcase_id; } =head2 store @@ -270,94 +270,94 @@ attachments and categories. sub store() { - my ($self, @new_testplans) = @_; - my $error_message = ""; - my @testplan_id = @{$self->testplan->get(uc $Bugzilla::Testopia::Xml::DATABASE_ID)}; - - # If we have any references to test plans from the XML data we need to search the @new_testplans - # array to find the actual test plan id. The new_testplans array contains all test plans created - # from the XML. - # Order of looping does not matter, number of test plans associated to each test case should be small. - foreach my $testplan_name ( @{$self->testplan->get(uc $Bugzilla::Testopia::Xml::XML_DESCRIPTION)} ) - { - foreach my $testplan (@new_testplans) - { - push @testplan_id, $testplan->id() if ( $testplan->name() eq $testplan_name ); - } - } - - #TODO Testplans using Database_Description - foreach my $testplan_name ( @{$self->testplan->get(uc $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION)} ) - { - $error_message .= "\n" if ( $error_message ne "" ); - $error_message .= "Have not implemented code for $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION lookup of test plan " . $testplan_name . "' for Test Case '". $self->testcase->summary . "'."; - } - return $error_message if ( $error_message ne "" ); - - # Have to have a testplan to determine valid categories for testcase. - return "Test Case '" . $self->testcase->summary . "' needs a Test Plan." if ( $#testplan_id == -1 ); - - # Verify that each testplan exists. - my @testplan; - foreach my $testplan_id (@testplan_id) - { - my $testplan = Bugzilla::Testopia::TestPlan->new($testplan_id); - if ( ! defined($testplan) ) - { - $error_message .= "\n" if ( $error_message ne "" ); - $error_message .= "Could not find Test Plan '" . $testplan_id . "' for Test Case '". $self->testcase->summary . "'."; - } - else - { - push @testplan, $testplan; - } - } - return $error_message if ( $error_message ne "" ); - - # Verify that each testplan has the testcase's category associated to it. If the category does not - # exist it will be created. - foreach my $testplan (@testplan) - { - my $category = $testplan->product->categories->[0]; - my $categoryid = $category->check_name($self->category) if ( defined($category) ); - if ( ! defined($categoryid) ) - { - my $new_category = Bugzilla::Testopia::Category->new({ - product_id => $testplan->product_id, - name => $self->category, - description => "FIX ME. Created during Test Plan import." - }); - $categoryid = $new_category->store(); - } - $self->testcase->{'category_id'} = $categoryid if ( ! defined($self->testcase->{'category_id'}) ); + my ($self, @new_testplans) = @_; + my $error_message = ""; + my @testplan_id = @{$self->testplan->get(uc $Bugzilla::Testopia::Xml::DATABASE_ID)}; + + # If we have any references to test plans from the XML data we need to search the @new_testplans + # array to find the actual test plan id. The new_testplans array contains all test plans created + # from the XML. + # Order of looping does not matter, number of test plans associated to each test case should be small. + foreach my $testplan_name ( @{$self->testplan->get(uc $Bugzilla::Testopia::Xml::XML_DESCRIPTION)} ) + { + foreach my $testplan (@new_testplans) + { + push @testplan_id, $testplan->id() if ( $testplan->name() eq $testplan_name ); + } } - my $case_id = $self->testcase->store(); - $self->testcase->{'case_id'} = $case_id; - foreach my $attachment ( @{$self->attachments} ) - { - $attachment->{'case_id'} = $case_id; - $attachment->store(); - } - foreach my $asciitag ( @{$self->tags} ) - { - my $classtag = Bugzilla::Testopia::TestTag->new({'tag_name' => $asciitag}); - my $tagid = $classtag->store; - $self->testcase->add_tag($tagid); - } - - # Link the testcase to each of it's testplans. - foreach my $testplan ( @testplan ) - { - $self->testcase->link_plan($testplan->id(),$case_id) - } - - # Code below requires the testplans to be linked into testcases before being run. - foreach my $component_id ( @{$self->component_ids} ) - { - $self->testcase->add_component($component_id); - } - - return $error_message; + + #TODO Testplans using Database_Description + foreach my $testplan_name ( @{$self->testplan->get(uc $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION)} ) + { + $error_message .= "\n" if ( $error_message ne "" ); + $error_message .= "Have not implemented code for $Bugzilla::Testopia::Xml::DATABASE_DESCRIPTION lookup of test plan " . $testplan_name . "' for Test Case '". $self->testcase->summary . "'."; + } + return $error_message if ( $error_message ne "" ); + + # Have to have a testplan to determine valid categories for testcase. + return "Test Case '" . $self->testcase->summary . "' needs a Test Plan." if ( $#testplan_id == -1 ); + + # Verify that each testplan exists. + my @testplan; + foreach my $testplan_id (@testplan_id) + { + my $testplan = Bugzilla::Testopia::TestPlan->new($testplan_id); + if ( ! defined($testplan) ) + { + $error_message .= "\n" if ( $error_message ne "" ); + $error_message .= "Could not find Test Plan '" . $testplan_id . "' for Test Case '". $self->testcase->summary . "'."; + } + else + { + push @testplan, $testplan; + } + } + return $error_message if ( $error_message ne "" ); + + # Verify that each testplan has the testcase's category associated to it. If the category does not + # exist it will be created. + foreach my $testplan (@testplan) + { + my $category = $testplan->product->categories->[0]; + my $categoryid = $category->check_name($self->category) if ( defined($category) ); + if ( ! defined($categoryid) ) + { + my $new_category = Bugzilla::Testopia::Category->new({ + product_id => $testplan->product_id, + name => $self->category, + description => "FIX ME. Created during Test Plan import." + }); + $categoryid = $new_category->store(); + } + $self->testcase->{'category_id'} = $categoryid if ( ! defined($self->testcase->{'category_id'}) ); + } + my $case_id = $self->testcase->store(); + $self->testcase->{'case_id'} = $case_id; + foreach my $attachment ( @{$self->attachments} ) + { + $attachment->{'case_id'} = $case_id; + $attachment->store(); + } + foreach my $asciitag ( @{$self->tags} ) + { + my $classtag = Bugzilla::Testopia::TestTag->new({'tag_name' => $asciitag}); + my $tagid = $classtag->store; + $self->testcase->add_tag($tagid); + } + + # Link the testcase to each of it's testplans. + foreach my $testplan ( @testplan ) + { + $self->testcase->link_plan($testplan->id(),$case_id) + } + + # Code below requires the testplans to be linked into testcases before being run. + foreach my $component_id ( @{$self->component_ids} ) + { + $self->testcase->add_component($component_id); + } + + return $error_message; } =head2 store_relationships @@ -371,39 +371,39 @@ been stored. sub store_relationships() { - my ($self, @new_testcases) = @_; + my ($self, @new_testcases) = @_; - # Hashes are used because the entires in blocks and dependson must be unique. - my %blocks = (); - foreach my $block ( $self->get_testcase_ids("blocks",@new_testcases) ) - { - $blocks{$block}++; - } - my $blocks_size = keys( %blocks ); - my %dependson = (); - foreach my $dependson ( $self->get_testcase_ids("dependson",@new_testcases) ) - { - $dependson{$dependson}++; - } - my $dependson_size = keys( %dependson ); - + # Hashes are used because the entires in blocks and dependson must be unique. + my %blocks = (); + foreach my $block ( $self->get_testcase_ids("blocks",@new_testcases) ) + { + $blocks{$block}++; + } + my $blocks_size = keys( %blocks ); + my %dependson = (); + foreach my $dependson ( $self->get_testcase_ids("dependson",@new_testcases) ) + { + $dependson{$dependson}++; + } + my $dependson_size = keys( %dependson ); + - if ( ( $blocks_size > 0 ) || ( $dependson_size > 0 ) ) - { - # Need to add the current blocks and dependson from the Test Case; otherwise, they will - # be removed. - foreach my $block ( split(/ /,$self->testcase->blocked_list_uncached()) ) - { - $blocks{$block}++; - } - foreach my $dependson ( split(/ /,$self->testcase->dependson_list_uncached()) ) - { - $dependson{$dependson}++; - } - my @blocks = keys(%blocks); - my @dependson = keys(%dependson); - $self->testcase->update_deps( join(' ',@dependson ),join(' ',@blocks) ); - } + if ( ( $blocks_size > 0 ) || ( $dependson_size > 0 ) ) + { + # Need to add the current blocks and dependson from the Test Case; otherwise, they will + # be removed. + foreach my $block ( split(/ /,$self->testcase->blocked_list_uncached()) ) + { + $blocks{$block}++; + } + foreach my $dependson ( split(/ /,$self->testcase->dependson_list_uncached()) ) + { + $dependson{$dependson}++; + } + my @blocks = keys(%blocks); + my @dependson = keys(%dependson); + $self->testcase->update_deps( join(' ',@dependson ),join(' ',@blocks) ); + } } 1; diff --git a/mozilla/webtools/testopia/Bugzilla/WebService.pm b/mozilla/webtools/testopia/Bugzilla/WebService.pm index c7a9c9d9fc3..a5348d071f2 100644 --- a/mozilla/webtools/testopia/Bugzilla/WebService.pm +++ b/mozilla/webtools/testopia/Bugzilla/WebService.pm @@ -100,7 +100,7 @@ sub make_fault { my $self = shift; - # RPC Fault Code must be an integer + # RPC Fault Code must be an integer $self->SUPER::make_fault(ERROR_FAULT_SERVER, $_[1]); } diff --git a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm index e9f66fd82c6..3c139a0a13a 100644 --- a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm +++ b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm @@ -30,15 +30,15 @@ sub get $self->login; - #Result is a test plan hash map + #Result is a test plan hash map my $build = new Bugzilla::Testopia::Build($build_id); - if (not defined $build) - { - $self->logout; + if (not defined $build) + { + $self->logout; die "Build, " . $build_id . ", not found"; - } - + } + $self->logout; return $build; @@ -46,45 +46,45 @@ sub get sub create { - my $self = shift; - my ($new_values) = @_; # Required: name, product_id + my $self = shift; + my ($new_values) = @_; # Required: name, product_id $self->login; - my $build = new Bugzilla::Testopia::Build($new_values); - - my $name = $$new_values{name}; - + my $build = new Bugzilla::Testopia::Build($new_values); + + my $name = $$new_values{name}; + if (defined($name) && $build->check_name($name)) { die "Build name, " . $name . ", already exists"; } - my $result = $build->store(); - - $self->logout; - - # Result is new build id - return $result; + my $result = $build->store(); + + $self->logout; + + # Result is new build id + return $result; } sub update { - my $self =shift; - my ($build_id, $new_values) = @_; # Modifiable: name, description, milestone + my $self =shift; + my ($build_id, $new_values) = @_; # Modifiable: name, description, milestone $self->login; - my $build = new Bugzilla::Testopia::Build($build_id); - - if (not defined $build) - { - $self->logout; + my $build = new Bugzilla::Testopia::Build($build_id); + + if (not defined $build) + { + $self->logout; die "Build, " . $build_id . ", not found"; - } - - my $name = $$new_values{name}; - + } + + my $name = $$new_values{name}; + if (defined($name) && $build->check_name($name)) { die "Build name, " . $name . ", already exists"; @@ -103,12 +103,12 @@ sub update $description, $milestone); - $build = new Bugzilla::Testopia::Build($build_id); - - $self->logout; + $build = new Bugzilla::Testopia::Build($build_id); + + $self->logout; - # Result is modified build, otherwise an exception will be thrown - return $build; + # Result is modified build, otherwise an exception will be thrown + return $build; } sub lookup_name_by_id diff --git a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm index 17396964bd6..d8f7e9c96f1 100644 --- a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm +++ b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm @@ -72,24 +72,24 @@ sub get_milestones my $product = new Bugzilla::Testopia::Product($product_id); - if (not defined $product) - { - $self->logout; + if (not defined $product) + { + $self->logout; die "Product, " . $product_id . ", not found"; - } - - if (not $product->canedit) - { - $self->logout; + } + + if (not $product->canedit) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $product->milestones; - $self->logout; - - # Result is list of milestones for the given product - return $result; + $self->logout; + + # Result is list of milestones for the given product + return $result; } #sub get_product diff --git a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCase.pm b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCase.pm index 5e798ad1733..e2552c05ee8 100644 --- a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCase.pm +++ b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCase.pm @@ -35,18 +35,18 @@ sub _list foreach (keys(%$query)) { - $cgi->param($_, $$query{$_}); + $cgi->param($_, $$query{$_}); } - + my $search = Bugzilla::Testopia::Search->new($cgi); - # Result is an array of test plan hash maps - return Bugzilla::Testopia::Table->new('case', - 'tr_xmlrpc.cgi', - $cgi, - undef, - $search->query() - )->list(); + # Result is an array of test plan hash maps + return Bugzilla::Testopia::Table->new('case', + 'tr_xmlrpc.cgi', + $cgi, + undef, + $search->query() + )->list(); } sub get @@ -58,21 +58,21 @@ sub get my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canview) - { - $self->logout; + } + + if (not $test_case->canview) + { + $self->logout; die "User Not Authorized"; - } + } $self->logout; - #Result is a test case hash map + #Result is a test case hash map return $test_case; } @@ -83,135 +83,135 @@ sub list $self->login; - my $list = _list($query); - + my $list = _list($query); + $self->logout; - return $list; + return $list; } sub create { - my $self =shift; - my ($new_values) = @_; - - if (not defined $$new_values{plan_id}) - { - die "Plan ID Number (plan_id) Required When Creating A TestCase" - } + my $self =shift; + my ($new_values) = @_; + + if (not defined $$new_values{plan_id}) + { + die "Plan ID Number (plan_id) Required When Creating A TestCase" + } # Plan id linked to new test case after store method is called - my $plan_id = $$new_values{plan_id}; + my $plan_id = $$new_values{plan_id}; - # Remove plan id from new_values hash - delete $$new_values{plan_id}; + # Remove plan id from new_values hash + delete $$new_values{plan_id}; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($new_values); - - # Result is test plan id - my $result = $test_case->store(); + my $test_case = new Bugzilla::Testopia::TestCase($new_values); + + # Result is test plan id + my $result = $test_case->store(); - $test_case->link_plan($plan_id, $result); - - $self->logout; + $test_case->link_plan($plan_id, $result); + + $self->logout; - return $result + return $result } sub update { - my $self =shift; - my ($test_case_id, $new_values) = @_; + my $self =shift; + my ($test_case_id, $new_values) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } + } - if (not $test_case->canedit) - { - $self->logout; + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } + } - if (defined $$new_values{author_id}) - { - die "Update of TestCase's author_id is not allowed"; - } + if (defined $$new_values{author_id}) + { + die "Update of TestCase's author_id is not allowed"; + } my $result = $test_case->update($new_values); - $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - $self->logout; - - # Result is modified test case on success, otherwise an exception will be thrown - return $test_case; + $self->logout; + + # Result is modified test case on success, otherwise an exception will be thrown + return $test_case; } sub get_text { - my $self =shift; - my ($test_case_id) = @_; + my $self =shift; + my ($test_case_id) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canview) - { - $self->logout; + } + + if (not $test_case->canview) + { + $self->logout; die "User Not Authorized"; - } + } - my $doc = $test_case->text(); + my $doc = $test_case->text(); - $self->logout; - - #Result is the latest test case doc hash map - return $doc; + $self->logout; + + #Result is the latest test case doc hash map + return $doc; } sub store_text { - my $self =shift; - my ($test_case_id, $author_id, $action, $effect, $setup, $breakdown) = @_; + my $self =shift; + my ($test_case_id, $author_id, $action, $effect, $setup, $breakdown) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canedit) - { - $self->logout; + } + + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } + } - my $version = $test_case->store_text($test_case_id, $author_id, $action, $effect, $setup, $breakdown); - - $self->logout; - - # Result is new test case doc version on success, otherwise an exception will be thrown - return $version; + my $version = $test_case->store_text($test_case_id, $author_id, $action, $effect, $setup, $breakdown); + + $self->logout; + + # Result is new test case doc version on success, otherwise an exception will be thrown + return $version; } sub get_plans @@ -223,24 +223,24 @@ sub get_plans my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canview) - { - $self->logout; + } + + if (not $test_case->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_case->plans(); - $self->logout; - - # Result is list of test plans for the given test case - return $result; + $self->logout; + + # Result is list of test plans for the given test case + return $result; } sub get_bugs @@ -252,137 +252,137 @@ sub get_bugs my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canview) - { - $self->logout; + } + + if (not $test_case->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_case->bugs; - $self->logout; - - # Result is list of bugs for the given test case - return $result; + $self->logout; + + # Result is list of bugs for the given test case + return $result; } sub add_component { - my $self =shift; - my ($test_case_id, $component_id) = @_; + my $self =shift; + my ($test_case_id, $component_id) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canedit) - { - $self->logout; + } + + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_case->add_component($component_id); - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return 0; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return 0; } sub remove_component { - my $self =shift; - my ($test_case_id, $component_id) = @_; + my $self =shift; + my ($test_case_id, $component_id) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canedit) - { - $self->logout; + } + + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_case->remove_component($component_id); - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return 0; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return 0; } sub get_components { - my $self =shift; - my ($test_case_id) = @_; + my $self =shift; + my ($test_case_id) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canview) - { - $self->logout; + } + + if (not $test_case->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_case->components(); - $self->logout; - - # Result list of components otherwise an exception will be thrown - return $result; + $self->logout; + + # Result list of components otherwise an exception will be thrown + return $result; } sub add_tag { - my $self =shift; - my ($test_case_id, $tag_name) = @_; + my $self =shift; + my ($test_case_id, $tag_name) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canedit) - { - $self->logout; + } + + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } - - #Create new tag or retrieve id of existing tag - my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name}); - my $tag_id = $test_tag->store; + } + + #Create new tag or retrieve id of existing tag + my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name}); + my $tag_id = $test_tag->store; my $result = $test_case->add_tag($tag_id); @@ -392,32 +392,32 @@ sub add_tag die "Tag, " . $tag_name . ", already exists for Testcase, " . $test_case_id; } - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return $result; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return $result; } sub remove_tag { - my $self =shift; - my ($test_case_id, $tag_name) = @_; + my $self =shift; + my ($test_case_id, $tag_name) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canedit) - { - $self->logout; + } + + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } + } my $test_tag = Bugzilla::Testopia::TestTag->check_name($tag_name); if (not defined $test_tag) @@ -428,59 +428,59 @@ sub remove_tag my $result = $test_case->remove_tag($test_tag->id); - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return 0; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return 0; } sub get_tags { - my $self =shift; - my ($test_case_id) = @_; + my $self =shift; + my ($test_case_id) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canview) - { - $self->logout; + } + + if (not $test_case->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_case->tags; - $self->logout; - - # Result list of tags otherwise an exception will be thrown - return $result; + $self->logout; + + # Result list of tags otherwise an exception will be thrown + return $result; } sub lookup_status_id_by_name { - my $self =shift; + my $self =shift; my ($name) = @_; $self->login; - my $result = Bugzilla::Testopia::TestCase::lookup_status_by_name($name); + my $result = Bugzilla::Testopia::TestCase::lookup_status_by_name($name); - $self->logout; + $self->logout; - # Result is test case status id for the given test case status name - return $result; + # Result is test case status id for the given test case status name + return $result; } sub lookup_status_name_by_id { - my $self =shift; + my $self =shift; my ($id) = @_; $self->login; @@ -489,35 +489,35 @@ sub lookup_status_name_by_id my $result = $test_case->lookup_status($id); - $self->logout; + $self->logout; if (!defined $result) { $result = 0; }; - - # Result is test case status name for the given test case status id - return $result; + + # Result is test case status name for the given test case status id + return $result; } sub lookup_category_id_by_name { - my $self =shift; + my $self =shift; my ($name) = @_; $self->login; - my $result = Bugzilla::Testopia::TestCase::lookup_category_by_name($name); + my $result = Bugzilla::Testopia::TestCase::lookup_category_by_name($name); - $self->logout; + $self->logout; - # Result is test case category id for the given test case category name - return $result; + # Result is test case category id for the given test case category name + return $result; } sub lookup_category_name_by_id { - my $self =shift; + my $self =shift; my ($id) = @_; $self->login; @@ -526,35 +526,35 @@ sub lookup_category_name_by_id my $result = $test_case->lookup_category($id); - $self->logout; + $self->logout; if (!defined $result) { $result = 0; }; - - # Result is test case category name for the given test case category id - return $result; + + # Result is test case category name for the given test case category id + return $result; } sub lookup_priority_id_by_name { - my $self =shift; + my $self =shift; my ($name) = @_; $self->login; - my $result = Bugzilla::Testopia::TestCase::lookup_priority_by_value($name); + my $result = Bugzilla::Testopia::TestCase::lookup_priority_by_value($name); - $self->logout; + $self->logout; - # Result is test case priority id for the given test case priority name - return $result; + # Result is test case priority id for the given test case priority name + return $result; } sub lookup_priority_name_by_id { - my $self =shift; + my $self =shift; my ($id) = @_; $self->login; @@ -563,83 +563,83 @@ sub lookup_priority_name_by_id my $result = $test_case->lookup_priority($id); - $self->logout; + $self->logout; if (!defined $result) { $result = 0; }; - - # Result is test case priority name for the given test case priority id - return $result; + + # Result is test case priority name for the given test case priority id + return $result; } sub link_plan { - my $self =shift; - my ($test_case_id, $test_plan_id) = @_; + my $self =shift; + my ($test_case_id, $test_plan_id) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canedit) - { - $self->logout; + } + + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } + } $test_case->link_plan($test_plan_id); my $result = $test_case->plans; - $self->logout; - - # Result is list of plans for test case on success, otherwise an exception will be thrown - return $result; + $self->logout; + + # Result is list of plans for test case on success, otherwise an exception will be thrown + return $result; } sub unlink_plan { - my $self =shift; - my ($test_case_id, $test_plan_id) = @_; + my $self =shift; + my ($test_case_id, $test_plan_id) = @_; $self->login; - my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); + my $test_case = new Bugzilla::Testopia::TestCase($test_case_id); - if (not defined $test_case) - { - $self->logout; + if (not defined $test_case) + { + $self->logout; die "Testcase, " . $test_case_id . ", not found"; - } - - if (not $test_case->canedit) - { - $self->logout; + } + + if (not $test_case->canedit) + { + $self->logout; die "User Not Authorized"; - } + } my $rtn_code = $test_case->unlink_plan($test_plan_id); if ($rtn_code == 0) { - $self->logout; + $self->logout; die "User Can Not Unlink Plan, " . $test_plan_id; } my $result = $test_case->plans; - $self->logout; - - # Result is list of plans for test case on success, otherwise an exception will be thrown - return $result; + $self->logout; + + # Result is list of plans for test case on success, otherwise an exception will be thrown + return $result; } diff --git a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCaseRun.pm b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCaseRun.pm index 81c43a6dbf9..30006d0afb7 100644 --- a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCaseRun.pm +++ b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestCaseRun.pm @@ -37,18 +37,18 @@ sub _list foreach (keys(%$query)) { - $cgi->param($_, $$query{$_}); + $cgi->param($_, $$query{$_}); } - + my $search = Bugzilla::Testopia::Search->new($cgi); - # Result is an array of test case run hash maps - return Bugzilla::Testopia::Table->new('case_run', - 'tr_xmlrpc.cgi', - $cgi, - undef, - $search->query() - )->list(); + # Result is an array of test case run hash maps + return Bugzilla::Testopia::Table->new('case_run', + 'tr_xmlrpc.cgi', + $cgi, + undef, + $search->query() + )->list(); } sub get @@ -61,17 +61,17 @@ sub get #Result is a test case run hash map my $test_case_run = new Bugzilla::Testopia::TestCaseRun($test_case_run_id); - if (not defined $test_case_run) - { - $self->logout; + if (not defined $test_case_run) + { + $self->logout; die "TestcaseRun, " . $test_case_run_id . ", not found"; - } - - if (not $test_case_run->canview) - { - $self->logout; + } + + if (not $test_case_run->canview) + { + $self->logout; die "User Not Authorized"; - } + } $self->logout; @@ -88,24 +88,24 @@ sub get_bugs my $test_case_run = new Bugzilla::Testopia::TestCaseRun($test_case_run_id); - if (not defined $test_case_run) - { - $self->logout; + if (not defined $test_case_run) + { + $self->logout; die "TestcaseRun, " . $test_case_run_id . ", not found"; - } - - if (not $test_case_run->canview) - { - $self->logout; + } + + if (not $test_case_run->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_case_run->bugs; - $self->logout; - - # Result is list of bugs for the given test case run - return $result; + $self->logout; + + # Result is list of bugs for the given test case run + return $result; } sub list @@ -115,34 +115,34 @@ sub list $self->login; - my $list = _list($query); - + my $list = _list($query); + $self->logout; - return $list; + return $list; } sub create { - my $self =shift; - my ($new_values) = @_; + my $self =shift; + my ($new_values) = @_; $self->login; - my $test_case_run = new Bugzilla::Testopia::TestCaseRun($new_values); - - my $result = $test_case_run->store(); - - $self->logout; + my $test_case_run = new Bugzilla::Testopia::TestCaseRun($new_values); + + my $result = $test_case_run->store(); + + $self->logout; - # Result is new test case run id - return $result; + # Result is new test case run id + return $result; } sub update { - my $self =shift; - my ($run_id, $case_id, $build_id, $environment_id, $new_values) = @_; + my $self =shift; + my ($run_id, $case_id, $build_id, $environment_id, $new_values) = @_; $self->login; @@ -152,21 +152,21 @@ sub update $environment_id ); - if (not defined $test_case_run) - { - $self->logout; + if (not defined $test_case_run) + { + $self->logout; die "TestCaseRun for build_id = " . $build_id . ", case_id = " . $case_id . ", environment_id = " . $environment_id . ", run_id = " . $run_id . ", not found"; - } + } - if (not $test_case_run->canedit) - { - $self->logout; + if (not $test_case_run->canedit) + { + $self->logout; die "User Not Authorized"; - } + } # Check to see what has changed then use set methods # The order is important. We need to check if the build or environment has @@ -202,37 +202,37 @@ sub update $$test_case_run{assignee} = $$test_case_run{assignee}->id(); } - $self->logout; + $self->logout; - #Remove attributes we do not want to publish - delete $$test_case_run{bugs}; - delete $$test_case_run{build}; - delete $$test_case_run{case}; - delete $$test_case_run{environment}; - delete $$test_case_run{run}; - - # Result is modified test case run on success, otherwise an exception will be thrown - return $test_case_run; + #Remove attributes we do not want to publish + delete $$test_case_run{bugs}; + delete $$test_case_run{build}; + delete $$test_case_run{case}; + delete $$test_case_run{environment}; + delete $$test_case_run{run}; + + # Result is modified test case run on success, otherwise an exception will be thrown + return $test_case_run; } sub lookup_status_id_by_name { - my $self =shift; + my $self =shift; my ($name) = @_; $self->login; - my $result = Bugzilla::Testopia::TestCaseRun::lookup_status_by_name($name); + my $result = Bugzilla::Testopia::TestCaseRun::lookup_status_by_name($name); - $self->logout; + $self->logout; - # Result is test case run status id for the given test case run status name - return $result; + # Result is test case run status id for the given test case run status name + return $result; } sub lookup_status_name_by_id { - my $self =shift; + my $self =shift; my ($id) = @_; $self->login; @@ -241,15 +241,15 @@ sub lookup_status_name_by_id my $result = $test_case_run->lookup_status($id); - $self->logout; + $self->logout; if (!defined $result) { $result = 0; }; - - # Result is test case run status name for the given test case run status id - return $result; + + # Result is test case run status name for the given test case run status id + return $result; } 1; diff --git a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestPlan.pm b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestPlan.pm index 628dbcaffec..1e6feca3d1c 100644 --- a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestPlan.pm +++ b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestPlan.pm @@ -38,18 +38,18 @@ sub _list foreach (keys(%$query)) { - $cgi->param($_, $$query{$_}); + $cgi->param($_, $$query{$_}); } - + my $search = Bugzilla::Testopia::Search->new($cgi); - # Result is an array of test plan hash maps - return Bugzilla::Testopia::Table->new('plan', - 'tr_xmlrpc.cgi', - $cgi, - undef, - $search->query() - )->list(); + # Result is an array of test plan hash maps + return Bugzilla::Testopia::Table->new('plan', + 'tr_xmlrpc.cgi', + $cgi, + undef, + $search->query() + )->list(); } sub get @@ -59,20 +59,20 @@ sub get $self->login; - #Result is a test plan hash map + #Result is a test plan hash map my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canview) - { - $self->logout; + } + + if (not $test_plan->canview) + { + $self->logout; die "User Not Authorized"; - } + } $self->logout; @@ -86,50 +86,50 @@ sub list $self->login; - my $list = _list($query); - + my $list = _list($query); + $self->logout; - return $list; + return $list; } sub create { - my $self =shift; - my ($new_values) = @_; + my $self =shift; + my ($new_values) = @_; $self->login; - my $test_plan = new Bugzilla::Testopia::TestPlan($new_values); - - my $result = $test_plan->store(); - - $self->logout; - - # Result is new test plan id - return $result; + my $test_plan = new Bugzilla::Testopia::TestPlan($new_values); + + my $result = $test_plan->store(); + + $self->logout; + + # Result is new test plan id + return $result; } sub update { - my $self =shift; - my ($test_plan_id, $new_values) = @_; + my $self =shift; + my ($test_plan_id, $new_values) = @_; $self->login; - my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - - if (not defined $test_plan) - { - $self->logout; + my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); + + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canedit) - { - $self->logout; + } + + if (not $test_plan->canedit) + { + $self->logout; die "User Not Authorized"; - } + } $test_plan->set_name(trim($new_values->{'name'})); $test_plan->set_product_id($new_values->{'product_id'}); @@ -138,161 +138,161 @@ sub update $test_plan->set_isactive($new_values->{'isactive'}); $test_plan->update(); - - $self->logout; + + $self->logout; - # Result is modified test plan, otherwise an exception will be thrown - return $test_plan; + # Result is modified test plan, otherwise an exception will be thrown + return $test_plan; } sub get_test_cases { - my $self =shift; + my $self =shift; my ($test_plan_id) = @_; $self->login; my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canview) - { - $self->logout; + } + + if (not $test_plan->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_plan->test_cases(); - - $self->logout; + + $self->logout; - # Result is list of test cases for the given test plan - return $result; + # Result is list of test cases for the given test plan + return $result; } sub get_test_runs { - my $self =shift; + my $self =shift; my ($test_plan_id) = @_; $self->login; my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canview) - { - $self->logout; + } + + if (not $test_plan->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_plan->test_runs(); - $self->logout; - - # Result is list of test runs for the given test plan - return $result; + $self->logout; + + # Result is list of test runs for the given test plan + return $result; } sub get_categories { - my $self =shift; + my $self =shift; my ($test_plan_id) = @_; $self->login; my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canview) - { - $self->logout; + } + + if (not $test_plan->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_plan->product->categories(); - $self->logout; - - # Result is list of categories for the given test plan - return $result; + $self->logout; + + # Result is list of categories for the given test plan + return $result; } sub get_components { - my $self =shift; + my $self =shift; my ($test_plan_id) = @_; $self->login; my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canview) - { - $self->logout; + } + + if (not $test_plan->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_plan->product->components; - $self->logout; - - # Result is list of components for the given test plan - return $result; + $self->logout; + + # Result is list of components for the given test plan + return $result; } sub get_builds { - my $self =shift; + my $self =shift; my ($test_plan_id) = @_; $self->login; my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canview) - { - $self->logout; + } + + if (not $test_plan->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_plan->product->builds(); - $self->logout; - - # Result is list of builds for the given test plan - return $result; + $self->logout; + + # Result is list of builds for the given test plan + return $result; } sub lookup_type_name_by_id { - my $self =shift; + my $self =shift; my ($id) = @_; $self->login; @@ -301,15 +301,15 @@ sub lookup_type_name_by_id my $result = $test_plan->lookup_type($id); - $self->logout; - - # Result is test plan type name for the given test plan type id - return $result; + $self->logout; + + # Result is test plan type name for the given test plan type id + return $result; } sub lookup_type_id_by_name { - my $self =shift; + my $self =shift; my ($name) = @_; $self->login; @@ -318,41 +318,41 @@ sub lookup_type_id_by_name my $result = $test_plan->lookup_type_by_name($name); - $self->logout; + $self->logout; if (!defined $result) { $result = 0; }; - - # Result is test plan type id for the given test plan type name - return $result; + + # Result is test plan type id for the given test plan type name + return $result; } sub add_tag { - my $self =shift; - my ($test_plan_id, $tag_name) = @_; + my $self =shift; + my ($test_plan_id, $tag_name) = @_; $self->login; - my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); + my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canedit) - { - $self->logout; + } + + if (not $test_plan->canedit) + { + $self->logout; die "User Not Authorized"; - } - - #Create new tag or retrieve id of existing tag - my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name}); - my $tag_id = $test_tag->store; + } + + #Create new tag or retrieve id of existing tag + my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name}); + my $tag_id = $test_tag->store; my $result = $test_plan->add_tag($tag_id); @@ -362,32 +362,32 @@ sub add_tag die "Tag, " . $tag_name . ", already exists for Testplan, " . $test_plan_id; } - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return $result; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return $result; } sub remove_tag { - my $self =shift; - my ($test_plan_id, $tag_name) = @_; + my $self =shift; + my ($test_plan_id, $tag_name) = @_; $self->login; - my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); + my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canedit) - { - $self->logout; + } + + if (not $test_plan->canedit) + { + $self->logout; die "User Not Authorized"; - } + } my $test_tag = Bugzilla::Testopia::TestTag->check_name($tag_name); if (not defined $test_tag) @@ -398,39 +398,39 @@ sub remove_tag my $result = $test_plan->remove_tag($test_tag->id); - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return 0; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return 0; } sub get_tags { - my $self =shift; - my ($test_plan_id) = @_; + my $self =shift; + my ($test_plan_id) = @_; $self->login; - my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); + my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id); - if (not defined $test_plan) - { - $self->logout; + if (not defined $test_plan) + { + $self->logout; die "Testplan, " . $test_plan_id . ", not found"; - } - - if (not $test_plan->canview) - { - $self->logout; + } + + if (not $test_plan->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_plan->tags; - $self->logout; - - # Result list of tags otherwise an exception will be thrown - return $result; + $self->logout; + + # Result list of tags otherwise an exception will be thrown + return $result; } 1; \ No newline at end of file diff --git a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestRun.pm b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestRun.pm index 070fa93bfda..84ffbda2fc1 100644 --- a/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestRun.pm +++ b/mozilla/webtools/testopia/Bugzilla/WebService/Testopia/TestRun.pm @@ -38,18 +38,18 @@ sub _list foreach (keys(%$query)) { - $cgi->param($_, $$query{$_}); + $cgi->param($_, $$query{$_}); } - + my $search = Bugzilla::Testopia::Search->new($cgi); - # Result is an array of test run hash maps - return Bugzilla::Testopia::Table->new('run', - 'tr_xmlrpc.cgi', - $cgi, - undef, - $search->query() - )->list(); + # Result is an array of test run hash maps + return Bugzilla::Testopia::Table->new('run', + 'tr_xmlrpc.cgi', + $cgi, + undef, + $search->query() + )->list(); } sub get @@ -59,20 +59,20 @@ sub get $self->login; - #Result is a test run hash map + #Result is a test run hash map my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canview) - { - $self->logout; + } + + if (not $test_run->canview) + { + $self->logout; die "User Not Authorized"; - } + } $self->logout; @@ -86,166 +86,166 @@ sub list $self->login; - my $list = _list($query); - + my $list = _list($query); + $self->logout; - return $list; + return $list; } sub create { - my $self =shift; - my ($new_values) = @_; + my $self =shift; + my ($new_values) = @_; $self->login; - my $test_run = new Bugzilla::Testopia::TestRun($new_values); - - my $result = $test_run->store(); - - $self->logout; - - # Result is new test run id - return $result + my $test_run = new Bugzilla::Testopia::TestRun($new_values); + + my $result = $test_run->store(); + + $self->logout; + + # Result is new test run id + return $result } sub update { - my $self =shift; - my ($test_run_id, $new_values) = @_; + my $self =shift; + my ($test_run_id, $new_values) = @_; $self->login; - my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); + my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canedit) - { - $self->logout; + } + + if (not $test_run->canedit) + { + $self->logout; die "User Not Authorized"; - } + } - my $result = $test_run->update($new_values); + my $result = $test_run->update($new_values); - $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - - $self->logout; - - # Result is modified test run on success, otherwise an exception will be thrown - return $test_run; + $test_run = new Bugzilla::Testopia::TestRun($test_run_id); + + $self->logout; + + # Result is modified test run on success, otherwise an exception will be thrown + return $test_run; } sub get_test_cases { - my $self =shift; + my $self =shift; my ($test_run_id) = @_; $self->login; my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canview) - { - $self->logout; + } + + if (not $test_run->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_run->cases(); - $self->logout; - - # Result is list of test cases for the given test run - return $result; + $self->logout; + + # Result is list of test cases for the given test run + return $result; } sub get_test_case_runs { - my $self =shift; + my $self =shift; my ($test_run_id) = @_; $self->login; my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canview) - { - $self->logout; + } + + if (not $test_run->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_run->caseruns(); - $self->logout; - - # Result is list of test case runs for the given test run - return $result; + $self->logout; + + # Result is list of test case runs for the given test run + return $result; } sub get_test_plan { - my $self =shift; + my $self =shift; my ($test_run_id) = @_; $self->login; my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canview) - { - $self->logout; + } + + if (not $test_run->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_run->plan(); - $self->logout; - - # Result is test plan for the given test run - return $result; + $self->logout; + + # Result is test plan for the given test run + return $result; } sub lookup_environment_id_by_name { - my $self =shift; + my $self =shift; my ($name) = @_; $self->login; - my $result = Bugzilla::Testopia::TestRun::lookup_environment_by_name($name); + my $result = Bugzilla::Testopia::TestRun::lookup_environment_by_name($name); - $self->logout; + $self->logout; - # Result is test run environment id for the given test run environment name - return $result; + # Result is test run environment id for the given test run environment name + return $result; } sub lookup_environment_name_by_id { - my $self =shift; + my $self =shift; my ($id) = @_; $self->login; @@ -254,41 +254,41 @@ sub lookup_environment_name_by_id my $result = $test_run->lookup_environment($id); - $self->logout; + $self->logout; if (!defined $result) { $result = 0; }; - - # Result is test run environment name for the given test run environment id - return $result; + + # Result is test run environment name for the given test run environment id + return $result; } sub add_tag { - my $self =shift; - my ($test_run_id, $tag_name) = @_; + my $self =shift; + my ($test_run_id, $tag_name) = @_; $self->login; - my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); + my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canedit) - { - $self->logout; + } + + if (not $test_run->canedit) + { + $self->logout; die "User Not Authorized"; - } - - #Create new tag or retrieve id of existing tag - my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name}); - my $tag_id = $test_tag->store; + } + + #Create new tag or retrieve id of existing tag + my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name}); + my $tag_id = $test_tag->store; my $result = $test_run->add_tag($tag_id); @@ -298,32 +298,32 @@ sub add_tag die "Tag, " . $tag_name . ", already exists for Testrun, " . $test_run_id; } - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return $result; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return $result; } sub remove_tag { - my $self =shift; - my ($test_run_id, $tag_name) = @_; + my $self =shift; + my ($test_run_id, $tag_name) = @_; $self->login; - my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); + my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canedit) - { - $self->logout; + } + + if (not $test_run->canedit) + { + $self->logout; die "User Not Authorized"; - } + } my $test_tag = Bugzilla::Testopia::TestTag->check_name($tag_name); if (not defined $test_tag) @@ -334,39 +334,39 @@ sub remove_tag my $result = $test_run->remove_tag($test_tag->id); - $self->logout; - - # Result 0 on success, otherwise an exception will be thrown - return 0; + $self->logout; + + # Result 0 on success, otherwise an exception will be thrown + return 0; } sub get_tags { - my $self =shift; - my ($test_run_id) = @_; + my $self =shift; + my ($test_run_id) = @_; $self->login; - my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); + my $test_run = new Bugzilla::Testopia::TestRun($test_run_id); - if (not defined $test_run) - { - $self->logout; + if (not defined $test_run) + { + $self->logout; die "Testrun, " . $test_run_id . ", not found"; - } - - if (not $test_run->canview) - { - $self->logout; + } + + if (not $test_run->canview) + { + $self->logout; die "User Not Authorized"; - } + } my $result = $test_run->tags; - $self->logout; - - # Result list of tags otherwise an exception will be thrown - return $result; + $self->logout; + + # Result list of tags otherwise an exception will be thrown + return $result; } 1; \ No newline at end of file diff --git a/mozilla/webtools/testopia/skins/standard/testopia.css b/mozilla/webtools/testopia/skins/standard/testopia.css index d678125e6b0..9b94460165e 100644 --- a/mozilla/webtools/testopia/skins/standard/testopia.css +++ b/mozilla/webtools/testopia/skins/standard/testopia.css @@ -8,14 +8,14 @@ } #header li.tr_find { - position:absolute; - top:0px; - right:10px; + position:absolute; + top:0px; + right:10px; } #header li.tr_saved_search { position:absolute; top:2px; - right:185px; + right:185px; } #header .testopia_btn { @@ -27,15 +27,15 @@ } #footer li.tr_find { - position:absolute; - top:2px; - right:10px; + position:absolute; + top:2px; + right:10px; } #footer li.tr_saved_search { position:absolute; top:4px; - right:185px; + right:185px; } #footer .tr_btn { background-color: #808285; diff --git a/mozilla/webtools/testopia/template/en/default/hook/global/banner.html.tmpl/version/testopia.html.tmpl b/mozilla/webtools/testopia/template/en/default/hook/global/banner.html.tmpl/version/testopia.html.tmpl index 6794ec9beeb..c82de2c04c7 100644 --- a/mozilla/webtools/testopia/template/en/default/hook/global/banner.html.tmpl/version/testopia.html.tmpl +++ b/mozilla/webtools/testopia/template/en/default/hook/global/banner.html.tmpl/version/testopia.html.tmpl @@ -1,2 +1,21 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Testopia System. + # + # The Initial Developer of the Original Code is Greg Hendricks. + # Portions created by Greg Hendricks are Copyright (C) 2006 + # Novell. All Rights Reserved. + # + # Contributor(s): Greg Hendricks + #%] Testopia - Version 1.0 BETA + Version 1.3 diff --git a/mozilla/webtools/testopia/template/en/default/testopia/caserun/short-form-header.html.tmpl b/mozilla/webtools/testopia/template/en/default/testopia/caserun/short-form-header.html.tmpl index 63fe849a7c5..a0a77668383 100644 --- a/mozilla/webtools/testopia/template/en/default/testopia/caserun/short-form-header.html.tmpl +++ b/mozilla/webtools/testopia/template/en/default/testopia/caserun/short-form-header.html.tmpl @@ -39,7 +39,7 @@ [% caserun.case.id FILTER html %] [% IF caserun.canedit %] - + [% END %] [% caserun.build.name FILTER html %] diff --git a/mozilla/webtools/testopia/template/en/default/testopia/text.png.tmpl b/mozilla/webtools/testopia/template/en/default/testopia/text.png.tmpl index 16afab31158..5301e7e4b65 100644 --- a/mozilla/webtools/testopia/template/en/default/testopia/text.png.tmpl +++ b/mozilla/webtools/testopia/template/en/default/testopia/text.png.tmpl @@ -1,3 +1,23 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Testopia System. + # + # The Initial Developer of the Original Code is Greg Hendricks. + # Portions created by Greg Hendricks are Copyright (C) 2006 + # Novell. All Rights Reserved. + # + # Contributor(s): Greg Hendricks + #%] + [% FILTER null; USE gd = GD.Image(100,40); USE gdc = GD.Constants; diff --git a/mozilla/webtools/testopia/testopia.dtd b/mozilla/webtools/testopia/testopia.dtd index 6be44117b8e..fcbb775d2be 100644 --- a/mozilla/webtools/testopia/testopia.dtd +++ b/mozilla/webtools/testopia/testopia.dtd @@ -1,6 +1,6 @@ @@ -12,31 +12,31 @@ @@ -64,26 +64,26 @@ diff --git a/mozilla/webtools/testopia/testopia/ChangeLog b/mozilla/webtools/testopia/testopia/ChangeLog index 3e1b60a5048..f20aa94b170 100644 --- a/mozilla/webtools/testopia/testopia/ChangeLog +++ b/mozilla/webtools/testopia/testopia/ChangeLog @@ -122,209 +122,209 @@ 2004-01-18 Ed Fuentetaja - * test cases can be marked as public, so anybody can run them + * test cases can be marked as public, so anybody can run them - * more than one tester can be assigned to a test case, but it only needs to be run once + * more than one tester can be assigned to a test case, but it only needs to be run once - * improvements on the UI and usability of the most common pages + * improvements on the UI and usability of the most common pages - * cleaned up and removed duplications in the code. A future use of templates is now closer + * cleaned up and removed duplications in the code. A future use of templates is now closer 2003-11-21 Ed Fuentetaja - * patch : updated to work with Bugzilla 2.17.6 + * patch : updated to work with Bugzilla 2.17.6 - * tr_buglist_to_plan : fixed bug: still using the products field + * tr_buglist_to_plan : fixed bug: still using the products field 2003-11-15 Ed Fuentetaja - * doc : updated documentation. + * doc : updated documentation. - * (all) : version migrated to make it work with Bugzilla 2.17.4 + * (all) : version migrated to make it work with Bugzilla 2.17.4 2002-09-27 Maciej Maczynski - * doc : updated documentation. + * doc : updated documentation. - * edittestplans.cgi (InitTestCaseLog): Placed version info in header (version 0.2). + * edittestplans.cgi (InitTestCaseLog): Placed version info in header (version 0.2). 2002-09-06 Maciej Maczynski - * buglist_to_plan_query.cgi: Added a feature to turn buglist into test plan. This way you can use - Testopia as "supervising tool" for verifing set of bugs. + * buglist_to_plan_query.cgi: Added a feature to turn buglist into test plan. This way you can use + Testopia as "supervising tool" for verifing set of bugs. 2002-06-17 Maciej Maczynski - * testrun_testers.cgi : Added a form to reassign test-cases "by bug owner". This is intended - to work together with test tests created out of lists of bugs (see 2002-06-10 buglist_to_plan.cgi - note). If a test case has "show_bug.cgi" is summary, it can be reassigned to tester, which is - bug reporter. + * testrun_testers.cgi : Added a form to reassign test-cases "by bug owner". This is intended + to work together with test tests created out of lists of bugs (see 2002-06-10 buglist_to_plan.cgi + note). If a test case has "show_bug.cgi" is summary, it can be reassigned to tester, which is + bug reporter. 2002-06-12 Maciej Maczynski - * testruns.cgi : Removed hyperlinks to 0-items bug lists. Replaced plain user mail address with - "mailto" tag in tables. + * testruns.cgi : Removed hyperlinks to 0-items bug lists. Replaced plain user mail address with + "mailto" tag in tables. - * tr_caselogform.cgi (DoRunNotifications): Case id is put to mail subject, user name to main body. + * tr_caselogform.cgi (DoRunNotifications): Case id is put to mail subject, user name to main body. 2002-06-10 Maciej Maczynski - * tr_query.cgi : $jscript must be parameter 5 to PutHeader. + * tr_query.cgi : $jscript must be parameter 5 to PutHeader. - * tr_testcaseform.cgi : Added a function for copying a test case to another test plan. + * tr_testcaseform.cgi : Added a function for copying a test case to another test plan. - * testruns.cgi : Added hyperlink to "Update test cases" page. + * testruns.cgi : Added hyperlink to "Update test cases" page. - * testplan_form.cgi : Added hyperlink to "Clone test plan" page. + * testplan_form.cgi : Added hyperlink to "Clone test plan" page. - * buglist_to_plan.cgi : Status of new test case is "confirmed". Added handling of %description% - in test case "action". It is expanded to bug's description. + * buglist_to_plan.cgi : Status of new test case is "confirmed". Added handling of %description% + in test case "action". It is expanded to bug's description. - * testrun_update.cgi : Added a feature for updating test run. "Updating" means creating - test case log entries for all test cases, which are in parent test-plan, but have to log - entries in test run (i.e. were added after test run were created) + * testrun_update.cgi : Added a feature for updating test run. "Updating" means creating + test case log entries for all test cases, which are in parent test-plan, but have to log + entries in test run (i.e. were added after test run were created) - * clone_testplan.cgi : Added a feature for makeing a copy of test plan. Various "copy options" - available. + * clone_testplan.cgi : Added a feature for makeing a copy of test plan. Various "copy options" + available. - * buglist_to_plan.cgi : Added a feature to create test cases out of bug list. I started to use - Testopia as "to-do container" for the things related to testing. I often have a situation, when - I wanted testers to test if a list of bug is fixed in current release. - Using this module, you can add "test-cases" out of buglist. For each bug in the list, a test-case - is created for selected plan. A test-case is just a note "check bug ###". But this forms a list - of to-do items, which I can trace. The text of a note is configurable through. - bug-to-test-case-summary, bug-to-test-case-action and bug-to-test-case-effect parameters. You can - use %id% symbol to include hyperlink to bug page. - + * buglist_to_plan.cgi : Added a feature to create test cases out of bug list. I started to use + Testopia as "to-do container" for the things related to testing. I often have a situation, when + I wanted testers to test if a list of bug is fixed in current release. + Using this module, you can add "test-cases" out of buglist. For each bug in the list, a test-case + is created for selected plan. A test-case is just a note "check bug ###". But this forms a list + of to-do items, which I can trace. The text of a note is configurable through. + bug-to-test-case-summary, bug-to-test-case-action and bug-to-test-case-effect parameters. You can + use %id% symbol to include hyperlink to bug page. + 2002-05-23 Maciej Maczynski - * tr_testcaseform.cgi: Improved checking for IE version in javascript. + * tr_testcaseform.cgi: Improved checking for IE version in javascript. 2002-04-17 Maciej Maczynski - * tr_import.pl : Fixed handling of situation when "Component" keyword was placed after "Add group". + * tr_import.pl : Fixed handling of situation when "Component" keyword was placed after "Add group". 2002-04-02 Maciej Maczynski - * tr_caselogform.cgi: Added the way to delete test case log entry (not adviced, but sometimes - convenient). + * tr_caselogform.cgi: Added the way to delete test case log entry (not adviced, but sometimes + convenient). - * caselogform.pl: Added "Delete" button to test case log entry form. + * caselogform.pl: Added "Delete" button to test case log entry form. 2002-03-27 Maciej Maczynski - * testrun_notif.cgi: Added interface for notifications setup. + * testrun_notif.cgi: Added interface for notifications setup. - * btpm_util.pl: Added "constants" for e-mail notification masks. - Added SendEmail procedure. + * btpm_util.pl: Added "constants" for e-mail notification masks. + Added SendEmail procedure. - * tr_caselogform.cgi: Added mechanism for email notifications. Notifications are set up separately for - each test-run. The testrun manager can receive the notifications when: - - test-run completes (no 'idle' case log entries left) - - test-run completes for tester - - test-run completes for component - - test case log entry is marked as failed + * tr_caselogform.cgi: Added mechanism for email notifications. Notifications are set up separately for + each test-run. The testrun manager can receive the notifications when: + - test-run completes (no 'idle' case log entries left) + - test-run completes for tester + - test-run completes for component + - test case log entry is marked as failed - * testruns.cgi: Added link to notifications configuration. + * testruns.cgi: Added link to notifications configuration. 2002-03-25 Maciej Maczynski - * btpm_util.pl: Defined global $::users_select_limit - it is used to defined maximum number of users - displayed in user-selection pop-ups. - Added some utility functions. + * btpm_util.pl: Defined global $::users_select_limit - it is used to defined maximum number of users + displayed in user-selection pop-ups. + Added some utility functions. - * doc/ref_param.html: Describe new options. + * doc/ref_param.html: Describe new options. - * doc/install.html : Described new options (new-case-action-template and new-case-effect-template). - Described Bugzilla bug-fix for GenerateCode procedure. + * doc/install.html : Described new options (new-case-action-template and new-case-effect-template). + Described Bugzilla bug-fix for GenerateCode procedure. - * tr_caselogform.cgi : Test case can now be re-assigned to another tester. Only test-plan editor or - test run manager can do it. - Added "Just mark as failed" option when marking the log entry as failed. + * tr_caselogform.cgi : Test case can now be re-assigned to another tester. Only test-plan editor or + test run manager can do it. + Added "Just mark as failed" option when marking the log entry as failed. - * testruns.cgi: New fields can be set: notes and manager. + * testruns.cgi: New fields can be set: notes and manager. - * testrun_testers.cgi : Testers and test cases can now be reassigned when test is running - (Finally!!! - I really missed it) + * testrun_testers.cgi : Testers and test cases can now be reassigned when test is running + (Finally!!! - I really missed it) - * testrun_reports.cgi: Added some new charts and bug-fixed the old ones. + * testrun_reports.cgi: Added some new charts and bug-fixed the old ones. - * edittestplans.cgi (RunTest): New field (manager) for test run is set to test-plan editor, when - test run is created. + * edittestplans.cgi (RunTest): New field (manager) for test run is set to test-plan editor, when + test run is created. - * caselogform.pl: IsManager function is now used to verify case-access rights; - "Reassign" button added. + * caselogform.pl: IsManager function is now used to verify case-access rights; + "Reassign" button added. - * testman.sql: Added columns to test_runs table: - - manager (person managing given test run) - - notes (notes for test run) - - notifications (e-mail notifications mask) + * testman.sql: Added columns to test_runs table: + - manager (person managing given test run) + - notes (notes for test run) + - notifications (e-mail notifications mask) 2002-03-18 Maciej Maczynski - * edittestplans.cgi (InitTestCaseLog): Missed some SQL-quotes when creating new test plan. + * edittestplans.cgi (InitTestCaseLog): Missed some SQL-quotes when creating new test plan. 2002-03-11 Maciej Maczynski - * edittesters.cgi (PrintTestersAssignForm): Number of test cases defined is put to table header for each component. - It makes it easier to balance number of test cases assigned for testers. + * edittesters.cgi (PrintTestersAssignForm): Number of test cases defined is put to table header for each component. + It makes it easier to balance number of test cases assigned for testers. 2002-03-08 Maciej Maczynski - * btpm_util.pl : Added some utility functions needed by other modules. + * btpm_util.pl : Added some utility functions needed by other modules. - * testrun_reports.cgi : Added bug-statistics reports for test run. You can get the numbers of bugs detected during - selected test run for each tester. Charts are also available. + * testrun_reports.cgi : Added bug-statistics reports for test run. You can get the numbers of bugs detected during + selected test run for each tester. Charts are also available. - * tr_testcaseform.cgi : After pressing "back" before saving values in test case form once again, - I added "change-notification" for this form. A picture is displayed next to "summary", "action" and - "effect" when fields need save. Must use some Java Script here, but I hope it will work with various - browsers (checked for IE5, NS4, NS6). Anyway - the feature seems worth some risk for me. + * tr_testcaseform.cgi : After pressing "back" before saving values in test case form once again, + I added "change-notification" for this form. A picture is displayed next to "summary", "action" and + "effect" when fields need save. Must use some Java Script here, but I hope it will work with various + browsers (checked for IE5, NS4, NS6). Anyway - the feature seems worth some risk for me. - * tr_edittestcases.cgi : Only privileged user can remove unused versions of test cases. - (NewTestCaseForm): Template values for case action and effect are used when creating new case. + * tr_edittestcases.cgi : Only privileged user can remove unused versions of test cases. + (NewTestCaseForm): Template values for case action and effect are used when creating new case. - * tr_editgroups.cgi : Improved support for group templates. Template can be deleted. + * tr_editgroups.cgi : Improved support for group templates. Template can be deleted. - * testruns.cgi (PrintPlanHeader): The form displays version of test document used for this run, not current version. - (PrintTestersComponents): '%' was prefixed in wrong way... - (PrintTestersComponents): Added hyper-link to Reports page. - (PrintTestersComponents): PrintTestPlan function is used to display test plan document in unified form. + * testruns.cgi (PrintPlanHeader): The form displays version of test document used for this run, not current version. + (PrintTestersComponents): '%' was prefixed in wrong way... + (PrintTestersComponents): Added hyper-link to Reports page. + (PrintTestersComponents): PrintTestPlan function is used to display test plan document in unified form. - * testplan_versions.cgi : PrintTestPlan function is used to display test plan document in unified form. + * testplan_versions.cgi : PrintTestPlan function is used to display test plan document in unified form. - * testplan_form.cgi : PrintTestPlan function is used to display test plan document in unified form. + * testplan_form.cgi : PrintTestPlan function is used to display test plan document in unified form. 2002-03-05 Maciej Maczynski - * tr_editgroups.cgi : Functional group templates can be created out of existing groups. "Delete template" function added - as well. + * tr_editgroups.cgi : Functional group templates can be created out of existing groups. "Delete template" function added + as well. 2002-03-04 Maciej Maczynski - * tr_query.cgi (StringSearch): Added "Find case id #" function. + * tr_query.cgi (StringSearch): Added "Find case id #" function. - * tr_edittestcases.cgi : Added a function to delete all unreferenced test case versions. + * tr_edittestcases.cgi : Added a function to delete all unreferenced test case versions. - * testruns.cgi : Bugfix - only one test run was printed (aaarrrghh...) because of SendSql in UserInGroup sub. + * testruns.cgi : Bugfix - only one test run was printed (aaarrrghh...) because of SendSql in UserInGroup sub. - * doc/dbschema.html: Added database schema chart. + * doc/dbschema.html: Added database schema chart. 2002-03-01 Maciej Maczynski - * edittesters.cgi (PrintTestersAssignForm): Added next column, which prints number of currently assigned test cases for - each tester. + * edittesters.cgi (PrintTestersAssignForm): Added next column, which prints number of currently assigned test cases for + each tester. 2002-02-26 Maciej Maczynski - * tr_export.cgi : Added two additional export options: preceed case with "product>component>group" text, - and generate reference to case page. + * tr_export.cgi : Added two additional export options: preceed case with "product>component>group" text, + and generate reference to case page. - * tr_edittags.cgi (TagsForm): Tags are sorted by name. + * tr_edittags.cgi (TagsForm): Tags are sorted by name. - * tr_testcaseform.cgi : Changed quoting of summary, action and effect. + * tr_testcaseform.cgi : Changed quoting of summary, action and effect. - + diff --git a/mozilla/webtools/testopia/testopia/css/print.css b/mozilla/webtools/testopia/testopia/css/print.css index eb9db961eb1..3c6b4bbc776 100644 --- a/mozilla/webtools/testopia/testopia/css/print.css +++ b/mozilla/webtools/testopia/testopia/css/print.css @@ -1,33 +1,33 @@ body { - font-family: arial,sans-serif; + font-family: arial,sans-serif; } .print_table_header { - font-weight: bold; - text-align: center; - padding-left: 5px; - padding-right: 5px; - border-bottom: 1px solid #000; + font-weight: bold; + text-align: center; + padding-left: 5px; + padding-right: 5px; + border-bottom: 1px solid #000; } .print_table_row_header { - font-weight: bold; - text-align: right; - padding-right: 5px; - border-right: 1px solid #000; + font-weight: bold; + text-align: right; + padding-right: 5px; + border-right: 1px solid #000; } .print_table_bold { - text-align: right; - font-weight: bold; + text-align: right; + font-weight: bold; } .print_table_body { - text-align: left; - padding-left: 15px; + text-align: left; + padding-left: 15px; } .print_table_data { - text-align: center; + text-align: center; } .print_table { - border-left: 1px solid #000000; - border-top: 1px solid #000000; - border-right: 1px solid #000000; - border-bottom: 1px solid #000000; + border-left: 1px solid #000000; + border-top: 1px solid #000000; + border-right: 1px solid #000000; + border-bottom: 1px solid #000000; } diff --git a/mozilla/webtools/testopia/testopia/environment.dtd b/mozilla/webtools/testopia/testopia/environment.dtd index df3563e64f5..2836cf226dd 100644 --- a/mozilla/webtools/testopia/testopia/environment.dtd +++ b/mozilla/webtools/testopia/testopia/environment.dtd @@ -1,15 +1,15 @@ + name CDATA #REQUIRED> + name CDATA #REQUIRED> + name CDATA #REQUIRED> + name CDATA #REQUIRED> diff --git a/mozilla/webtools/testopia/testopia/js/DocumentManager.js b/mozilla/webtools/testopia/testopia/js/DocumentManager.js index f3115590927..6791b5dacd0 100644 --- a/mozilla/webtools/testopia/testopia/js/DocumentManager.js +++ b/mozilla/webtools/testopia/testopia/js/DocumentManager.js @@ -5,26 +5,26 @@ dojo.require("dojo.dom.*"); dojo.require("dojo.event.*"); function DocumentManager(/*string*/ prefix, /*string*/action, /*array of strings*/otherListeners, /*bool*/ directEdit) { if (prefix.length > 0) { - this.prefix = prefix - if ( arguments.length > 1 ) { - this.action = action; - } else { - this.action = "Commit"; - } - if ( arguments.length > 2 ) { - this.others = otherListeners; - } else { - this.others = []; - } - if ( arguments.length > 3 ) { - this.directEdit = directEdit; - } else { - this.directEdit = false; - } - this.div; - this.widget; - this.helpPar; - dojo.addOnLoad( dojo.lang.hitch(this, "handleLoad" ) ); + this.prefix = prefix + if ( arguments.length > 1 ) { + this.action = action; + } else { + this.action = "Commit"; + } + if ( arguments.length > 2 ) { + this.others = otherListeners; + } else { + this.others = []; + } + if ( arguments.length > 3 ) { + this.directEdit = directEdit; + } else { + this.directEdit = false; + } + this.div; + this.widget; + this.helpPar; + dojo.addOnLoad( dojo.lang.hitch(this, "handleLoad" ) ); } } new DocumentManager(""); @@ -42,20 +42,20 @@ DocumentManager.prototype.handleLoad = function() { this.helpPar.setAttribute("style", "text-align: right;cursor: default"); dojo.dom.insertAfter(this.helpPar, this.div); if ( this.directEdit ) { - return this.gotoEditMode(); + return this.gotoEditMode(); } else { - var l = document.createElement("a"); - l.setAttribute("title", "Click here to edit, or double-click document text."); - l.setAttribute("style", "cursor: pointer; color: blue"); - var t = document.createTextNode("Edit Document"); - l.appendChild(t); - this.helpPar.appendChild(l); - dojo.event.connect(l, "onclick", this, "gotoEditMode"); - dojo.event.connect(this.div, "ondblclick", this, "gotoEditMode"); - for (i = 0; i < this.others.length; ++i) { - var n = document.getElementById(this.others[i]); - dojo.event.connect(n, "ondblclick", this, "gotoEditMode"); - } + var l = document.createElement("a"); + l.setAttribute("title", "Click here to edit, or double-click document text."); + l.setAttribute("style", "cursor: pointer; color: blue"); + var t = document.createTextNode("Edit Document"); + l.appendChild(t); + this.helpPar.appendChild(l); + dojo.event.connect(l, "onclick", this, "gotoEditMode"); + dojo.event.connect(this.div, "ondblclick", this, "gotoEditMode"); + for (i = 0; i < this.others.length; ++i) { + var n = document.getElementById(this.others[i]); + dojo.event.connect(n, "ondblclick", this, "gotoEditMode"); + } } } DocumentManager.prototype.handleSubmit = function (evt) { @@ -65,30 +65,30 @@ DocumentManager.prototype.handleSubmit = function (evt) { el.setAttribute("type", "hidden"); var value; if (this.widget) { - value = this.widget.getEditorContent(); + value = this.widget.getEditorContent(); } else { - value = ""; - for (i = 0; i < this.div.childNodes.length; ++i) { - value = value + dojo.dom.innerXML(this.div.childNodes[i]); - } + value = ""; + for (i = 0; i < this.div.childNodes.length; ++i) { + value = value + dojo.dom.innerXML(this.div.childNodes[i]); + } } el.setAttribute("value", value); dojo.dom.insertAfter(el, this.div); } DocumentManager.prototype.gotoEditMode = function(evt) { if (this.widget) { - return; + return; } else { this.div.style.border = "1px solid #000"; this.div.style.padding = "0px 0px 10px 0px"; - dojo.dom.removeChildren(this.helpPar); - var b = document.createElement("input"); - b.setAttribute("type", "SUBMIT"); - b.setAttribute("name", "action"); - b.setAttribute("id", "action"); - b.setAttribute("class", "tr_button"); - b.setAttribute("value", this.action); - this.helpPar.appendChild(b); - this.widget = dojo.widget.createWidget("Editor2", {saveName: this.prefix, minHeight: "3em"}, this.div); + dojo.dom.removeChildren(this.helpPar); + var b = document.createElement("input"); + b.setAttribute("type", "SUBMIT"); + b.setAttribute("name", "action"); + b.setAttribute("id", "action"); + b.setAttribute("class", "tr_button"); + b.setAttribute("value", this.action); + this.helpPar.appendChild(b); + this.widget = dojo.widget.createWidget("Editor2", {saveName: this.prefix, minHeight: "3em"}, this.div); } } diff --git a/mozilla/webtools/testopia/testopia/js/caserun.js b/mozilla/webtools/testopia/testopia/js/caserun.js index a039fdeaaf3..e3154f29996 100755 --- a/mozilla/webtools/testopia/testopia/js/caserun.js +++ b/mozilla/webtools/testopia/testopia/js/caserun.js @@ -45,205 +45,207 @@ function validBugid(bugid) { } function fillrow(data, idx){ - //document.write(data); - if (data.substring(0,5) == 'Error'){ - displayMsg('pp'+idx, 2, data); - return; - } - if (data.substring(0,9) == '{'default'} = \%default; @@ -55,8 +55,8 @@ Index: Bugzilla.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla.pm,v retrieving revision 1.29 diff -u -r1.29 Bugzilla.pm ---- Bugzilla.pm 7 Feb 2006 22:46:28 -0000 1.29 -+++ Bugzilla.pm 27 Mar 2007 20:34:34 -0000 +--- Bugzilla.pm 7 Feb 2006 22:46:28 -0000 1.29 ++++ Bugzilla.pm 27 Mar 2007 20:34:34 -0000 @@ -46,6 +46,7 @@ use constant SHUTDOWNHTML_EXEMPT => [ 'editparams.cgi', @@ -70,8 +70,8 @@ Index: post_bug.cgi RCS file: /cvsroot/mozilla/webtools/bugzilla/post_bug.cgi,v retrieving revision 1.135 diff -u -r1.135 post_bug.cgi ---- post_bug.cgi 8 Jan 2006 19:56:03 -0000 1.135 -+++ post_bug.cgi 27 Mar 2007 20:34:34 -0000 +--- post_bug.cgi 8 Jan 2006 19:56:03 -0000 1.135 ++++ post_bug.cgi 27 Mar 2007 20:34:34 -0000 @@ -33,6 +33,8 @@ use Bugzilla::Bug; use Bugzilla::User; @@ -104,8 +104,8 @@ Index: editusers.cgi RCS file: /cvsroot/mozilla/webtools/bugzilla/editusers.cgi,v retrieving revision 1.113 diff -u -r1.113 editusers.cgi ---- editusers.cgi 3 Jan 2006 08:40:45 -0000 1.113 -+++ editusers.cgi 27 Mar 2007 20:34:34 -0000 +--- editusers.cgi 3 Jan 2006 08:40:45 -0000 1.113 ++++ editusers.cgi 27 Mar 2007 20:34:34 -0000 @@ -185,6 +185,8 @@ # Lock tables during the check+creation session. $dbh->bz_lock_tables('profiles WRITE', @@ -129,8 +129,8 @@ Index: Bugzilla/User.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/User.pm,v retrieving revision 1.101.2.3 diff -u -r1.101.2.3 User.pm ---- Bugzilla/User.pm 14 Mar 2006 07:45:54 -0000 1.101.2.3 -+++ Bugzilla/User.pm 27 Mar 2007 20:34:34 -0000 +--- Bugzilla/User.pm 14 Mar 2006 07:45:54 -0000 1.101.2.3 ++++ Bugzilla/User.pm 27 Mar 2007 20:34:34 -0000 @@ -236,6 +236,16 @@ return $self->{queries}; } @@ -225,8 +225,8 @@ Index: Bugzilla/Template.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v retrieving revision 1.41 diff -u -r1.41 Template.pm ---- Bugzilla/Template.pm 22 Jan 2006 21:37:37 -0000 1.41 -+++ Bugzilla/Template.pm 27 Mar 2007 20:34:34 -0000 +--- Bugzilla/Template.pm 22 Jan 2006 21:37:37 -0000 1.41 ++++ Bugzilla/Template.pm 27 Mar 2007 20:34:34 -0000 @@ -499,6 +499,14 @@ return $var; }, @@ -247,8 +247,8 @@ Index: Bugzilla/DB/Schema/Mysql.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema/Mysql.pm,v retrieving revision 1.12 diff -u -r1.12 Mysql.pm ---- Bugzilla/DB/Schema/Mysql.pm 18 Dec 2005 18:53:00 -0000 1.12 -+++ Bugzilla/DB/Schema/Mysql.pm 27 Mar 2007 20:34:34 -0000 +--- Bugzilla/DB/Schema/Mysql.pm 18 Dec 2005 18:53:00 -0000 1.12 ++++ Bugzilla/DB/Schema/Mysql.pm 27 Mar 2007 20:34:34 -0000 @@ -103,9 +103,10 @@ INT3 => 'mediumint', INT4 => 'integer', @@ -268,8 +268,8 @@ Index: Bugzilla/DB/Schema/Pg.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema/Pg.pm,v retrieving revision 1.9 diff -u -r1.9 Pg.pm ---- Bugzilla/DB/Schema/Pg.pm 15 Jun 2005 03:54:59 -0000 1.9 -+++ Bugzilla/DB/Schema/Pg.pm 27 Mar 2007 20:34:34 -0000 +--- Bugzilla/DB/Schema/Pg.pm 15 Jun 2005 03:54:59 -0000 1.9 ++++ Bugzilla/DB/Schema/Pg.pm 27 Mar 2007 20:34:34 -0000 @@ -69,6 +69,7 @@ INT3 => 'integer', INT4 => 'integer', @@ -283,8 +283,8 @@ Index: Bugzilla/DB/Schema.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema.pm,v retrieving revision 1.45 diff -u -r1.45 Schema.pm ---- Bugzilla/DB/Schema.pm 6 Jan 2006 14:38:42 -0000 1.45 -+++ Bugzilla/DB/Schema.pm 27 Mar 2007 20:34:34 -0000 +--- Bugzilla/DB/Schema.pm 6 Jan 2006 14:38:42 -0000 1.45 ++++ Bugzilla/DB/Schema.pm 27 Mar 2007 20:34:34 -0000 @@ -1040,6 +1040,557 @@ ], }, @@ -847,8 +847,8 @@ Index: createaccount.cgi RCS file: /cvsroot/mozilla/webtools/bugzilla/createaccount.cgi,v retrieving revision 1.46 diff -u -r1.46 createaccount.cgi ---- createaccount.cgi 20 Dec 2005 22:16:07 -0000 1.46 -+++ createaccount.cgi 12 Jun 2007 16:31:57 -0000 +--- createaccount.cgi 20 Dec 2005 22:16:07 -0000 1.46 ++++ createaccount.cgi 12 Jun 2007 16:31:57 -0000 @@ -69,8 +69,8 @@ $vars->{'login'} = $login; diff --git a/mozilla/webtools/testopia/testopia/patch-2.22.1 b/mozilla/webtools/testopia/testopia/patch-2.22.1 index 95715c98dd9..fb8e454abf1 100644 --- a/mozilla/webtools/testopia/testopia/patch-2.22.1 +++ b/mozilla/webtools/testopia/testopia/patch-2.22.1 @@ -3,8 +3,8 @@ Index: editusers.cgi RCS file: /cvsroot/mozilla/webtools/bugzilla/editusers.cgi,v retrieving revision 1.113.2.1 diff -u -r1.113.2.1 editusers.cgi ---- editusers.cgi 14 Oct 2006 22:05:54 -0000 1.113.2.1 -+++ editusers.cgi 11 May 2007 18:52:16 -0000 +--- editusers.cgi 14 Oct 2006 22:05:54 -0000 1.113.2.1 ++++ editusers.cgi 11 May 2007 18:52:16 -0000 @@ -190,6 +190,8 @@ # Lock tables during the check+creation session. $dbh->bz_lock_tables('profiles WRITE', @@ -28,8 +28,8 @@ Index: checksetup.pl RCS file: /cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v retrieving revision 1.469.2.15 diff -u -r1.469.2.15 checksetup.pl ---- checksetup.pl 14 Oct 2006 20:30:53 -0000 1.469.2.15 -+++ checksetup.pl 27 Mar 2007 20:27:05 -0000 +--- checksetup.pl 14 Oct 2006 20:30:53 -0000 1.469.2.15 ++++ checksetup.pl 27 Mar 2007 20:27:05 -0000 @@ -313,7 +313,7 @@ }, { @@ -64,8 +64,8 @@ Index: enter_bug.cgi RCS file: /cvsroot/mozilla/webtools/bugzilla/enter_bug.cgi,v retrieving revision 1.126.2.2 diff -u -r1.126.2.2 enter_bug.cgi ---- enter_bug.cgi 21 Aug 2006 19:26:06 -0000 1.126.2.2 -+++ enter_bug.cgi 27 Mar 2007 20:27:05 -0000 +--- enter_bug.cgi 21 Aug 2006 19:26:06 -0000 1.126.2.2 ++++ enter_bug.cgi 27 Mar 2007 20:27:05 -0000 @@ -591,6 +591,8 @@ $vars->{'default'} = \%default; @@ -80,8 +80,8 @@ Index: post_bug.cgi RCS file: /cvsroot/mozilla/webtools/bugzilla/post_bug.cgi,v retrieving revision 1.135.2.3 diff -u -r1.135.2.3 post_bug.cgi ---- post_bug.cgi 4 Jul 2006 09:51:56 -0000 1.135.2.3 -+++ post_bug.cgi 27 Mar 2007 20:27:05 -0000 +--- post_bug.cgi 4 Jul 2006 09:51:56 -0000 1.135.2.3 ++++ post_bug.cgi 27 Mar 2007 20:27:05 -0000 @@ -33,6 +33,8 @@ use Bugzilla::Bug; use Bugzilla::User; @@ -114,8 +114,8 @@ Index: Bugzilla.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla.pm,v retrieving revision 1.29.2.2 diff -u -r1.29.2.2 Bugzilla.pm ---- Bugzilla.pm 8 Aug 2006 20:53:40 -0000 1.29.2.2 -+++ Bugzilla.pm 27 Mar 2007 20:27:04 -0000 +--- Bugzilla.pm 8 Aug 2006 20:53:40 -0000 1.29.2.2 ++++ Bugzilla.pm 27 Mar 2007 20:27:04 -0000 @@ -46,6 +46,7 @@ use constant SHUTDOWNHTML_EXEMPT => [ 'editparams.cgi', @@ -129,8 +129,8 @@ Index: Bugzilla/Template.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v retrieving revision 1.41.2.3 diff -u -r1.41.2.3 Template.pm ---- Bugzilla/Template.pm 14 Oct 2006 20:30:54 -0000 1.41.2.3 -+++ Bugzilla/Template.pm 27 Mar 2007 20:27:05 -0000 +--- Bugzilla/Template.pm 14 Oct 2006 20:30:54 -0000 1.41.2.3 ++++ Bugzilla/Template.pm 27 Mar 2007 20:27:05 -0000 @@ -499,6 +499,14 @@ return $var; }, @@ -151,8 +151,8 @@ Index: Bugzilla/User.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/User.pm,v retrieving revision 1.101.2.5 diff -u -r1.101.2.5 User.pm ---- Bugzilla/User.pm 14 Oct 2006 21:07:19 -0000 1.101.2.5 -+++ Bugzilla/User.pm 27 Mar 2007 20:27:05 -0000 +--- Bugzilla/User.pm 14 Oct 2006 21:07:19 -0000 1.101.2.5 ++++ Bugzilla/User.pm 27 Mar 2007 20:27:05 -0000 @@ -236,6 +236,16 @@ return $self->{queries}; } @@ -247,8 +247,8 @@ Index: Bugzilla/DB/Schema.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema.pm,v retrieving revision 1.45.2.2 diff -u -r1.45.2.2 Schema.pm ---- Bugzilla/DB/Schema.pm 19 Jun 2006 18:17:38 -0000 1.45.2.2 -+++ Bugzilla/DB/Schema.pm 27 Mar 2007 20:27:05 -0000 +--- Bugzilla/DB/Schema.pm 19 Jun 2006 18:17:38 -0000 1.45.2.2 ++++ Bugzilla/DB/Schema.pm 27 Mar 2007 20:27:05 -0000 @@ -1040,6 +1040,557 @@ ], }, @@ -812,8 +812,8 @@ Index: Bugzilla/DB/Schema/Mysql.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema/Mysql.pm,v retrieving revision 1.12.2.1 diff -u -r1.12.2.1 Mysql.pm ---- Bugzilla/DB/Schema/Mysql.pm 19 Jun 2006 14:57:14 -0000 1.12.2.1 -+++ Bugzilla/DB/Schema/Mysql.pm 27 Mar 2007 20:27:05 -0000 +--- Bugzilla/DB/Schema/Mysql.pm 19 Jun 2006 14:57:14 -0000 1.12.2.1 ++++ Bugzilla/DB/Schema/Mysql.pm 27 Mar 2007 20:27:05 -0000 @@ -103,9 +103,10 @@ INT3 => 'mediumint', INT4 => 'integer', @@ -842,8 +842,8 @@ Index: Bugzilla/DB/Schema/Pg.pm RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB/Schema/Pg.pm,v retrieving revision 1.9 diff -u -r1.9 Pg.pm ---- Bugzilla/DB/Schema/Pg.pm 15 Jun 2005 03:54:59 -0000 1.9 -+++ Bugzilla/DB/Schema/Pg.pm 27 Mar 2007 20:27:05 -0000 +--- Bugzilla/DB/Schema/Pg.pm 15 Jun 2005 03:54:59 -0000 1.9 ++++ Bugzilla/DB/Schema/Pg.pm 27 Mar 2007 20:27:05 -0000 @@ -69,6 +69,7 @@ INT3 => 'integer', INT4 => 'integer', @@ -857,8 +857,8 @@ Index: createaccount.cgi RCS file: /cvsroot/mozilla/webtools/bugzilla/createaccount.cgi,v retrieving revision 1.46 diff -u -r1.46 createaccount.cgi ---- createaccount.cgi 20 Dec 2005 22:16:07 -0000 1.46 -+++ createaccount.cgi 12 Jun 2007 16:31:57 -0000 +--- createaccount.cgi 20 Dec 2005 22:16:07 -0000 1.46 ++++ createaccount.cgi 12 Jun 2007 16:31:57 -0000 @@ -69,8 +69,8 @@ $vars->{'login'} = $login; diff --git a/mozilla/webtools/testopia/tr_csv2xml.pl b/mozilla/webtools/testopia/tr_csv2xml.pl index d5a060ab0a2..8834801b06d 100644 --- a/mozilla/webtools/testopia/tr_csv2xml.pl +++ b/mozilla/webtools/testopia/tr_csv2xml.pl @@ -85,18 +85,18 @@ sub error { # sub map_TCDB_users { - my ($tcdb_user) = @_; - if ( -r "tcdbUsers" ) - { - open(TCDBUSERS, "tcdbUsers") || error("Cannot open tcdbUsers"); - while () - { - chop; - my ($email_addr,$user_id) = split(/ /); - $tcdb_user->{$user_id} = $email_addr; - } - close(TCDBUSERS); - } + my ($tcdb_user) = @_; + if ( -r "tcdbUsers" ) + { + open(TCDBUSERS, "tcdbUsers") || error("Cannot open tcdbUsers"); + while () + { + chop; + my ($email_addr,$user_id) = split(/ /); + $tcdb_user->{$user_id} = $email_addr; + } + close(TCDBUSERS); + } } # @@ -104,16 +104,16 @@ sub map_TCDB_users # sub peek(*) { - my $fh = shift; - - # Get current position in file. - my $position = tell $fh; - # Read next character. - read(CSVINPUT, my $next_char, 1); - # Restore position in file. - seek(CSVINPUT,$position,0); - - return $next_char; + my $fh = shift; + + # Get current position in file. + my $position = tell $fh; + # Read next character. + read(CSVINPUT, my $next_char, 1); + # Restore position in file. + seek(CSVINPUT,$position,0); + + return $next_char; } # @@ -128,25 +128,25 @@ sub peek(*) # sub print_fields { - my ($file_descriptor,$fields_ref,$testcasenamefield,$tcdb_format) = @_; + my ($file_descriptor,$fields_ref,$testcasenamefield,$tcdb_format) = @_; - my $index = 0; - while ( $index < @$fields_ref ) - { - $fields_ref->[$index] =~ s/"$//g if ( $index == ( @$fields_ref -1 ) ); - $fields_ref->[$index] =~ s/\\"/"/g; - $fields_ref->[$index] =~ s/"/""/g; - if ( $tcdb_format && ( $index == $testcasenamefield ) ) - { - $fields_ref->[$index] =~ s/__\d\d\d\d\d\d\d//g; - $fields_ref->[$index] =~ s/__\d\d\d\d\d\d//g; - $fields_ref->[$index] =~ s/__\d\d\d\d\d//g; - } - print $file_descriptor "\"$fields_ref->[$index]\""; - print $file_descriptor "," if ( $index != ( @$fields_ref -1 ) ); - $index += 1; - } - print $file_descriptor "\n"; + my $index = 0; + while ( $index < @$fields_ref ) + { + $fields_ref->[$index] =~ s/"$//g if ( $index == ( @$fields_ref -1 ) ); + $fields_ref->[$index] =~ s/\\"/"/g; + $fields_ref->[$index] =~ s/"/""/g; + if ( $tcdb_format && ( $index == $testcasenamefield ) ) + { + $fields_ref->[$index] =~ s/__\d\d\d\d\d\d\d//g; + $fields_ref->[$index] =~ s/__\d\d\d\d\d\d//g; + $fields_ref->[$index] =~ s/__\d\d\d\d\d//g; + } + print $file_descriptor "\"$fields_ref->[$index]\""; + print $file_descriptor "," if ( $index != ( @$fields_ref -1 ) ); + $index += 1; + } + print $file_descriptor "\n"; } # @@ -157,270 +157,270 @@ sub print_fields # The Test Case Data Base (TCDB) CSV files also need to be processed to clean up format errors. # # The TCDB CSV errors are: -# 1) Does not escape " used in a field with "". May use \" instead of "" but not always. -# 2) Runs the CSV across multiple lines. -# 3) In some cases a line may be missing the last field. +# 1) Does not escape " used in a field with "". May use \" instead of "" but not always. +# 2) Runs the CSV across multiple lines. +# 3) In some cases a line may be missing the last field. # sub remove_field_list { - my ($input_filename,$work_filename,$tcdb_format) = @_; - my $field_list = ""; - my @field_buffer; - my @fields; - my $fields_index = 0; - my $in_quote_field = 0; - my $line = ""; - my $line_count = 0; - my $number_of_fields = 0; - my $parse_line = ""; - my $testcasenamefield = ""; + my ($input_filename,$work_filename,$tcdb_format) = @_; + my $field_list = ""; + my @field_buffer; + my @fields; + my $fields_index = 0; + my $in_quote_field = 0; + my $line = ""; + my $line_count = 0; + my $number_of_fields = 0; + my $parse_line = ""; + my $testcasenamefield = ""; - open(CSVINPUT, $input_filename) or error("Cannot open file $input_filename"); - open(CSVWORK, ">", $work_filename) or error("Cannot open file $work_filename"); + open(CSVINPUT, $input_filename) or error("Cannot open file $input_filename"); + open(CSVWORK, ">", $work_filename) or error("Cannot open file $work_filename"); - while () - { - chop; + while () + { + chop; - s/\r//g; - # - # Map extended characters into HTML entities. - # - s/\342\200\223/-/g; - s/\342\200\224/—/g; - s/\342\200\230/‘/g; - s/\342\200\231/’/g; - s/\342\200\234/“/g; - s/\342\200\235/”/g; - s/\342\200\246/…/g; - s/\302\240/ /g; - s/\302\251/©/g; - s/\031/'/g; - s/\221/&8216;/g; # left single quotation mark - s/\222/&8217;/g; # right single quotation mark - s/\223/&8220;/g; # left double quotation mark - s/\224/&8221;/g; # right double quotation mark - s/\226/-/g; - s/\337/ß/g; # beta - s/\341/à/g; # small letter a with acute accent - s/\342/á/g; # small letter a with grave accent - s/\344/ä/g; # small letter a with tilde - s/\346/å/g; # small letter a with umlaut - s/\347/æ/g; # small ae - s/\350/ç/g; # small letter c cedilla - s/\351/è/g; # small letter e with acute accent - s/\364/ô/g; # small letter o with circumflex - - $line_count += 1; - if ( $line_count == 1 ) - { - $field_list = $_; - $number_of_fields = $field_list; - $number_of_fields =~ s/[^,]//g; - # Counting the number of commas so number of fields is one more. - $number_of_fields = (length $number_of_fields) + 1; - # Returned $field_list needs to be lower case, all spaces, " and \ removed. - $field_list = lc $field_list; - $field_list =~ s/[\s"\/]//g; - my $index = 0; - # Find the field that contains the Test Case name. - foreach my $field ( split(/,/,$field_list) ) - { - if ( $field eq "testcasename" ) - { - $testcasenamefield = $index ; - last; - } - $index++; - } - next; - } - - if ( ! $tcdb_format ) - { - print CSVWORK $_ . "\n"; - next; - } - - # Missing or empty environment in TCDB has this value in the environment field. Set it to - # null and hope it was not in the middle of a field. - s/"\$EMPTYENV"/""/; - - # TCDB CSV options that are not handled correctly: - # If a field contains some thing like: - # '2. Click "Roles and Tasks " , "Storage" , click "Volumes" and'' - # the "," will be seen as field seperator and not as part of the field. + s/\r//g; + # + # Map extended characters into HTML entities. + # + s/\342\200\223/-/g; + s/\342\200\224/—/g; + s/\342\200\230/‘/g; + s/\342\200\231/’/g; + s/\342\200\234/“/g; + s/\342\200\235/”/g; + s/\342\200\246/…/g; + s/\302\240/ /g; + s/\302\251/©/g; + s/\031/'/g; + s/\221/&8216;/g; # left single quotation mark + s/\222/&8217;/g; # right single quotation mark + s/\223/&8220;/g; # left double quotation mark + s/\224/&8221;/g; # right double quotation mark + s/\226/-/g; + s/\337/ß/g; # beta + s/\341/à/g; # small letter a with acute accent + s/\342/á/g; # small letter a with grave accent + s/\344/ä/g; # small letter a with tilde + s/\346/å/g; # small letter a with umlaut + s/\347/æ/g; # small ae + s/\350/ç/g; # small letter c cedilla + s/\351/è/g; # small letter e with acute accent + s/\364/ô/g; # small letter o with circumflex + + $line_count += 1; + if ( $line_count == 1 ) + { + $field_list = $_; + $number_of_fields = $field_list; + $number_of_fields =~ s/[^,]//g; + # Counting the number of commas so number of fields is one more. + $number_of_fields = (length $number_of_fields) + 1; + # Returned $field_list needs to be lower case, all spaces, " and \ removed. + $field_list = lc $field_list; + $field_list =~ s/[\s"\/]//g; + my $index = 0; + # Find the field that contains the Test Case name. + foreach my $field ( split(/,/,$field_list) ) + { + if ( $field eq "testcasename" ) + { + $testcasenamefield = $index ; + last; + } + $index++; + } + next; + } + + if ( ! $tcdb_format ) + { + print CSVWORK $_ . "\n"; + next; + } + + # Missing or empty environment in TCDB has this value in the environment field. Set it to + # null and hope it was not in the middle of a field. + s/"\$EMPTYENV"/""/; + + # TCDB CSV options that are not handled correctly: + # If a field contains some thing like: + # '2. Click "Roles and Tasks " , "Storage" , click "Volumes" and'' + # the "," will be seen as field seperator and not as part of the field. - # Add the current line onto the line to parse. - $parse_line .= $_; + # Add the current line onto the line to parse. + $parse_line .= $_; - # The end of the TCDB CSV line will be a double quote at the end of the line. Keep combining - # lines until we have a double quote at the end of the line and try to parse the line. - if ( ! ($parse_line =~ /.+\n*"$/) ) - { - $parse_line .= "\\n"; - next; - } + # The end of the TCDB CSV line will be a double quote at the end of the line. Keep combining + # lines until we have a double quote at the end of the line and try to parse the line. + if ( ! ($parse_line =~ /.+\n*"$/) ) + { + $parse_line .= "\\n"; + next; + } - # At this point $parse_line will hopefully contain the full CSV line. It may not though since - # we could have found a double quote at the end of the line used in field that spans multiple - # lines. Parse it below and if we have not found all the fields we will loop back and read - # more lines until the next double quote at the end of the line is found. + # At this point $parse_line will hopefully contain the full CSV line. It may not though since + # we could have found a double quote at the end of the line used in field that spans multiple + # lines. Parse it below and if we have not found all the fields we will loop back and read + # more lines until the next double quote at the end of the line is found. - $in_quote_field = 0; - my $index = 0; - @fields = (); - @field_buffer = (); - my @chars = split(//,$parse_line); - while ( $index <= $#chars ) - { - my $char = $chars[$index]; - if ( $char eq "\"" ) - { - # Following check is for character sequence \". Look at last character in the current - # field_buffer and if it is a \ this " is not the end of the field. - if ( $#field_buffer>=0 && $field_buffer[$#field_buffer] eq "\\" ) - { - push (@field_buffer,$char); - } - elsif ( ! $in_quote_field ) - { - $in_quote_field = 1; - } - else - { - # If this double quote is followed by a comma double quote ',"' it would be the end of the field - # otherwise it should included in the field. Need to ignore white space when searching for the - # next two characters. - # The TCDB never breaks a line at field separators (have not seen it yet anyway) so the code does - # not need to worry about finding a comma at the end of the line and checking for a double quote at - # the beginning of the next line. - my $comma_index = $index+1; - while ( $comma_index<=$#chars ) - { - last if ( $chars[$comma_index] =~ m/\S/ ); - $comma_index++; - } - my $double_quote_index = $comma_index+1; - while ( $double_quote_index<=$#chars ) - { - last if ( $chars[$double_quote_index] =~ m/\S/ && $chars[$double_quote_index] ne ',' ); - $double_quote_index++; - } - # Is the next non-white space character a comma followed by a double quote? If yes then we - # have reached the end of the field. - if ( ( $comma_index <= $#chars && $chars[$comma_index] eq "," ) && - ( $double_quote_index <= $#chars && $chars[$double_quote_index] eq "\"" ) ) - { - push (@fields,join("",@field_buffer)); - @field_buffer = (); - # Skip past the comma. - $index++; - $in_quote_field = 0; - } - # This quote is at end of the line. Assume it's the last double quote on the CSV line. - elsif ( $index == $#chars ) - { - push (@fields,join("",@field_buffer)); - @field_buffer = (); - $in_quote_field = 0; - } - else - { - push (@field_buffer,$char); - } + $in_quote_field = 0; + my $index = 0; + @fields = (); + @field_buffer = (); + my @chars = split(//,$parse_line); + while ( $index <= $#chars ) + { + my $char = $chars[$index]; + if ( $char eq "\"" ) + { + # Following check is for character sequence \". Look at last character in the current + # field_buffer and if it is a \ this " is not the end of the field. + if ( $#field_buffer>=0 && $field_buffer[$#field_buffer] eq "\\" ) + { + push (@field_buffer,$char); + } + elsif ( ! $in_quote_field ) + { + $in_quote_field = 1; + } + else + { + # If this double quote is followed by a comma double quote ',"' it would be the end of the field + # otherwise it should included in the field. Need to ignore white space when searching for the + # next two characters. + # The TCDB never breaks a line at field separators (have not seen it yet anyway) so the code does + # not need to worry about finding a comma at the end of the line and checking for a double quote at + # the beginning of the next line. + my $comma_index = $index+1; + while ( $comma_index<=$#chars ) + { + last if ( $chars[$comma_index] =~ m/\S/ ); + $comma_index++; + } + my $double_quote_index = $comma_index+1; + while ( $double_quote_index<=$#chars ) + { + last if ( $chars[$double_quote_index] =~ m/\S/ && $chars[$double_quote_index] ne ',' ); + $double_quote_index++; + } + # Is the next non-white space character a comma followed by a double quote? If yes then we + # have reached the end of the field. + if ( ( $comma_index <= $#chars && $chars[$comma_index] eq "," ) && + ( $double_quote_index <= $#chars && $chars[$double_quote_index] eq "\"" ) ) + { + push (@fields,join("",@field_buffer)); + @field_buffer = (); + # Skip past the comma. + $index++; + $in_quote_field = 0; + } + # This quote is at end of the line. Assume it's the last double quote on the CSV line. + elsif ( $index == $#chars ) + { + push (@fields,join("",@field_buffer)); + @field_buffer = (); + $in_quote_field = 0; + } + else + { + push (@field_buffer,$char); + } - } - } - # - # This check is for empty fields, i.e. "field1",,"field2". - # - elsif ( $char eq "," && ! $in_quote_field ) - { - push (@fields,""); - } - else - { - if ( $in_quote_field ) - { - push (@field_buffer,$char); - } - else - { - # Only allow white space between fields. - error("Found unexpected character $char after phrase '" . - join("",@field_buffer) . - "' on line $line_count in file $input_filename") if ( $char =~ '\S'); - } - } - $index++; - } - - my $next_char = peek(*CSVINPUT); - my $looks_like_end_of_csv_line = $next_char eq "\"" || $next_char eq ""; - - # Do we have all the fields we need? - if ( ($#fields == ($number_of_fields-1)) && (! $in_quote_field) && $looks_like_end_of_csv_line ) - { - print_fields(\*CSVWORK,\@fields,$testcasenamefield,$tcdb_format); - $parse_line = ""; - @fields = (); - } - # Is this the TCDB export error? We have one less field than needed and the next line begins with a - # double quote. - elsif ( ($#fields == ($number_of_fields-2)) && (! $in_quote_field ) && $looks_like_end_of_csv_line ) - { - if ( $_ =~ m/^"/ ) - { - # Pull double quote of the end of the last field. - $fields[$#fields] =~ s/"$//; - # Create the missing field. Need to insert a double quote since print_fields expects a double - # quote at end of last field. - push (@fields,"\""); - print_fields(\*CSVWORK,\@fields,$testcasenamefield,$tcdb_format); - $parse_line = ""; - @fields = (); - } - } - elsif ( $#fields >= $number_of_fields ) - { - error("Read too many lines. Parse line '$parse_line' at line $line_count in file $input_filename"); - } - else - # Not enough fields yet. Need to append a \n to the $parse_line buffer and starting reading - # until we find another double quote at the end of the line. - { - $parse_line .= "\\n"; - } - } - # When End of File is read the parse_line is suppose to be empty. - error("Reached end of file while parsing '$parse_line'") if ( $parse_line ne "" ); - close(CSVINPUT); - close(CSVWORK); - error("Did not find the last double quote in file") if ( $in_quote_field ); + } + } + # + # This check is for empty fields, i.e. "field1",,"field2". + # + elsif ( $char eq "," && ! $in_quote_field ) + { + push (@fields,""); + } + else + { + if ( $in_quote_field ) + { + push (@field_buffer,$char); + } + else + { + # Only allow white space between fields. + error("Found unexpected character $char after phrase '" . + join("",@field_buffer) . + "' on line $line_count in file $input_filename") if ( $char =~ '\S'); + } + } + $index++; + } + + my $next_char = peek(*CSVINPUT); + my $looks_like_end_of_csv_line = $next_char eq "\"" || $next_char eq ""; + + # Do we have all the fields we need? + if ( ($#fields == ($number_of_fields-1)) && (! $in_quote_field) && $looks_like_end_of_csv_line ) + { + print_fields(\*CSVWORK,\@fields,$testcasenamefield,$tcdb_format); + $parse_line = ""; + @fields = (); + } + # Is this the TCDB export error? We have one less field than needed and the next line begins with a + # double quote. + elsif ( ($#fields == ($number_of_fields-2)) && (! $in_quote_field ) && $looks_like_end_of_csv_line ) + { + if ( $_ =~ m/^"/ ) + { + # Pull double quote of the end of the last field. + $fields[$#fields] =~ s/"$//; + # Create the missing field. Need to insert a double quote since print_fields expects a double + # quote at end of last field. + push (@fields,"\""); + print_fields(\*CSVWORK,\@fields,$testcasenamefield,$tcdb_format); + $parse_line = ""; + @fields = (); + } + } + elsif ( $#fields >= $number_of_fields ) + { + error("Read too many lines. Parse line '$parse_line' at line $line_count in file $input_filename"); + } + else + # Not enough fields yet. Need to append a \n to the $parse_line buffer and starting reading + # until we find another double quote at the end of the line. + { + $parse_line .= "\\n"; + } + } + # When End of File is read the parse_line is suppose to be empty. + error("Reached end of file while parsing '$parse_line'") if ( $parse_line ne "" ); + close(CSVINPUT); + close(CSVWORK); + error("Did not find the last double quote in file") if ( $in_quote_field ); - # - # Sort the corrected CSV to remove duplicate records. - # - if ( $tcdb ) - { - my @args = ( "sort -u -o " . $work_filename . " " . $work_filename ); - system(@args) == 0 or error("Could not sort $work_filename"); - } - - return $field_list; + # + # Sort the corrected CSV to remove duplicate records. + # + if ( $tcdb ) + { + my @args = ( "-u -o " . $work_filename . " " . $work_filename ); + system("sort", @args) == 0 or error("Could not sort $work_filename"); + } + + return $field_list; } # # Remove the leading and trailing white space characters. Remove commas at end of line. # sub remove_white_space { - my ($line) = @_; - $line =~ s/^\s+//g; - $line =~ s/\s+$//g; - $line =~ s/,$//g; + my ($line) = @_; + $line =~ s/^\s+//g; + $line =~ s/\s+$//g; + $line =~ s/,$//g; - return $line; + return $line; } # @@ -430,15 +430,15 @@ sub remove_white_space { # Some new lines have been showing up as \\n in exports. # sub fix_entities { - my ($line) = @_; - $line =~ s/\\n/\n/g; - $line =~ s/\&/&/g; - $line =~ s/\/>/g; - $line =~ s/\'/'/g; - $line =~ s/\"/"/g; + my ($line) = @_; + $line =~ s/\\n/\n/g; + $line =~ s/\&/&/g; + $line =~ s/\/>/g; + $line =~ s/\'/'/g; + $line =~ s/\"/"/g; - return $line; + return $line; } GetOptions("debug" => \$debug, "tcdb" => \$tcdb, "help|usage|?" => \$usage); @@ -524,12 +524,12 @@ $field_list =~ s/,$//; my %fields; foreach my $field ( split(/,/,$field_list) ) { - $fields{$field} = ""; + $fields{$field} = ""; } my $csv = Class::CSV->parse( - filename => $csv_work_filename, - fields => [ split(/,/,$field_list) ] + filename => $csv_work_filename, + fields => [ split(/,/,$field_list) ] ); print XMLOUTPUT "\n"; @@ -538,7 +538,7 @@ my $testopia_dtd = "testopia.dtd"; open(DTDINPUT,$testopia_dtd) || die "Cannot open $testopia_dtd\n"; while () { - print XMLOUTPUT $_; + print XMLOUTPUT $_; } close(DTDINPUT); print XMLOUTPUT "]>\n"; @@ -546,150 +546,150 @@ print XMLOUTPUT "\n"; if ( $TEST_PLAN_AUTHOR ne "Change TEST_PLAN_AUTHOR in import.pl user\@novell.com" ) { - print XMLOUTPUT " \n"; - print XMLOUTPUT " " . TEST_PLAN_NAME . "\n"; - print XMLOUTPUT " " . TEST_PLAN_PRODUCT . "\n"; - print XMLOUTPUT " " . TEST_PLAN_PRODUCT_VERSION . "\n"; - print XMLOUTPUT " " . TEST_PLAN_DOCUMENT . "\n"; - print XMLOUTPUT " \n"; + print XMLOUTPUT " \n"; + print XMLOUTPUT " " . TEST_PLAN_NAME . "\n"; + print XMLOUTPUT " " . TEST_PLAN_PRODUCT . "\n"; + print XMLOUTPUT " " . TEST_PLAN_PRODUCT_VERSION . "\n"; + print XMLOUTPUT " " . TEST_PLAN_DOCUMENT . "\n"; + print XMLOUTPUT " \n"; } my $line_count = 0; foreach my $line (@{$csv->lines()}) { - $line_count += 1; - print XMLOUTPUT " owner(); - $owner = $tcdb_user{$line->owner()} if ( $tcdb ); - error("Could not find owner for Test Case at line $line_count in $csv_work_filename") if ( $owner eq "" ); - - print XMLOUTPUT "author=\"" . fix_entities($owner) . "\" "; - if ( defined($fields{'priority'}) ) - { - my $priority = fix_entities($line->priority()); - $priority =~ s/ .*//g; - $priority = uc $priority; - $priority = "P5" if ( $priority eq "" ); - $priority = "P" . $priority if ( ! ( $priority =~ m/^P.*/ ) ); - print XMLOUTPUT "priority=\"" . fix_entities($priority) . "\" "; - } - print XMLOUTPUT "automated=\"Manual\" "; - print XMLOUTPUT "status=\"CONFIRMED\">\n"; - print XMLOUTPUT " " . TEST_PLAN_NAME . "\n"; - my $summary; - if ( defined($fields{'testcasename'}) ) - { - $summary = fix_entities($line->testcasename()); - } - elsif ( defined($fields{'description'}) ) - { - $summary = fix_entities($line->description()); - } - if ( defined($fields{'environment'}) ) - { - my $environment = $line->environment(); - $summary .= " - " . fix_entities($environment) if ( $environment ne "" ); - } - error("No summary for Test Case at line $line_count in $csv_work_filename") if ( $summary eq "" ); - print XMLOUTPUT " " . $summary . "\n"; - print XMLOUTPUT " " . fix_entities($owner) . "\n"; - if ( $tcdb && defined($fields{'folder'}) ) - { - my @folder = split(/\\/,$line->folder()); - print XMLOUTPUT " " . fix_entities($folder[4]) . "\n" if ( defined( $folder[4] ) ); - if ( defined($fields{'category'}) ) - { - print XMLOUTPUT " " . fix_entities($folder[5]) . "\n" if ( defined( $folder[5] ) ); - } - else - { - print XMLOUTPUT " " . fix_entities($folder[5]) . "\n" if ( defined( $folder[5] ) ); - } - my $fieldstart = 6; - while ( defined $folder[$fieldstart] ) - { - print XMLOUTPUT " " . fix_entities($folder[$fieldstart]) . "\n"; - $fieldstart += 1; - } - } - if ( defined($fields{'attributes'}) ) - { - my @attributes = split(/,/,$line->attributes()); - foreach my $attribute (@attributes) - { - print XMLOUTPUT " " . fix_entities(remove_white_space($attribute)) . "\n"; - } - } - if ( defined($fields{'environment'}) ) - { - my @environments = split(/,/,$line->environment()); + $line_count += 1; + print XMLOUTPUT " owner(); + $owner = $tcdb_user{$line->owner()} if ( $tcdb ); + error("Could not find owner for Test Case at line $line_count in $csv_work_filename") if ( $owner eq "" ); + + print XMLOUTPUT "author=\"" . fix_entities($owner) . "\" "; + if ( defined($fields{'priority'}) ) + { + my $priority = fix_entities($line->priority()); + $priority =~ s/ .*//g; + $priority = uc $priority; + $priority = "P5" if ( $priority eq "" ); + $priority = "P" . $priority if ( ! ( $priority =~ m/^P.*/ ) ); + print XMLOUTPUT "priority=\"" . fix_entities($priority) . "\" "; + } + print XMLOUTPUT "automated=\"Manual\" "; + print XMLOUTPUT "status=\"CONFIRMED\">\n"; + print XMLOUTPUT " " . TEST_PLAN_NAME . "\n"; + my $summary; + if ( defined($fields{'testcasename'}) ) + { + $summary = fix_entities($line->testcasename()); + } + elsif ( defined($fields{'description'}) ) + { + $summary = fix_entities($line->description()); + } + if ( defined($fields{'environment'}) ) + { + my $environment = $line->environment(); + $summary .= " - " . fix_entities($environment) if ( $environment ne "" ); + } + error("No summary for Test Case at line $line_count in $csv_work_filename") if ( $summary eq "" ); + print XMLOUTPUT " " . $summary . "\n"; + print XMLOUTPUT " " . fix_entities($owner) . "\n"; + if ( $tcdb && defined($fields{'folder'}) ) + { + my @folder = split(/\\/,$line->folder()); + print XMLOUTPUT " " . fix_entities($folder[4]) . "\n" if ( defined( $folder[4] ) ); + if ( defined($fields{'category'}) ) + { + print XMLOUTPUT " " . fix_entities($folder[5]) . "\n" if ( defined( $folder[5] ) ); + } + else + { + print XMLOUTPUT " " . fix_entities($folder[5]) . "\n" if ( defined( $folder[5] ) ); + } + my $fieldstart = 6; + while ( defined $folder[$fieldstart] ) + { + print XMLOUTPUT " " . fix_entities($folder[$fieldstart]) . "\n"; + $fieldstart += 1; + } + } + if ( defined($fields{'attributes'}) ) + { + my @attributes = split(/,/,$line->attributes()); + foreach my $attribute (@attributes) + { + print XMLOUTPUT " " . fix_entities(remove_white_space($attribute)) . "\n"; + } + } + if ( defined($fields{'environment'}) ) + { + my @environments = split(/,/,$line->environment()); - foreach my $environment (@environments) - { - print XMLOUTPUT " " . fix_entities(remove_white_space($environment)) . "\n"; - } - } - if ( defined($fields{'component'}) && ( $line->component() ne "") ) - { - print XMLOUTPUT " " . fix_entities(remove_white_space($line->component())) . "\n"; - } - if ( defined($fields{'category'}) && ( $line->category() ne "") ) - { - print XMLOUTPUT " " . fix_entities(remove_white_space($line->category())) . "\n"; - } - if ( defined($fields{'setupsteps'}) && ( $line->setupsteps() ne "") ) - { - print XMLOUTPUT " "; - print XMLOUTPUT "[TCDB Setup Steps]\n" if ( $tcdb ); - print XMLOUTPUT fix_entities($line->setupsteps()); - print XMLOUTPUT "\n"; - } - if ( defined($fields{'cleanupsteps'}) && ( $line->cleanupsteps() ne "") ) - { - print XMLOUTPUT " "; - print XMLOUTPUT "[TCDB Cleanup Steps]\n" if ( $tcdb ); - print XMLOUTPUT fix_entities($line->cleanupsteps()); - print XMLOUTPUT "\n"; - } - print XMLOUTPUT " "; - if ( $tcdb ) - { - if ( defined($fields{'testcasename'}) && ( $line->testcasename() ne "") ) - { - print XMLOUTPUT "[TCDB Test Case Name]\n"; - print XMLOUTPUT fix_entities($line->testcasename()); - } - if ( defined($fields{'description'}) && ( $line->description() ne "") ) - { - print XMLOUTPUT "\n\n[TCDB Description]\n"; - print XMLOUTPUT fix_entities($line->description()); - } - if ( defined($fields{'longdescription'}) && ( $line->longdescription() ne "") ) - { - print XMLOUTPUT "\n\n[TCDB Long Description]\n"; - print XMLOUTPUT fix_entities($line->longdescription()); - } - if ( defined($fields{'resdetails'}) && ( $line->resdetails() ne "") ) - { - print XMLOUTPUT "\n\n[TCDB Resolution Details]\n"; - print XMLOUTPUT fix_entities($line->resdetails()); - } - } - if ( defined($fields{'steps'}) && ( $line->steps() ne "") ) - { - print XMLOUTPUT "\n\n[TCDB Steps]\n" if ( $tcdb ); - print XMLOUTPUT fix_entities($line->steps()); - } - print XMLOUTPUT "\n"; - if ( defined($fields{'passfaildefinition'}) && ( $line->passfaildefinition() ne "") ) - { - print XMLOUTPUT " "; - print XMLOUTPUT "[TCDB Pass Fail Definition]\n" if ( $tcdb ); - print XMLOUTPUT fix_entities($line->passfaildefinition()); - print XMLOUTPUT "\n"; - } - print XMLOUTPUT " \n"; + foreach my $environment (@environments) + { + print XMLOUTPUT " " . fix_entities(remove_white_space($environment)) . "\n"; + } + } + if ( defined($fields{'component'}) && ( $line->component() ne "") ) + { + print XMLOUTPUT " " . fix_entities(remove_white_space($line->component())) . "\n"; + } + if ( defined($fields{'category'}) && ( $line->category() ne "") ) + { + print XMLOUTPUT " " . fix_entities(remove_white_space($line->category())) . "\n"; + } + if ( defined($fields{'setupsteps'}) && ( $line->setupsteps() ne "") ) + { + print XMLOUTPUT " "; + print XMLOUTPUT "[TCDB Setup Steps]\n" if ( $tcdb ); + print XMLOUTPUT fix_entities($line->setupsteps()); + print XMLOUTPUT "\n"; + } + if ( defined($fields{'cleanupsteps'}) && ( $line->cleanupsteps() ne "") ) + { + print XMLOUTPUT " "; + print XMLOUTPUT "[TCDB Cleanup Steps]\n" if ( $tcdb ); + print XMLOUTPUT fix_entities($line->cleanupsteps()); + print XMLOUTPUT "\n"; + } + print XMLOUTPUT " "; + if ( $tcdb ) + { + if ( defined($fields{'testcasename'}) && ( $line->testcasename() ne "") ) + { + print XMLOUTPUT "[TCDB Test Case Name]\n"; + print XMLOUTPUT fix_entities($line->testcasename()); + } + if ( defined($fields{'description'}) && ( $line->description() ne "") ) + { + print XMLOUTPUT "\n\n[TCDB Description]\n"; + print XMLOUTPUT fix_entities($line->description()); + } + if ( defined($fields{'longdescription'}) && ( $line->longdescription() ne "") ) + { + print XMLOUTPUT "\n\n[TCDB Long Description]\n"; + print XMLOUTPUT fix_entities($line->longdescription()); + } + if ( defined($fields{'resdetails'}) && ( $line->resdetails() ne "") ) + { + print XMLOUTPUT "\n\n[TCDB Resolution Details]\n"; + print XMLOUTPUT fix_entities($line->resdetails()); + } + } + if ( defined($fields{'steps'}) && ( $line->steps() ne "") ) + { + print XMLOUTPUT "\n\n[TCDB Steps]\n" if ( $tcdb ); + print XMLOUTPUT fix_entities($line->steps()); + } + print XMLOUTPUT "\n"; + if ( defined($fields{'passfaildefinition'}) && ( $line->passfaildefinition() ne "") ) + { + print XMLOUTPUT " "; + print XMLOUTPUT "[TCDB Pass Fail Definition]\n" if ( $tcdb ); + print XMLOUTPUT fix_entities($line->passfaildefinition()); + print XMLOUTPUT "\n"; + } + print XMLOUTPUT " \n"; } print XMLOUTPUT "\n"; diff --git a/mozilla/webtools/testopia/tr_importxml.pl b/mozilla/webtools/testopia/tr_importxml.pl index ed2c1d1c7c9..cc43a5395e2 100644 --- a/mozilla/webtools/testopia/tr_importxml.pl +++ b/mozilla/webtools/testopia/tr_importxml.pl @@ -83,17 +83,17 @@ my $xml; my $filename; if ( $#ARGV == -1 ) { - # Read STDIN in slurp mode. VERY dangerous, but we live on the wild side ;-) - local($/); - $xml = <>; + # Read STDIN in slurp mode. VERY dangerous, but we live on the wild side ;-) + local($/); + $xml = <>; } elsif ( $#ARGV == 0 ) { - $filename = $ARGV[0]; + $filename = $ARGV[0]; } else { - pod2usage(0); + pod2usage(0); } Debug("Parsing tree", DEBUG_LEVEL); diff --git a/mozilla/webtools/testopia/tr_list_cases.cgi b/mozilla/webtools/testopia/tr_list_cases.cgi index 1fd54d482ba..b44c9d251ac 100755 --- a/mozilla/webtools/testopia/tr_list_cases.cgi +++ b/mozilla/webtools/testopia/tr_list_cases.cgi @@ -438,22 +438,22 @@ if ($serverpush && !$cgi->param('debug')) { print $cgi->multipart_start; } else { - my @time = localtime(time()); - my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; - my $filename = "testcases-$date.$format->{extension}"; - - my $disp = "inline"; - # We set CSV files to be downloaded, as they are designed for importing + my @time = localtime(time()); + my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; + my $filename = "testcases-$date.$format->{extension}"; + + my $disp = "inline"; + # We set CSV files to be downloaded, as they are designed for importing # into other programs. if ( $format->{'extension'} eq "csv" || $format->{'extension'} eq "xml" ) { - $disp = "attachment"; - $vars->{'displaycolumns'} = \@Bugzilla::Testopia::Constants::TESTCASE_EXPORT; + $disp = "attachment"; + $vars->{'displaycolumns'} = \@Bugzilla::Testopia::Constants::TESTCASE_EXPORT; } # Suggest a name for the bug list if the user wants to save it as a file. print $cgi->header(-type => $contenttype, - -content_disposition => "$disp; filename=$filename"); + -content_disposition => "$disp; filename=$filename"); } $template->process($format->{'template'}, $vars) diff --git a/mozilla/webtools/testopia/tr_query.cgi b/mozilla/webtools/testopia/tr_query.cgi index 5bd8cbb58f4..79a1dfdb1ff 100755 --- a/mozilla/webtools/testopia/tr_query.cgi +++ b/mozilla/webtools/testopia/tr_query.cgi @@ -174,7 +174,7 @@ elsif ($action eq 'get_categories'){ my $cats_ref = $cat->get_element_categories_by_product($prod_id); foreach my $e (@{$cats_ref}){ - $ret .= $e->id.'||'.$e->name.'|||'; + $ret .= $e->id.'||'.$e->name.'|||'; } } chop($ret); @@ -230,13 +230,13 @@ elsif ($action eq 'get_valid_exp'){ my $prop = Bugzilla::Testopia::Environment::Property->new($prop_id); my $exp = $prop->validexp; - my @exps = split /\|/, $exp; - foreach my $exp (@exps){ - $ret .=$exp.'|||'; - } + my @exps = split /\|/, $exp; + foreach my $exp (@exps){ + $ret .=$exp.'|||'; + } } - chop($ret); - print $ret; + chop($ret); + print $ret; } elsif ($action eq 'save_query'){ ; diff --git a/mozilla/webtools/testopia/tr_show_case.cgi b/mozilla/webtools/testopia/tr_show_case.cgi index 1bbae7cdbfe..f453667e22b 100755 --- a/mozilla/webtools/testopia/tr_show_case.cgi +++ b/mozilla/webtools/testopia/tr_show_case.cgi @@ -50,9 +50,9 @@ local our $cgi = Bugzilla->cgi; my $case_id = trim(Bugzilla->cgi->param('case_id')) || ''; unless ($case_id){ - print $cgi->header(); - $template->process("testopia/case/choose.html.tmpl", $vars) - || ThrowTemplateError($template->error()); + print $cgi->header(); + $template->process("testopia/case/choose.html.tmpl", $vars) + || ThrowTemplateError($template->error()); exit; } validate_test_id($case_id, 'case'); @@ -65,8 +65,8 @@ my $disp = "inline"; # into other programs. if ( $format->{'extension'} eq "csv" || $format->{'extension'} eq "xml" ) { - $disp = "attachment"; - $vars->{'displaycolumns'} = \@Bugzilla::Testopia::Constants::TESTCASE_EXPORT; + $disp = "attachment"; + $vars->{'displaycolumns'} = \@Bugzilla::Testopia::Constants::TESTCASE_EXPORT; } # Suggest a name for the file if the user wants to save it as a file. @@ -74,7 +74,7 @@ my @time = localtime(time()); my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; my $filename = "testcase-$case_id-$date.$format->{extension}"; print $cgi->header(-type => $format->{'ctype'}, - -content_disposition => "$disp; filename=$filename"); + -content_disposition => "$disp; filename=$filename"); $vars->{'action'} = "Commit"; $vars->{'form_action'} = "tr_show_case.cgi"; @@ -103,7 +103,7 @@ elsif ($action eq 'do_clone'){ } if ($cgi->param('existing')){ foreach my $p (@{$case->plans}){ - $planseen{$p->id} = 1; + $planseen{$p->id} = 1; } } my $author = $cgi->param('keepauthor') ? $case->author->id : Bugzilla->user->id; @@ -457,6 +457,6 @@ sub display { $vars->{'case'} = $case; $vars->{'table'} = $table; $vars->{'user'} = Bugzilla->user; - $template->process($format->{'template'}, $vars) || - ThrowTemplateError($template->error()); + $template->process($format->{'template'}, $vars) || + ThrowTemplateError($template->error()); } diff --git a/mozilla/webtools/testopia/tr_show_environment.cgi b/mozilla/webtools/testopia/tr_show_environment.cgi index edcd6818485..e8780df511c 100755 --- a/mozilla/webtools/testopia/tr_show_environment.cgi +++ b/mozilla/webtools/testopia/tr_show_environment.cgi @@ -248,17 +248,17 @@ else { sub display { - detaint_natural($env_id); + detaint_natural($env_id); validate_test_id($env_id, 'environment'); my $env = Bugzilla::Testopia::Environment->new($env_id); if(!defined($env)){ - my $env = Bugzilla::Testopia::Environment->new({'environment_id' => 0}); - $vars->{'environment'} = $env; - $vars->{'action'} = 'do_add'; - $template->process("testopia/environment/add.html.tmpl", $vars) - || print $template->error(); - exit; + my $env = Bugzilla::Testopia::Environment->new({'environment_id' => 0}); + $vars->{'environment'} = $env; + $vars->{'action'} = 'do_add'; + $template->process("testopia/environment/add.html.tmpl", $vars) + || print $template->error(); + exit; } ThrowUserError("testopia-read-only", {'object' => $env}) unless $env->canview; my $category = Bugzilla::Testopia::Environment::Category->new({'id' => 0}); diff --git a/mozilla/webtools/testopia/tr_show_plan.cgi b/mozilla/webtools/testopia/tr_show_plan.cgi index 45eed0585bb..7081ebb519a 100755 --- a/mozilla/webtools/testopia/tr_show_plan.cgi +++ b/mozilla/webtools/testopia/tr_show_plan.cgi @@ -436,24 +436,24 @@ sub display { $vars->{'plan'} = $plan; my $format = $template->get_format("testopia/plan/show", scalar $cgi->param('format'), scalar $cgi->param('ctype')); - my $disp = "inline"; - # We set CSV files to be downloaded, as they are designed for importing + my $disp = "inline"; + # We set CSV files to be downloaded, as they are designed for importing # into other programs. if ( $format->{'extension'} eq "csv" || $format->{'extension'} eq "xml" ) { - $disp = "attachment"; - $vars->{'displaycolumns'} = \@Bugzilla::Testopia::Constants::TESTCASE_EXPORT; + $disp = "attachment"; + $vars->{'displaycolumns'} = \@Bugzilla::Testopia::Constants::TESTCASE_EXPORT; } - - # Suggest a name for the file if the user wants to save it as a file. + + # Suggest a name for the file if the user wants to save it as a file. my @time = localtime(time()); my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3]; - my $filename = "testcases-$date.$format->{extension}"; + my $filename = "testcases-$date.$format->{extension}"; print $cgi->header(-type => $format->{'ctype'}, - -content_disposition => "$disp; filename=$filename") - unless ($action eq 'do_clone'); - - $vars->{'percentage'} = \&percentage; + -content_disposition => "$disp; filename=$filename") + unless ($action eq 'do_clone'); + + $vars->{'percentage'} = \&percentage; $template->process($format->{'template'}, $vars) || ThrowTemplateError($template->error()); diff --git a/mozilla/webtools/testopia/tr_xmlrpc.cgi b/mozilla/webtools/testopia/tr_xmlrpc.cgi index 5ec0f650c5e..df10a2b425b 100755 --- a/mozilla/webtools/testopia/tr_xmlrpc.cgi +++ b/mozilla/webtools/testopia/tr_xmlrpc.cgi @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -wT ####!/usr/bin/perl -d:ptkdb -wT # -*- Mode: perl; indent-tabs-mode: nil -*- #