import SOAP-WSDL 2.00_33 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_33 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_33.tar.gz
This commit is contained in:
committed by
Michael G. Schwern
parent
51db446428
commit
0cbf981665
@@ -91,7 +91,8 @@ isa_ok $result[1], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
);
|
||||
|
||||
isa_ok $result[0], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
is $result[0], undef;
|
||||
is $result[0], q{};
|
||||
|
||||
is $result[1], 'Header2';
|
||||
isa_ok $result[1], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
|
||||
@@ -116,7 +117,7 @@ isa_ok $result[1], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
});
|
||||
|
||||
isa_ok $result[0], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
is $result[0], undef;
|
||||
is $result[0], q{};
|
||||
|
||||
eval { $client->call({
|
||||
operation => 'sayHello',
|
||||
@@ -139,7 +140,8 @@ eval { $client->call({
|
||||
like $@, qr{ Can't \s locate }xms;
|
||||
|
||||
isa_ok $result[0], 'SOAP::WSDL::XSD::Typelib::Builtin::string';
|
||||
is $result[0], undef;
|
||||
|
||||
is $result[0], q{};
|
||||
|
||||
eval { $client->call({
|
||||
operation => 'sayHello',
|
||||
@@ -161,4 +163,4 @@ eval { $client->call({
|
||||
})
|
||||
};
|
||||
# die $@;
|
||||
like $@, qr{ Can't \s locate }xms;
|
||||
like $@, qr{ Can't \s locate }xms;
|
||||
|
||||
@@ -30,15 +30,6 @@ my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
OUTPUT_PATH => "$path/testlib",
|
||||
});
|
||||
|
||||
#my $code = "";
|
||||
#$generator->set_output(\$code);
|
||||
#$generator->generate_typelib();
|
||||
#{
|
||||
# eval $code;
|
||||
# ok !$@;
|
||||
# print $@ if $@;
|
||||
#}
|
||||
|
||||
$definitions = $parser->parse_uri(
|
||||
"file://$path/../../../acceptance/wsdl/WSDLParser-import.wsdl"
|
||||
);
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 4;
|
||||
|
||||
use SOAP::WSDL::Factory::Serializer;
|
||||
use SOAP::WSDL::Factory::Deserializer;
|
||||
|
||||
eval { SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => 'zumsl'
|
||||
eval { SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => 'zumsl'
|
||||
}) };
|
||||
like $@, qr{^no serializer};
|
||||
like $@, qr{^no deserializer};
|
||||
|
||||
ok my $serializer = SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => '1.1'
|
||||
ok my $serializer = SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => '1.1'
|
||||
});
|
||||
ok $serializer = SOAP::WSDL::Factory::Deserializer->get_deserializer({});
|
||||
|
||||
SOAP::WSDL::Factory::Serializer->register('1.1', 'Hope_You_Have_No_Such_Package_Installed');
|
||||
SOAP::WSDL::Factory::Deserializer->register('1.1', 'Hope_You_Have_No_Such_Package_Installed');
|
||||
|
||||
eval { SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => '1.1'
|
||||
eval { SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => '1.1'
|
||||
}) };
|
||||
like $@, qr{^Cannot load};
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 4;
|
||||
|
||||
use SOAP::WSDL::Factory::Deserializer;
|
||||
use SOAP::WSDL::Factory::Serializer;
|
||||
|
||||
eval { SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => 'zumsl'
|
||||
eval { SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => 'zumsl'
|
||||
}) };
|
||||
like $@, qr{^no deserializer};
|
||||
like $@, qr{^no serializer};
|
||||
|
||||
ok my $serializer = SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => '1.1'
|
||||
ok my $serializer = SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => '1.1'
|
||||
});
|
||||
|
||||
SOAP::WSDL::Factory::Deserializer->register('1.1', 'Hope_You_Have_No_Such_Package_Installed');
|
||||
ok $serializer = SOAP::WSDL::Factory::Serializer->get_serializer({});
|
||||
|
||||
eval { SOAP::WSDL::Factory::Deserializer->get_deserializer({
|
||||
soap_version => '1.1'
|
||||
SOAP::WSDL::Factory::Serializer->register('1.1', 'Hope_You_Have_No_Such_Package_Installed');
|
||||
|
||||
eval { SOAP::WSDL::Factory::Serializer->get_serializer({
|
||||
soap_version => '1.1'
|
||||
}) };
|
||||
like $@, qr{^Cannot load};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More qw(no_plan);
|
||||
use Test::More tests => 2;
|
||||
use Template;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
||||
@@ -4,11 +4,23 @@ use Test::More tests => 5;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use SOAP::WSDL::Generator::Template::Plugin::XSD;
|
||||
use SOAP::WSDL::Generator::Iterator::WSDL11;
|
||||
use SOAP::WSDL::Generator::PrefixResolver;
|
||||
use_ok qw(SOAP::WSDL::Generator::Visitor::Typemap);
|
||||
|
||||
my $visitor;
|
||||
ok $visitor = SOAP::WSDL::Generator::Visitor::Typemap->new(), 'constructor';
|
||||
ok $visitor = SOAP::WSDL::Generator::Visitor::Typemap->new({
|
||||
resolver => SOAP::WSDL::Generator::Template::Plugin::XSD->new({
|
||||
prefix_resolver=> SOAP::WSDL::Generator::PrefixResolver->new({
|
||||
prefix => {
|
||||
type => 'TestTypes',
|
||||
element => 'TestElements',
|
||||
typemap => 'TestTypemap',
|
||||
}
|
||||
}),
|
||||
})
|
||||
}), 'constructor';
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
@@ -24,12 +36,21 @@ $parser->parse_file(
|
||||
|
||||
my $definitions = $parser->get_data();
|
||||
|
||||
$definitions->_accept( $visitor );
|
||||
my $iter = SOAP::WSDL::Generator::Iterator::WSDL11->new({
|
||||
definitions => $definitions
|
||||
});
|
||||
$visitor->set_definitions($definitions);
|
||||
$iter->init();
|
||||
while (my $node = $iter->get_next()) {
|
||||
$node->_accept( $visitor );
|
||||
};
|
||||
|
||||
my $typemap = $visitor->get_typemap();
|
||||
is $typemap->{'EnqueueMessage/MMessage/MKeepalive'}, 'MyTypes::TKeepalive', 'content';
|
||||
is $typemap->{'EnqueueMessageResponse'}, 'MyElements::EnqueueMessageResponse', 'content';
|
||||
is $typemap->{'KeepaliveMessageResponse'}, 'MyElements::KeepaliveMessageResponse', 'content';
|
||||
is $typemap->{'EnqueueMessage/MMessage/MKeepalive'}, 'TestTypes::TKeepalive', 'content';
|
||||
is $typemap->{'EnqueueMessageResponse'}, 'TestElements::EnqueueMessageResponse', 'content';
|
||||
is $typemap->{'KeepaliveMessageResponse'}, 'TestElements::KeepaliveMessageResponse', 'content';
|
||||
use Data::Dumper;
|
||||
print Dumper $typemap;
|
||||
|
||||
sub wsdl {
|
||||
q{<?xml version="1.0" encoding="UTF-8"?>
|
||||
@@ -137,4 +158,4 @@ xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
</service>
|
||||
</definitions>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
eval { require XML::Compile::WSDL11 }
|
||||
or plan skip_all => 'Cannot test without XML::Compile::WSDL11';
|
||||
|
||||
eval { require XML::LibXML }
|
||||
or plan skip_all => 'Cannot test without XML::LibXML';
|
||||
|
||||
plan skip_all => 'XML::Compile::WSDL11 is not functional yet';
|
||||
|
||||
plan qw(no_plan);
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
my $libxml = XML::LibXML->new();
|
||||
my $xml = $libxml->parse_file("$path/../../../acceptance/wsdl/generator_test.wsdl");
|
||||
|
||||
my $wsdl = XML::Compile::WSDL11->new($xml);
|
||||
my $schemas = $wsdl->schemas;
|
||||
ok my $operation = $wsdl->operation('testHeader');
|
||||
|
||||
#die Dumper $operation;
|
||||
#
|
||||
#my $client = $operation->prepareClient();
|
||||
@@ -1,4 +1,4 @@
|
||||
use Test::More tests => 42;
|
||||
use Test::More tests => 49;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
@@ -156,9 +156,40 @@ ok my $empty = MyElements::testElementCompletelyEmptyComplex->new();
|
||||
is $empty->serialize_qualified(), '<testElementCompletelyEmptyComplex xmlns="urn:Test"/>'
|
||||
, 'serialize empty';
|
||||
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeSimpleRestriction; }
|
||||
, 'load MyTypes::testComplexTypeSimpleRestriction';
|
||||
|
||||
ok eval { require MyTypes::testComplexTypeSequenceWithAttribute; }
|
||||
, 'load MyTypes::testComplexTypeSequenceWithAttribute';
|
||||
|
||||
use_ok qw(MyElements::testElementComplexTypeSequenceWithAttribute);
|
||||
|
||||
my $obj = MyElements::testElementComplexTypeSequenceWithAttribute->new({
|
||||
Test1 => 'foo',
|
||||
Test2 => 'bar',
|
||||
});
|
||||
$obj->attr({ testAttr => 'foobar' });
|
||||
|
||||
is $obj, q{<testElementComplexTypeSequenceWithAttribute xmlns="urn:Test" }
|
||||
. q{testAttr="foobar"><Test1>foo</Test1><Test2>bar</Test2>}
|
||||
. q{</testElementComplexTypeSequenceWithAttribute>}
|
||||
, 'seralize complexType sequence with attribute';
|
||||
|
||||
use_ok qw(MyTypes::testSimpleContentExtension);
|
||||
|
||||
ok $obj = MyTypes::testSimpleContentExtension->new({ value => 'foo' });
|
||||
$obj->attr({ testAttr => 'bar' });
|
||||
|
||||
is $obj->serialize({ name => 'baz'}), q{<baz testAttr="bar">foo</baz>};
|
||||
|
||||
SKIP: {
|
||||
eval { require Test::Pod::Content; }
|
||||
or skip 'Cannot test pod content without Test::Pod::Content', 1;
|
||||
Test::Pod::Content::pod_section_like(
|
||||
'MyTypes::testComplexTypeSequenceWithAttribute',
|
||||
'attr',
|
||||
qr{Test \s Attribute \s good \s for \s nothing}x,
|
||||
'Attribute POD');
|
||||
}
|
||||
|
||||
rmtree "$path/testlib";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use Test::More tests => 12;
|
||||
use Test::More tests => 14;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
@@ -12,7 +12,7 @@ use SOAP::WSDL::Expat::WSDLParser;
|
||||
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
my $definitions = $parser->parse_file(
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_test_dot_names.wsdl"
|
||||
#"$path/../../../acceptance/wsdl/elementAtomicComplexType.xml"
|
||||
);
|
||||
@@ -26,7 +26,7 @@ my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
});
|
||||
|
||||
my $code = "";
|
||||
$generator->set_output(\$code);
|
||||
$generator->set_output(\$code);
|
||||
$generator->generate_typelib();
|
||||
{
|
||||
eval $code;
|
||||
@@ -47,9 +47,9 @@ $generator->generate();
|
||||
#$generator->generate_typemap();
|
||||
|
||||
if (eval { require Test::Warn; }) {
|
||||
Test::Warn::warning_like( sub { $generator->generate_interface() },
|
||||
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 };
|
||||
@@ -61,38 +61,40 @@ 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);
|
||||
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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'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',
|
||||
'MyServer::My::SOAP::testService::testPort',
|
||||
'SYNOPSIS',
|
||||
qr{\s MyServer::My::SOAP::testService::testPort->new\(}xms,
|
||||
'Pod SYNOPSIS section');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
use Test::More tests => 14;
|
||||
use File::Basename qw(dirname);
|
||||
use File::Spec;
|
||||
use File::Path;
|
||||
|
||||
my $path = File::Spec->rel2abs( dirname __FILE__ );
|
||||
|
||||
use SOAP::WSDL::Expat::MessageParser;
|
||||
|
||||
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/nested_complextype.wsdl"
|
||||
);
|
||||
|
||||
ok my $element = $definitions->get_types()->[0]->find_element("urn:HelloWorld", "sayHello")
|
||||
, 'got element';
|
||||
ok my $sub_element = $element->get_complexType->[0]->find_element("urn:HelloWorld", "givenName"),
|
||||
, 'atomic type element';
|
||||
ok $sub_element->get_complexType->[0]->find_element("urn:HelloWorld", "givenName"),
|
||||
'element in subtype';
|
||||
|
||||
|
||||
my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
definitions => $definitions,
|
||||
type_prefix => 'Bar',
|
||||
element_prefix => 'BarElem',
|
||||
typemap_prefix => 'Bar',
|
||||
OUTPUT_PATH => "$path/testlib",
|
||||
});
|
||||
|
||||
|
||||
my $code = "";
|
||||
$generator->set_output(\$code);
|
||||
$generator->generate_typelib();
|
||||
{
|
||||
eval $code;
|
||||
ok !$@, 'eval generated code';
|
||||
print $@ if $@;
|
||||
}
|
||||
# print $code;
|
||||
|
||||
my %prefix_of = (
|
||||
type => 'FooType',
|
||||
element => 'FooElement',
|
||||
typemap => 'FooMap',
|
||||
);
|
||||
|
||||
while (my ($name, $value) = each %prefix_of ) {
|
||||
$generator->can("set_$name\_prefix")->($generator, $value);
|
||||
}
|
||||
|
||||
$generator->set_output(undef);
|
||||
$generator->generate();
|
||||
#$generator->generate_typelib();
|
||||
$generator->generate_typemap();
|
||||
$generator->generate_server();
|
||||
|
||||
eval "use lib '$path/testlib'";
|
||||
|
||||
use_ok qw(FooElement::sayHello);
|
||||
eval {
|
||||
FooElement::sayHello::_givenName->new({
|
||||
givenName => 'Foo',
|
||||
middleInitial => 'Bar',
|
||||
});
|
||||
};
|
||||
ok !$@, 'instantiate subpackage FooElement::sayHello::_givenName';
|
||||
|
||||
eval {
|
||||
FooElement::sayHello::_givenName::XmlAttr->new({
|
||||
testAttr => 'Bar'
|
||||
});
|
||||
};
|
||||
ok !$@, 'instantiate subpackage attribute class FooElement::sayHello::_givenName::XmlAttr';
|
||||
|
||||
|
||||
SKIP: {
|
||||
eval { require Test::Pod::Content; }
|
||||
or skip 'Cannot test pod content without Test::Pod::Content', 1;
|
||||
Test::Pod::Content::pod_section_is(
|
||||
'FooElement::sayHello',
|
||||
'NAME',
|
||||
'FooElement::sayHello',
|
||||
'Pod NAME section');
|
||||
}
|
||||
|
||||
#rmtree "$path/testlib";
|
||||
require FooMap::Service1;
|
||||
my $message_parser = SOAP::WSDL::Expat::MessageParser->new({
|
||||
class_resolver => 'FooMap::Service1',
|
||||
});
|
||||
|
||||
my $result = $message_parser->parse_string( xml() );
|
||||
is $result->get_name(), 'Kutter', 'content';
|
||||
is $result->get_givenName()->get_givenName, 'Martin', 'nested complexType content';
|
||||
is $result->get_givenName()->get_givenName, 'Martin', 'nested complexType content';
|
||||
is $result->get_givenName()->attr()->get_testAttr, 'Bar', 'nested complexType attr';
|
||||
|
||||
sub xml {
|
||||
return q{<SOAP-ENV:Envelope
|
||||
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
|
||||
<SOAP-ENV:Body >
|
||||
<sayHello xmlns="urn:HelloWorld" testAttr="Foo">
|
||||
<name>Kutter</name>
|
||||
<givenName testAttr="Bar">
|
||||
<givenName>Martin</givenName>
|
||||
<middleInitial>A.</middleInitial>
|
||||
</givenName>
|
||||
</sayHello>
|
||||
</SOAP-ENV:Body></SOAP-ENV:Envelope>};
|
||||
}
|
||||
@@ -10,7 +10,7 @@ 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(
|
||||
my $definitions = $parser->parse_file(
|
||||
"$path/../../../acceptance/wsdl/generator_unsupported_test.wsdl"
|
||||
);
|
||||
|
||||
@@ -21,4 +21,4 @@ my $generator = SOAP::WSDL::Generator::Template::XSD->new({
|
||||
{
|
||||
eval { $generator->generate_typelib() };
|
||||
}
|
||||
ok $@;
|
||||
ok $@, $@;
|
||||
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
@@ -0,0 +1,34 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
use SOAP::WSDL::XSD::Attribute;
|
||||
|
||||
use SOAP::WSDL::XSD::Schema;
|
||||
use_ok qw(SOAP::WSDL::Types);
|
||||
|
||||
my $types = SOAP::WSDL::Types->new();
|
||||
$types->set_xmlns({
|
||||
foo => 'bar',
|
||||
});
|
||||
|
||||
my $attr = SOAP::WSDL::XSD::Attribute->new({
|
||||
name => 'test',
|
||||
targetNamespace => 'bar'
|
||||
});
|
||||
|
||||
my $schema = SOAP::WSDL::XSD::Schema->new();
|
||||
$schema->push_attribute( $attr );
|
||||
|
||||
$types->push_schema(
|
||||
$schema
|
||||
);
|
||||
|
||||
ok my $found_attr = $types->find_attribute('bar', 'test');
|
||||
is $found_attr, $attr;
|
||||
|
||||
ok $types->find_attribute([ 'bar', 'test' ]);
|
||||
|
||||
ok ! $types->find_attribute('foo', 'test');
|
||||
|
||||
ok ! $types->find_element('foo', 'test');
|
||||
@@ -0,0 +1,6 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 1; #qw(no_plan);
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::AttributeGroup);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 2; #qw(no_plan);
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::Builtin);
|
||||
|
||||
my $foo = SOAP::WSDL::XSD::Builtin->new();
|
||||
$foo->set_targetNamespace('bar');
|
||||
|
||||
eval {
|
||||
$foo->serialize(
|
||||
'foo', 'bar', { autotype => 1 , namespace => {} }
|
||||
)
|
||||
};
|
||||
|
||||
like $@, qr{^No \s prefix \s found \s for \s namespace \s bar}x;
|
||||
@@ -1,6 +1,6 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 2; #qw(no_plan);
|
||||
use Test::More tests => 3; #qw(no_plan);
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::ComplexType);
|
||||
|
||||
@@ -9,3 +9,13 @@ $obj->set_variety('extension');
|
||||
|
||||
eval { $obj->serialize('foo') };
|
||||
like $@, qr{sorry, \s we \s just}xsm;
|
||||
|
||||
$obj->set_targetNamespace('bar');
|
||||
|
||||
eval {
|
||||
$obj->serialize(
|
||||
'foo', 'bar', { autotype => 1 , namespace => {} }
|
||||
)
|
||||
};
|
||||
|
||||
like $@, qr{^No \s prefix \s found \s for \s namespace \s bar}x;
|
||||
@@ -0,0 +1,30 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3; #qw(no_plan);
|
||||
|
||||
use_ok qw(SOAP::WSDL::XSD::Enumeration);
|
||||
|
||||
use SOAP::WSDL::Expat::WSDLParser;
|
||||
my $parser = SOAP::WSDL::Expat::WSDLParser->new();
|
||||
|
||||
my $xml = q{<s:schema elementFormDefault="qualified"
|
||||
targetNamespace="urn:HelloWorld" xmlns:s="http://www.w3.org/2001/XMLSchema">
|
||||
<s:simpleType name="test">
|
||||
<s:restriction base="s:string">
|
||||
<s:enumeration value="foo"/>
|
||||
<s:enumeration value="bar">
|
||||
<s:annotation>
|
||||
<s:documentation>foobar</s:documentation>
|
||||
</s:annotation>
|
||||
</s:enumeration>
|
||||
</s:restriction>
|
||||
</s:simpleType>
|
||||
</s:schema>
|
||||
};
|
||||
|
||||
my $schema = $parser->parse($xml);
|
||||
|
||||
is $schema->find_type('urn:HelloWorld', 'test')
|
||||
->get_enumeration()->[0]->get_value(), 'foo';
|
||||
is $schema->find_type('urn:HelloWorld', 'test')
|
||||
->get_enumeration()->[1]->get_value(), 'bar';
|
||||
@@ -1,21 +1,30 @@
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS;
|
||||
my $NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new();
|
||||
is $NMTOKENS->get_value(), undef;
|
||||
is $NMTOKENS->get_value(), undef, 'get undef value';
|
||||
$NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({});
|
||||
is $NMTOKENS->get_value(), undef;
|
||||
is $NMTOKENS->get_value(), undef, 'get undef value after new with {}';
|
||||
ok $NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({ value => [ 127 , 'Test' ] });
|
||||
|
||||
is $NMTOKENS->serialize, '127 Test', 'stringification';
|
||||
is $NMTOKENS->serialize(), '127 Test', 'stringification';
|
||||
|
||||
ok $NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({ value => 'Test' });
|
||||
ok $NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({ value => 'Test' })
|
||||
, 'constructor';
|
||||
is "$NMTOKENS", "Test", 'stringification';
|
||||
|
||||
$NMTOKENS = SOAP::WSDL::XSD::Typelib::Builtin::NMTOKENS->new({ value => undef });
|
||||
is $NMTOKENS, undef, 'stringification';
|
||||
|
||||
#{
|
||||
# my $found = 0;
|
||||
# local $SIG{__WARN__} = sub {
|
||||
# # die $_[0];
|
||||
# $found++ if $_[0] =~m{Use \s of \s uninitialized \s value}x;
|
||||
# };
|
||||
# ok ! "$NMTOKENS";
|
||||
# is $found, 1;
|
||||
#}
|
||||
|
||||
ok $NMTOKENS->isa('SOAP::WSDL::XSD::Typelib::Builtin::NMTOKEN'), 'inheritance';
|
||||
ok $NMTOKENS->isa('SOAP::WSDL::XSD::Typelib::Builtin::list'), 'inheritance';
|
||||
ok $NMTOKENS->isa('SOAP::WSDL::XSD::Typelib::Builtin::list'), 'inheritance';
|
||||
|
||||
@@ -54,7 +54,7 @@ is $obj->get_value(), 'test2', 'get_value on attr value';
|
||||
|
||||
$obj->set_value(undef);
|
||||
|
||||
is $obj->serialize({ name => 'foo' }), '<foo></foo>'
|
||||
is $obj->serialize({ name => 'foo' }), '<foo xsi:nil="true"/>'
|
||||
, 'serialize undef value with name';
|
||||
is $obj->serialize(), q{}, 'serialize undef value without name';
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 4;
|
||||
use Scalar::Util qw(blessed);
|
||||
use_ok qw(SOAP::WSDL::XSD::Typelib::Builtin::anyType);
|
||||
|
||||
is SOAP::WSDL::XSD::Typelib::Builtin::anyType->get_xmlns(), 'http://www.w3.org/2001/XMLSchema', 'get_xmlns';
|
||||
is SOAP::WSDL::XSD::Typelib::Builtin::anyType->serialize(), q{}, 'serialize to empty';
|
||||
#is SOAP::WSDL::XSD::Typelib::Builtin::anyType->serialize(), q{}, 'serialize to empty';
|
||||
is SOAP::WSDL::XSD::Typelib::Builtin::anyType->start_tag(), q{}, 'serialize to empty';
|
||||
is SOAP::WSDL::XSD::Typelib::Builtin::anyType->start_tag({ name => 'foo'}), q{<foo>}, 'serialize with name';
|
||||
exit 0;
|
||||
|
||||
@@ -34,6 +34,8 @@ use base qw(
|
||||
|
||||
__PACKAGE__->__set_name( 'MyElement' );
|
||||
|
||||
sub __get_attr_class { 'MyElement::_ATTR' };
|
||||
|
||||
package MyElement::_ATTR;
|
||||
use base qw(SOAP::WSDL::XSD::Typelib::AttributeSet);
|
||||
{
|
||||
@@ -51,6 +53,7 @@ use base qw(SOAP::WSDL::XSD::Typelib::AttributeSet);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
package MyType2;
|
||||
|
||||
use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
|
||||
@@ -67,8 +70,19 @@ __PACKAGE__->_factory(
|
||||
}
|
||||
);
|
||||
|
||||
package MyElementSimpleContent;
|
||||
use base qw(
|
||||
SOAP::WSDL::XSD::Typelib::Element
|
||||
SOAP::WSDL::XSD::Typelib::ComplexType
|
||||
SOAP::WSDL::XSD::Typelib::Builtin::string
|
||||
);
|
||||
|
||||
__PACKAGE__->__set_name( 'MyElementSimpleContent' );
|
||||
|
||||
sub __get_attr_class { 'MyElement::_ATTR' };
|
||||
|
||||
package main;
|
||||
use Test::More tests => 109;
|
||||
use Test::More tests => 111;
|
||||
use Storable;
|
||||
|
||||
my $have_warn = eval { require Test::Warn; import Test::Warn; 1; };
|
||||
@@ -150,6 +164,12 @@ $nested = MyType2->new({
|
||||
|
||||
is $nested->get_test->[0], $obj;
|
||||
|
||||
# use Data::Dumper;
|
||||
# print Data::Dumper::Dumper $nested->as_hash_ref();
|
||||
|
||||
is $nested->as_hash_ref()->{ test }->[ 0 ]->{ test }->[0], 'Test'
|
||||
, 'as_hash_ref with nested elements';
|
||||
|
||||
$nested = MyType2->new({
|
||||
test => {
|
||||
test => [
|
||||
@@ -194,10 +214,7 @@ $obj->set_test();
|
||||
is $obj->get_test, (), 'removed element content';
|
||||
|
||||
$obj = MyEmptyType->new();
|
||||
eval {
|
||||
isa_ok $obj->attr() , 'SOAP::WSDL::XSD::Typelib::AttributeSet';
|
||||
};
|
||||
like $@, qr{\s has \s no \s attributes}x;
|
||||
is $obj->attr(), undef;
|
||||
|
||||
$obj = MyElement->new();
|
||||
isa_ok $obj->attr() , 'SOAP::WSDL::XSD::Typelib::AttributeSet';
|
||||
@@ -324,3 +341,7 @@ eval { SOAP::WSDL::XSD::Typelib::ComplexType->_factory([], { test => {} }, { tes
|
||||
like $@, qr{ Can't \s locate \s HopeItDoesntExistOnYourSystem.pm }xms;
|
||||
|
||||
# print Dumper
|
||||
|
||||
$obj = MyElementSimpleContent->new({ value => 'foo' });
|
||||
$obj->attr({ test => 'foo', test2 => 'bar' });
|
||||
is $obj->serialize_qualified(), '<MyElementSimpleContent xmlns="http://www.w3.org/2001/XMLSchema" test="foo" test2="bar">foo</MyElementSimpleContent>';
|
||||
|
||||
Reference in New Issue
Block a user