import SOAP-WSDL 2.00_01 from CPAN
git-cpan-module: SOAP-WSDL git-cpan-version: 2.00_01 git-cpan-authorid: MKUTTER git-cpan-file: authors/id/M/MK/MKUTTER/SOAP-WSDL-2.00_01.tar.gz
This commit is contained in:
1 parent
bfbf5e27e0
commit
6fe52c4370
108 files changed
+11670
-2369
No files matched your search
@@ -0,0 +1,4 @@
|
||||
use Test::More tests => 2;
|
||||
use lib '../lib';
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
ok( SOAP::WSDL->new(), 'Instantiated object' );
|
||||
@@ -0,0 +1,38 @@
|
||||
use Test::More tests => 9;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use lib '../lib';
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
my $path = dirname( $0 );
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
chdir $path;
|
||||
|
||||
$path = cwd;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
ok( ($soap->servicename('testService') eq 'testService' ) );
|
||||
ok( ($soap->portname('testPort') eq 'testPort' ) );
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
|
||||
ok( ($soap->portname() eq 'testPort' ),
|
||||
"Found first port definition" );
|
||||
|
||||
ok( ($soap->portname('testPort2') eq 'testPort2' ),
|
||||
"Found second port definition (based on URL)" );
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
ok( ($soap->portname('testPort3') eq 'testPort3' ),
|
||||
"Found third port definition (based on Name)" );
|
||||
|
||||
|
||||
ok( $soap->wsdlinit( servicename => 'testService', portname => 'testPort'), 'parsed WSDL' );
|
||||
ok( ($soap->portname() eq 'testPort' ), 'found port passed to wsdlinit');
|
||||
@@ -0,0 +1,94 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $path = cwd();
|
||||
my $name = $0;
|
||||
$name =~s/\.t$//;
|
||||
$name =~s/^t\///;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
print "# SOAP::WSDL Version: $SOAP::WSDL::VERSION\n";
|
||||
|
||||
my $xml;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/acceptance/wsdl/' . $name . '.wsdl',
|
||||
readable =>1,
|
||||
), 'Instantiated object' );
|
||||
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(
|
||||
checkoccurs => 1,
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
ok ($xml = $soap->serializer->method( $soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => 'Test 2',
|
||||
}
|
||||
) ), 'Serialized complexType' );
|
||||
|
||||
# oprint $xml;
|
||||
|
||||
#exit;
|
||||
|
||||
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|
||||
|| die "Cannot open acceptance results file";
|
||||
my $testXML = <$fh>;
|
||||
close $fh;
|
||||
|
||||
SKIP: {
|
||||
print $SKIP;
|
||||
skip( $SKIP, 1 ) if ($SKIP);
|
||||
eval { soap_eq_or_diff( $xml, $testXML, 'Got expected result') };
|
||||
};
|
||||
|
||||
# $soap->wsdl_checkoccurs(1);
|
||||
|
||||
eval
|
||||
{
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 'Test 2', 'Test 3' ]
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
ok( ($@ =~m/illegal\snumber\sof\selements/),
|
||||
"Died on illegal number of elements (too many)"
|
||||
);
|
||||
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => {
|
||||
Test1 => 'Test 1',
|
||||
}
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
@@ -0,0 +1,19 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
@@ -0,0 +1,19 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
@@ -0,0 +1,92 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
my $path = cwd();
|
||||
my $name = $0;
|
||||
$name =~s/\.t$//;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(
|
||||
checkoccurs => 1,
|
||||
), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
$soap->serializer()->namespace('SOAP-ENV');
|
||||
$soap->serializer()->encodingspace('SOAP-ENC');
|
||||
|
||||
#4
|
||||
ok ($xml = $soap->serializer->method( $soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => 'Test 2',
|
||||
}
|
||||
) ), 'Serialized complexType' );
|
||||
|
||||
#5
|
||||
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|
||||
|| die "Cannot open acceptance results file";
|
||||
my $testXML = <$fh>;
|
||||
close $fh;
|
||||
|
||||
SKIP:
|
||||
{
|
||||
skip( 1, $SKIP ) if ($SKIP);
|
||||
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
|
||||
}
|
||||
#6
|
||||
eval
|
||||
{
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
ok( ($@),
|
||||
"Died on illegal number of elements"
|
||||
);
|
||||
|
||||
#7
|
||||
eval
|
||||
{
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testSequence => {
|
||||
Test1 => 'Test 1',
|
||||
Test2 => [ 1, 2, 3, ]
|
||||
}
|
||||
)
|
||||
);
|
||||
};
|
||||
ok( ($@),
|
||||
"Died on illegal number of elements"
|
||||
);
|
||||
|
||||
|
||||
# chdir back to where we came from
|
||||
chdir $cwd;
|
||||
@@ -0,0 +1,19 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing. $@";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
use Test::More tests => 1;
|
||||
use lib '../lib';
|
||||
|
||||
use_ok qw/SOAP::WSDL/;
|
||||
@@ -0,0 +1,93 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
|
||||
use Test::More;
|
||||
plan qw/no_plan/;
|
||||
# plan "skip_all", "Not yet supported";
|
||||
# use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
my $path = dirname( $0 );
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
chdir $path;
|
||||
|
||||
$path = cwd;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
$soap->serializer()->namespace('SOAP-ENV');
|
||||
$soap->serializer()->encodingspace('SOAP-ENC');
|
||||
|
||||
ok ( $xml = $soap->serializer->method( $soap->call('test',
|
||||
testAll => 1 )
|
||||
),
|
||||
'Serialized (simpler) element' );
|
||||
|
||||
# print $xml, "\n";
|
||||
|
||||
|
||||
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|
||||
|| die 'Cannot open acceptance file '
|
||||
. $path . '/acceptance/results/' . $name . '.xml';
|
||||
my $testXML = <$fh>;
|
||||
close $fh;
|
||||
|
||||
SKIP: {
|
||||
skip($SKIP, 1) if ($SKIP);
|
||||
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
|
||||
};
|
||||
|
||||
|
||||
eval
|
||||
{
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 2, 3 ]
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
# print $@;
|
||||
|
||||
ok( ($@ =~m/illegal\snumber\sof\selements/),
|
||||
"Died on illegal number of elements (too many)"
|
||||
);
|
||||
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => undef
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
chdir $cwd;
|
||||
@@ -0,0 +1,74 @@
|
||||
BEGIN
|
||||
{
|
||||
chdir 't/' if (-d 't/');
|
||||
|
||||
use Test::More tests => 7;;
|
||||
use lib '../lib';
|
||||
use lib 't/lib';
|
||||
use lib 'lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
our $SKIP;
|
||||
eval "use Test::SOAPMessage";
|
||||
if ($@)
|
||||
{
|
||||
$SKIP = "Test::Differences required for testing.";
|
||||
}
|
||||
}
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
my $path = cwd();
|
||||
my $name = $0;
|
||||
$name =~s/\.t$//;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file://' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
$soap->serializer()->namespace('SOAP-ENV');
|
||||
$soap->serializer()->encodingspace('SOAP-ENC');
|
||||
|
||||
ok ($xml = $soap->serializer->method( $soap->call('test',
|
||||
testAll => 'Test'
|
||||
) ), 'Serialized (simpler) element' );
|
||||
|
||||
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|
||||
|| die "Cannot open acceptance results file";
|
||||
my $testXML = <$fh>;
|
||||
close $fh;
|
||||
|
||||
SKIP:
|
||||
{
|
||||
skip( $SKIP, 1 ) if ($SKIP);
|
||||
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
|
||||
};
|
||||
|
||||
eval
|
||||
{
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 'Test 2', 'Test 3' ]
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
ok( ($@ =~m/illegal\snumber\sof\selements/),
|
||||
"Died on illegal number of elements (too many)"
|
||||
);
|
||||
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => undef
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
use Test::More tests => 10;
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
use lib 't/lib';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use Test::SOAPMessage;
|
||||
use diagnostics;
|
||||
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
unless ($SOAP::WSDL::MISSING) { };
|
||||
|
||||
my ($xml, $xml2);
|
||||
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
my $path = dirname( $0 );
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
chdir $path;
|
||||
|
||||
$path = cwd;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
|
||||
#4
|
||||
ok ( $xml = $soap->serializer->method( $soap->call('test',
|
||||
testAll => [ 1, 2 ] )
|
||||
),
|
||||
'Serialized (simple) call (list)' );
|
||||
|
||||
#print $xml, "\n";
|
||||
|
||||
SKIP: {
|
||||
|
||||
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|
||||
|| skip("Cannot open acceptance results file", 1);
|
||||
my $testXML = <$fh>;
|
||||
close $fh;
|
||||
#5
|
||||
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
|
||||
}
|
||||
|
||||
#6
|
||||
ok ( $xml2 = $soap->serializer->method( $soap->call('test',
|
||||
testAll => "1 2" )
|
||||
),
|
||||
'Serialized (simple) call (scalar)' );
|
||||
#7
|
||||
ok( $xml eq $xml2, 'Got expected result');
|
||||
|
||||
#8
|
||||
ok (
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => 2
|
||||
)
|
||||
), "Serialized simple call (scalar value)"
|
||||
);
|
||||
|
||||
#9
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => undef
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
|
||||
#10
|
||||
SKIP:
|
||||
{
|
||||
skip ("maxLength test not implemented", 1)
|
||||
if ( $SOAP::WSDL::MISSING->{ simpleType }->{ list }->{ maxLength } );
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ]
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (more than maxLength)');
|
||||
|
||||
}
|
||||
|
||||
chdir $cwd;
|
||||
@@ -0,0 +1,105 @@
|
||||
use Test::More tests => 9;
|
||||
use diagnostics;
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use lib '../lib';
|
||||
use lib 'lib';
|
||||
use lib 't/lib';
|
||||
|
||||
use Test::SOAPMessage;
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
my $path = dirname( $0 );
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
chdir $path;
|
||||
|
||||
$path = cwd;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
$soap->autotype(0);
|
||||
#4
|
||||
ok ( $xml = $soap->serializer->method( $soap->call('test',
|
||||
testAll => 1 )
|
||||
),
|
||||
'Serialized (simple) call (list)' );
|
||||
|
||||
print $xml, "\n";
|
||||
|
||||
|
||||
SKIP: {
|
||||
skip 'broken', 1;
|
||||
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|
||||
|| skip("Cannot open acceptance results file ". $name . '.xml', 1);
|
||||
my $testXML = <$fh>;
|
||||
close $fh;
|
||||
chomp $testXML;
|
||||
chomp $xml;
|
||||
|
||||
soap_eq_or_diff( $xml, $testXML, 'Got expected result');
|
||||
}
|
||||
|
||||
# 6
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1, 2 ]
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => undef
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
SKIP:
|
||||
{
|
||||
skip( "minValue check not implemented ", 1)
|
||||
if ($SOAP::WSDL::MISSING->{ simpleType }->{ restriction }->{ minValue });
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => 0
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal value');
|
||||
}
|
||||
|
||||
SKIP:
|
||||
{
|
||||
skip( "maxValue check not implemented ", 1)
|
||||
if ($SOAP::WSDL::MISSING->{ simpleType }->{ restriction }->{ maxValue });
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => 100
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal value');
|
||||
}
|
||||
|
||||
|
||||
chdir $cwd;
|
||||
@@ -0,0 +1,85 @@
|
||||
use Test::More tests => 9;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use lib '../lib';
|
||||
|
||||
use_ok(qw/SOAP::WSDL/);
|
||||
|
||||
my $xml;
|
||||
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
my $path = dirname( $0 );
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
chdir $path;
|
||||
|
||||
$path = cwd;
|
||||
|
||||
#2
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $path . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
), 'Instantiated object' );
|
||||
|
||||
#3
|
||||
ok( $soap->wsdlinit(), 'parsed WSDL' );
|
||||
$soap->no_dispatch(1);
|
||||
$soap->serializer()->namespace('SOAP-ENV');
|
||||
$soap->serializer()->encodingspace('SOAP-ENC');
|
||||
|
||||
#4
|
||||
ok ( $xml = $soap->serializer->method( $soap->call('test',
|
||||
testAll => 1 )
|
||||
),
|
||||
'Serialized (simple) call (list)' );
|
||||
|
||||
# print $xml, "\n";
|
||||
|
||||
SKIP: {
|
||||
|
||||
open (my $fh, $path . '/acceptance/results/' . $name . '.xml')
|
||||
|| skip("Cannot open acceptance results file ". $name . '.xml', 1);
|
||||
my $testXML = <$fh>;
|
||||
close $fh;
|
||||
|
||||
is( $xml, $testXML, 'Got expected result');
|
||||
}
|
||||
|
||||
# 6
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1 , 'union']
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => undef
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
#8
|
||||
ok ( $xml = $soap->serializer->method( $soap->call('test2',
|
||||
testAll => 1 )
|
||||
),
|
||||
'Serialized (simple) call (list)' );
|
||||
|
||||
#9
|
||||
eval {
|
||||
$xml = $soap->serializer->method(
|
||||
$soap->call('test',
|
||||
testAll => [ 1 , 'union']
|
||||
)
|
||||
)
|
||||
};
|
||||
ok($@, 'Died on illegal number of elements (not enough)');
|
||||
|
||||
chdir $cwd;
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use Test::More tests=> 6;
|
||||
use Time::HiRes qw( gettimeofday tv_interval );
|
||||
use lib '../..';
|
||||
use Data::Dumper;
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
use_ok qw/ SOAP::WSDL /;
|
||||
use Benchmark;
|
||||
|
||||
# print "Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
|
||||
# print "Performance test with simple WSDL file\n";
|
||||
|
||||
my $data = {
|
||||
name => 'Mein Name',
|
||||
givenName => 'Vorname'
|
||||
|
||||
};
|
||||
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
my $path = dirname( $0 );
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
chdir $path;
|
||||
|
||||
$path = cwd;
|
||||
|
||||
my $cacheDir;
|
||||
if ($^O =~ m/Win/)
|
||||
{
|
||||
$cacheDir = 'C:/Temp/WSDL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$cacheDir = '/tmp/';
|
||||
}
|
||||
|
||||
|
||||
my $t0 = [gettimeofday];
|
||||
ok(
|
||||
$soap=SOAP::WSDL->new(
|
||||
wsdl => "file://$path/acceptance/wsdl/10_helloworld.asmx.xml",
|
||||
no_dispatch => 1
|
||||
),
|
||||
"Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."ms)" );
|
||||
|
||||
$soap->proxy('http://helloworld/helloworld.asmx');
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
eval{
|
||||
$soap->wsdlinit(caching => 1,
|
||||
cache_directory => $cacheDir ) };
|
||||
|
||||
unless ($@) {
|
||||
pass("wsdl file init (".tv_interval ( $t0, [gettimeofday]) ."s)");
|
||||
} else {
|
||||
fail( $@ );
|
||||
}
|
||||
$soap->readable(1);
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok( $soap->call("sayHello" , %{ $data }),
|
||||
"1 x call pre-work (".tv_interval ( $t0, [gettimeofday]) ."s)") ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
ok($soap->call(sayHello => %{ $data }),
|
||||
"1 x call pre-work (".tv_interval ( $t0, [gettimeofday]) ."s)" );
|
||||
|
||||
timethis 500, sub { $soap->call(sayHello => %{ $data }) };
|
||||
|
||||
__END__
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
for (my $i=1; $i<100; $i++)
|
||||
{
|
||||
$soap->call(sayHello => %{ $data });
|
||||
}
|
||||
ok(1, "100 x call pre-work (".tv_interval ( $t0, [gettimeofday]) ."s)");
|
||||
|
||||
chdir $cwd;
|
||||
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/perl -w
|
||||
#######################################################################################
|
||||
#
|
||||
# 2_helloworld.t
|
||||
#
|
||||
# Acceptance test for message encoding, based on .NET wsdl and example code.
|
||||
# SOAP::WSDL's encoding doesn't I<exactly> match the .NET example, because
|
||||
# .NET doesn't always specify types (SOAP::WSDL does), and the namespace
|
||||
# prefixes chosen are different (maybe the encoding style, too ? this would be a bug !)
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
use strict;
|
||||
use diagnostics;
|
||||
use Test;
|
||||
plan tests => 5;
|
||||
use Time::HiRes qw( gettimeofday tv_interval );
|
||||
use lib '../..';
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use SOAP::WSDL;
|
||||
ok 1; # if we made it this far, we're ok
|
||||
### test vars END
|
||||
print "Testing SOAP::WSDL ". $SOAP::WSDL::VERSION."\n";
|
||||
print "Acceptance test against sample output with simple WSDL\n";
|
||||
|
||||
my $data = {
|
||||
name => 'test',
|
||||
givenName => 'test',
|
||||
# test => {
|
||||
# name => 'TESTNAME',
|
||||
# givenName => 'GIVENNAME',
|
||||
# },
|
||||
# test1 => {
|
||||
# name => 'TESTNAME',
|
||||
# givenName => 'GIVENNAME',
|
||||
# extend => 'EXTEND',
|
||||
# },
|
||||
# test2 => {
|
||||
# name => 'TESTNAME',
|
||||
# givenName => 'GIVENNAME',
|
||||
# }
|
||||
};
|
||||
|
||||
my $t0 = [gettimeofday];
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
my $path = dirname( $0 );
|
||||
my $soap = undef;
|
||||
my $name = basename( $0 );
|
||||
$name =~s/\.(t|pl)$//;
|
||||
chdir $path;
|
||||
|
||||
$path = cwd;
|
||||
|
||||
|
||||
ok( $soap=SOAP::WSDL->new(
|
||||
wsdl => 'file:///'.$path.'/acceptance/wsdl/11_helloworld.wsdl',
|
||||
no_dispatch => 1
|
||||
) );
|
||||
|
||||
$soap->serializer()->namespace('SOAP-ENV');
|
||||
$soap->serializer()->encodingspace('SOAP-ENC');
|
||||
|
||||
print "Create SOAP::WSDL object (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
$soap->proxy('http://helloworld/helloworld.asmx');
|
||||
$t0 = [gettimeofday];
|
||||
ok($soap->wsdlinit());
|
||||
print "WSDL init (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
do {
|
||||
my $xml = $soap->serializer->method( $soap->call(sayHello => %{ $data }) );
|
||||
|
||||
open (FILE, "acceptance/results/11_helloworld.xml")
|
||||
|| open (FILE, "t/acceptance/results/11_helloworld.xml") || die "can't open acceptance file";
|
||||
my $xml_test=<FILE>;
|
||||
close FILE;
|
||||
$xml=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
$xml_test=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml_test=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
if ( ($xml) && ($xml eq $xml_test) ) {
|
||||
ok 1;
|
||||
print "Message encoding (" .tv_interval ( $t0, [gettimeofday]) ."s)\n"
|
||||
} else {
|
||||
ok 0;
|
||||
print "Message encoding (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
print "$xml\n$xml_test\n"; };
|
||||
};
|
||||
|
||||
$t0 = [gettimeofday];
|
||||
do {
|
||||
my $xml = $soap->serializer->method( $soap->call(sayHello => %{ $data }) );
|
||||
|
||||
open (FILE, "acceptance/results/11_helloworld.xml")
|
||||
|| open FILE, ("t/acceptance/results/11_helloworld.xml") || die "can't open acceptance file";
|
||||
my $xml_test=<FILE>;
|
||||
close FILE;
|
||||
$xml=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
$xml_test=~s/^.+\<([^\/]+?)\:Body\>//;
|
||||
$xml_test=~s/\<\/$1\:Body\>.*//;
|
||||
|
||||
if ( ($xml) && ($xml eq $xml_test) ) {
|
||||
ok 1;
|
||||
print "Message encoding (" .tv_interval ( $t0, [gettimeofday]) ."s)\n";
|
||||
} else {
|
||||
ok 0;
|
||||
print "Message encoding (".tv_interval ( $t0, [gettimeofday]) ."s)\n" ;
|
||||
print "$xml\n$xml_test\n"; };
|
||||
};
|
||||
|
||||
chdir $cwd;
|
||||
@@ -0,0 +1,48 @@
|
||||
use lib '../lib';
|
||||
use Test;
|
||||
use SOAP::WSDL;
|
||||
use Cwd;
|
||||
use Data::Dumper;
|
||||
|
||||
plan tests => 9;
|
||||
|
||||
print "# Using SOAP::WSDL Version $SOAP::WSDL::VERSION\n";
|
||||
|
||||
my $name = '02_port';
|
||||
# chdir to my location
|
||||
my $cwd = cwd;
|
||||
|
||||
|
||||
if (-d 't')
|
||||
{
|
||||
$cwd .= '/t';
|
||||
}
|
||||
|
||||
|
||||
my $url = 'http://127.0.0.1/testPort';
|
||||
|
||||
|
||||
ok(1);
|
||||
|
||||
ok( $soap = SOAP::WSDL->new(
|
||||
wsdl => 'file:///' . $cwd . '/acceptance/wsdl/' . $name . '.wsdl'
|
||||
) );
|
||||
ok( ($soap->servicename('testService') eq 'testService' ) );
|
||||
ok( ($soap->portname('testPort') eq 'testPort' ) );
|
||||
|
||||
ok( $soap->wsdlinit( url => $url ) );
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
my $xpath = $soap->_wsdl_xpath( );
|
||||
|
||||
my @ports = $xpath->findnodes( '/definitions/service[@name="' . $soap->servicename() . '"]/port/soap:address[@location="' . $url .'"]');
|
||||
if (@ports)
|
||||
{
|
||||
print "# found testPort URL\n";
|
||||
my $address = shift @ports;
|
||||
my $port = $address->getParentNode();
|
||||
print $port->getAttribute('binding'), "\n";
|
||||
print $port->getAttribute('name'), "\n";
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use Test::More;
|
||||
eval "use Test::Pod 1.00";
|
||||
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
|
||||
|
||||
use Cwd;
|
||||
|
||||
my $dir = cwd;
|
||||
|
||||
if ( $dir =~ /t$/ )
|
||||
{
|
||||
@directories = ('../lib/');
|
||||
}
|
||||
else
|
||||
{
|
||||
@directories = ();
|
||||
}
|
||||
|
||||
my @files = all_pod_files(
|
||||
@directories
|
||||
);
|
||||
|
||||
plan tests => scalar(@files);
|
||||
|
||||
foreach my $module (@files)
|
||||
{
|
||||
pod_file_ok( $module )
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
use Test::More;
|
||||
eval "use Test::Pod::Coverage 1.00";
|
||||
plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD" if $@;
|
||||
|
||||
|
||||
|
||||
BEGIN
|
||||
{
|
||||
if (-d 't') # chdir into test directory if we
|
||||
{ # are not there (make test)
|
||||
chdir 't';
|
||||
@dirs = '../blib/lib';
|
||||
}
|
||||
else
|
||||
{
|
||||
@dirs = ('../lib');
|
||||
use lib '../lib'; # use our lib if we are in t/ (if we are, we're)
|
||||
# not run from "make test" / "Build test"
|
||||
}
|
||||
}
|
||||
|
||||
@files = all_modules( @dirs );
|
||||
plan tests => scalar @files;
|
||||
foreach (@files)
|
||||
{
|
||||
s/^\.\.::blib::lib:://;
|
||||
s/^\.\.::lib:://;
|
||||
pod_coverage_ok( $_ );
|
||||
}
|
||||
Reference in new issue
Block a user