After mucking about in the guts of this module I think it is JIRA's SOAP API itself that is not honoring changing the ticket type.
sub AUTOLOAD {
my ($self, @args) = @_;
(my $method = $AUTOLOAD) =~ s/.*:://;
say STDERR "AUTOLOAD = " . $AUTOLOAD if $method eq 'updateIssue';
say STDERR "Before madness, \@args = " . Dumper( \@args ) if $method eq 'updateIssue';
# Perform any non-default type coersion
if (my $typeof = $typeof{$method}) {
if (ref $typeof eq 'HASH') {
while (my ($i, $type) = each %$typeof) {
if (ref $type) {
ref $type eq 'CODE'
or croak "Invalid coersion spec to (", ref($type), ").\n";
$args[$i] = $type->($self, $args[$i]);
} elsif (! ref $args[$i]) {
$args[$i] = SOAP::Data->type($type => $args[$i]);
} elsif (ref $args[$i] eq 'ARRAY') {
foreach (@{$args[$i]}) {
$_ = SOAP::Data->type($type => $_);
}
} elsif (ref $args[$i] eq 'HASH') {
foreach (values %{$args[$i]}) {
$_ = SOAP::Data->type($type => $_);
}
} else {
croak "Can't coerse argument $i of method $AUTOLOAD.\n";
}
}
}
elsif (ref $typeof eq 'CODE') {
$typeof->($self, \$method, \@args);
}
}
say STDERR "After madness, \@args = " . Dumper( \@args ) if $method eq 'updateIssue';
my $call = $self->{soap}->call($method, $self->{auth}, @args);
croak $call->faultcode(), ', ', $call->faultstring()
if defined $call->fault();
say STDERR "result = " . Dumper( $call->result() ) if $method eq 'updateIssue';
return $call->result();
}
[17:05:06] t/Blackjack/jira_client_bug.t ..
# Fixture: everything
1..10
ok 1 - instantiated JIRA::Client isa JIRA::Client
ok 2 - instantiated RemoteIssue isa RemoteIssue
ok 3 - ... issue assignee is 'dbaber'
ok 4 - ... issue summary is 'TEST Ticket from Unit test'
ok 5 - ... issue project is 'TESTPROJECT'
ok 6 - ... issue type is '7'
ok 7 - ... issue description is 'Test ticket to illustrate bug in JIRA::Client where the ticket type is not updated.'
AUTOLOAD = JIRA::Client::updateIssue
Before madness, @args = [
"TESTPROJECT-219",
{
description => "UDATED - Test ticket to illustrate bug in JIRA::Client where the ticket type is not updated.",
summary => "TEST Ticket from Unit test- UPDATED",
type => 1
}
]
After madness, @args = [
"TESTPROJECT-219",
[
bless( {
id => "summary",
values => [
"TEST Ticket from Unit test- UPDATED"
]
}, 'RemoteFieldValue' ),
bless( {
id => "type",
values => [
1
]
}, 'RemoteFieldValue' ),
bless( {
id => "description",
values => [
1
]
}, 'RemoteFieldValue' ),
bless( {
id => "description",
values => [
"UDATED - Test ticket to illustrate bug in JIRA::Client where the ticket type is not updated."
]
}, 'RemoteFieldValue' )
]
]
result = bless( {
affectsVersions => [],
assignee => "dbaber",
attachmentNames => [],
components => [],
created => "2011-11-16T23:05:00.676Z",
customFieldValues => [
bless( {
customfieldId => "customfield_10002",
key => undef,
values => [
"2180000000.95"
]
}, 'RemoteCustomFieldValue' )
],
description => "UDATED - Test ticket to illustrate bug in JIRA::Client where the ticket type is not updated.",
duedate => undef,
environment => undef,
fixVersions => [],
id => 15348,
key => "TESTPROJECT-219",
priority => 3,
project => "TESTPROJECT",
reporter => "integrations",
resolution => undef,
status => 1,
summary => "TEST Ticket from Unit test- UPDATED",
type => 7,
updated => "2011-11-16T23:05:00.676Z",
votes => 0
}, 'RemoteIssue' )
ok 8 - ... issue summary after update is 'TEST Ticket from Unit test- UPDATED'
not ok 9 - ... issue type after update is '1'
# Failed test '... issue type after update is '1''
# at t/Blackjack/jira_client_bug.t line 72.
# got: '7'
# expected: '1'
ok 10 - ... issue description after update is 'UDATED - Test ticket to illustrate bug in JIRA::Client where the ticket type is not updated.'
Failed 1/10 subtests
[17:05:17]
Test Summary Report
-------------------
t/Blackjack/jira_client_bug.t (Wstat: 0 Tests: 10 Failed: 1)
Failed test: 9
Files=1, Tests=10, 11 wallclock secs ( 0.04 usr 0.01 sys + 0.48 cusr 0.05 csys = 0.58 CPU)
Result: FAIL
Dan
Show quoted text----- Original Message -----
From: "Bugs in JIRA-Client via RT" <bug-JIRA-Client@rt.cpan.org>
To: dbaber@corvisa.com
Sent: Wednesday, November 16, 2011 11:34:42 AM
Subject: [rt.cpan.org #72470] AutoReply: Ticket type not updated when calling JIRA::Client::update_issue
Greetings,
This message has been automatically generated in response to the
creation of a trouble ticket regarding:
"Ticket type not updated when calling JIRA::Client::update_issue",
a summary of which appears below.
There is no need to reply to this message right now. Your ticket has been
assigned an ID of [rt.cpan.org #72470]. Your ticket is accessible
on the web at:
https://rt.cpan.org/Ticket/Display.html?id=72470
Please include the string:
[rt.cpan.org #72470]
in the subject line of all future correspondence about this issue. To do so,
you may reply to this message.
Thank you,
bug-JIRA-Client@rt.cpan.org
-------------------------------------------------------------------------
Hello, I believe I found a bug in the update_issue() method of JIRA::Client. I have attached some test code and I am providing the output of my test run which should illustrate the bug. Basically when passing "type" into the hash to update the ticket the ticket type is not updated.
Here is info about my working env and the module version being used:
dbaber@atlas:~/src/blackjack/t$ perl -MJIRA::Client -e 'print "$JIRA::Client::VERSION\n"'
0.30
dbaber@atlas:~/src/blackjack/t$ perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at
http://www.perl.org/, the Perl Home Page.
dbaber@atlas:~/src/blackjack/t$ uname -a
Linux atlas 2.6.32-35-generic #78-Ubuntu SMP Tue Oct 11 16:11:24 UTC 2011 x86_64 GNU/Linux
dbaber@atlas:~/src/blackjack/t$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.3 LTS"
Here is the test run results:
[11:32:15] t/Blackjack/jira_client_bug.t ..
# Fixture: everything
1..10
ok 1 - instantiated JIRA::Client isa JIRA::Client
ok 2 - instantiated RemoteIssue isa RemoteIssue
ok 3 - ... issue assignee is 'dbaber'
ok 4 - ... issue summary is 'TEST Ticket from Unit test'
ok 5 - ... issue project is 'TESTPROJECT'
ok 6 - ... issue type is '7'
ok 7 - ... issue description is 'Test ticket to illustrate bug in JIRA::Client where the ticket type is not updated.'
ok 8 - ... issue summary after update is 'TEST Ticket from Unit test- UPDATED'
not ok 9 - ... issue type after update is '1'
# Failed test '... issue type after update is '1''
# at t/Blackjack/jira_client_bug.t line 72.
# got: '7'
# expected: '1'
ok 10 - ... issue description after update is 'UDATED - Test ticket to illustrate bug in JIRA::Client where the ticket type is not updated.'
Failed 1/10 subtests
[11:32:26]
Test Summary Report
-------------------
t/Blackjack/jira_client_bug.t (Wstat: 0 Tests: 10 Failed: 1)
Failed test: 9
Files=1, Tests=10, 11 wallclock secs ( 0.04 usr 0.00 sys + 0.47 cusr 0.05 csys = 0.56 CPU)
Result: FAIL
And I have attached the code.
Thanks,
Dan
--
Dan Baber | StreetLinks Lender Solutions | Software Developer
365 N. Mayfair Road, Second Floor, Milwaukee, WI 53226
www.streetlinks.com | dbaber@corvisa.com
--
Dan Baber | StreetLinks Lender Solutions | Software Developer
2365 N. Mayfair Road, Second Floor, Milwaukee, WI 53226
www.streetlinks.com | dbaber@corvisa.com