mach 2003/08/06 12:53:13
Modified: t/conf extra.last.conf.in Added: t/component/configreader 01_get_matching_processors.t t/htdocs/component/configreader get_matching_processors_1.xml get_matching_processors_2.xml t/htdocs/style/component/configreader get_matching_processors_1.xsl get_matching_processors_2.xsl Log: Test for #global array in configreader getting polluted with media/style based processors. This bug only occurs if you have a global config directive AND are using <AxMediaType <AxStyleName directives. Mike. Revision Changes Path 1.1 xml-axkit/t/component/configreader/01_get_matching_processors.t Index: 01_get_matching_processors.t =================================================================== #!perl use Apache::Test; use Apache::TestUtil; use Apache::TestRequest qw( GET POST ) ; plan tests => 2, have_module qw(LWP); sub test_basic1 { my $resp1 = GET '/component/configreader/get_matching_processors_1.xml' ; return 0 unless $resp1->content =~ /get_matching_processors_1.xsl/gi; return 1; } sub test_basic2 { my $resp2 = GET '/component/configreader/get_matching_processors_2.xml' ; return 0 unless $resp2->content =~ /get_matching_processors_2.xsl/gi; return 1; } ok( test_basic1(),1, "Testing Get Matching Processors" ); ok( test_basic2(),1, "Testing Get Matching Processors doesn't leak"); 1.2 +19 -0 xml-axkit/t/conf/extra.last.conf.in Index: extra.last.conf.in =================================================================== RCS file: /home/cvs/xml-axkit/t/conf/extra.last.conf.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- extra.last.conf.in 17 Jul 2003 16:34:50 -0000 1.1 +++ extra.last.conf.in 6 Aug 2003 19:53:13 -0000 1.2 @@ -53,3 +53,22 @@ AxAddProcessor text/xsl /style/xslt-basic/04_document_2args.xsl </Location> +# Test for global styles bug. +# only triggered when using a global style AND a media/style combination. +# The styles within the AxStyle would leak into the #global array + +<Location "/component/configreader"> + SetHandler axkit +</Location> + +# I've had to add this Root processor here so it gets picked up in #global inside configreader. +# If it's defined in a Location it doesn't trigger the bug. +# If you can find a better way to trigger it, please do. + +AxAddRootProcessor application/x-xsp NULL {http://www.apache.org/1999/XSP/Core}page +<AxMediaType screen> + <AxStyleName "#default"> + AxAddURIProcessor text/xsl /style/component/configreader/get_matching_processors_1.xsl "/component/configreader/get_matching_processors_1.xml" + AxAddURIProcessor text/xsl /style/component/configreader/get_matching_processors_2.xsl "/component/configreader/get_matching_processors_2.xml" + </AxStyleName> +</AxMediaType> 1.1 xml-axkit/t/htdocs/component/configreader/get_matching_processors_1.xml Index: get_matching_processors_1.xml =================================================================== <?xml version="1.0"?> <root/> 1.1 xml-axkit/t/htdocs/component/configreader/get_matching_processors_2.xml Index: get_matching_processors_2.xml =================================================================== <?xml version="1.0"?> <root/> 1.1 xml-axkit/t/htdocs/style/component/configreader/get_matching_processors_1.xsl Index: get_matching_processors_1.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="root"> <match>get_matching_processors_1.xsl</match> </xsl:template> <xsl:template match="match"> <bug>Template got applied twice</bug> </xsl:template> </xsl:stylesheet> 1.1 xml-axkit/t/htdocs/style/component/configreader/get_matching_processors_2.xsl Index: get_matching_processors_2.xsl =================================================================== <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="root"> <match>get_matching_processors_2.xsl</match> </xsl:template> <xsl:template match="match"> <bug>Template got applied twice</bug> </xsl:template> </xsl:stylesheet>