import SOAP-WSDL 2.00.02 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00.02
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00.02.tar.gz
This commit is contained in:
Martin Kutter
2009-12-12 19:48:35 -08:00
committed by Michael G. Schwern
parent 745ce925c1
commit 915ee03cbe
153 changed files with 3289 additions and 2513 deletions
-28
View File
@@ -39,31 +39,3 @@ $generator->generate_interface({
ok eval $output;
print $@ if $@;
# print $output;
__END__
my $tt = Template->new(
DEBUG => 1,
EVAL_PERL => 1,
RECURSION => 1,
INCLUDE_PATH => "$path/../../../../lib/SOAP/WSDL/Template",
);
foreach my $service (@{ $definitions->get_service }) {
my $output;
$tt->process( 'Interface.tt', {
definitions => $definitions,
service => $service,
interface_prefix => 'MyInterface',
type_prefix => 'MyTypes',
TYPE_PREFIX => 'MyTypes',
element_prefix => 'MyElement',
}, \$output);
die $tt->error if $tt->error();
ok eval $output, 'eval output';
print $output;
};
+17 -1
View File
@@ -1,4 +1,4 @@
use Test::More tests => 51;
use Test::More tests => 61;
use File::Basename qw(dirname);
use File::Spec;
use File::Path;
@@ -16,6 +16,9 @@ my $definitions = $parser->parse_file(
"$path/../../../acceptance/wsdl/generator_test.wsdl"
);
#my $type = $definitions->first_types()->find_type('urn:Test', 'elementRefComplexType');
#die $type->get_element()->[0]->_DUMP;
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
definitions => $definitions,
type_prefix => 'Foo',
@@ -127,6 +130,12 @@ is $complexExtension->get_Test1(), 'test1';
is $complexExtension->get_Test2(), 'test2';
is $complexExtension->get_Test3(), 'test3';
ok eval { require MyTypes::testComplexNestedExtension };
my $nestedExtension = MyTypes::testComplexNestedExtension->new();
ok $nestedExtension->can('get_Test1');
ok $nestedExtension->can('get_Test2');
ok $nestedExtension->can('get_Test3');
ok $nestedExtension->can('get_Test4');
ok eval { require MyTypes::testComplexTypeElementAtomicSimpleType; };
my $ct_east = MyTypes::testComplexTypeElementAtomicSimpleType->new({
@@ -193,4 +202,11 @@ SKIP: {
'Attribute POD');
}
ok $typemap = MyTypemaps::testService->get_typemap();
ok $typemap->{'testElementNestedExtension/Test1'};
ok $typemap->{'testElementNestedExtension/Test2'};
ok $typemap->{'testElementNestedExtension/Test3'};
ok $typemap->{'testElementNestedExtension/Test4'};
rmtree "$path/testlib";
+131
View File
@@ -0,0 +1,131 @@
package TestResolver;
use strict; use warnings;
use Class::Std::Fast;
use base qw(SOAP::WSDL::Generator::PrefixResolver);
sub resolve_prefix {
my ($self, $type, $namespace, $node) = @_;
my $name = defined($node) ? $node->get_name() : ();
if (($type eq 'interface') && $name =~m{\.}x) {
return "MySpacialPrufax::";
}
if ($type eq 'type') {
return 'MySpatialTaipeeProfix::'
if $namespace ne 'http://www.w3.org/2001/XMLSchema'
}
return $self->SUPER::resolve_prefix($type, $namespace, $node);
}
package main;
use Test::More tests => 15;
use File::Basename qw(dirname);
use File::Spec;
use File::Path;
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_file(
"$path/../../../acceptance/wsdl/generator_test_dot_names.wsdl"
#"$path/../../../acceptance/wsdl/elementAtomicComplexType.xml"
);
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
definitions => $definitions,
type_prefix => 'Foo',
element_prefix => 'Foo',
typemap_prefix => 'Foo',
OUTPUT_PATH => "$path/testlib",
prefix_resolver_class => 'TestResolver',
});
my $code = "";
$generator->set_output(\$code);
$generator->generate_typelib();
{
eval $code;
ok !$@;
print $@ if $@;
}
# print $code;
$generator->set_type_prefix('MySpatialTaipeeProfix');
$generator->set_element_prefix('MyElements');
$generator->set_typemap_prefix('MyTypemaps');
$generator->set_interface_prefix('MyInterfaces');
$generator->set_output(undef);
$generator->generate();
#$generator->generate_typelib();
#$generator->generate_typemap();
if (eval { require Test::Warn; }) {
Test::Warn::warning_like( sub { $generator->generate_interface() },
qr{\A Multiple \s parts \s detected \s in \s message \s testMultiPartWarning}xms);
}
else {
$generator->generate_interface();
SKIP: { skip 'Cannot test warnings without Test::Warn', 1 };
}
$generator->generate_server();
eval "use lib '$path/testlib'";
use_ok qw(MySpacialPrufax::My::SOAP::testService::testPort);
use_ok qw(MyServer::My::SOAP::testService::testPort);
use_ok qw(MySpatialTaipeeProfix::testComplexTypeRestriction);
use_ok qw(MySpatialTaipeeProfix::testComplexTypeAll);
SKIP: {
eval { require Test::Pod::Content; }
or skip 'Cannot test pod content without Test::Pod::Content', 6;
Test::Pod::Content::pod_section_like(
'MySpacialPrufax::My::SOAP::testService::testPort',
'NAME',
qr{^MySpacialPrufax::My::SOAP::testService::testPort \s - \s}xms,
'Pod NAME section');
Test::Pod::Content::pod_section_like(
'MySpacialPrufax::My::SOAP::testService::testPort',
'SYNOPSIS',
qr{use \s MySpacialPrufax::My::SOAP::testService::testPort}xms,
'Pod SYNOPSIS section');
Test::Pod::Content::pod_section_like(
'MySpacialPrufax::My::SOAP::testService::testPort',
'SYNOPSIS',
qr{\s MySpacialPrufax::My::SOAP::testService::testPort->new\(}xms,
'Pod SYNOPSIS section');
Test::Pod::Content::pod_section_like(
'MyServer::My::SOAP::testService::testPort',
'NAME',
qr{^MyServer::My::SOAP::testService::testPort \s - \s}xms,
'Pod NAME section');
Test::Pod::Content::pod_section_like(
'MyServer::My::SOAP::testService::testPort',
'SYNOPSIS',
qr{use \s MyServer::My::SOAP::testService::testPort}xms,
'Pod SYNOPSIS section');
Test::Pod::Content::pod_section_like(
'MyServer::My::SOAP::testService::testPort',
'SYNOPSIS',
qr{\s MyServer::My::SOAP::testService::testPort->new\(}xms,
'Pod SYNOPSIS section');
}
my $obj = MySpatialTaipeeProfix::testComplexTypeAll->new({
Test_1 => 'Test1',
Test_2 => 'Test2',
});
like $obj->serialize(), qr{<Test-1>Test1</Test-1>}xm, 'serialize altered name with original name';
rmtree "$path/testlib";
+8 -1
View File
@@ -1,4 +1,4 @@
use Test::More tests => 14;
use Test::More tests => 15;
use File::Basename qw(dirname);
use File::Spec;
use File::Path;
@@ -99,4 +99,11 @@ SKIP: {
'Pod SYNOPSIS section');
}
my $obj = MyTypes::testComplexTypeAll->new({
Test_1 => 'Test1',
Test_2 => 'Test2',
});
like $obj->serialize(), qr{<Test-1>Test1</Test-1>}xm, 'serialize altered name with original name';
rmtree "$path/testlib";
@@ -90,7 +90,6 @@ SKIP: {
'Pod NAME section');
}
#rmtree "$path/testlib";
require FooMap::Service1;
my $message_parser = SOAP::WSDL::Expat::MessageParser->new({
class_resolver => 'FooMap::Service1',
@@ -115,3 +114,5 @@ sub xml {
</sayHello>
</SOAP-ENV:Body></SOAP-ENV:Envelope>};
}
rmtree "$path/testlib";
+5 -2
View File
@@ -1,4 +1,4 @@
use Test::More tests => 3;
use Test::More tests => 2;
use File::Basename qw(dirname);
use File::Spec;
@@ -19,6 +19,9 @@ 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)
eval { $generator->generate_typelib() };
}
ok $@, $@;
# ok $@, $@;
-23
View File
@@ -1,23 +0,0 @@
use Test::More qw(no_plan);
use lib 'testlib';
#ok eval { require MyTypes::testComplexTypeSequenceWithAttribute; }
# , 'load MyTypes::testComplexTypeSequenceWithAttribute';
#
#my $obj = MyTypes::testComplexTypeSequenceWithAttribute->new({
# Test1 => 'foo',
# Test2 => 'bar',
#});
#$obj->attr({ testAttr => 'foobar' });
#
#print $obj->attr();
#
use_ok qw(MyElements::testElementComplexTypeSequenceWithAttribute);
my $obj = MyElements::testElementComplexTypeSequenceWithAttribute->new({
Test1 => 'foo',
Test2 => 'bar',
});
$obj->attr({ testAttr => 'foobar' });
print $obj;