BEGIN {
use_ok(
'LS::Authority::WSDL'
);
use_ok(
'LS::Authority::WSDL::Simple'
);
}
sub
readWSDL {
my
$filename
=
shift
;
my
$data
;
ok(
open
(WSDL,
$filename
),
'Open authority WSDL file'
);
local
$/ =
undef
;
$data
= <WSDL>;
close
(WSDL);
return
$data
;
}
my
$wsdlData
=
&readWSDL
(
't/authority02.wsdl'
);
ok(
$wsdlData
,
'WSDL file: t/authority02.wsdl'
);
my
$wsdl
= LS::Authority::WSDL::Simple->from_xml(
$wsdlData
);
isa_ok(
$wsdl
,
'LS::Authority::WSDL::Simple'
);
my
$metaLoc
=
$wsdl
->getMetadataLocations(
'NCBIHTTP'
);
isa_ok(
$metaLoc
,
'ARRAY'
,
'Verify we have a array ref of METADATA locations'
);
cmp_ok(
scalar
(@{
$metaLoc
}),
'=='
,
'1'
,
'Verfiy that there is only ONE METADATA location'
);
my
$specificLoc
=
$metaLoc
->[0];
isa_ok(
$specificLoc
,
'LS::Authority::WSDL::Location'
,
'Verify the METADATA location is the proper object'
);
cmp_ok(
$specificLoc
->name(),
'eq'
,
'HTTPMetadata'
,
'Verify the name of the specific location'
);
cmp_ok(
$specificLoc
->parentName(),
'eq'
,
'NCBIHTTP'
,
'Verify the parent service\'s name'
);
cmp_ok(
$specificLoc
->method(),
'eq'
,
'GET'
,
'Verify the method '
);
cmp_ok(
$specificLoc
->protocol(),
'eq'
, ${LS::Authority::WSDL::Constants::Protocols::HTTP},
'Verify the protocol'
);
my
$dataLoc
=
$wsdl
->getDataLocations();
isa_ok(
$dataLoc
,
'ARRAY'
,
'Verify we have a array ref of DATA locations'
);
cmp_ok(
scalar
(@{
$dataLoc
}),
'=='
,
'1'
,
'Verfiy that there is only ONE DATA location'
);
$specificLoc
=
$dataLoc
->[0];
isa_ok(
$specificLoc
,
'LS::Authority::WSDL::Location'
,
'Verify the DATA location is the proper object'
);
cmp_ok(
$specificLoc
->name(),
'eq'
,
'HTTPData'
,
'Verify the name of the specific location'
);
cmp_ok(
$specificLoc
->parentName(),
'eq'
,
'NCBIHTTP'
,
'Verify the parent service\'s name'
);
cmp_ok(
$specificLoc
->method(),
'eq'
,
'GET'
,
'Verify the method '
);
cmp_ok(
$specificLoc
->protocol(),
'eq'
, ${LS::Authority::WSDL::Constants::Protocols::HTTP},
'Verify the protocol'
);