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:
Martin Kutter authored and Michael G. Schwern committed 2009-12-12 19:48:28 -08:00
1 parent 51db446428
commit 0cbf981665
146 files changed
+3364 -1280

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
use strict;
use warnings;
use Test::More tests => 1; #qw(no_plan);
use_ok qw(SOAP::WSDL::XSD::AttributeGroup);
+16
View File
@@ -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;
+11 -1
View File
@@ -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;
+30
View File
@@ -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';
+16 -7
View File
@@ -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';
+2 -2
View File
@@ -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;
+26 -5
View File
@@ -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>';