Update links to new location in extensions

git-svn-id: svn://10.0.0.236/trunk@258275 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ghendricks%novell.com 2009-08-27 19:16:17 +00:00
parent 8dc64681a3
commit 3ee97f9bd9
23 changed files with 438 additions and 438 deletions

View File

@ -21,7 +21,7 @@
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::Attachment;
package Testopia::Attachment;
use strict;
@ -29,8 +29,8 @@ use Bugzilla::Util;
use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Util;
use Testopia::Constants;
use Testopia::Util;
use base qw(Exporter Bugzilla::Object);
@ -78,14 +78,14 @@ sub _validate_data {
sub _check_plan {
my ($invocant, $plan_id) = @_;
Bugzilla::Testopia::Util::validate_test_id($plan_id, 'plan');
Testopia::Util::validate_test_id($plan_id, 'plan');
trick_taint($plan_id);
return $plan_id;
}
sub _check_case {
my ($invocant, $case_id) = @_;
Bugzilla::Testopia::Util::validate_test_id($case_id, 'case');
Testopia::Util::validate_test_id($case_id, 'case');
trick_taint($case_id);
return $case_id;
}
@ -166,7 +166,7 @@ sub create {
}
$field_values->{contents} = _validate_data($field_values->{contents});
$field_values->{creation_ts} = Bugzilla::Testopia::Util::get_time_stamp();
$field_values->{creation_ts} = Testopia::Util::get_time_stamp();
$field_values->{mime_type} ||= 'application/octet-stream';
my $contents = $field_values->{contents};
@ -438,7 +438,7 @@ sub cases {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
require Bugzilla::Testopia::TestCase;
require Testopia::TestCase;
return $self->{'cases'} if exists $self->{'cases'};
my $caseids = $dbh->selectcol_arrayref(
@ -447,7 +447,7 @@ sub cases {
undef, $self->id);
my @cases;
foreach my $id (@{$caseids}){
push @cases, Bugzilla::Testopia::TestCase->new($id);
push @cases, Testopia::TestCase->new($id);
}
$self->{'cases'} = \@cases;
@ -458,7 +458,7 @@ sub plans {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
require Bugzilla::Testopia::TestPlan;
require Testopia::TestPlan;
return $self->{'plans'} if exists $self->{'plans'};
my $planids = $dbh->selectcol_arrayref(
@ -467,7 +467,7 @@ sub plans {
undef, $self->id);
my @plans;
foreach my $id (@{$planids}){
push @plans, Bugzilla::Testopia::TestPlan->new($id);
push @plans, Testopia::TestPlan->new($id);
}
$self->{'plans'} = \@plans;
@ -486,7 +486,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::Attachment - Attachment object for Testopia
Testopia::Attachment - Attachment object for Testopia
=head1 EXTENDS
@ -503,10 +503,10 @@ an optional id for the case_run in which it was linked.
=head2 Creating
$attachment = Bugzilla::Testopia::Attachment->new($attachment_id);
$attachment = Bugzilla::Testopia::Attachment->new({name => $name});
$attachment = Testopia::Attachment->new($attachment_id);
$attachment = Testopia::Attachment->new({name => $name});
$new_attachment = Bugzilla::Testopia::Attachment->create({name => $name,
$new_attachment = Testopia::Attachment->create({name => $name,
description => $desc
... });
@ -595,7 +595,7 @@ The ID of the person that uploaded the attachment.
or a hash with the "name" key representing the named
attachment in the database.
Returns: A blessed Bugzilla::Testopia::Attachment object
Returns: A blessed Testopia::Attachment object
=item C<candelete()>
@ -787,8 +787,8 @@ The ID of the person that uploaded the attachment.
=over
L<Bugzilla::Testopia::TestCase>
L<Bugzilla::Testopia::TestPlan>
L<Testopia::TestCase>
L<Testopia::TestPlan>
L<Bugzilla::Object>
=back

View File

@ -18,17 +18,17 @@
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::Build;
package Testopia::Build;
use strict;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Testopia::Product;
use Testopia::Product;
use JSON;
use base qw(Exporter Bugzilla::Object);
@Bugzilla::Testopia::Build::EXPORT = qw(check_build);
@Testopia::Build::EXPORT = qw(check_build);
###############################
#### Initialization ####
@ -67,7 +67,7 @@ sub _check_product {
$product = Bugzilla::Product::check_product($product_id);
}
else {
$product = Bugzilla::Testopia::Product->new($product_id);
$product = Testopia::Product->new($product_id);
}
if (ref $invocant){
@ -196,7 +196,7 @@ sub check_build {
undef, $name, $product->id);
if ($throw){
ThrowUserError('invalid-test-id-non-existent', {type => 'Build', id => $name}) unless $is;
return Bugzilla::Testopia::Build->new($is);
return Testopia::Build->new($is);
}
return $is;
}
@ -250,7 +250,7 @@ sub product {
return $self->{'product'} if exists $self->{'product'};
$self->{'product'} = Bugzilla::Testopia::Product->new($self->product_id);
$self->{'product'} = Testopia::Product->new($self->product_id);
return $self->{'product'};
}
@ -299,14 +299,14 @@ sub runs {
my $dbh = Bugzilla->dbh;
return $self->{'runs'} if exists $self->{'runs'};
require Bugzilla::Testopia::TestRun;
require Testopia::TestRun;
my $runids = $dbh->selectcol_arrayref("SELECT run_id FROM test_runs
WHERE build_id = ?",
undef, $self->id);
my @runs;
foreach my $id (@{$runids}){
push @runs, Bugzilla::Testopia::TestRun->new($id);
push @runs, Testopia::TestRun->new($id);
}
$self->{'runs'} = \@runs;
@ -324,14 +324,14 @@ sub caseruns {
my $dbh = Bugzilla->dbh;
return $self->{'caseruns'} if exists $self->{'caseruns'};
require Bugzilla::Testopia::TestCaseRun;
require Testopia::TestCaseRun;
my $ids = $dbh->selectcol_arrayref("SELECT case_run_id FROM test_case_runs
WHERE build_id = ?",
undef, $self->id);
my @caseruns;
foreach my $id (@{$ids}){
push @caseruns, Bugzilla::Testopia::TestCaseRun->new($id);
push @caseruns, Testopia::TestCaseRun->new($id);
}
$self->{'caseruns'} = \@caseruns;
@ -344,7 +344,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::Build
Testopia::Build
=head1 EXTENDS
@ -360,10 +360,10 @@ and are associated with a milestone if targetmilestones are used in Bugzilla.
=head2 Creating
$build = Bugzilla::Testopia::Build->new($build_id);
$build = Bugzilla::Testopia::Build->new({name => $name});
$build = Testopia::Build->new($build_id);
$build = Testopia::Build->new({name => $name});
$new_build = Bugzilla::Testopia::Build->create({name => $name,
$new_build = Testopia::Build->create({name => $name,
description => $desc
... });
@ -457,7 +457,7 @@ Boolean - Determines whether to show this build in lists for selection.
or a hash with the "name" key representing the named
build in the database.
Returns: A blessed Bugzilla::Testopia::Build object
Returns: A blessed Testopia::Build object
=item C<create()>
@ -551,7 +551,7 @@ Boolean - Determines whether to show this build in lists for selection.
=item C<product()>
Returns a Bugzilla::Testopia::Product object of the product this build is of.
Returns a Testopia::Product object of the product this build is of.
=item C<product_id()>
@ -573,8 +573,8 @@ Boolean - Determines whether to show this build in lists for selection.
=over
L<Bugzilla::Testopia::Product>
L<Bugzilla::Testopia::TestRun>
L<Testopia::Product>
L<Testopia::TestRun>
L<Bugzilla::Object>
=back

View File

@ -18,18 +18,18 @@
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::Category;
package Testopia::Category;
use strict;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Testopia::Product;
use Testopia::Product;
use JSON;
use base qw(Exporter Bugzilla::Object);
@Bugzilla::Testopia::Category::EXPORT = qw(check_case_category);
@Testopia::Category::EXPORT = qw(check_case_category);
###############################
#### Initialization ####
@ -63,10 +63,10 @@ sub _check_product {
my $product;
if (trim($product_id) !~ /^\d+$/ ){
$product = Bugzilla::Product::check_product($product_id);
$product = Bugzilla::Testopia::Product->new($product->id);
$product = Testopia::Product->new($product->id);
}
else {
$product = Bugzilla::Testopia::Product->new($product_id);
$product = Testopia::Product->new($product_id);
}
@ -227,7 +227,7 @@ sub product {
return $self->{'product'} if exists $self->{'product'};
$self->{'product'} = Bugzilla::Testopia::Product->new($self->product_id);
$self->{'product'} = Testopia::Product->new($self->product_id);
return $self->{'product'};
}
@ -266,7 +266,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::Category - An object representing a test case category
Testopia::Category - An object representing a test case category
=head1 EXTENDS
@ -282,10 +282,10 @@ Every plan in a product will have access to that product's categories.
=head2 Creating
$category = Bugzilla::Testopia::Category->new($category_id);
$category = Bugzilla::Testopia::Category->new({name => $name});
$category = Testopia::Category->new($category_id);
$category = Testopia::Category->new({name => $name});
$new_category = Bugzilla::Testopia::Category->create({name => $name,
$new_category = Testopia::Category->create({name => $name,
description => $desc});
=head2 Updating
@ -364,7 +364,7 @@ A detailed description for this category.
or a hash with the "name" key representing the named
category in the database.
Returns: A blessed Bugzilla::Testopia::Category object
Returns: A blessed Testopia::Category object
=back
@ -506,9 +506,9 @@ A detailed description for this category.
=head1 SEE ALSO
L<Bugzilla::Testopia::TestCase>
L<Testopia::TestCase>
L<Bugzilla::Testopia::Product>
L<Testopia::Product>
L<Bugzilla::Object>

View File

@ -19,7 +19,7 @@
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Andrew Nelson <anelson@novell.com>
package Bugzilla::Testopia::Classification;
package Testopia::Classification;
use strict;
@ -55,7 +55,7 @@ sub user_visible_products {
my @products;
foreach my $product_id (@$product_ids) {
push (@products, new Bugzilla::Testopia::Product($product_id));
push (@products, new Testopia::Product($product_id));
}
$self->{'user_visible_products'} = \@products;
}

View File

@ -18,11 +18,11 @@
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::Constants;
package Testopia::Constants;
use strict;
use base qw(Exporter);
@Bugzilla::Testopia::Constants::EXPORT = qw(
@Testopia::Constants::EXPORT = qw(
PROPOSED
CONFIRMED
DISABLED
@ -62,7 +62,7 @@ TIME_FORMAT
#
# All _id fields but case_id are converted to a string representation.
#
@Bugzilla::Testopia::Constants::TESTCASE_EXPORT = qw(
@Testopia::Constants::TESTCASE_EXPORT = qw(
case_id
summary
set_up

View File

@ -23,7 +23,7 @@
=head1 NAME
Bugzilla::Testopia::Environment - A test environment
Testopia::Environment - A test environment
=head1 DESCRIPTION
@ -38,12 +38,12 @@ of the possible values.
=head1 SYNOPSIS
$env = Bugzilla::Testopia::Environment->new($env_id);
$env = Bugzilla::Testopia::Environment->new(\%env_hash);
$env = Testopia::Environment->new($env_id);
$env = Testopia::Environment->new(\%env_hash);
=cut
package Bugzilla::Testopia::Environment;
package Testopia::Environment;
use strict;
@ -52,9 +52,9 @@ use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Config;
use Bugzilla::Testopia::Environment::Category;
use Bugzilla::Testopia::Environment::Element;
use Bugzilla::Testopia::Environment::Property;
use Testopia::Environment::Category;
use Testopia::Environment::Element;
use Testopia::Environment::Property;
use JSON;
@ -100,15 +100,15 @@ sub _check_product {
$product_id = trim($product_id);
require Bugzilla::Testopia::Product;
require Testopia::Product;
my $product;
if (trim($product_id) !~ /^\d+$/ ){
$product = Bugzilla::Product::check_product($product_id);
$product = Bugzilla::Testopia::Product->new($product->id);
$product = Testopia::Product->new($product->id);
}
else {
$product = Bugzilla::Testopia::Product->new($product_id);
$product = Testopia::Product->new($product_id);
}
ThrowUserError("testopia-create-denied", {'object' => 'environment'}) unless $product->canedit;
@ -221,8 +221,8 @@ sub create_full {
# first, get ALL rows to add to test_environment_map table
# and store them in @environment_map array
foreach my $key (keys(%{$environment})){
require Bugzilla::Testopia::Environment::Category;
my $cat = Bugzilla::Testopia::Environment::Category->new({'product_id' => $prod_id});
require Testopia::Environment::Category;
my $cat = Testopia::Environment::Category->new({'product_id' => $prod_id});
my $cat_id = $cat->check_category($key);
if (!$cat_id) { warn "category: $key for id: $cat did not exist"; return 0; }
_parseElementsRecursively($environment->{$key}, $cat_id, 'category');
@ -295,8 +295,8 @@ sub _parseElementsRecursively {
foreach my $key (keys(%{$hash})) {
if(ref($hash->{$key})){ # must be element, since property contains value instead of another hash
require Bugzilla::Testopia::Environment::Element;
my $elem = Bugzilla::Testopia::Environment::Element->new({});
require Testopia::Environment::Element;
my $elem = Testopia::Environment::Element->new({});
# get exising element OR create new one
my ($elem_id) = $elem->check_element($key, $callerid);
if(!$elem_id){
@ -310,8 +310,8 @@ sub _parseElementsRecursively {
}
_parseElementsRecursively($hash->{$key}, $elem_id, 'element', $categoryid);
} else {
require Bugzilla::Testopia::Environment::Property;
my $prop = Bugzilla::Testopia::Environment::Property->new({});
require Testopia::Environment::Property;
my $prop = Testopia::Environment::Property->new({});
my ($prop_id) = $prop->check_property($key, $callerid);
# get existing property OR create new one
if(!$prop_id){
@ -323,7 +323,7 @@ sub _parseElementsRecursively {
$modified_environment_structure = 1;
} else {
# if property exists, still update validexp if needed
$prop = Bugzilla::Testopia::Environment::Property->new($prop_id);
$prop = Testopia::Environment::Property->new($prop_id);
my $validexp = $prop->validexp;
if ($validexp !~ m/\Q$hash->{$key}/){
my $newexp = $validexp . ((!length($validexp)) ? "" : "|") . $hash->{$key};
@ -367,7 +367,7 @@ sub get_environment_elements{
my @elements;
foreach my $val (@$ref){
push @elements, Bugzilla::Testopia::Environment::Element->new($val);
push @elements, Testopia::Environment::Element->new($val);
}
$self->{'elements'} = \@elements;
@ -393,7 +393,7 @@ sub element_categories {
my @elements;
foreach my $val (@$ref){
push @elements, Bugzilla::Testopia::Environment::Category->new($val);
push @elements, Testopia::Environment::Category->new($val);
}
$self->{'categories'} = \@elements;
@ -440,7 +440,7 @@ sub mapped_category_elements_to_json {
my @elements;
foreach my $id (@$ref){
my $element = Bugzilla::Testopia::Environment::Element->new($id);
my $element = Testopia::Environment::Element->new($id);
push @elements, {
text => $element->{'name'},
id => $element->id,
@ -565,7 +565,7 @@ sub get_all_elements{
my @elements;
foreach my $val (@$ref){
push @elements, Bugzilla::Testopia::Environment::Element->new($val);
push @elements, Testopia::Environment::Element->new($val);
}
return \@elements;
@ -583,7 +583,7 @@ sub check_environment{
undef, ($name, $pid));
if ($throw){
ThrowUserError('invalid-test-id-non-existent', {type => 'Environment', id => $name}) unless $used;
return Bugzilla::Testopia::Environment->new($used);
return Testopia::Environment->new($used);
}
return $used;
@ -908,7 +908,7 @@ sub product {
my $self = shift;
my $dbh = Bugzilla->dbh;
return $self->{'product'} if exists $self->{'product'};
require Bugzilla::Testopia::Product;
require Testopia::Product;
$self->{'product'} = Bugzilla::Product->new($self->{'product_id'});
return $self->{'product'};
}
@ -924,14 +924,14 @@ sub runs {
my $dbh = Bugzilla->dbh;
return $self->{'runs'} if exists $self->{'runs'};
require Bugzilla::Testopia::TestRun;
require Testopia::TestRun;
my $runids = $dbh->selectcol_arrayref("SELECT run_id FROM test_runs
WHERE environment_id = ?",
undef, $self->id);
my @runs;
foreach my $id (@{$runids}){
push @runs, Bugzilla::Testopia::TestRun->new($id);
push @runs, Testopia::TestRun->new($id);
}
$self->{'runs'} = \@runs;
@ -949,14 +949,14 @@ sub caseruns {
my $dbh = Bugzilla->dbh;
return $self->{'caseruns'} if exists $self->{'caseruns'};
require Bugzilla::Testopia::TestCaseRun;
require Testopia::TestCaseRun;
my $ids = $dbh->selectcol_arrayref("SELECT case_run_id FROM test_case_runs
WHERE environment_id = ?",
undef, $self->id);
my @caseruns;
foreach my $id (@{$ids}){
push @caseruns, Bugzilla::Testopia::TestCaseRun->new($id);
push @caseruns, Testopia::TestCaseRun->new($id);
}
$self->{'caseruns'} = \@caseruns;

View File

@ -23,7 +23,7 @@
=head1 NAME
Bugzilla::Testopia::Environment::Category - A test element category
Testopia::Environment::Category - A test element category
=head1 DESCRIPTION
@ -31,12 +31,12 @@ Categories are used to organize environment elements.
=head1 SYNOPSIS
$prop = Bugzilla::Testopia::Environment::Category->new($env_category_id);
$prop = Bugzilla::Testopia::Environment::Category->new(\%cat_hash);
$prop = Testopia::Environment::Category->new($env_category_id);
$prop = Testopia::Environment::Category->new(\%cat_hash);
=cut
package Bugzilla::Testopia::Environment::Category;
package Testopia::Environment::Category;
use strict;
@ -45,8 +45,8 @@ use Bugzilla::Error;
use Bugzilla::Config;
use Bugzilla::User;
use Bugzilla::Constants;
use Bugzilla::Testopia::Environment::Element;
use Bugzilla::Testopia::Product;
use Testopia::Environment::Element;
use Testopia::Product;
###############################
#### Initialization ####
@ -143,7 +143,7 @@ sub get_elements_by_category {
my @elements;
foreach my $val (@$ref) {
push @elements, Bugzilla::Testopia::Environment::Element->new($val);
push @elements, Testopia::Environment::Element->new($val);
}
return \@elements;
@ -170,7 +170,7 @@ sub get_parent_elements {
my @elements;
foreach my $val (@$ref) {
push @elements, Bugzilla::Testopia::Environment::Element->new($val);
push @elements, Testopia::Environment::Element->new($val);
}
return \@elements;
@ -318,7 +318,7 @@ sub get_element_categories_by_product {
);
my @objs;
foreach my $id ( @{$ref} ) {
push @objs, Bugzilla::Testopia::Environment::Category->new($id);
push @objs, Testopia::Environment::Category->new($id);
}
return \@objs;
}
@ -399,7 +399,7 @@ sub store {
# Exclude the auto-incremented field from the column list.
my $columns = join( ", ", grep { $_ ne 'env_category_id' } DB_COLUMNS );
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
return 0 if $self->check_category( $self->{'name'}, $self->{'product_id'} );
@ -470,7 +470,7 @@ sub obliterate {
);
foreach my $id (@$children) {
my $element = Bugzilla::Testopia::Environment::Element->new($id);
my $element = Testopia::Environment::Element->new($id);
$element->obliterate;
}
$dbh->do( "DELETE FROM test_environment_category WHERE env_category_id = ?",
@ -526,7 +526,7 @@ sub product_id { return $_[0]->{'product_id'}; }
sub product {
my $self = shift;
$self->{'product'} = Bugzilla::Testopia::Product->new( $self->product_id );
$self->{'product'} = Testopia::Product->new( $self->product_id );
return $self->{'product'};
}

View File

@ -23,7 +23,7 @@
=head1 NAME
Bugzilla::Testopia::Environment::Element - A test environment element
Testopia::Environment::Element - A test environment element
=head1 DESCRIPTION
@ -34,19 +34,19 @@ Elements can have child elements.
=head1 SYNOPSIS
$elem = Bugzilla::Testopia::Environment::Element->new($elem_id);
$elem = Bugzilla::Testopia::Environment::Element->new(\%elem_hash);
$elem = Testopia::Environment::Element->new($elem_id);
$elem = Testopia::Environment::Element->new(\%elem_hash);
=cut
package Bugzilla::Testopia::Environment::Element;
package Testopia::Environment::Element;
use strict;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Testopia::Product;
use Testopia::Product;
use JSON;
###############################
@ -180,7 +180,7 @@ sub get_child_elements {
my @children;
foreach my $val (@$ref) {
my $child = Bugzilla::Testopia::Environment::Element->new($val);
my $child = Testopia::Environment::Element->new($val);
$child->get_child_elements( 'depth' => $depth );
push( @children, $child );
}
@ -209,7 +209,7 @@ sub get_properties {
my @properties;
foreach my $val (@$ref) {
my $property = Bugzilla::Testopia::Environment::Property->new($val);
my $property = Testopia::Environment::Property->new($val);
push( @properties, $property );
}
@ -371,7 +371,7 @@ sub store {
# Exclude the auto-incremented field from the column list.
my $columns = join( ", ", grep { $_ ne 'element_id' } DB_COLUMNS );
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
# Verify name is available
return undef
@ -398,7 +398,7 @@ Updates the element in the database
sub set_name {
my $self = shift;
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
my ($name) = (@_);
@ -421,7 +421,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 = Testopia::Util::get_time_stamp();
my ($catid) = (@_);
@ -442,7 +442,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 = Testopia::Util::get_time_stamp();
my ($parent_id) = (@_);
@ -539,7 +539,7 @@ sub get_parent {
return $self->new( $self->{'parent_id'} );
}
else {
return Bugzilla::Testopia::Environment::Category->new(
return Testopia::Environment::Category->new(
$self->{'env_category_id'} );
}
}
@ -555,7 +555,7 @@ sub is_parent_a_category {
sub product {
my $self = shift;
return $self->{'product'} if exists $self->{'product'};
$self->{'product'} = Bugzilla::Testopia::Product->new( $self->product_id );
$self->{'product'} = Testopia::Product->new( $self->product_id );
return $self->{'product'};
}

View File

@ -22,7 +22,7 @@
=head1 NAME
Bugzilla::Testopia::Environment::Property - A test environment element property
Testopia::Environment::Property - A test environment element property
=head1 DESCRIPTION
@ -33,19 +33,19 @@ for each property.
=head1 SYNOPSIS
$prop = Bugzilla::Testopia::Environment::Property->new($prop_id);
$prop = Bugzilla::Testopia::Environment::Property->new(\%prop_hash);
$prop = Testopia::Environment::Property->new($prop_id);
$prop = Testopia::Environment::Property->new(\%prop_hash);
=cut
package Bugzilla::Testopia::Environment::Property;
package Testopia::Environment::Property;
use strict;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Testopia::Environment::Element;
use Testopia::Environment::Element;
###############################
#### Initialization ####
@ -225,7 +225,7 @@ sub store {
# Exclude the auto-incremented field from the column list.
my $columns = join( ", ", grep { $_ ne 'property_id' } DB_COLUMNS );
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
# Verify name is available
return undef
@ -247,7 +247,7 @@ Updates the property name in the database
sub set_name {
my $self = shift;
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
my ($name) = (@_);
@ -268,7 +268,7 @@ Updates the elmnt_id in the database
sub set_element {
my $self = shift;
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
my ($id) = (@_);
@ -288,7 +288,7 @@ Updates the property valid expression in the database
=cut
sub update_property_validexp {
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
my $self = shift;
my ($validexp) = (@_);
@ -305,7 +305,7 @@ sub value_to_json {
my $self = shift;
my ($env_id) = @_;
my $env = Bugzilla::Testopia::Environment->new($env_id) if $env_id;
my $env = Testopia::Environment->new($env_id) if $env_id;
my @values = split( /\|/, $self->get_validexp );
my @json;
@ -377,7 +377,7 @@ sub is_mapped {
sub canview {
my $self = shift;
my $element =
Bugzilla::Testopia::Environment::Element->new( $self->element_id );
Testopia::Environment::Element->new( $self->element_id );
return 1 if $element->canview;
return 0;
}
@ -385,7 +385,7 @@ sub canview {
sub canedit {
my $self = shift;
my $element =
Bugzilla::Testopia::Environment::Element->new( $self->element_id );
Testopia::Environment::Element->new( $self->element_id );
return 1 if $element->canedit;
return 0;
}

View File

@ -21,7 +21,7 @@
=head1 NAME
Bugzilla::Testopia::Environment::Xml - An XML representation of the Environment Object.
Testopia::Environment::Xml - An XML representation of the Environment Object.
=head1 DESCRIPTION
@ -33,7 +33,7 @@ initialized using new and passing it an XML scalar. It can also take two other
$max_depth - the max depth of child elements to import.
Example:
my $env_xml = Bugzilla::Testopia::Environment::Xml->new($xml, 1, 5);
my $env_xml = Testopia::Environment::Xml->new($xml, 1, 5);
Other subroutines can be called on the object. For example:
parse - takes the same three parameters as new
@ -51,17 +51,17 @@ Import XML Environment Implementation Example: see tr_import_environment.cgi
To export an environment by env_id to XML use export
Example:
my $xml = Bugzilla::Testopia::Environment::Xml->export($env_id);
my $xml = Testopia::Environment::Xml->export($env_id);
Export Environment XML Implementation Example: see tr_export_environment.cgi
=head1 SYNOPSIS
use Bugzilla::Testopia::Environment::Xml;
use Testopia::Environment::Xml;
=cut
package Bugzilla::Testopia::Environment::Xml;
package Testopia::Environment::Xml;
#************************************************** Uses ****************************************************#
use strict;
@ -75,19 +75,19 @@ use Bugzilla::Config;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Product;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Environment;
use Bugzilla::Testopia::Product;
use Bugzilla::Testopia::Environment::Category;
use Bugzilla::Testopia::Environment::Element;
use Bugzilla::Testopia::Environment::Property;
use Testopia::Util;
use Testopia::Environment;
use Testopia::Product;
use Testopia::Environment::Category;
use Testopia::Environment::Element;
use Testopia::Environment::Property;
our constant $max_depth = 7;
=head2 new
Instantiates a new Bugzilla::Testopia::Environment::Xml object
Instantiates a new Testopia::Environment::Xml object
=cut
@ -102,7 +102,7 @@ sub new {
=head2 _init
Private constructor for the Bugzilla::Testopia::Environment::XML class
Private constructor for the Testopia::Environment::XML class
=cut
@ -158,7 +158,7 @@ sub parse() {
}
else {
$self->{'message'} .= "..Checking if <U>$product_name</U> <STRONG>PRODUCT</STRONG> already exists...";
($product_id) = Bugzilla::Testopia::Product->check_product_by_name($product_name);
($product_id) = Testopia::Product->check_product_by_name($product_name);
if ($product_id) {
$self->{'message'} .= "EXISTS.<BR />";
}
@ -173,7 +173,7 @@ sub parse() {
my $environment_name = $root->{'att'}->{'name'};
$self->{'name'} = $environment_name;
$self->{'message'} .= "..Checking if <U>$environment_name</U> <STRONG>ENVIRONMENT NAME</STRONG> already exists for the <U>$product_name</U> <STRONG>PRODUCT</STRONG>...";
my $environment = Bugzilla::Testopia::Environment->new({});
my $environment = Testopia::Environment->new({});
my ($env_id) = $environment->check_environment($environment_name, $product_id);
my $environment_id;
if ($env_id < 1) {
@ -182,7 +182,7 @@ sub parse() {
if ($admin) {
$self->{'message'} .= "....Storing new <U>$environment_name</U> <STRONG>ENVIRONMENT NAME</STRONG> in the <U>$self->{'product_name'}</U> <STRONG>PRODUCT</STRONG>...";
$environment->{'name'} = $environment_name;
($environment_id) = Bugzilla::Testopia::Environment->store_environment_name($self->{'name'}, $product_id);
($environment_id) = Testopia::Environment->store_environment_name($self->{'name'}, $product_id);
$self->{'message'} .= "DONE.<BR />";
}
}
@ -198,7 +198,7 @@ sub parse() {
foreach my $twig_category ($root->children("category")) {
my $category_name = $twig_category->{'att'}->{'name'};
# Makes sure to get the category_id by name and product_id
my $category = Bugzilla::Testopia::Environment::Category->new({});
my $category = Testopia::Environment::Category->new({});
my ($cat_id) = $category->check_category($category_name, $product_id);
my $category_id;
# Checking if Categories already exist.
@ -258,7 +258,7 @@ sub parse_child_elements() {
}
$self->{'message'} .= "Checking if <U>$element_name</U> <STRONG>ELEMENT</STRONG> already exists in the <U>$category_name</U> <STRONG>CATEGORY</STRONG>...";
my ($product_id) = $self->{'product_id'};
my $element = Bugzilla::Testopia::Environment::Element->new({});
my $element = Testopia::Environment::Element->new({});
my ($elem_id) = $element->check_element($element_name, $env_category_id);
my $element_id;
if ($elem_id < 1) {
@ -300,7 +300,7 @@ sub parse_child_elements() {
$self->{'message'} .= "....";
}
$self->{'message'} .= "....Checking if <U>$property_name</U> <STRONG>PROPERTY</STRONG> already exists...";
my $property = Bugzilla::Testopia::Environment::Property->new({});
my $property = Testopia::Environment::Property->new({});
my ($prop_id) = $property->check_property($property_name, $element_id);
my $property_id;
if ($prop_id < 1) {
@ -324,7 +324,7 @@ sub parse_child_elements() {
($property_id) = $prop_id;
$self->{'message'} .= "EXISTS.<BR />";
}
$property = Bugzilla::Testopia::Environment::Property->new($property_id);
$property = Testopia::Environment::Property->new($property_id);
# Checking if new Selected Value and Valid Expression exist.
my $validexp;
if ($property) {
@ -373,7 +373,7 @@ sub parse_child_elements() {
$self->{'message'} .= "....";
}
$self->{'message'} .= "............Storing new <STRONG>VALUE SELECTED</STRONG> <U>$value</U>...";
my $environment = Bugzilla::Testopia::Environment->new($self->{'environment_id'});
my $environment = Testopia::Environment->new($self->{'environment_id'});
$environment->store_property_value($property_id, $element_id, $value);
$self->{'message'} .= "DONE.<BR/>";
}
@ -446,9 +446,9 @@ sub store() {
my $self = shift;
$self->{'message'} .= "Storing new XML Environment...";
if (!$self->{'environment_id'}) {
$self->{'environment_id'} = Bugzilla::Testopia::Environment->store_environment_name($self->{'name'}, $self->{'product_id'});
$self->{'environment_id'} = Testopia::Environment->store_environment_name($self->{'name'}, $self->{'product_id'});
}
my $environment = Bugzilla::Testopia::Environment->new($self);
my $environment = Testopia::Environment->new($self);
my $success = $environment->update();
if (!$success) {
$self->{'message'} .= "ABORTED!<BR/>";
@ -474,7 +474,7 @@ sub export() {
my $xml;
my $environment = Bugzilla::Testopia::Environment->new($env_id);
my $environment = Testopia::Environment->new($env_id);
$xml =
"<?xml version='1.0' encoding='UTF-8'?>" .
@ -564,7 +564,7 @@ sub export_element_and_children() {
my $properties = $element->{'properties'};
foreach my $property (@$properties) {
my $value_selected = Bugzilla::Testopia::Environment->get_value_selected(
my $value_selected = Testopia::Environment->get_value_selected(
$env_id, $element->{'element_id'}, $property->{'property_id'});
if (defined($value_selected)) {
$xml .=

View File

@ -18,7 +18,7 @@
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::Product;
package Testopia::Product;
use strict;
@ -34,7 +34,7 @@ sub environments {
return $self->{'environments'} if defined $self->{'environments'};
require Bugzilla::Testopia::Environment;
require Testopia::Environment;
my $query = "SELECT environment_id";
$query .= " FROM test_environments";
@ -51,7 +51,7 @@ sub environments {
my @objs;
foreach my $id (@{$ref}){
push @objs, Bugzilla::Testopia::Environment->new($id);
push @objs, Testopia::Environment->new($id);
}
$self->{'environments'} = \@objs;
@ -63,7 +63,7 @@ sub builds {
my($active, $current) = @_;
my $dbh = Bugzilla->dbh;
require Bugzilla::Testopia::Build;
require Testopia::Build;
my $query = "SELECT build_id FROM test_builds WHERE product_id = ?";
if ($active && $current){
@ -87,7 +87,7 @@ sub builds {
my @objs;
foreach my $id (@{$ref}){
push @objs, Bugzilla::Testopia::Build->new($id);
push @objs, Testopia::Build->new($id);
}
$self->{'builds'} = \@objs;
@ -105,9 +105,9 @@ sub categories {
ORDER BY name",
undef, $self->{'id'});
my @objs;
require Bugzilla::Testopia::Category;
require Testopia::Category;
foreach my $id (@{$ref}){
push @objs, Bugzilla::Testopia::Category->new($id);
push @objs, Testopia::Category->new($id);
}
$self->{'categories'} = \@objs;
return $self->{'categories'};
@ -119,7 +119,7 @@ sub plans {
return $self->{'plans'} if exists $self->{'plans'};
require Bugzilla::Testopia::TestPlan;
require Testopia::TestPlan;
my $ref = $dbh->selectcol_arrayref(
"SELECT plan_id
@ -130,7 +130,7 @@ sub plans {
my @objs;
foreach my $id (@{$ref}){
push @objs, Bugzilla::Testopia::TestPlan->new($id);
push @objs, Testopia::TestPlan->new($id);
}
$self->{'plans'} = \@objs;
return $self->{'plans'};
@ -141,7 +141,7 @@ sub cases {
my $dbh = Bugzilla->dbh;
return $self->{'cases'} if exists $self->{'cases'};
require Bugzilla::Testopia::TestCase;
require Testopia::TestCase;
my $caseids = $dbh->selectcol_arrayref(
"SELECT case_id FROM test_case_plans
@ -151,7 +151,7 @@ sub cases {
my @cases;
foreach my $id (@{$caseids}){
push @cases, Bugzilla::Testopia::TestCase->new($id);
push @cases, Testopia::TestCase->new($id);
}
$self->{'cases'} = \@cases;
@ -163,7 +163,7 @@ sub runs {
my $dbh = Bugzilla->dbh;
return $self->{'runs'} if exists $self->{'runs'};
require Bugzilla::Testopia::TestRun;
require Testopia::TestRun;
my $runids = $dbh->selectcol_arrayref(
"SELECT run_id FROM test_runs
@ -173,7 +173,7 @@ sub runs {
my @runs;
foreach my $id (@{$runids}){
push @runs, Bugzilla::Testopia::TestRun->new($id);
push @runs, Testopia::TestRun->new($id);
}
$self->{'runs'} = \@runs;
@ -190,9 +190,9 @@ sub environment_categories {
WHERE product_id = ?",
undef, $self->id);
my @objs;
require Bugzilla::Testopia::Environment::Category;
require Testopia::Environment::Category;
foreach my $id (@{$ref}){
push @objs, Bugzilla::Testopia::Environment::Category->new($id);
push @objs, Testopia::Environment::Category->new($id);
}
$self->{'environment_categories'} = \@objs;
return $self->{'environment_categories'};
@ -245,7 +245,7 @@ sub tags {
my $self = shift;
my $dbh = Bugzilla->dbh;
require Bugzilla::Testopia::TestTag;
require Testopia::TestTag;
my $ref = $dbh->selectcol_arrayref(
"(SELECT test_tags.tag_id, test_tags.tag_name AS name
@ -272,7 +272,7 @@ sub tags {
my @product_tags;
foreach my $id (@$ref){
push @product_tags, Bugzilla::Testopia::TestTag->new($id);
push @product_tags, Testopia::TestTag->new($id);
}
$self->{'tags'} = \@product_tags;
@ -325,7 +325,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::Product
Testopia::Product
=head1 EXTENDS
@ -341,8 +341,8 @@ creating new products, see Bugzilla::Product.
=head2 Creating
$build = Bugzilla::Testopia::Product->new($product_id);
$build = Bugzilla::Testopia::Product->new({name => $name});
$build = Testopia::Product->new($product_id);
$build = Testopia::Product->new({name => $name});
=head1 METHODS
@ -469,7 +469,7 @@ creating new products, see Bugzilla::Product.
=over
L<Bugzilla::Testopia::Product>
L<Testopia::Product>
L<Bugzilla::Webservice>

View File

@ -23,7 +23,7 @@
=head1 NAME
Bugzilla::Testopia::Report - Generates report data.
Testopia::Report - Generates report data.
=head1 DESCRIPTION
@ -38,15 +38,15 @@ Reports
=cut
package Bugzilla::Testopia::Report;
package Testopia::Report;
use strict;
use Bugzilla;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Search;
use Testopia::Util;
use Testopia::Search;
###############################
@ -200,7 +200,7 @@ sub init {
$cgi->param('viewall', 1);
my $dbh = Bugzilla->switch_to_shadow_db;
my $search = Bugzilla::Testopia::Search->new($cgi, \@selectnames);
my $search = Testopia::Search->new($cgi, \@selectnames);
my $results = $dbh->selectall_arrayref($search->query);
$dbh = Bugzilla->switch_to_main_db;

View File

@ -32,7 +32,7 @@
=head1 NAME
Bugzilla::Testopia::Search - A module to support searches in Testopis
Testopia::Search - A module to support searches in Testopis
=head1 DESCRIPTION
@ -46,11 +46,11 @@ on one column at a time in ascending order.
=head1 SYNOPSIS
$search = Bugzilla::Testopia::Search($cgi);
$search = Testopia::Search($cgi);
=cut
package Bugzilla::Testopia::Search;
package Testopia::Search;
use strict;
@ -58,8 +58,8 @@ use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestCase;
use Testopia::Util;
use Testopia::TestCase;
use Date::Format;
use Date::Parse;
@ -119,7 +119,7 @@ sub init {
my @plan_ids = split(',',$cgi->param('plan_ids'));
my @plans;
foreach my $p (@plan_ids){
my $plan = Bugzilla::Testopia::TestPlan->new(trim($p));
my $plan = Testopia::TestPlan->new(trim($p));
push @plans, $plan->id if $plan && $plan->canview;
}
my $plans = join(',',@plans);

View File

@ -20,7 +20,7 @@
=head1 NAME
Bugzilla::Testopia::Table - Produces display tables for Testopia lists
Testopia::Table - Produces display tables for Testopia lists
=head1 DESCRIPTION
@ -45,22 +45,22 @@ arguments:
=head1 SYNOPSIS
$table = Bugzilla::Testopia::Table->new($type, $url, $cgi, $list, $query);
$table = Testopia::Table->new($type, $url, $cgi, $list, $query);
=cut
package Bugzilla::Testopia::Table;
package Testopia::Table;
use strict;
use Bugzilla;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestCase;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestRun;
use Bugzilla::Testopia::TestCaseRun;
use Testopia::Util;
use Testopia::TestCase;
use Testopia::TestPlan;
use Testopia::TestRun;
use Testopia::TestCaseRun;
###############################
#### Initialization ####
@ -128,19 +128,19 @@ sub init {
foreach my $id (@$list){
my $o;
if ($type eq 'case'){
$o = Bugzilla::Testopia::TestCase->new($id);
$o = Testopia::TestCase->new($id);
}
elsif ($type eq 'plan'){
$o = Bugzilla::Testopia::TestPlan->new($id);
$o = Testopia::TestPlan->new($id);
}
elsif ($type eq 'run'){
$o = Bugzilla::Testopia::TestRun->new($id);
$o = Testopia::TestRun->new($id);
}
elsif ($type eq 'case_run'){
$o = Bugzilla::Testopia::TestCaseRun->new($id);
$o = Testopia::TestCaseRun->new($id);
}
elsif ($type eq 'environment'){
$o = Bugzilla::Testopia::Environment->new($id);
$o = Testopia::Environment->new($id);
}
push (@ids, $id);
push (@list, $o);
@ -160,34 +160,34 @@ sub init {
# my @list;
# foreach my $id (split(",", $self->get_saved_list())){
# if ($self->{'type'} eq 'case'){
# my $o = Bugzilla::Testopia::TestCase->new($id);
# my $o = Testopia::TestCase->new($id);
# push @list, $o;
# $o->category;
# $o->status;
# $o->priority;
# }
# elsif ($self->{'type'} eq 'plan'){
# my $o = Bugzilla::Testopia::TestPlan->new($id);
# my $o = Testopia::TestPlan->new($id);
# push @list, $o;
# $o->test_case_count;
# $o->test_run_count;
# }
# elsif ($self->{'type'} eq 'run'){
# my $o = Bugzilla::Testopia::TestCase->new($id);
# my $o = Testopia::TestCase->new($id);
# push @list, $o;
## $o->category;
## $o->status;
## $o->priority;
# }
# elsif ($self->{'type'} eq 'caserun'){
# my $o = Bugzilla::Testopia::TestCase->new($id);
# my $o = Testopia::TestCase->new($id);
# push @list, $o;
## $o->category;
## $o->status;
## $o->priority;
# }
# elsif ($self->{'type'} eq 'attachment'){
# my $o = Bugzilla::Testopia::TestCase->new($id);
# my $o = Testopia::TestCase->new($id);
# push @list, $o;
## $o->category;
## $o->status;

View File

@ -30,7 +30,7 @@
# Jeff Dayley <jedayley@novell.com>
# M-A Parent <maparent@miranda.com>
package Bugzilla::Testopia::TestCase;
package Testopia::TestCase;
use strict;
@ -41,19 +41,19 @@ use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestRun;
use Bugzilla::Testopia::TestCaseRun;
use Bugzilla::Testopia::Category;
use Bugzilla::Testopia::Attachment;
use Testopia::Constants;
use Testopia::Util;
use Testopia::TestPlan;
use Testopia::TestRun;
use Testopia::TestCaseRun;
use Testopia::Category;
use Testopia::Attachment;
use JSON;
use Text::Diff;
use base qw(Exporter Bugzilla::Object);
@Bugzilla::Testopia::TestCase::EXPORT = qw(lookup_status lookup_status_by_name
@Testopia::TestCase::EXPORT = qw(lookup_status lookup_status_by_name
lookup_category lookup_category_by_name
lookup_priority lookup_priority_by_value
lookup_default_tester);
@ -161,7 +161,7 @@ sub _check_status{
$status = trim($status);
my $status_id;
if ($status =~ /^\d+$/){
$status_id = Bugzilla::Testopia::Util::validate_selection($status, 'case_status_id', 'test_case_status');
$status_id = Testopia::Util::validate_selection($status, 'case_status_id', 'test_case_status');
}
else {
trick_taint($status);
@ -177,13 +177,13 @@ sub _check_category{
my $category_id;
if (ref $category){
$product = Bugzilla::Product::check_product($category->{'product'});
$category_id = Bugzilla::Testopia::Category::check_case_category($category->{'category'}, $product);
$category_id = Testopia::Category::check_case_category($category->{'category'}, $product);
}
elsif ($category =~ /^\d+$/){
$category_id = Bugzilla::Testopia::Util::validate_selection($category, 'category_id', 'test_case_categories');
$category_id = Testopia::Util::validate_selection($category, 'category_id', 'test_case_categories');
}
else {
$category_id = Bugzilla::Testopia::Category::check_case_category($category, $product);
$category_id = Testopia::Category::check_case_category($category, $product);
}
return $category_id;
@ -195,7 +195,7 @@ sub _check_priority{
trick_taint($priority);
my $priority_id;
if ($priority =~ /^\d+$/){
$priority_id = Bugzilla::Testopia::Util::validate_selection($priority, 'id', 'priority');
$priority_id = Testopia::Util::validate_selection($priority, 'id', 'priority');
}
else {
$priority_id = lookup_priority_by_value($priority);
@ -318,7 +318,7 @@ sub _check_dependency{
my @validvalues;
foreach my $id (split(/[\s,]+/, $value)) {
next unless $id;
Bugzilla::Testopia::Util::validate_test_id($id, 'case');
Testopia::Util::validate_test_id($id, 'case');
push(@validvalues, $id);
}
$value = join(",", @validvalues);
@ -339,8 +339,8 @@ sub _check_cases {
my @cases;
foreach my $caseid (split(/[\s,]+/, $caseids)){
Bugzilla::Testopia::Util::validate_test_id($caseid, 'case');
push @cases, Bugzilla::Testopia::TestCase->new($caseid);
Testopia::Util::validate_test_id($caseid, 'case');
push @cases, Testopia::TestCase->new($caseid);
}
return \@cases;
@ -353,8 +353,8 @@ sub _check_runs {
$runids = join(',' ,@$runids);
}
foreach my $runid (split(/[\s,]+/, $runids)){
Bugzilla::Testopia::Util::validate_test_id($runid, 'run');
push @runs, Bugzilla::Testopia::TestRun->new($runid);
Testopia::Util::validate_test_id($runid, 'run');
push @runs, Testopia::TestRun->new($runid);
}
return \@runs;
}
@ -393,7 +393,7 @@ sub _check_components {
@comp_ids = split(/[\s,]+/, $components);
}
foreach my $id (@comp_ids){
Bugzilla::Testopia::Util::validate_selection($id, 'id', 'components');
Testopia::Util::validate_selection($id, 'id', 'components');
trick_taint($id);
if (ref $invocant){
@ -496,7 +496,7 @@ sub create {
$class->SUPER::check_required_create_fields($params);
my $field_values = $class->run_create_validators($params);
$field_values->{creation_date} = Bugzilla::Testopia::Util::get_time_stamp();
$field_values->{creation_date} = Testopia::Util::get_time_stamp();
# We have to handle these fields a bit differently since they have their own tables.
my $action = $field_values->{action};
@ -543,7 +543,7 @@ sub create {
sub update {
my $self = shift;
my $dbh = Bugzilla->dbh;
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$self->update_deps($self->{'dependson'}, $self->{'blocks'});
@ -554,7 +554,7 @@ sub update {
delete $changed->{'sortkey'};
foreach my $field (keys %$changed){
Bugzilla::Testopia::Util::log_activity('case', $self->id, $field, $timestamp,
Testopia::Util::log_activity('case', $self->id, $field, $timestamp,
$changed->{$field}->[0], $changed->{$field}->[1]);
}
@ -689,7 +689,7 @@ sub get_category_list{
WHERE product_id IN (". join(",", @{$self->get_product_ids}) .")");
my @categories;
foreach my $c (@$ids){
push @categories, Bugzilla::Testopia::Category->new($c);
push @categories, Testopia::Category->new($c);
}
return \@categories;
}
@ -818,7 +818,7 @@ sub add_tag {
}
foreach my $name (@tags){
my $tag = Bugzilla::Testopia::TestTag->create({'tag_name' => $name});
my $tag = Testopia::TestTag->create({'tag_name' => $name});
$tag->attach($self);
}
}
@ -832,7 +832,7 @@ Disassociates a tag from this test case
sub remove_tag {
my $self = shift;
my ($tag_name) = @_;
my $tag = Bugzilla::Testopia::TestTag->check_tag($tag_name);
my $tag = Testopia::TestTag->check_tag($tag_name);
ThrowUserError('testopia-unknown-tag', {'name' => $tag}) unless $tag;
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_case_tags
@ -1156,7 +1156,7 @@ sub store {
my $dbh = Bugzilla->dbh;
# Exclude the auto-incremented field from the column list.
my $columns = join(", ", grep {$_ ne 'case_id'} DB_COLUMNS);
my ($timestamp) = Bugzilla::Testopia::Util::get_time_stamp();
my ($timestamp) = Testopia::Util::get_time_stamp();
$dbh->do("INSERT INTO test_cases ($columns) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
undef, ## Database Column ##
@ -1199,7 +1199,7 @@ sub store_text {
my $dbh = Bugzilla->dbh;
my ($key, $author, $action, $effect, $setup, $breakdown, $reset_version, $timestamp) = @_;
if (!defined $timestamp){
($timestamp) = Bugzilla::Testopia::Util::get_time_stamp();
($timestamp) = Testopia::Util::get_time_stamp();
}
trick_taint($action) if $action;
trick_taint($effect) if $effect;
@ -1249,7 +1249,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'}}, Testopia::TestPlan->new($plan_id);
}
@ -1264,7 +1264,7 @@ sub unlink_plan {
my $self = shift;
my $dbh = Bugzilla->dbh;
my ($plan_id) = @_;
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
my $plan = Testopia::TestPlan->new($plan_id);
if (scalar @{$self->plans} == 1){
$self->obliterate;
@ -1304,7 +1304,7 @@ sub copy {
my ($author, $tester, $copydoc, $category_id) = @_;
# Exclude the auto-incremented field from the column list.
my $columns = join(", ", grep {$_ ne 'case_id'} DB_COLUMNS);
my ($timestamp) = Bugzilla::Testopia::Util::get_time_stamp();
my ($timestamp) = Testopia::Util::get_time_stamp();
$category_id ||= $self->{'category_id'};
$dbh->do("INSERT INTO test_cases ($columns) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
@ -1481,7 +1481,7 @@ sub update_deps {
my @validvalues;
foreach my $id (split(/[\s,]+/, $fields->{$field})) {
next unless $id;
Bugzilla::Testopia::Util::validate_test_id($id, 'case');
Testopia::Util::validate_test_id($id, 'case');
push(@validvalues, $id);
}
$fields->{$field} = join(",", @validvalues);
@ -1758,7 +1758,7 @@ sub can_unlink_plan {
my $self = shift;
my ($plan_id) = @_;
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
my $plan = Testopia::TestPlan->new($plan_id);
return 1 if Bugzilla->user->in_group('admin');
return 1 if Bugzilla->user->in_group('Testers') && Bugzilla->params->{"testopia-allow-group-member-deletes"};
return 1 if $plan->get_user_rights(Bugzilla->user->id) & TR_DELETE;
@ -1883,7 +1883,7 @@ sub attachments {
my @attachments;
foreach my $attach (@{$attachments}){
push @attachments, Bugzilla::Testopia::Attachment->new($attach);
push @attachments, Testopia::Attachment->new($attach);
}
$self->{'attachments'} = \@attachments;
return $self->{'attachments'};
@ -1955,7 +1955,7 @@ Returns the category name based on the category_id of this case
sub category {
my $self = shift;
return $self->{'category'} if exists $self->{'category'};
$self->{'category'} = Bugzilla::Testopia::Category->new($self->{'category_id'});
$self->{'category'} = Testopia::Category->new($self->{'category_id'});
return $self->{'category'};
}
@ -1991,7 +1991,7 @@ sub components {
=head2 tags
Returns a reference to a list of Bugzilla::Testopia::TestTag objects
Returns a reference to a list of Testopia::TestTag objects
associated with this case.
=cut
@ -2008,7 +2008,7 @@ sub tags {
undef, $self->{'case_id'});
my @tags;
foreach my $id (@{$tagids}){
push @tags, Bugzilla::Testopia::TestTag->new($id);
push @tags, Testopia::TestTag->new($id);
}
$self->{'tags'} = \@tags;
return $self->{'tags'};
@ -2016,7 +2016,7 @@ sub tags {
=head2 plans
Returns a reference to a list of Bugzilla::Testopia::TestPlan objects
Returns a reference to a list of Testopia::TestPlan objects
associated with this case.
=cut
@ -2031,7 +2031,7 @@ sub plans {
undef, $self->{'case_id'});
my @plans;
foreach my $id (@{$ref}){
push @plans, Bugzilla::Testopia::TestPlan->new($id);
push @plans, Testopia::TestPlan->new($id);
}
$self->{'plans'} = \@plans;
return $self->{'plans'};
@ -2058,7 +2058,7 @@ sub bugs {
next unless Bugzilla->user->can_see_bug($row->{'bug_id'});
my $bug = Bugzilla::Bug->new($row->{'bug_id'}, Bugzilla->user->id);
if ($row->{'case_run_id'}){
my $cr = Bugzilla::Testopia::TestCaseRun->new($row->{'case_run_id'});
my $cr = Testopia::TestCaseRun->new($row->{'case_run_id'});
next unless $cr;
$bug->{'build'} = $cr->build->name;
$bug->{'env'} = $cr->environment->name;
@ -2127,7 +2127,7 @@ sub text {
=head2 runs
Returns a reference to a list of Bugzilla::Testopia::TestRun objects
Returns a reference to a list of Testopia::TestRun objects
associated with this case.
=cut
@ -2144,7 +2144,7 @@ sub runs {
undef, $self->{'case_id'});
my @runs;
foreach my $id (@{$ref}){
push @runs, Bugzilla::Testopia::TestRun->new($id);
push @runs, Testopia::TestRun->new($id);
}
$self->{'runs'} = \@runs;
return $self->{'runs'};
@ -2163,7 +2163,7 @@ sub run_count {
=head2 caseruns
Returns a reference to a list of Bugzilla::Testopia::TestCaseRun objects
Returns a reference to a list of Testopia::TestCaseRun objects
associated with this case.
=cut
@ -2178,7 +2178,7 @@ sub caseruns {
undef, $self->{'case_id'});
my @runs;
foreach my $id (@{$ref}){
push @runs, Bugzilla::Testopia::TestCaseRun->new($id);
push @runs, Testopia::TestCaseRun->new($id);
}
$self->{'caseruns'} = \@runs;
return $self->{'caseruns'};
@ -2195,7 +2195,7 @@ sub sortkey {
=head2 blocked
Returns a reference to a list of Bugzilla::Testopia::TestCase objects
Returns a reference to a list of Testopia::TestCase objects
which are blocked by this test case.
=cut
@ -2206,7 +2206,7 @@ sub blocked {
my @deps;
my $ref = _get_dep_lists("dependson", "blocked", $self->{'case_id'});
foreach my $id (@{$ref}){
push @deps, Bugzilla::Testopia::TestCase->new($id);
push @deps, Testopia::TestCase->new($id);
}
$self->{'blocked'} = \@deps;
return $self->{'blocked'};
@ -2237,7 +2237,7 @@ sub blocked_list_uncached {
=head2 dependson
Returns a reference to a list of Bugzilla::Testopia::TestCase objects
Returns a reference to a list of Testopia::TestCase objects
which depend on this test case.
=cut
@ -2248,7 +2248,7 @@ sub dependson {
my @deps;
my $ref = _get_dep_lists("blocked", "dependson", $self->{'case_id'});
foreach my $id (@{$ref}){
push @deps, Bugzilla::Testopia::TestCase->new($id);
push @deps, Testopia::TestCase->new($id);
}
$self->{'dependson'} = \@deps;
return $self->{'dependson'};
@ -2320,7 +2320,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::TestCase - Testopia Test Case object
Testopia::TestCase - Testopia Test Case object
=head1 DESCRIPTION
@ -2329,10 +2329,10 @@ be linked to one or more test plans.
=head1 SYNOPSIS
use Bugzilla::Testopia::TestCase;
use Testopia::TestCase;
$case = Bugzilla::Testopia::TestCase->new($case_id);
$case = Bugzilla::Testopia::TestCase->new(\%case_hash);
$case = Testopia::TestCase->new($case_id);
$case = Testopia::TestCase->new(\%case_hash);
=cut

View File

@ -19,7 +19,7 @@
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::TestCaseRun;
package Testopia::TestCaseRun;
use strict;
@ -30,17 +30,17 @@ use Bugzilla::Bug;
use Bugzilla::Config;
use Bugzilla::Constants;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Environment;
use Bugzilla::Testopia::Build;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Attachment;
use Testopia::Util;
use Testopia::Environment;
use Testopia::Build;
use Testopia::Constants;
use Testopia::Attachment;
use Date::Format;
use Date::Parse;
use base qw(Exporter Bugzilla::Object);
#@Bugzilla::Testopia::TestCaseRun::EXPORT = qw(lookup_status lookup_status_by_name);
#@Testopia::TestCaseRun::EXPORT = qw(lookup_status lookup_status_by_name);
###############################
#### Initialization ####
@ -124,22 +124,22 @@ sub report_columns {
###############################
sub _check_case_id {
my ($invocant, $id) = @_;
return Bugzilla::Testopia::Util::validate_test_id($id, 'case');
return Testopia::Util::validate_test_id($id, 'case');
}
sub _check_run_id {
my ($invocant, $id) = @_;
return Bugzilla::Testopia::Util::validate_test_id($id, 'run');
return Testopia::Util::validate_test_id($id, 'run');
}
sub _check_build_id {
my ($invocant, $id) = @_;
return Bugzilla::Testopia::Util::validate_test_id($id, 'build');
return Testopia::Util::validate_test_id($id, 'build');
}
sub _check_env_id {
my ($invocant, $id) = @_;
return Bugzilla::Testopia::Util::validate_test_id($id, 'environment');
return Testopia::Util::validate_test_id($id, 'environment');
}
sub _check_case_run_status_id {
@ -147,7 +147,7 @@ sub _check_case_run_status_id {
$status = trim($status);
my $status_id;
if ($status =~ /^\d+$/){
$status_id = Bugzilla::Testopia::Util::validate_selection($status, 'case_run_status_id', 'test_case_run_status');
$status_id = Testopia::Util::validate_selection($status, 'case_run_status_id', 'test_case_run_status');
}
else {
$status_id = lookup_status_by_name($status);
@ -267,7 +267,7 @@ sub switch {
undef, ($run_id, $case_id, $build_id, $env_id));
if ($is){
$self = Bugzilla::Testopia::TestCaseRun->new($is);
$self = Testopia::TestCaseRun->new($is);
}
else {
my $oldbuild = $self->{'build_id'};
@ -284,7 +284,7 @@ sub switch {
});
if ($oldbuild != $build_id){
my $build = Bugzilla::Testopia::Build->new($oldbuild);
my $build = Testopia::Build->new($oldbuild);
my $note = "Build Changed by ". Bugzilla->user->login;
$note .= ". Old build: '". $build->name;
$note .= "' New build: '". $self->build->name;
@ -292,7 +292,7 @@ sub switch {
$self->append_note($note);
}
if ($oldenv != $env_id){
my $environment = Bugzilla::Testopia::Environment->new($oldenv);
my $environment = Testopia::Environment->new($oldenv);
my $note = "Environment Changed by ". Bugzilla->user->login;
$note .= ". Old environment: '". $environment->name;
$note .= "' New environment: '". $self->environment->name;
@ -421,13 +421,13 @@ sub set_status {
$self->{'testedby'} = undef;
}
elsif ($status_id == RUNNING || $status_id == PAUSED){
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$self->_update_fields({'running_date' => $timestamp}) if $status_id == RUNNING;
$self->_update_fields({'close_date' => undef});
$self->{'close_date'} = undef;
}
else {
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$self->_update_fields({'close_date' => $timestamp});
$self->_update_fields({'testedby' => Bugzilla->user->id});
$self->{'close_date'} = $timestamp;
@ -609,7 +609,7 @@ Attaches the specified bug to this test case-run
sub attach_bug {
my $self = shift;
my ($bugs, $caserun_id) = @_;
$bugs = Bugzilla::Testopia::TestCase->_check_bugs($bugs, "ATTACH");
$bugs = Testopia::TestCase->_check_bugs($bugs, "ATTACH");
$caserun_id ||= $self->{'case_run_id'};
my $dbh = Bugzilla->dbh;
@ -682,7 +682,7 @@ sub update_bugs {
my ($status) = @_;
my $resolution;
my $dbh = Bugzilla->dbh;
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
foreach my $bug (@{$self->bugs}){
my $oldstatus = $bug->bug_status;
my $oldresolution = $bug->resolution;
@ -855,8 +855,8 @@ Returns the TestRun object that this case-run is associated with
sub run {
my $self = shift;
return $self->{'run'} if exists $self->{'run'};
require Bugzilla::Testopia::TestRun;
$self->{'run'} = Bugzilla::Testopia::TestRun->new($self->{'run_id'});
require Testopia::TestRun;
$self->{'run'} = Testopia::TestRun->new($self->{'run_id'});
return $self->{'run'};
}
@ -870,8 +870,8 @@ Returns the TestCase object that this case-run is associated with
sub case {
my $self = shift;
return $self->{'case'} if exists $self->{'case'};
require Bugzilla::Testopia::TestCase;
$self->{'case'} = Bugzilla::Testopia::TestCase->new($self->{'case_id'});
require Testopia::TestCase;
$self->{'case'} = Testopia::TestCase->new($self->{'case_id'});
return $self->{'case'};
}
@ -884,7 +884,7 @@ Returns the Build object that this case-run is associated with
sub build {
my $self = shift;
return $self->{'build'} if exists $self->{'build'};
$self->{'build'} = Bugzilla::Testopia::Build->new($self->{'build_id'});
$self->{'build'} = Testopia::Build->new($self->{'build_id'});
return $self->{'build'};
}
@ -897,7 +897,7 @@ Returns the Build object that this case-run is associated with
sub environment {
my $self = shift;
return $self->{'environment'} if exists $self->{'environment'};
$self->{'environment'} = Bugzilla::Testopia::Environment->new($self->{'environment_id'});
$self->{'environment'} = Testopia::Environment->new($self->{'environment_id'});
return $self->{'environment'};
}
@ -937,7 +937,7 @@ sub attachments {
my @attachments;
foreach my $attach (@{$attachments}){
my $att = Bugzilla::Testopia::Attachment->new($attach->{attachment_id});
my $att = Testopia::Attachment->new($attach->{attachment_id});
$att->{'caserun_id'} = $self->id if $attach->{case_run_id};
push @attachments, $att;
}
@ -1157,7 +1157,7 @@ sub lookup_status_by_name {
__END__
=head1 NAME
Bugzilla::Testopia::TestCaseRun - Testopia Test Case Run object
Testopia::TestCaseRun - Testopia Test Case Run object
=head1 DESCRIPTION
@ -1171,10 +1171,10 @@ case-run is made in the table for historical purposes.
=head1 SYNOPSIS
use Bugzilla::Testopia::TestCaseRun;
use Testopia::TestCaseRun;
$caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
$caserun = Bugzilla::Testopia::TestCaseRun->new(\%caserun_hash);
$caserun = Testopia::TestCaseRun->new($caserun_id);
$caserun = Testopia::TestCaseRun->new(\%caserun_hash);
=cut

View File

@ -18,7 +18,7 @@
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::TestPlan;
package Testopia::TestPlan;
use strict;
@ -30,17 +30,17 @@ use Bugzilla::Constants;
use Bugzilla::Version;
use Bugzilla::Bug;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestTag;
use Bugzilla::Testopia::Product;
use Bugzilla::Testopia::Attachment;
use Testopia::Constants;
use Testopia::Util;
use Testopia::TestTag;
use Testopia::Product;
use Testopia::Attachment;
use Text::Diff;
use JSON;
use base qw(Exporter Bugzilla::Object);
@Bugzilla::Testopia::TestPlan::EXPORT = qw(lookup_type_by_name lookup_type);
@Testopia::TestPlan::EXPORT = qw(lookup_type_by_name lookup_type);
###############################
#### Initialization ####
@ -118,10 +118,10 @@ sub _check_product {
my $product;
if ($product_id !~ /^\d+$/ ){
$product = Bugzilla::Product::check_product($product_id);
$product = Bugzilla::Testopia::Product->new($product->id);
$product = Testopia::Product->new($product->id);
}
else {
$product = Bugzilla::Testopia::Product->new($product_id);
$product = Testopia::Product->new($product_id);
}
ThrowUserError("invalid-test-id-non-existent", {'id' => $product_id, 'type' => 'product'}) unless $product;
@ -153,7 +153,7 @@ sub _check_type {
if ($type_id !~ /^\d+$/){
$type_id = lookup_type_by_name($type_id) || $type_id;
}
Bugzilla::Testopia::Util::validate_selection($type_id, 'type_id', 'test_plan_types');
Testopia::Util::validate_selection($type_id, 'type_id', 'test_plan_types');
return $type_id;
}
@ -226,7 +226,7 @@ sub create {
$class->SUPER::check_required_create_fields($params);
my $field_values = $class->run_create_validators($params);
$field_values->{creation_date} = Bugzilla::Testopia::Util::get_time_stamp();
$field_values->{creation_date} = Testopia::Util::get_time_stamp();
$field_values->{isactive} = 1;
#We have to handle the plan document text a bit differently since it has its own table.
@ -247,8 +247,8 @@ sub create {
# Create default category
unless (scalar @{$self->product->categories}){
require Bugzilla::Testopia::Category;
my $category = Bugzilla::Testopia::Category->create(
require Testopia::Category;
my $category = Testopia::Category->create(
{'name' => '--default--',
'description' => 'Default product category for test cases',
'product_id' => $self->product->id });
@ -260,13 +260,13 @@ sub create {
sub update {
my $self = shift;
my $dbh = Bugzilla->dbh;
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$dbh->bz_start_transaction();
my $changed = $self->SUPER::update();
foreach my $field (keys %$changed){
Bugzilla::Testopia::Util::log_activity('plan', $self->id, $field, $timestamp, $changed->{$field}->[0], $changed->{$field}->[1]);
Testopia::Util::log_activity('plan', $self->id, $field, $timestamp, $changed->{$field}->[0], $changed->{$field}->[1]);
}
$dbh->bz_commit_transaction();
}
@ -288,7 +288,7 @@ sub store_text {
my $dbh = Bugzilla->dbh;
my ($key, $author, $text, $timestamp) = @_;
if (!defined $timestamp){
($timestamp) = Bugzilla::Testopia::Util::get_time_stamp();
($timestamp) = Testopia::Util::get_time_stamp();
}
$text ||= '';
trick_taint($text);
@ -317,7 +317,7 @@ sub clone {
my $dbh = Bugzilla->dbh;
# Exclude the auto-incremented field from the column list.
my $columns = join(", ", grep {$_ ne 'plan_id'} DB_COLUMNS);
my ($timestamp) = Bugzilla::Testopia::Util::get_time_stamp();
my ($timestamp) = Testopia::Util::get_time_stamp();
$dbh->do("INSERT INTO test_plans ($columns) VALUES (?,?,?,?,?,?,?)",
undef, ($product_id, $author,
@ -367,7 +367,7 @@ sub add_tag {
}
foreach my $name (@tags){
my $tag = Bugzilla::Testopia::TestTag->create({'tag_name' => $name});
my $tag = Testopia::TestTag->create({'tag_name' => $name});
$tag->attach($self);
}
}
@ -381,7 +381,7 @@ Removes a tag from this plan. Takes the tag_id of the tag to remove.
sub remove_tag {
my $self = shift;
my ($tag_name) = @_;
my $tag = Bugzilla::Testopia::TestTag->check_tag($tag_name);
my $tag = Testopia::TestTag->check_tag($tag_name);
ThrowUserError('testopia-unknown-tag', {'name' => $tag}) unless $tag;
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_plan_tags
@ -1132,7 +1132,7 @@ sub attachments {
my @attachments;
foreach my $attach (@{$attachments}){
push @attachments, Bugzilla::Testopia::Attachment->new($attach);
push @attachments, Testopia::Attachment->new($attach);
}
$self->{'attachments'} = \@attachments;
return $self->{'attachments'};
@ -1177,7 +1177,7 @@ sub product {
return $self->{'product'} if exists $self->{'product'};
$self->{'product'} = Bugzilla::Testopia::Product->new($self->product_id);
$self->{'product'} = Testopia::Product->new($self->product_id);
return $self->{'product'};
}
@ -1193,7 +1193,7 @@ sub test_cases {
my $dbh = Bugzilla->dbh;
return $self->{'test_cases'} if exists $self->{'test_cases'};
require Bugzilla::Testopia::TestCase;
require Testopia::TestCase;
my $caseids = $dbh->selectcol_arrayref(
"SELECT case_id FROM test_case_plans
@ -1201,7 +1201,7 @@ sub test_cases {
undef, $self->{'plan_id'});
my @cases;
foreach my $id (@{$caseids}){
push @cases, Bugzilla::Testopia::TestCase->new($id);
push @cases, Testopia::TestCase->new($id);
}
$self->{'test_cases'} = \@cases;
@ -1241,7 +1241,7 @@ sub test_runs {
undef, $self->{'plan_id'});
my @runs;
foreach my $id (@{$runids}){
push @runs, Bugzilla::Testopia::TestRun->new($id);
push @runs, Testopia::TestRun->new($id);
}
$self->{'test_runs'} = \@runs;
@ -1291,7 +1291,7 @@ sub builds_seen {
my ($status_id) = @_;
my $dbh = Bugzilla->dbh;
require Bugzilla::Testopia::Build;
require Testopia::Build;
my $ref = $dbh->selectcol_arrayref(
"SELECT DISTINCT test_case_runs.build_id
@ -1302,7 +1302,7 @@ sub builds_seen {
my @o;
foreach my $id (@$ref){
push @o, Bugzilla::Testopia::Build->new($id);
push @o, Testopia::Build->new($id);
}
return \@o;
}
@ -1312,7 +1312,7 @@ sub environments_seen {
my ($status_id) = @_;
my $dbh = Bugzilla->dbh;
require Bugzilla::Testopia::Environment;
require Testopia::Environment;
my $ref = $dbh->selectcol_arrayref(
"SELECT DISTINCT test_case_runs.environment_id
@ -1323,7 +1323,7 @@ sub environments_seen {
my @o;
foreach my $id (@$ref){
push @o, Bugzilla::Testopia::Environment->new($id);
push @o, Testopia::Environment->new($id);
}
return \@o;
}
@ -1347,7 +1347,7 @@ sub tags {
undef, $self->{'plan_id'});
my @plan_tags;
foreach my $t (@{$tagids}){
push @plan_tags, Bugzilla::Testopia::TestTag->new($t);
push @plan_tags, Testopia::TestTag->new($t);
}
$self->{'tags'} = \@plan_tags;
return $self->{'tags'};
@ -1445,7 +1445,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::TestPlan - Testopia Test Plan object
Testopia::TestPlan - Testopia Test Plan object
=head1 DESCRIPTION
@ -1455,10 +1455,10 @@ to a plan.
=head1 SYNOPSIS
use Bugzilla::Testopia::TestPlan;
use Testopia::TestPlan;
$plan = Bugzilla::Testopia::TestPlan->new($plan_id);
$plan = Bugzilla::Testopia::TestPlan->new({});
$plan = Testopia::TestPlan->new($plan_id);
$plan = Testopia::TestPlan->new({});
=cut

View File

@ -20,7 +20,7 @@
# Ed Fuentetaja <efuentetaja@acm.org>
# Joel Smith <jsmith@novell.com>
package Bugzilla::Testopia::TestRun;
package Testopia::TestRun;
use strict;
@ -31,15 +31,15 @@ use Bugzilla::Constants;
use Bugzilla::Bug;
use Bugzilla::Config;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Environment;
use Bugzilla::Testopia::Build;
use Testopia::Constants;
use Testopia::Environment;
use Testopia::Build;
use JSON;
use Date::Parse;
use base qw(Exporter Bugzilla::Object);
@Bugzilla::Testopia::TestRun::EXPORT = qw(calculate_percent);
@Testopia::TestRun::EXPORT = qw(calculate_percent);
###############################
#### Initialization ####
@ -110,7 +110,7 @@ sub _check_plan {
my ($invocant, $plan_id) = @_;
trick_taint($plan_id);
ThrowUserError('testopia-missing-required-field', {'field' => 'plan'}) unless $plan_id;
Bugzilla::Testopia::Util::validate_test_id($plan_id, 'plan');
Testopia::Util::validate_test_id($plan_id, 'plan');
return $plan_id;
}
@ -118,7 +118,7 @@ sub _check_env {
my ($invocant, $env_id) = @_;
trick_taint($env_id);
ThrowUserError('testopia-missing-required-field', {'field' => 'environment'}) unless $env_id;
Bugzilla::Testopia::Util::validate_test_id($env_id, 'environment');
Testopia::Util::validate_test_id($env_id, 'environment');
return $env_id;
}
@ -126,7 +126,7 @@ sub _check_build {
my ($invocant, $build_id) = @_;
trick_taint($build_id);
ThrowUserError('testopia-missing-required-field', {'field' => 'build'}) unless $build_id;
Bugzilla::Testopia::Util::validate_test_id($build_id, 'build');
Testopia::Util::validate_test_id($build_id, 'build');
return $build_id;
}
@ -230,7 +230,7 @@ sub new {
sub run_create_validators {
my $class = shift;
my $params = $class->SUPER::run_create_validators(@_);
my $plan = Bugzilla::Testopia::TestPlan->new($params->{plan_id});
my $plan = Testopia::TestPlan->new($params->{plan_id});
$params->{product_version} = $class->_check_product_version($params->{product_version}, $plan->product);
@ -239,13 +239,13 @@ sub run_create_validators {
sub create {
my ($class, $params) = @_;
require Bugzilla::Testopia::TestPlan;
require Testopia::TestPlan;
$class->SUPER::check_required_create_fields($params);
my $field_values = $class->run_create_validators($params);
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$field_values->{start_date} = $timestamp;
$field_values->{stop_date} = Bugzilla::Testopia::Util::get_time_stamp() if $field_values->{status} == 0;
$field_values->{stop_date} = Testopia::Util::get_time_stamp() if $field_values->{status} == 0;
delete $field_values->{status};
my $self = $class->SUPER::insert_create_data($field_values);
@ -256,14 +256,14 @@ sub create {
sub update {
my $self = shift;
my $dbh = Bugzilla->dbh;
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$dbh->bz_start_transaction();
my $changed = $self->SUPER::update();
foreach my $field (keys %$changed){
Bugzilla::Testopia::Util::log_activity('run', $self->id, $field, $timestamp, $changed->{$field}->[0], $changed->{$field}->[1]);
Testopia::Util::log_activity('run', $self->id, $field, $timestamp, $changed->{$field}->[0], $changed->{$field}->[1]);
}
$dbh->bz_commit_transaction();
@ -350,7 +350,7 @@ sub add_tag {
}
foreach my $name (@tags){
my $tag = Bugzilla::Testopia::TestTag->create({'tag_name' => $name});
my $tag = Testopia::TestTag->create({'tag_name' => $name});
$tag->attach($self);
}
}
@ -364,7 +364,7 @@ Disassociates a tag from this test run
sub remove_tag {
my $self = shift;
my ($tag_name) = @_;
my $tag = Bugzilla::Testopia::TestTag->check_tag($tag_name);
my $tag = Testopia::TestTag->check_tag($tag_name);
ThrowUserError('testopia-unknown-tag', {'name' => $tag}) unless $tag;
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_run_tags
@ -386,12 +386,12 @@ sub add_case_run {
$status ||=IDLE;
trick_taint($case_id);
return 0 if $self->check_case($case_id);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
my $case = Testopia::TestCase->new($case_id);
$sortkey = $case->sortkey unless $sortkey;
return 0 if $case->status ne 'CONFIRMED';
my $assignee = $case->default_tester ? $case->default_tester->id : undef;
my $caserun = Bugzilla::Testopia::TestCaseRun->create({
my $caserun = Testopia::TestCaseRun->create({
'run_id' => $self->{'run_id'},
'case_id' => $case_id,
'assignee' => $assignee,
@ -416,7 +416,7 @@ sub store {
my $dbh = Bugzilla->dbh;
# Exclude the auto-incremented field from the column list.
my $columns = join(", ", grep {$_ ne 'run_id'} DB_COLUMNS);
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$dbh->do("INSERT INTO test_runs ($columns) VALUES (?,?,?,?,?,?,?,?,?,?)",
undef, ($self->{'plan_id'}, $self->{'environment_id'},
@ -455,7 +455,7 @@ sub clone {
my $dbh = Bugzilla->dbh;
# Exclude the auto-incremented field from the column list.
my $columns = join(", ", grep {$_ ne 'run_id'} DB_COLUMNS);
my $timestamp = Bugzilla::Testopia::Util::get_time_stamp();
my $timestamp = Testopia::Util::get_time_stamp();
$dbh->do("INSERT INTO test_runs ($columns) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
undef, ($plan_id, $env_id,
@ -702,7 +702,7 @@ sub filter_case_categories {
my @categories;
foreach my $id (@$ids){
push @categories, Bugzilla::Testopia::Category->new($id);
push @categories, Testopia::Category->new($id);
}
return \@categories;
@ -722,7 +722,7 @@ sub filter_builds {
my @builds;
foreach my $id (@$ids){
push @builds, Bugzilla::Testopia::Build->new($id);
push @builds, Testopia::Build->new($id);
}
return \@builds;
}
@ -766,7 +766,7 @@ sub environments {
my @environments;
foreach my $id (@{$environments}){
push @environments, Bugzilla::Testopia::Environment->new($id);
push @environments, Testopia::Environment->new($id);
}
$self->{'environments'} = \@environments;
return $self->{'environments'};
@ -1043,8 +1043,8 @@ is assoceated with
sub plan {
my $self = shift;
return $self->{'plan'} if exists $self->{'plan'};
require Bugzilla::Testopia::TestPlan;
$self->{'plan'} = Bugzilla::Testopia::TestPlan->new($self->{'plan_id'});
require Testopia::TestPlan;
$self->{'plan'} = Testopia::TestPlan->new($self->{'plan_id'});
return $self->{'plan'};
}
@ -1067,7 +1067,7 @@ sub tags {
undef, $self->{'run_id'});
my @tags;
foreach my $t (@{$tagids}){
push @tags, Bugzilla::Testopia::TestTag->new($t);
push @tags, Testopia::TestTag->new($t);
}
$self->{'tags'} = \@tags;
return $self->{'tags'};
@ -1083,7 +1083,7 @@ this run is assoceated with
sub environment {
my $self = shift;
return $self->{'environment'} if exists $self->{'environment'};
$self->{'environment'} = Bugzilla::Testopia::Environment->new($self->{'environment_id'});
$self->{'environment'} = Testopia::Environment->new($self->{'environment_id'});
return $self->{'environment'};
}
@ -1098,7 +1098,7 @@ is assoceated with
sub build {
my $self = shift;
return $self->{'build'} if exists $self->{'build'};
$self->{'build'} = Bugzilla::Testopia::Build->new($self->{'build_id'});
$self->{'build'} = Testopia::Build->new($self->{'build_id'});
return $self->{'build'};
}
@ -1173,7 +1173,7 @@ sub cases {
return $self->{'cases'} if exists $self->{'cases'};
my @cases;
foreach my $cr (@{$self->current_caseruns}){
push @cases, Bugzilla::Testopia::TestCase->new($cr->case_id);
push @cases, Testopia::TestCase->new($cr->case_id);
}
$self->{'cases'} = \@cases;
return $self->{'cases'};
@ -1400,7 +1400,7 @@ sub current_caseruns {
my $dbh = Bugzilla->dbh;
return $self->{'current_caseruns'} if exists $self->{'current_caseruns'};
require Bugzilla::Testopia::TestCaseRun;
require Testopia::TestCaseRun;
my $ref = $dbh->selectcol_arrayref(
"SELECT case_run_id FROM test_case_runs
@ -1409,7 +1409,7 @@ sub current_caseruns {
my @caseruns;
foreach my $id (@{$ref}){
push @caseruns, Bugzilla::Testopia::TestCaseRun->new($id);
push @caseruns, Testopia::TestCaseRun->new($id);
}
$self->{'current_caseruns'} = \@caseruns;
return $self->{'current_caseruns'};
@ -1427,7 +1427,7 @@ sub caseruns {
my $dbh = Bugzilla->dbh;
return $self->{'caseruns'} if exists $self->{'caseruns'};
require Bugzilla::Testopia::TestCaseRun;
require Testopia::TestCaseRun;
my $ref = $dbh->selectcol_arrayref(
"SELECT case_run_id FROM test_case_runs
@ -1435,7 +1435,7 @@ sub caseruns {
my @caseruns;
foreach my $id (@{$ref}){
push @caseruns, Bugzilla::Testopia::TestCaseRun->new($id);
push @caseruns, Testopia::TestCaseRun->new($id);
}
$self->{'caseruns'} = \@caseruns;
return $self->{'caseruns'};
@ -1473,7 +1473,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::TestRun - Testopia Test Run object
Testopia::TestRun - Testopia Test Run object
=head1 DESCRIPTION
@ -1484,10 +1484,10 @@ case-runs.
=head1 SYNOPSIS
use Bugzilla::Testopia::TestRun;
use Testopia::TestRun;
$run = Bugzilla::Testopia::TestRun->new($run_id);
$run = Bugzilla::Testopia::TestRun->new(\%run_hash);
$run = Testopia::TestRun->new($run_id);
$run = Testopia::TestRun->new(\%run_hash);
=cut

View File

@ -20,7 +20,7 @@
=head1 NAME
Bugzilla::Testopia::TestTag - A Testopia tag
Testopia::TestTag - A Testopia tag
=head1 DESCRIPTION
@ -31,14 +31,14 @@ not require administrator privileges to create.
=head1 SYNOPSIS
use Bugzilla::Testopia::TestTag;
use Testopia::TestTag;
$tag = Bugzilla::Testopia::TestTag->new($tag_id);
$tag = Bugzilla::Testopia::TestTag->new($tag_hash);
$tag = Testopia::TestTag->new($tag_id);
$tag = Testopia::TestTag->new($tag_hash);
=cut
package Bugzilla::Testopia::TestTag;
package Testopia::TestTag;
use strict;
@ -145,7 +145,7 @@ sub check_tag {
WHERE tag_name = ?",
undef, lc($name));
if ($id){
return Bugzilla::Testopia::TestTag->new($id);
return Testopia::TestTag->new($id);
}
else{
return undef;

View File

@ -22,7 +22,7 @@
=head1 NAME
Bugzilla::Testopia::Util
Testopia::Util
=head1 DESCRIPTION
@ -31,12 +31,12 @@ It exports all of these functions using Exporter.
=cut
package Bugzilla::Testopia::Util;
package Testopia::Util;
use strict;
use base qw(Exporter);
@Bugzilla::Testopia::Util::EXPORT = qw(get_test_field_id get_time_stamp
@Testopia::Util::EXPORT = qw(get_test_field_id get_time_stamp
validate_test_id validate_selection
support_server_push process_list
percentage);
@ -46,7 +46,7 @@ use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Util;
#use Bugzilla::Testopia::TestPlan;
#use Testopia::TestPlan;
### Methods ###
@ -193,7 +193,7 @@ sub log_activity {
$timestamp ||= get_time_stamp();
trick_taint($newvalue) if defined $newvalue;
my $field_id = Bugzilla::Testopia::Util::get_test_field_id($field, "test_". $type ."s");
my $field_id = Testopia::Util::get_test_field_id($field, "test_". $type ."s");
$dbh->do("INSERT INTO test_". $type ."_activity
(". $type . "_id, fieldid, who, changed, oldvalue, newvalue)
VALUES(?,?,?,?,?,?)",

View File

@ -22,7 +22,7 @@
=head1 NAME
Bugzilla::Testopia::Xml - Testopia Xml object
Testopia::Xml - Testopia Xml object
=head1 DESCRIPTION
@ -32,11 +32,11 @@ are detected.
=head1 SYNOPSIS
use Bugzilla::Testopia::Xml;
use Testopia::Xml;
=cut
package Bugzilla::Testopia::Xml;
package Testopia::Xml;
#use fields qw(testplans testcases tags categories builds);
use strict;
@ -44,15 +44,15 @@ use strict;
use Bugzilla::Config;
use Bugzilla::Product;
use Bugzilla::Testopia::Attachment;
use Bugzilla::Testopia::Build;
use Bugzilla::Testopia::Category;
use Bugzilla::Testopia::TestCase;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestRun;
use Bugzilla::Testopia::TestTag;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::XmlTestCase;
use Testopia::Attachment;
use Testopia::Build;
use Testopia::Category;
use Testopia::TestCase;
use Testopia::TestPlan;
use Testopia::TestRun;
use Testopia::TestTag;
use Testopia::Util;
use Testopia::XmlTestCase;
use Bugzilla::User;
use Bugzilla::Util;
@ -99,7 +99,7 @@ our $XML_LT = "&[Ll][Tt];";
our $XML_QUOT = "&[Qq][Uu][Oo][Tt];";
use constant XMLREFERENCES_FIELDS => "Database_description Database_id Xml_description";
@Bugzilla::Testopia::Xml::EXPORT = qw($DATABASE_DESCRIPTION $DATABASE_ID $XML_DESCRIPTION);
@Testopia::Xml::EXPORT = qw($DATABASE_DESCRIPTION $DATABASE_ID $XML_DESCRIPTION);
use Class::Struct;
#
@ -107,7 +107,7 @@ use Class::Struct;
#
struct
(
'Bugzilla::Testopia::Xml',
'Testopia::Xml',
{
# Array of attachments read for xml source.
attachments => '@',
@ -228,7 +228,7 @@ sub parse()
}
else
{
$self->error("Bugzilla::Testopia::Xml::parse has no XML input source")
$self->error("Testopia::Xml::parse has no XML input source")
}
my $root = $twig->root;
@ -270,7 +270,7 @@ sub parse()
next;
}
my $category = new Bugzilla::Testopia::Category
my $category = new Testopia::Category
({
name => $category_name,
product_id => $product->id(),
@ -281,7 +281,7 @@ sub parse()
push @{$self->categories}, $category if ( ! $category->check_name($category_name) );
}
my $testplan = Bugzilla::Testopia::TestPlan->new({});
my $testplan = Testopia::TestPlan->new({});
my %plantype_ids;
my @temparray = @{$testplan->get_plan_types()};
foreach my $arrayelement (@temparray)
@ -308,7 +308,7 @@ sub parse()
$author_id = $author_user->id();
}
my $product_id = Bugzilla::Testopia::TestPlan::lookup_product_by_name($twig_testplan->field('product'));
my $product_id = 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') . "'.");
@ -316,9 +316,9 @@ sub parse()
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 ) );
$self->error("Length of Test Plan name '" . $name . "' must be " . Testopia::TestPlan->NAME_MAX_LENGTH . " characters or less.") if ( defined($name) && ( length($name) > Testopia::TestPlan->NAME_MAX_LENGTH ) );
$testplan = Bugzilla::Testopia::TestPlan->create({
$testplan = Testopia::TestPlan->create({
'name' => $name,
'product_id' => $product_id,
'default_product_version' => entity_replace_xml($twig_testplan->field('productversion'),STRIP_BOTH),
@ -354,7 +354,7 @@ sub parse()
bless($submitter_user,"Bugzilla::User");
$submitter_id = $submitter_user->id();
}
my $attachment = Bugzilla::Testopia::Attachment->new({
my $attachment = 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,
@ -365,7 +365,7 @@ sub parse()
}
}
my $testcase = Bugzilla::Testopia::TestCase->new({ 'name' => 'dummy' });
my $testcase = Testopia::TestCase->new({ 'name' => 'dummy' });
my %priority_ids;
@temparray = @{$testcase->get_priority_list()};
foreach my $arrayelement (@temparray)
@ -383,7 +383,7 @@ sub parse()
{
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 ) );
$self->error("Length of summary '" . $summary . "' must be " . Testopia::TestCase->SUMMARY_MAX_LENGTH . " characters or less.") if ( defined($summary) && ( length($summary) > 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'.
@ -414,20 +414,20 @@ sub parse()
bless($tester_user,"Bugzilla::User");
$tester_id = $tester_user->id();
}
my $status_id = Bugzilla::Testopia::TestCase::lookup_status_by_name($twig_testcase->att('status'));
my $status_id = 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));
my $xml_testcase = new Testopia::XmlTestCase;
$xml_testcase->blocks(Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS));
$xml_testcase->dependson(Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS));
$xml_testcase->testplan(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 ) );
$self->error("Length of alias '" . $alias . "' in test case '" . $summary . "' must be " . Testopia::TestCase->ALIAS_MAX_LENGTH . " characters or less.") if ( defined($alias) && ( length($alias) > 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 ) );
$self->error("Length of requirement '" . $requirement . "' in test case '" . $summary . "' must be " . Testopia::TestCase->REQUIREMENT_MAX_LENGTH . " characters or less.") if ( defined($requirement) && ( length($requirement) > Testopia::TestCase->REQUIREMENT_MAX_LENGTH ) );
$xml_testcase->testcase(Bugzilla::Testopia::TestCase->new({
$xml_testcase->testcase(Testopia::TestCase->new({
'action' => entity_replace_testopia($twig_testcase->field('action')),
'alias' => $alias,
'arguments' => entity_replace_xml($twig_testcase->field('arguments'),STRIP_NONE),
@ -457,9 +457,9 @@ sub parse()
. $twig_testplan_reference->att('type')
. "' in test case '" . $twig_testcase->field('summary') . "'." );
}
elsif ( length($testplan_reference) > Bugzilla::Testopia::TestPlan->NAME_MAX_LENGTH )
elsif ( length($testplan_reference) > 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.");
$self->error("Length of Test Plan name '" . $testplan_reference . "' for test case '" . $summary . "' must be " . 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)) )
{
@ -516,7 +516,7 @@ sub parse()
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 ) );
$self->error("Length of tag '" . $tag . "' in test case '" . $summary . "' must be " . Testopia::TestCase->TAG_MAX_LENGTH . " characters or less.") if ( defined($tag) && ( length($tag) > Testopia::TestCase->TAG_MAX_LENGTH ) );
$xml_testcase->add_tag($tag);
}
@ -558,7 +558,7 @@ sub parse()
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);
my $alias_testcase_id = Testopia::TestCase::class_check_alias($alias);
if ( $alias_testcase_id )
{
$duplicate_alias{$alias} = $alias_testcase_id;
@ -614,7 +614,7 @@ sub parse()
if ( ! $category->check_name($category->name()) )
{
$category->store();
my $product_name = Bugzilla::Testopia::Product->new($category->product_id())->name();
my $product_name = Testopia::Product->new($category->product_id())->name();
print "Created category '" . $category->name() . "': " . $category->description() . " for product " . $product_name . ".\n";
}
}
@ -624,7 +624,7 @@ sub parse()
{
foreach my $asciitag ( @{$self->tags} )
{
my $classtag = Bugzilla::Testopia::TestTag->new({'tag_name' => $asciitag});
my $classtag = Testopia::TestTag->new({'tag_name' => $asciitag});
my $tagid = $classtag->store;
$testplan->{'tag_id'} = $tagid;
$testplan->add_tag($tagid);
@ -632,7 +632,7 @@ sub parse()
foreach my $attachment ( @{$self->attachments} )
{
$attachment->{'plan_id'} = $testplan->id;
Bugzilla::Testopia::Attachment->create($attachment);
Testopia::Attachment->create($attachment);
}
print "Created Test Plan ". $testplan->id . ": " . $testplan->name() . "\n";
}
@ -640,7 +640,7 @@ sub parse()
# Store new testcases.
foreach my $testcase ( @{$self->testcases} )
{
bless($testcase,"Bugzilla::Testopia::XmlTestCase");
bless($testcase,"Testopia::XmlTestCase");
my $result = $testcase->store(@{$self->testplans});
if ( $result ne "" )
{

View File

@ -18,7 +18,7 @@
#
# Contributor(s): David Koenig <dkoenig@novell.com>
package Bugzilla::Testopia::XmlReferences;
package Testopia::XmlReferences;
use constant IGNORECASE => "ignorecase";
@ -78,7 +78,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::XmlReferences - Testopia XmlReferences object
Testopia::XmlReferences - Testopia XmlReferences object
=head1 DESCRIPTION
@ -89,11 +89,11 @@ are stored here and processed as needed.
=head1 SYNOPSIS
use Bugzilla::Testopia::XmlReferences;
use Testopia::XmlReferences;
$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));
$xml_testcase->blocks(Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS));
$xml_testcase->dependson(Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS));
$xml_testcase->testplan(Testopia::XmlReferences->new(IGNORECASE, XMLREFERENCES_FIELDS));
=head1 METHODS

View File

@ -20,38 +20,38 @@
# Jeff Dayley <jedayley@novell.com>
# Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Testopia::XmlTestCase;
package Testopia::XmlTestCase;
#use fields qw(testplans testcases tags categories builds);
use strict;
use Bugzilla::Product;
use Bugzilla::Testopia::Attachment;
use Bugzilla::Testopia::Build;
use Bugzilla::Testopia::Category;
use Bugzilla::Testopia::TestCase;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestRun;
use Bugzilla::Testopia::TestTag;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::XmlReferences;
use Bugzilla::Testopia::Product;
use Testopia::Attachment;
use Testopia::Build;
use Testopia::Category;
use Testopia::TestCase;
use Testopia::TestPlan;
use Testopia::TestRun;
use Testopia::TestTag;
use Testopia::Util;
use Testopia::XmlReferences;
use Testopia::Product;
use Bugzilla::User;
use Bugzilla::Util;
use Class::Struct;
struct(
'Bugzilla::Testopia::XmlTestCase',
'Testopia::XmlTestCase',
{
attachments => '@',
blocks => 'Bugzilla::Testopia::XmlReferences',
blocks => 'Testopia::XmlReferences',
category => '$',
component_ids => '@',
dependson => 'Bugzilla::Testopia::XmlReferences',
dependson => 'Testopia::XmlReferences',
tags => '@',
testcase => '$',
testplan => 'Bugzilla::Testopia::XmlReferences',
testplan => 'Testopia::XmlReferences',
}
);
@ -96,7 +96,7 @@ sub add_component {
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 $product = Testopia::Product->new($product_id);
my $components_ref = $product->components;
foreach my $product_component ( @$components_ref ) {
if ( $component eq $product_component->name ) {
@ -181,24 +181,24 @@ sub get_testcase_ids {
my ($self, $field, @new_testcases) = @_;
my $error_message = "";
my @testcase_id = @{$self->$field->get(uc $Bugzilla::Testopia::Xml::DATABASE_ID)};
my @testcase_id = @{$self->$field->get(uc $Testopia::Xml::DATABASE_ID)};
foreach my $testcase_summary ( @{$self->$field->get(uc $Bugzilla::Testopia::Xml::XML_DESCRIPTION)} ) {
foreach my $testcase_summary ( @{$self->$field->get(uc $Testopia::Xml::XML_DESCRIPTION)} ) {
foreach my $testcase (@new_testcases) {
push @testcase_id, $testcase->testcase->{'case_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)} ) {
foreach my $testcase_summary ( @{$self->$field->get(uc $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 . "'.";
$error_message .= "Have not implemented code for $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);
my $testcase = 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 . "'.";
@ -215,22 +215,22 @@ sub get_testcase_ids {
sub store {
my ($self, @new_testplans) = @_;
my $error_message = "";
my @testplan_id = @{$self->testplan->get(uc $Bugzilla::Testopia::Xml::DATABASE_ID)};
my @testplan_id = @{$self->testplan->get(uc $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_name ( @{$self->testplan->get(uc $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)} ) {
foreach my $testplan_name ( @{$self->testplan->get(uc $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'} . "'.";
$error_message .= "Have not implemented code for $Testopia::Xml::DATABASE_DESCRIPTION lookup of test plan " . $testplan_name . "' for Test Case '". $self->testcase->{'summary'} . "'.";
}
return $error_message if ( $error_message ne "" );
@ -240,7 +240,7 @@ sub store {
# Verify that each testplan exists.
my @testplan;
foreach my $testplan_id (@testplan_id) {
my $testplan = Bugzilla::Testopia::TestPlan->new($testplan_id);
my $testplan = 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'} . "'.";
@ -256,9 +256,9 @@ sub store {
foreach my $testplan (@testplan) {
my $category = $testplan->product->categories->[0];
my $categoryid = check_case_category($self->category, new Bugzilla::Testopia::Product($testplan->product_id)) if ( defined($category) );
my $categoryid = check_case_category($self->category, new Testopia::Product($testplan->product_id)) if ( defined($category) );
if ( ! defined($categoryid) ) {
my $new_category = Bugzilla::Testopia::Category->create({
my $new_category = Testopia::Category->create({
product_id => $testplan->product_id,
name => $self->category,
description => "FIX ME. Created during Test Plan import."
@ -268,11 +268,11 @@ sub store {
$self->testcase->{'category_id'} = $categoryid if ( ! defined($self->testcase->{'category_id'}) );
}
$self->testcase->{plans} = \@testplan;
my $case = Bugzilla::Testopia::TestCase->create($self->testcase);
my $case = Testopia::TestCase->create($self->testcase);
$self->testcase->{'case_id'} = $case->id;
foreach my $attachment ( @{$self->attachments} ) {
$attachment->{'case_id'} = $case->id;
$attachment = Bugzilla::Testopia::Attachment->create($attachment);
$attachment = Testopia::Attachment->create($attachment);
}
foreach my $asciitag ( @{$self->tags} ) {
$case->add_tag($asciitag);
@ -292,7 +292,7 @@ sub store {
sub store_relationships {
my ($self, @new_testcases) = @_;
return unless $self->testcase->{'case_id'};
my $testcase = Bugzilla::Testopia::TestCase->new($self->testcase->{'case_id'});
my $testcase = Testopia::TestCase->new($self->testcase->{'case_id'});
# Hashes are used because the entires in blocks and dependson must be unique.
my %blocks = ();
@ -330,7 +330,7 @@ __END__
=head1 NAME
Bugzilla::Testopia::XmlTestCase
Testopia::XmlTestCase
=head1 DESCRIPTION
@ -341,7 +341,7 @@ structure stores these references to be used during verfication and writting to
=head1 SYNOPSIS
$testcase = Bugzilla::Testopia::XMLTestcase->new($case_hash_ref);
$testcase = Testopia::XMLTestcase->new($case_hash_ref);
$testcase->store();
@ -380,7 +380,7 @@ Hash representation of the test case that will be created.
=item C<testplan>
Bugzilla::Testopia::XmlReferences of plans to link to this test case
Testopia::XmlReferences of plans to link to this test case
=back
@ -459,7 +459,7 @@ Bugzilla::Testopia::XmlReferences of plans to link to this test case
=item C<get_available_products()>
Description: Returns a list of products. This is the same code as Bugzilla::Testopia::TestPlan->get_available_products
Description: Returns a list of products. This is the same code as Testopia::TestPlan->get_available_products
without view restrictions.
Params: None.
@ -472,11 +472,11 @@ Bugzilla::Testopia::XmlReferences of plans to link to this test case
=over
L<Bugzilla::Testopia::TestCase>
L<Testopia::TestCase>
L<Bugzilla::Testopia::Xml>
L<Testopia::Xml>
L<Bugzilla::Testopia::XmlReferences>
L<Testopia::XmlReferences>
=back