Hi Kristis,
We are about to role out Test Director/Quality Center 9.2 here and I
have done some changes to support this.
The main change is to allow multiple "Assignees" for a given bug.
I have made the changes in such a way that that it is completely
backwards compatible for older versions of Test Director.
I have generated a diff for you, I hope that this is OK.
Thanks
Rob
diff -uNPr Scmbug_0-22-0/etc/scmbug/TestDirector.conf
Scmbug_Test_Director/etc/scmbug/TestDirector.conf
--- Scmbug_0-22-0/etc/scmbug/TestDirector.conf 2008-01-07 09:02:35.368987100
+0000
+++ Scmbug_Test_Director/etc/scmbug/TestDirector.conf 2008-01-07
09:02:36.916208600 +0000
@@ -10,30 +10,31 @@
# The list of the active and inactive states
td_bug_status_map => {
- "Open - Awaiting Check" => { name => "Open - Awaiting Check",
- active => 1,
- possible_resolution_states => [],
- possible_resolutions => [] },
- "Allocated to DEV/TAG" => { name => "Allocated to DEV/TAG",
- active => 1,
- possible_resolution_states => [],
- possible_resolutions => [] },
- "Fixed" => { name => "Fixed",
- active => 0,
- possible_resolution_states => [],
- possible_resolutions => [] },
- "Return to PAG" => { name => "Return to PAG",
- active => 0,
- possible_resolution_states => [],
- possible_resolutions => [] },
- "Closed" => { name => "Closed",
- active => 0,
- possible_resolution_states => [],
- possible_resolutions => [] },
- "PAG Invalid Defect" => { name => "PAG Invalid Defect",
- active => 0,
- possible_resolution_states => [],
- possible_resolutions => [] }
+ "Open" => { name => "Open",
+ active => 1,
+ possible_resolution_states => [
"Allocated", "Closed",
+
"Fixed"],
+ possible_resolutions => [] },
+ "Allocated" => { name => "Allocated",
+ active => 1,
+ possible_resolution_states => [ "Closed",
"Fixed" ],
+ possible_resolutions => [] },
+ "Fixed" => { name => "Fixed",
+ active => 0,
+ possible_resolution_states => [ "Closed" ],
+ possible_resolutions => [] },
+ "Closed" => { name => "Closed",
+ active => 0,
+ possible_resolution_states => [],
+ possible_resolutions => [] },
+ "Passed" => { name => "Passed",
+ active => 0,
+ possible_resolution_states => [],
+ possible_resolutions => [] },
+ "Return to QA" => { name => "Return to QA",
+ active => 0,
+ possible_resolution_states => [],
+ possible_resolutions => [] }
},
#
diff -uNPr Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/Bugzilla.pm
Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/Bugzilla.pm
--- Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/Bugzilla.pm 2008-01-07
09:02:36.322325600 +0000
+++ Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/Bugzilla.pm
2008-01-07 09:02:37.994575100 +0000
@@ -572,7 +572,9 @@
PopGlobalSQLState();
}
- return $bug_owner;
+ my @bug_owners = ( $bug_owner );
+
+ return @bug_owners;
}
diff -uNPr Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/Integration.pm
Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/Integration.pm
--- Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/Integration.pm 2008-01-07
09:02:36.337954100 +0000
+++ Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/Integration.pm
2008-01-07 09:02:38.010203600 +0000
@@ -108,7 +108,6 @@
my $who = $request->{ translated_username };
my $ret;
my $bug_state;
- my $bug_owner;
# Apply policy valid_product_name
if ( $request->{ policies }->{ valid_product_name }->{ enabled } ) {
@@ -128,21 +127,33 @@
if ( $request->{ policies }->{ valid_bug_owner }->{ enabled } ) {
# Verify that a bug is owned by the user submitting the
# request
- $bug_owner = $self->bugtracker()->integration_get_bug_owner( $bugid
);
+ my @bug_owners = $self->bugtracker()->integration_get_bug_owner(
$bugid );
- # Apply policy case_sensitive_username_verification
- my $case_sensitive_username_verification_bug_owner;
my $case_sensitive_username_verification_who;
if ( $request->{ policies }->{ case_sensitive_username_verification
} == 1 ) {
- $case_sensitive_username_verification_bug_owner = $bug_owner;
$case_sensitive_username_verification_who = $who;
} else {
- $case_sensitive_username_verification_bug_owner = lc $bug_owner;
$case_sensitive_username_verification_who = lc $who;
}
- if ( $case_sensitive_username_verification_bug_owner ne
$case_sensitive_username_verification_who ) {
- $ret_message = "Bug '$bugid' is not assigned to
'$case_sensitive_username_verification_who'. It is assigned to
'$case_sensitive_username_verification_bug_owner'.\n";
+ my $matched_owner = 0;
+ foreach my $bug_owner ( @bug_owners ) {
+ # Apply policy case_sensitive_username_verification
+ my $case_sensitive_username_verification_bug_owner;
+ if ( $request->{ policies }->{
case_sensitive_username_verification } == 1 ) {
+ $case_sensitive_username_verification_bug_owner =
$bug_owner;
+ } else {
+ $case_sensitive_username_verification_bug_owner = lc
$bug_owner;
+ }
+
+ if ( $case_sensitive_username_verification_bug_owner eq
$case_sensitive_username_verification_who ) {
+ $matched_owner = 1;
+ }
+ }
+
+ if( $matched_owner == 0 ) {
+ my $owners_string = join( ',', @bug_owners );
+ $ret_message = "Bug '$bugid' is not assigned to
'$case_sensitive_username_verification_who'. It is assigned to
'$owners_string'.\n";
$request->add_result(1, $ret_message);
}
}
@@ -178,7 +189,6 @@
if ( $request->{ policies }->{ resolution_template }->{ enabled } ) {
foreach my $resolution_id ( sort keys %{ $request->{ resolution_ids } }
) {
- my $bug_owner;
my $who = $request->{ translated_username };
# Verify that the bugs are owned by the user changing the
@@ -200,24 +210,35 @@
# resolution status
if ( $request->{ policies }->{ resolution_template }->{
resolution_valid_bug_owner } ) {
- $bug_owner = $self->bugtracker()->integration_get_bug_owner(
$resolution_id );
-
- # Apply policy case_sensitive_username_verification
- my $case_sensitive_username_verification_bug_owner;
- my $case_sensitive_username_verification_who;
- if ( $request->{ policies }->{
case_sensitive_username_verification } == 1 ) {
- $case_sensitive_username_verification_bug_owner =
$bug_owner;
+ my @bug_owners =
$self->bugtracker()->integration_get_bug_owner( $resolution_id );
+
+ my $case_sensitive_username_verification_who;
+ if ( $request->{ policies }->{
case_sensitive_username_verification } == 1 ) {
$case_sensitive_username_verification_who = $who;
- } else {
- $case_sensitive_username_verification_bug_owner = lc
$bug_owner;
+ } else {
$case_sensitive_username_verification_who = lc $who;
- }
+ }
+
+ my $matched_owner = 0;
+ foreach my $bug_owner ( @bug_owners ) {
+ # Apply policy case_sensitive_username_verification
+ my $case_sensitive_username_verification_bug_owner;
+ if ( $request->{ policies }->{
case_sensitive_username_verification } == 1 ) {
+ $case_sensitive_username_verification_bug_owner =
$bug_owner;
+ } else {
+ $case_sensitive_username_verification_bug_owner = lc
$bug_owner;
+ }
- if ( $case_sensitive_username_verification_bug_owner ne
$case_sensitive_username_verification_who ) {
- $ret_message = "Bug '$resolution_id' used for bug
resolution is not assigned to '$case_sensitive_username_verification_who'. It
is assigned to '$case_sensitive_username_verification_bug_owner'.\n";
+ if ( $case_sensitive_username_verification_bug_owner eq
$case_sensitive_username_verification_who ) {
+ $matched_owner = 1;
+ }
+ }
+
+ if( $matched_owner == 0 ) {
+ my $owners_string = join( ',', @bug_owners );
+ $ret_message = "Bug '$resolution_id' used for bug
resolution is not assigned to '$case_sensitive_username_verification_who'. It
is assigned to '$owners_string'.\n";
$request->add_result(1, $ret_message);
}
-
}
# Verify that the resolution status change is valid
diff -uNPr Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/Mantis.pm
Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/Mantis.pm
--- Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/Mantis.pm 2008-01-07
09:02:36.337954100 +0000
+++ Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/Mantis.pm
2008-01-07 09:02:38.057089100 +0000
@@ -589,7 +589,9 @@
$bug_owner = $self->mantis_fetch_column( $sql, 'username', $bugid );
- return $bug_owner;
+ my @bug_owners = ( $bug_owner );
+
+ return @bug_owners;
}
diff -uNPr Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/RequestTracker.pm
Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/RequestTracker.pm
--- Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/RequestTracker.pm
2008-01-07 09:02:36.369211100 +0000
+++ Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/RequestTracker.pm
2008-01-07 09:02:38.072717600 +0000
@@ -248,7 +248,9 @@
$ticket->Load($bugid);
$bug_owner = $ticket->OwnerObj()->Name;
- return $bug_owner;
+ my @bug_owners = ( $bug_owner );
+
+ return @bug_owners;
}
diff -uNPr Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/TestDirector.pm
Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/TestDirector.pm
--- Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/TestDirector.pm
2008-01-07 09:02:36.369211100 +0000
+++ Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/TestDirector.pm
2008-01-07 09:02:38.072717600 +0000
@@ -465,7 +465,26 @@
my $self = shift;
my ( $bugid, $username, $status, $resolution, $resolution_data ) = ( @_ );
- return ( 1, "Changing bug resolution is not yet implemented in this
version of Test Director.\n");
+ my $tags = $self->td_bug_status_tag();
+
+ my $cmd_line = $self->build_command_line( $bugid, "update_bug_details",
$tags );
+
+ $cmd_line .= " Y \"" . $status . "\"";
+
+ # Make the Test Director request
+ open( TD_COMMAND, $cmd_line . " |" );
+ # Cygwin has a problem with newlines
+ binmode( TD_COMMAND, ":crlf" );
+
+ # Check if there was an error
+ my $error_message = <TD_COMMAND>;
+
+ close ( TD_COMMAND );
+
+ if( "$error_message" ne "" ) {
+ return 1, $error_message;
+ }
+ return 0;
}
@@ -560,7 +579,9 @@
close ( TD_COMMAND );
}
- return $bug_owner;
+ my @bug_owners = split( $separator, $bug_owner );
+
+ return @bug_owners;
}
@@ -575,7 +596,7 @@
my $bugid = shift;
# Get the user that raised this bug
- my $username = $self->td_get_bug_value( $bugid, "get_users_email",
$self->td_bug_reporter_tag() );
+ my $username = $self->td_get_bug_value( $bugid, "get_bug_values",
$self->td_bug_reporter_tag() );
# now find and return the E-mail address of that user
return $self->integration_get_user_email( $username );
diff -uNPr Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/TestDirectorUtils.pm
Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/TestDirectorUtils.pm
--- Scmbug_0-22-0/share/scmbug/lib/Scmbug/Daemon/TestDirectorUtils.pm
2008-01-07 09:02:36.384839600 +0000
+++ Scmbug_Test_Director/share/scmbug/lib/Scmbug/Daemon/TestDirectorUtils.pm
2008-01-07 09:02:38.088346100 +0000
@@ -105,6 +105,9 @@
} elsif( "$operationType" eq "bug_lock_available" ) {
my $ret_message = $self->bug_lock_available( $bugid );
print "$ret_message";
+ } elsif( "$operationType" eq "get_attachments" ) {
+ my $ret_message = $self->get_attachments( $bugid, $tag_name );
+ print "$ret_message";
}
# Now disconnect
@@ -179,7 +182,7 @@
my $number_of_lock_err = scalar @lock_err;
# The last argument is the username
- $lock_username = $lock_err[ $number_of_lock_err ];
+ $lock_username = $lock_err[ $number_of_lock_err - 1 ];
}
}
@@ -219,6 +222,7 @@
print "Bug " . $bugid . " locked by user: " . $self->last_lock_user();
}
+
#Post the bug
$bug->post();
@@ -308,7 +312,9 @@
# Print each field for the Bug
foreach my $bug_field ( @fields ) {
if ( $bug_field ne "" ) {
- $bug_data .= $self->get_generic_value( $bug_field, $bug );
+ my $bug_value = $self->get_generic_value( $bug_field, $bug
);
+ $bug_value =~ s/$separator/,/g;
+ $bug_data .= $bug_value;
$bug_data .= $separator;
}
}
@@ -335,6 +341,10 @@
my $custUsers = $cust->users;
my $custUser = $custUsers->user( $username );
+ if( !defined($custUser) ) {
+ return "Unknown";
+ }
+
return $custUser->email;
}
@@ -548,5 +558,70 @@
}
+# Returns all the attachments for a given bug
+#
+# PARAMETERS:
+# $1 - Field names for where the value is stored
+# $2 - Bug id
+sub get_attachments {
+ my $self = shift;
+ my ( $bug_list, $filter ) = ( @_ );
+ my $bug_data = "";
+
+ # Get the name of the product the bug was raised on
+ my $bgf = $self->td_db_handle()->bugfactory;
+
+ if( ! $bgf ) {
+ return "";
+ }
+
+ my @bugs = split( $separator, $bug_list );
+
+ my $bug_attachments = "";
+
+ foreach my $bugid ( @bugs ) {
+
+ if ( $bugid ne "" ) {
+
+ my $bug = $bgf->item( $bugid );
+ my $attachments = $bug->Attachments;
+
+ my @filtered_results = ();
+
+ if( $attachments ) {
+ my $attachment_list = $attachments->NewList("");
+
+ my $attach_counter = 1;
+ while ( $attach_counter <= $attachment_list->Count ) {
+ my $attachment = $attachment_list->Item($attach_counter);
+
+ if( $filter eq "" ) {
+ push @filtered_results, $attachment->Name;
+ } elsif( $attachment->Name =~ /$filter/ ) {
+ push @filtered_results, $attachment->Name;
+ }
+
+ $attach_counter++;
+ }
+ }
+
+ my $attachment_string = "";
+
+ foreach my $filtered_result ( @filtered_results ) {
+ if( $attachment_string ne "" ) {
+ $attachment_string .= $separator;
+ }
+ $attachment_string .= $filtered_result;
+ }
+
+ $bug_attachments .= $bugid . $separator . $attachment_string . "\n";
+ }
+ }
+
+ return $bug_attachments;
+}
+
+
+
1;
diff -uNPr Scmbug_0-22-0/share/scmbug/lib/Scmbug/Glue/SCM.pm
Scmbug_Test_Director/share/scmbug/lib/Scmbug/Glue/SCM.pm
--- Scmbug_0-22-0/share/scmbug/lib/Scmbug/Glue/SCM.pm 2008-01-07
09:02:36.416096600 +0000
+++ Scmbug_Test_Director/share/scmbug/lib/Scmbug/Glue/SCM.pm 2008-01-07
09:02:38.119603100 +0000
@@ -407,7 +407,9 @@
$log_message_without_resolution .= $line . "\n";
}
}
- }
+ } else {
+ $log_message_without_resolution .=
$self->activity()->original_log_message();
+ }
#
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users