import SOAP-WSDL 2.00.07 from CPAN

git-cpan-module:   SOAP-WSDL
git-cpan-version:  2.00.07
git-cpan-authorid: MKUTTER
git-cpan-file:     authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00.07.tar.gz
This commit is contained in:
Martin Kutter authored and Michael G. Schwern committed 2009-12-12 19:48:57 -08:00
1 parent 3de318be40
commit bfc3247583
229 files changed
+16685 -2064

No files matched your search

+2 -1
View File
@@ -8,7 +8,8 @@ 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">
targetNamespace="urn:HelloWorld"
xmlns="urn:HelloWorld" xmlns:s="http://www.w3.org/2001/XMLSchema">
<s:element name="sayHello">
<s:complexType>
<s:sequence>
+2 -1
View File
@@ -1,5 +1,6 @@
package Foo;
sub serialize {
$_[2] = q{} if not defined $_[2];
return "serialized $_[1] $_[2]" . join ' ', @{$_[3]->{ attributes } || [] } if $_[3];
}
package main;
@@ -50,4 +51,4 @@ $element->set_abstract('1');
is $element->serialize('Bar', undef, { namespace => {} } ), 'serialized Bar Foobar';
eval { $element->serialize(undef, undef, { namespace => {} } ) };
like $@, qr{cannot \s serialize \s abstract}xms;
like $@, qr{cannot \s serialize \s abstract}xms;
+2 -1
View File
@@ -8,7 +8,8 @@ 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">
targetNamespace="urn:HelloWorld" xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns="urn:HelloWorld">
<s:simpleType name="test">
<s:restriction base="s:string">
<s:enumeration value="foo"/>
+3 -1
View File
@@ -9,15 +9,17 @@ my $obj = SOAP::WSDL::XSD::Schema->new({
element => [
SOAP::WSDL::XSD::Element->new({
name => 'foo',
targetNamespace => 'bar',
xmlns => { '#default' => 'bar' },
}),
SOAP::WSDL::XSD::Element->new({
name => 'foo',
targetNamespace => 'baz',
xmlns => { '#default' => 'baz' },
}),
SOAP::WSDL::XSD::Element->new({
name => 'foobar',
targetNamespace => 'bar',
xmlns => { '#default' => 'bar' },
}),
]
});
+4 -2
View File
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 11;
use Test::More tests => 12;
use_ok qw(SOAP::WSDL::XSD::SimpleType);
@@ -30,4 +30,6 @@ is $obj->serialize('Foo', 'Foobar'), '<Foo>Foobar</Foo>';
# TODO die on non-serializable content...
$obj->set_flavor('');
is $obj->serialize('Foo', 'Foobar'), '';
is $obj->serialize('Foo', 'Foobar'), '';
ok eval { $obj->set_restriction({ LocalName => 'bar'}, { LocalName => 'base', Value => 'string' }); 1; };
+10 -8
View File
@@ -1,4 +1,4 @@
use Test::More tests => 30;
use Test::More tests => 31;
use strict;
use warnings;
#use Carp qw(cluck);
@@ -19,7 +19,7 @@ sub timezone {
}
my %dates = (
'2007/12/31' => '2007-12-31',
'2007/12/31' => '2007-12-31',
'2007:08:31' => '2007-08-31',
'30 Aug 2007' => '2007-08-30',
);
@@ -36,8 +36,8 @@ my %localized_date_of = (
'2007-12-31T00:00:00.0000000+0800' => '2007-12-31+08:00',
'2007-12-31T00:00:00.0000000+0900' => '2007-12-31+09:00',
'2007-12-31T00:00:00.0000000+1000' => '2007-12-31+10:00',
'2007-12-31T00:00:00.0000000+1100' => '2007-12-31+11:00',
'2007-12-31T00:00:00.0000000+1200' => '2007-12-31+12:00',
'2007-12-31T00:00:00.0000000+1100' => '2007-12-31+11:00',
'2007-12-31T00:00:00.0000000+1200' => '2007-12-31+12:00',
'2007-12-31T00:00:00.0000000-0100' => '2007-12-31-01:00',
'2007-12-31T00:00:00.0000000-0200' => '2007-12-31-02:00',
'2007-12-31T00:00:00.0000000-0300' => '2007-12-31-03:00',
@@ -48,8 +48,8 @@ my %localized_date_of = (
'2007-12-31T00:00:00.0000000-0800' => '2007-12-31-08:00',
'2007-12-31T00:00:00.0000000-0900' => '2007-12-31-09:00',
'2007-12-31T00:00:00.0000000-1000' => '2007-12-31-10:00',
'2007-12-31T00:00:00.0000000-1100' => '2007-12-31-11:00',
'2007-12-31T00:00:00.0000000-1200' => '2007-12-31-12:00',
'2007-12-31T00:00:00.0000000-1100' => '2007-12-31-11:00',
'2007-12-31T00:00:00.0000000-1200' => '2007-12-31-12:00',
);
@@ -64,7 +64,7 @@ while (my ($date, $converted) = each %localized_date_of ) {
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
$obj->set_value( $date );
is $obj->get_value() , $converted , 'conversion';
}
@@ -72,10 +72,12 @@ while (my ($date, $converted) = each %dates ) {
$obj = SOAP::WSDL::XSD::Typelib::Builtin::date->new();
$obj->set_value( $date );
is $obj->get_value() , $converted . timezone($date), 'conversion';
}
$obj->set_value( '2037-12-31+12:00' );
is $obj->get_value() , '2037-12-31+12:00', 'no conversion on match';
$obj->set_value('2007-12-31+01:00');
is $obj->get_value(), '2007-12-31+01:00';
+10 -5
View File
@@ -1,7 +1,7 @@
use strict;
use warnings;
use lib '../lib';
use Test::More tests => 7;
use Test::More tests => 9;
use Date::Parse;
use Date::Format;
@@ -17,7 +17,7 @@ use_ok('SOAP::WSDL::XSD::Typelib::Builtin::dateTime');
print "# timezone is " . timezone( scalar localtime(time) ) . "\n";
my $obj;
my %dates = (
'2007-12-31 12:32' => '2007-12-31T12:32:00',
'2007-12-31 12:32' => '2007-12-31T12:32:00',
'2007-08-31 00:32' => '2007-08-31T00:32:00',
'30 Aug 2007' => '2007-08-30T00:00:00',
);
@@ -30,7 +30,8 @@ while (my ($date, $converted) = each %dates ) {
$obj = SOAP::WSDL::XSD::Typelib::Builtin::dateTime->new();
$obj->set_value( $date );
local $^W; # really turn off warnings for the next line
is $obj->get_value() , $converted . timezone($date), 'conversion with timezone';
}
$obj->set_value('2007-12-31T00:00:00.0000000+01:00');
@@ -38,5 +39,9 @@ is $obj->get_value(), '2007-12-31T00:00:00.0000000+01:00';
$obj->set_value(undef);
is $obj->get_value(), undef;
eval { $obj->set_value(1) };
ok $@, 'Die on illegal datetime';
eval { print $obj->set_value(0) };
ok $@, 'Die on illegal datetime ' . $@;
eval { print $obj->set_value('A') };
ok $@, 'Die on illegal datetime';
eval { print $obj->set_value('8') };
ok $@, 'Die on illegal datetime';
+39 -5
View File
@@ -22,7 +22,8 @@ use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
__PACKAGE__->_factory(
[ 'test' ],
{ test => \%test_of, },
{ test => 'SOAP::WSDL::XSD::Typelib::Builtin::string', }
{ test => 'SOAP::WSDL::XSD::Typelib::Builtin::string', },
);
}
@@ -50,7 +51,8 @@ use base qw(SOAP::WSDL::XSD::Typelib::AttributeSet);
{
test => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
test2 => 'MyAttribute',
}
},
{ test => 'test' }
);
}
@@ -82,7 +84,7 @@ __PACKAGE__->__set_name( 'MyElementSimpleContent' );
sub __get_attr_class { 'MyElement::_ATTR' };
package main;
use Test::More tests => 115;
use Test::More tests => 127;
use Storable;
my $have_warn = eval { require Test::Warn; import Test::Warn; 1; };
@@ -236,6 +238,22 @@ is $obj->serialize(),
q{<MyElement test="TestAttribute" test2="test"/>},
'Serialization with attributes';
#
# cloning attributes...
#
ok exists $obj->as_hash_ref()->{ xmlattr }, 'as_hash_ref attributes';
is $obj->as_hash_ref()->{ xmlattr }->{ test }, 'TestAttribute', 'as_hash_ref attribute value';
is $obj->as_hash_ref()->{ xmlattr }->{ test2 }, 'test', 'as_hash_ref attribute value';
my $clone = ref($obj)->new($obj->as_hash_ref());
isnt $$clone, $$obj, 'clone is new object';
isnt ${ $clone->attr() }, ${ $obj->attr() }, 'cloned attrs are a new object';
is $clone->attr()->get_test(), 'TestAttribute';
#
# end cloning attributes
#
$obj = MyType->new();
isa_ok $obj, 'MyType';
@@ -283,8 +301,10 @@ for my $count (1..5) {
}
my $clone = Storable::thaw( Storable::freeze( $obj ));
is $clone->get_test()->[0], 'TestString0', 'clone via freeze/thaw';
{
my $clone = Storable::thaw( Storable::freeze( $obj ));
is $clone->get_test()->[0], 'TestString0', 'clone via freeze/thaw';
}
## failure tests
@@ -359,3 +379,17 @@ like $@, qr{ Can't \s locate \s HopeItDoesntExistOnYourSystem.pm }xms;
$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>';
$clone = ref($obj)->new($obj->as_hash_ref());
isnt $$clone, $$obj, 'clone is new object';
isnt ${ $clone->attr() }, ${ $obj->attr() }, 'cloned attrs are a new object';
is $clone->get_value(), 'foo';
ok ! exists $obj->as_hash_ref(1)->{ xmlattr };
{
local $SOAP::WSDL::XSD::Typelib::ComplexType::AS_HASH_REF_WITHOUT_ATTRIBUTES = 1;
ok ! exists $obj->as_hash_ref()->{ xmlattr };
ok ! exists $obj->as_hash_ref(1)->{ xmlattr };
}
+16 -2
View File
@@ -10,7 +10,7 @@ __PACKAGE__->__set_name('MyElement');
__PACKAGE__->__set_nillable(1);
package main;
use Test::More tests => 13;
use Test::More tests => 18;
my $obj;
@@ -34,15 +34,29 @@ is $obj->__get_nillable(), 1;
$obj->__set_nillable(0);
is $obj->__get_nillable(), 0;
eval { SOAP::WSDL::XSD::Typelib::Element::__get_nillable() };
like $@, qr{Cannot \s call}xms;
eval { SOAP::WSDL::XSD::Typelib::Element::__set_nillable() };
like $@, qr{Cannot \s call}xms;
# useless test for increasing coverage...
# Stores a value under the key "0" of the element class' private nillable
# hash.
#
# Don't you ever abuse the element's this method for such bad stuff !
is SOAP::WSDL::XSD::Typelib::Element::__set_nillable(0,0), 0;
is SOAP::WSDL::XSD::Typelib::Element::__get_nillable(0), 0;
is $obj->start_tag({ name => 'foo'}), '<foo>';
is $obj->start_tag({empty => 1}), '<MyElement/>';
is $obj->start_tag({nil => 1}), '', 'empty string with nil option and NILLABLE false';
is $obj->end_tag(), '</MyElement>';
is $obj->end_tag({ name => 'foo'}), '</foo>';
$obj->set_value('Test');
eval { is @{ $obj }, 1, 'ARRAYIFY' };
fail 'ARRAYIFY' if ($@);
fail 'ARRAYIFY' if ($@);