import SOAP-WSDL 2.00.04 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00.04 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00.04.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
e58a27e2ad
commit
c3e3d1908e
@@ -0,0 +1,36 @@
|
||||
use Test::More tests => 3;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
use diagnostics;
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typelib);
|
||||
use_ok qw(SOAP::WSDL::Generator::Template::XSD);
|
||||
|
||||
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 $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
type_prefix => 'Foo',
|
||||
element_prefix => 'Foo',
|
||||
typemap_prefix => 'Foo',
|
||||
OUTPUT_PATH => "$path/testlib",
|
||||
});
|
||||
|
||||
my $code = "";
|
||||
$generator->set_output(\$code);
|
||||
$generator->generate_typelib();
|
||||
{
|
||||
eval $code;
|
||||
ok !$@;
|
||||
print $@ if $@;
|
||||
}
|
||||
|
||||
rmtree "$path/testlib";
|
||||
@@ -1,4 +1,4 @@
|
||||
use Test::More tests => 61;
|
||||
use Test::More tests => 68;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
@@ -12,12 +12,34 @@ use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_test.wsdl"
|
||||
);
|
||||
#
|
||||
# the next test is a bit odd: on parsing the WSDL, we test whether the
|
||||
# parser can cope with unknown (anyAttribute) attributes.
|
||||
# The default is to issue a warning.
|
||||
#
|
||||
# But if Test::Warn isn't there, we have to skip the test, but parse the
|
||||
# file, too, so in this case we skip a zero-length block, set no warnings
|
||||
# and parse the WSDL...
|
||||
#
|
||||
|
||||
#my $type = $definitions->first_types()->find_type('urn:Test', 'elementRefComplexType');
|
||||
#die $type->get_element()->[0]->_DUMP;
|
||||
my $definitions;
|
||||
if (eval "require Test::Warn; 1") {
|
||||
Test::Warn::warning_is( sub {
|
||||
$definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_test.wsdl"
|
||||
);
|
||||
}, 'found unrecognised attribute {http://foo.bar}Action (ignored)'
|
||||
, 'warning on unrecognized attribute');
|
||||
}
|
||||
else {
|
||||
SKIP: {
|
||||
skip "cannot test warnings without Test::Warn", 1
|
||||
}
|
||||
no warnings;
|
||||
$definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_test.wsdl"
|
||||
);
|
||||
}
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
@@ -96,7 +118,6 @@ for (1..2) {
|
||||
is $header->get_Test2(), 'Header2', 'Header content';
|
||||
}
|
||||
|
||||
|
||||
# complexType choice test
|
||||
ok $message = $interface->testChoice( { Test1 => 'Test1' } ), 'call soap method (no_dispatch)';
|
||||
ok $message = $interface->testChoice( { Test2 => 'Test2' } ), 'call soap method (no_dispatch)';
|
||||
@@ -191,6 +212,18 @@ is $obj->serialize({ name => 'baz'}), q{<baz testAttr="bar">foo</baz>};
|
||||
use_ok qw(MyAttributes::TestAttribute);
|
||||
ok $obj = MyAttributes::TestAttribute->new({ value => 'foo' });
|
||||
|
||||
use_ok qw(MyElements::testRef);
|
||||
ok $obj = MyElements::testRef->new({ testElementString => 'foo'});
|
||||
is q{<testRef xmlns="urn:Test"><testElementString>foo</testElementString></testRef>}
|
||||
, $obj->serialize_qualified()
|
||||
, 'serialize element ref';
|
||||
|
||||
use_ok qw(MyElements::testAtomicRef);
|
||||
ok $obj = MyElements::testAtomicRef->new({ in => 'foo'});
|
||||
is q{<testAtomicRef xmlns="urn:Test"><in>foo</in></testAtomicRef>}
|
||||
, $obj->serialize_qualified()
|
||||
, 'serialize element with atomic complexType / all with element ref';
|
||||
|
||||
|
||||
SKIP: {
|
||||
eval { require Test::Pod::Content; }
|
||||
|
||||
Reference in New Issue
Block a user