1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
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::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",
silent => 1,
});
my $code = "";
$generator->set_output(\$code);
$generator->generate_typelib();
{
eval $code;
ok !$@;
print $@ if $@;
}
# print $code;
$generator->set_type_prefix('MyTypes');
$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(MyInterfaces::My::SOAP::testService::testPort);
use_ok qw(MyServer::My::SOAP::testService::testPort);
use_ok qw(MyTypes::testComplexTypeRestriction);
use_ok qw(MyTypes::testComplexTypeAll);
# type with dot in name including atomic type
use_ok qw(MyTypes::test::ComplexTypeElementAtomicSimpleType);
SKIP: {
eval { require Test::Pod::Content; }
or skip 'Cannot test pod content without Test::Pod::Content', 6;
Test::Pod::Content::pod_section_like(
'MyInterfaces::My::SOAP::testService::testPort',
'NAME',
qr{^MyInterfaces::My::SOAP::testService::testPort \s - \s}xms,
'Pod NAME section');
Test::Pod::Content::pod_section_like(
'MyInterfaces::My::SOAP::testService::testPort',
'SYNOPSIS',
qr{use \s MyInterfaces::My::SOAP::testService::testPort}xms,
'Pod SYNOPSIS section');
Test::Pod::Content::pod_section_like(
'MyInterfaces::My::SOAP::testService::testPort',
'SYNOPSIS',
qr{\s MyInterfaces::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 = 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";
|