import SOAP-WSDL 2.00.05 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00.05 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00.05.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
c3e3d1908e
commit
c2ac24dd0f
@@ -0,0 +1,13 @@
|
||||
use strict; use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
use_ok qw(SOAP::WSDL::Base);
|
||||
|
||||
my $obj = SOAP::WSDL::Base->new();
|
||||
|
||||
ok $obj->push_annotation('foo');
|
||||
ok $obj->push_annotation('foo');
|
||||
ok $obj->push_annotation('foo');
|
||||
|
||||
ok $obj->set_namespace('foo');
|
||||
ok $obj->push_namespace('foo');
|
||||
@@ -8,7 +8,7 @@ eval { require SOAP::Lite; 1; } or do {
|
||||
print "# Using SOAP::Lite $SOAP::Lite::VERSION\n";
|
||||
|
||||
use lib '../../../lib';
|
||||
plan tests => 10;
|
||||
plan tests => 13;
|
||||
use_ok qw(SOAP::WSDL::Deserializer::SOM);
|
||||
|
||||
ok my $deserializer = SOAP::WSDL::Deserializer::SOM->new();
|
||||
@@ -30,8 +30,19 @@ eval { $deserializer->generate_fault({
|
||||
message => 'Teststring'
|
||||
});
|
||||
};
|
||||
ok $@->isa('SOAP::Fault');
|
||||
|
||||
is $@->faultcode(), 'Test';
|
||||
is $@->faultactor(), 'soap:Server';
|
||||
is $@->faultstring(), 'Teststring';
|
||||
my $fault = $@;
|
||||
|
||||
isa_ok $fault, 'SOAP::Fault';
|
||||
|
||||
is $fault->faultcode(), 'Test';
|
||||
is $fault->faultactor(), 'soap:Server';
|
||||
is $fault->faultstring(), 'Teststring';
|
||||
|
||||
$fault = $deserializer->deserialize('');
|
||||
|
||||
isa_ok $fault, 'SOAP::Fault';
|
||||
|
||||
is $fault->faultactor(), 'soap:Server';
|
||||
like $fault->faultstring(), qr{no \s element \s found}x;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 14; #qw(no_plan);
|
||||
use Test::More tests => 16; #qw(no_plan);
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
|
||||
my $HAVE_TEST_WARN =eval { require Test::Warn; };
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
$path =~s{\\}{/}xg; # stupid windows workaround: $path works with /, but not
|
||||
# with \
|
||||
@@ -16,25 +18,25 @@ my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/WSDLParser.wsdl"
|
||||
);
|
||||
|
||||
use Data::Dumper;
|
||||
my $schema = $definitions->first_types()->get_schema()->[1];
|
||||
my $attr = $schema->get_element()->[0]->first_complexType->first_attribute();
|
||||
ok $attr->get_name('testAttribute'), 'attribute name';
|
||||
ok $attr->get_type('xs:string'), 'attribute type';
|
||||
|
||||
|
||||
#use SOAP::WSDL::Generator::Template::XSD;
|
||||
#my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
# definitions => $definitions,
|
||||
# type_prefix => 'Foo',
|
||||
# element_prefix => 'Foo',
|
||||
# typemap_prefix => 'Foo',
|
||||
# OUTPUT_PATH => "$path/testlib",
|
||||
#});
|
||||
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../acceptance/wsdl/WSDLParser-import.wsdl"
|
||||
);
|
||||
if ($HAVE_TEST_WARN) {
|
||||
Test::Warn::warning_like( sub {
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../acceptance/wsdl/WSDLParser-import.wsdl"
|
||||
);
|
||||
}, qr{already \s imported}x, 'duplicate import warning')
|
||||
}
|
||||
else {
|
||||
SKIP: { skip 'Cannot test warnings without Test::Warn', 1; };
|
||||
local $SIG{__WARN__} = sub {};
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../acceptance/wsdl/WSDLParser-import.wsdl"
|
||||
);
|
||||
}
|
||||
|
||||
ok my $service = $definitions->first_service();
|
||||
is $service->get_name(), 'Service1', 'wsdl:import service name';
|
||||
@@ -77,9 +79,20 @@ like $@, qr{\A cannot \s import \s document \s from \s namespace \s
|
||||
$SIG{ALRM} = sub { die 'looped'};
|
||||
alarm 1;
|
||||
|
||||
$definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/WSDLParser_import_loop.wsdl"
|
||||
);
|
||||
if ($HAVE_TEST_WARN) {
|
||||
Test::Warn::warning_like( sub {
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../acceptance/wsdl/WSDLParser_import_loop.wsdl"
|
||||
);
|
||||
}, qr{already \s imported}x, 'duplicate import warning');
|
||||
}
|
||||
else {
|
||||
SKIP: { skip 'Cannot test warnings without Test::Warn', 1; };
|
||||
local $SIG{__WARN__} = sub {};
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../acceptance/wsdl/WSDLParser_import_loop.wsdl"
|
||||
);
|
||||
}
|
||||
|
||||
alarm 0;
|
||||
pass 'import loop';
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
use Test::More tests => 3;
|
||||
use strict;
|
||||
use Test::More tests => 4;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
use diagnostics;
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
my $HAVE_TEST_WARN =eval { require Test::Warn; };
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
@@ -12,10 +15,24 @@ use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
my $definitions = $parser->parse_uri(
|
||||
"file://$path/../../../../../acceptance/wsdl/WSDLParser-import.wsdl"
|
||||
);
|
||||
my $definitions;
|
||||
|
||||
if ($HAVE_TEST_WARN) {
|
||||
Test::Warn::warning_like(sub {
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../../../acceptance/wsdl/WSDLParser-import.wsdl"
|
||||
);
|
||||
}
|
||||
, qr{already \s imported}x
|
||||
);
|
||||
}
|
||||
else {
|
||||
local $SIG{__WARN__} = sub {};
|
||||
SKIP: { skip 'Cannot test warning without Test::Warn', 1; }
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../../../acceptance/wsdl/WSDLParser-import.wsdl"
|
||||
);
|
||||
}
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
type_prefix => 'Foo',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use Test::More tests => 2;
|
||||
use Test::More tests => 3;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
|
||||
@@ -19,9 +19,12 @@ my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
});
|
||||
|
||||
{
|
||||
# currently, there is no completely unsupported XML schema
|
||||
# idiom (at least none which is detected properly)
|
||||
# TODO update WSDL and add some (there sure are)
|
||||
# currently, there is no completely unsupported XML schema
|
||||
# idiom (at least none which is detected properly)
|
||||
# TODO update WSDL and add some (there sure are)
|
||||
my $code = "";
|
||||
$generator->set_output(\$code);
|
||||
eval { $generator->generate_typelib() };
|
||||
eval $code;
|
||||
}
|
||||
# ok $@, $@;
|
||||
ok ! $@;
|
||||
|
||||
@@ -10,7 +10,7 @@ __PACKAGE__->__set_name('MyElement');
|
||||
__PACKAGE__->__set_nillable(1);
|
||||
|
||||
package main;
|
||||
use Test::More tests => 12;
|
||||
use Test::More tests => 13;
|
||||
|
||||
my $obj;
|
||||
|
||||
@@ -27,6 +27,10 @@ is $obj->get_value(), 'Test';
|
||||
$obj->set_value(undef);
|
||||
is $obj->serialize_qualified, '<MyElement xsi:nil="true" xmlns="http://www.w3.org/2001/XMLSchema"/>';
|
||||
is $obj->serialize, '<MyElement xsi:nil="true"/>';
|
||||
|
||||
$obj->__set_nillable(1);
|
||||
is $obj->__get_nillable(), 1;
|
||||
|
||||
$obj->__set_nillable(0);
|
||||
is $obj->__get_nillable(), 0;
|
||||
|
||||
@@ -35,10 +39,10 @@ like $@, qr{Cannot \s call}xms;
|
||||
eval { SOAP::WSDL::XSD::Typelib::Element::__set_nillable() };
|
||||
like $@, qr{Cannot \s call}xms;
|
||||
|
||||
is $obj->start_tag({empty => 1}), '<MyElement/>';
|
||||
is $obj->start_tag({empty => 1}), '<MyElement/>';
|
||||
is $obj->start_tag({nil => 1}), '', 'empty string with nil option and NILLABLE false';
|
||||
$obj->set_value('Test');
|
||||
|
||||
|
||||
eval { is @{ $obj }, 1, 'ARRAYIFY' };
|
||||
fail 'ARRAYIFY' if ($@);
|
||||
fail 'ARRAYIFY' if ($@);
|
||||
Reference in New Issue
Block a user