116 |
|
|
117 |
use Message::Util::DIS::DNLite; |
use Message::Util::DIS::DNLite; |
118 |
use Message::Util::PerlCode; |
use Message::Util::PerlCode; |
119 |
use Message::Util::DIS::Test; |
|
120 |
use Message::DOM::GenericLS; |
my %feature; |
121 |
|
eval q{ |
122 |
|
use Message::Util::DIS::Test; |
123 |
|
use Message::DOM::GenericLS; |
124 |
|
$feature{ExpandedURI q<fe:GenericLS>} = '3.0'; |
125 |
|
$feature{'+' . ExpandedURI q<DIS:TDT>} = '1.0'; |
126 |
|
}; |
127 |
|
|
128 |
my $limpl = $Message::DOM::ImplementationRegistry->get_implementation |
my $limpl = $Message::DOM::ImplementationRegistry->get_implementation |
129 |
({ExpandedURI q<fe:Min> => '3.0', |
({ExpandedURI q<fe:Min> => '3.0', |
|
ExpandedURI q<fe:GenericLS> => '3.0', |
|
130 |
'+' . ExpandedURI q<DIS:DNLite> => '1.0', |
'+' . ExpandedURI q<DIS:DNLite> => '1.0', |
131 |
'+' . ExpandedURI q<DIS:Core> => '1.0', |
'+' . ExpandedURI q<DIS:Core> => '1.0', |
132 |
'+' . ExpandedURI q<Util:PerlCode> => '1.0', |
'+' . ExpandedURI q<Util:PerlCode> => '1.0', |
133 |
'+' . ExpandedURI q<DIS:TDT> => '1.0', |
%feature, |
134 |
}); |
}); |
135 |
my $impl = $limpl->get_feature (ExpandedURI q<DIS:Core> => '1.0'); |
my $impl = $limpl->get_feature (ExpandedURI q<DIS:Core> => '1.0'); |
|
my $pc = $impl->get_feature (ExpandedURI q<Util:PerlCode> => '1.0'); |
|
|
my $di = $impl->get_feature (ExpandedURI q<DIS:Core> => '1.0'); |
|
136 |
my $tdt_parser; |
my $tdt_parser; |
137 |
|
|
138 |
## --- Loading and Updating the Database |
## --- Loading and Updating the Database |
213 |
unless (defined $ModuleSourceDISDocument{$module_uri}) { |
unless (defined $ModuleSourceDISDocument{$module_uri}) { |
214 |
daf_open_source_dis_document ($module_uri); |
daf_open_source_dis_document ($module_uri); |
215 |
} |
} |
|
daf_convert_dis_document_to_dnl_document (); |
|
216 |
} |
} |
217 |
return daf_get_referring_module_uri_list ($module_uri); |
return daf_get_referring_module_uri_list ($module_uri); |
218 |
}, |
}, |
293 |
|
|
294 |
if ($out_type eq 'perl-pm') { |
if ($out_type eq 'perl-pm') { |
295 |
status_msg_ qq<Generating Perl module from <$mod_uri> for <$mod_for>...>; |
status_msg_ qq<Generating Perl module from <$mod_uri> for <$mod_for>...>; |
296 |
|
local $Message::Util::DIS::Perl::Implementation |
297 |
|
= $impl->get_feature (ExpandedURI q<Util:PerlCode> => '1.0'); |
298 |
my $pl = $mod->pl_generate_perl_module_file; |
my $pl = $mod->pl_generate_perl_module_file; |
299 |
status_msg qq<done>; |
status_msg qq<done>; |
300 |
|
|
342 |
undef $db; |
undef $db; |
343 |
status_msg "done"; |
status_msg "done"; |
344 |
|
|
345 |
|
undef $limpl; |
346 |
|
undef $impl; |
347 |
|
|
348 |
{ |
{ |
349 |
use integer; |
use integer; |
350 |
my $time = time - $start_time; |
my $time = time - $start_time; |
483 |
sub dac_search_file_path_stem ($$$) { |
sub dac_search_file_path_stem ($$$) { |
484 |
my ($ns, $ln, $suffix) = @_; |
my ($ns, $ln, $suffix) = @_; |
485 |
require File::Spec; |
require File::Spec; |
486 |
for my $dir ('.', @{$Opt{input_search_path}->{$ns}||[]}) { |
for my $dir (@{$Opt{input_search_path}->{$ns}||[]}) { |
487 |
my $name = Cwd::abs_path |
my $name = Cwd::abs_path |
488 |
(File::Spec->canonpath |
(File::Spec->canonpath |
489 |
(File::Spec->catfile ($dir, $ln))); |
(File::Spec->catfile ($dir, $ln))); |
588 |
|
|
589 |
sub daf_generate_perl_test_file ($) { |
sub daf_generate_perl_test_file ($) { |
590 |
my $mod = shift; |
my $mod = shift; |
591 |
|
my $pc = $impl->get_feature (ExpandedURI q<Util:PerlCode> => '1.0'); |
592 |
|
local $Message::Util::DIS::Perl::Implementation = $pc; |
593 |
my $pl = $pc->create_perl_file; |
my $pl = $pc->create_perl_file; |
594 |
my $pack = $pl->get_last_package ("Manakai::Test", make_new_package => 1); |
my $pack = $pl->get_last_package ("Manakai::Test", make_new_package => 1); |
595 |
$pack->add_use_perl_module_name ("Message::Util::DIS::Test"); |
$pack->add_use_perl_module_name ("Message::Util::DIS::Test"); |
602 |
$pl->license_uri ($mod->get_property_resource (ExpandedURI q<dis:License>) |
$pl->license_uri ($mod->get_property_resource (ExpandedURI q<dis:License>) |
603 |
->uri); |
->uri); |
604 |
|
|
605 |
|
$pack->append_code (' |
606 |
|
use Getopt::Long; |
607 |
|
my %Skip; |
608 |
|
GetOptions ( |
609 |
|
"Skip=s" => sub { |
610 |
|
shift; |
611 |
|
for (split /\s+/, shift) { |
612 |
|
if (/^(\d+)-(\d+)$/) { |
613 |
|
$Skip{$_} = 1 for $1..$2; |
614 |
|
} else { |
615 |
|
$Skip{$_} = 1; |
616 |
|
} |
617 |
|
} |
618 |
|
}, |
619 |
|
); |
620 |
|
'); |
621 |
|
|
622 |
$pack->append_code |
$pack->append_code |
623 |
($pc->create_perl_statement |
($pc->create_perl_statement |
624 |
('my $impl = $Message::DOM::ImplementationRegistry->get_implementation ({ |
('my $impl = $Message::DOM::ImplementationRegistry->get_implementation ({ |
638 |
|
|
639 |
if ($res->is_type_uri (ExpandedURI q<test:Test>)) { |
if ($res->is_type_uri (ExpandedURI q<test:Test>)) { |
640 |
if ($res->is_type_uri (ExpandedURI q<test:StandaloneTest>)) { |
if ($res->is_type_uri (ExpandedURI q<test:StandaloneTest>)) { |
641 |
$total_tests++; |
my $test_num = ++$total_tests; |
642 |
|
my $test_uri = $res->name_uri || $res->uri; |
643 |
|
|
644 |
$pack->append_code ('$test->start_new_test ('); |
$pack->append_code ('$test->start_new_test ('); |
645 |
$pack->append_new_pc_literal ($res->name_uri || $res->uri); |
$pack->append_new_pc_literal ($test_uri); |
646 |
$pack->append_code (');'); |
$pack->append_code (');'); |
647 |
|
|
648 |
|
$pack->append_code ('if (not $Skip{'.$test_num.'} and not $Skip{'); |
649 |
|
$pack->append_new_pc_literal ($test_uri); |
650 |
|
$pack->append_code ('}) {'); |
651 |
|
|
652 |
$pack->append_code ('try {'); |
$pack->append_code ('try {'); |
653 |
|
|
668 |
$test->not_ok; |
$test->not_ok; |
669 |
};'); |
};'); |
670 |
|
|
671 |
|
$pack->append_code ('} else { warn "'.$test_num.' skipped\n" }'); |
672 |
|
|
673 |
} elsif ($res->is_type_uri (ExpandedURI q<test:ParserTestSet>)) { |
} elsif ($res->is_type_uri (ExpandedURI q<test:ParserTestSet>)) { |
674 |
my $block = $pack->append_new_pc_block; |
my $block = $pack->append_new_pc_block; |
675 |
my @test; |
my @test; |
696 |
not defined $ttest->{root_uri}; |
not defined $ttest->{root_uri}; |
697 |
} |
} |
698 |
|
|
699 |
|
## DOM configuration parameters |
700 |
|
for my $v (@{$tres->get_property_value_list |
701 |
|
(ExpandedURI q<c:anyDOMConfigurationParameter>)}) { |
702 |
|
my $cpuri = $v->name; |
703 |
|
my $cp = $db->get_resource ($cpuri, for_arg => $tres->for_uri); |
704 |
|
$ttest->{dom_config}->{$cp->get_dom_configuration_parameter_name} |
705 |
|
= $v->get_perl_code ($block->owner_document, $tres); |
706 |
|
} |
707 |
|
|
708 |
## Result DOM tree |
## Result DOM tree |
709 |
my $tree_t = $tres->get_property_text (ExpandedURI q<test:domTree>); |
my $tree_t = $tres->get_property_text (ExpandedURI q<test:domTree>); |
710 |
if (defined $tree_t) { |
if (defined $tree_t) { |