#!./perl
require
'./t/config.cache'
;
my
$maxtest
= 5;
print
"1..$maxtest\n"
;
my
$c
= ars_Login(
&CCACHE::SERVER
,
&CCACHE::USERNAME
,
&CCACHE::PASSWORD
);
if
(!
defined
(
$c
)) {
for
(
my
$i
= 1 ;
$i
<=
$maxtest
;
$i
++) {
print
"not ok [$i] [ctrl]\n"
;
}
exit
0;
}
else
{
print
"ok [1]\n"
;
}
my
%fids
= ars_GetFieldTable(
$c
,
"ARSperl Test"
);
if
(!(
%fids
)) {
for
(
my
$i
= 2 ;
$i
<=
$maxtest
;
$i
++) {
print
"not ok [$i] [gft]\n"
;
}
exit
0;
}
else
{
print
"ok [2]\n"
;
}
my
$eid
= ars_MergeEntry(
$c
,
"ARSperl Test"
, 2,
$fids
{
'Submitter'
},
'jcmurphy'
,
$fids
{
'Short Description'
},
'foobar'
,
$fids
{
'Status'
}, 0);
if
(!
defined
(
$eid
)) {
print
"not ok [3] [$ars_errstr]\n"
;
}
else
{
print
"ok [3]\n"
;
}
my
$eid2
= ars_MergeEntry(
$c
,
"ARSperl Test"
,
&ARS::AR_MERGE_ENTRY_DUP_MERGE
,
1,
$eid
,
$fids
{
'Submitter'
},
'jcm'
,
$fids
{
'Short Description'
},
'foobar2'
,
$fids
{
'Status'
}, 1);
if
(!
defined
(
$eid2
)) {
print
"not ok [4] ndef eid [$ars_errstr]\n"
;
}
elsif
(
$eid2
eq
""
) {
if
(
$ARS::ars_errhash
{numItems} > 0) {
for
(
my
$i
= 0 ;
$i
<
$ARS::ars_errhash
{numItems} ;
$i
++) {
if
(@{
$ARS::ars_errhash
{
'messageType'
}}[
$i
] >=
&ARS::AR_RETURN_ERROR
) {
print
"not ok [4]\n"
;
}
}
}
}
print
"ok [4]\n"
;
my
$ooc
= new ARS(
-ctrl
=>
$c
,
-catch
=> { ARS::
AR_RETURN_ERROR
=>
undef
,
ARS::
AR_RETURN_WARNING
=>
undef
,
ARS::
AR_RETURN_FATAL
=>
undef
},
-debug
=>
undef
);
my
$oof
=
$ooc
->openForm(
-form
=>
'ARSperl Test'
);
$eid2
=
$oof
->merge(
-type
=>
&ARS::AR_MERGE_ENTRY_DUP_MERGE
,
-values
=> {
'Request ID'
=>
$eid
,
'Submitter'
=>
'xyz'
,
'Short Description'
=>
'oo-foobar'
,
'Status'
=>
'Rejected'
}
);
if
(
$eid2
eq
$eid
) {
print
"ok [5]\n"
;
}
else
{
print
"not ok [5] (eid2=$eid2 ; eid=$eid ; err=$ars_errstr)\n"
;
}
ars_DeleteEntry(
$c
,
"ARSperl Test"
,
$eid
);
exit
0;