;ò ðX‡>c@s\dZddd!Zddd!Zddd!ZdkZdkZdkZedjo$eei i ei d d ƒƒnd k l Z d k lZlZlZe id ƒe idƒdklZlZe iiƒ\ZZdeeefZde i fd„ƒYZedjo,dGeiƒiƒGHeddddƒndkZd„ZdS(sÆ $RCSfile: TestCacheManager.py,v $ Unit tests for ZopeXMLMethods product Author: Craeg Strong Modified by Philipp von Weitershausen Release: 1.0 s $Name: $iiþÿÿÿs$Date: 2003/03/30 20:51:59 $s$Revision: 1.20 $i Ns__main__is framework.py(s ZopeTestCase(s CacheManagers XSLTMethodsProcessorChoosersZopeXMLMethodss PageTemplates(s _folder_names_standard_permissionsshttp://%s:%d/%ssCacheManagerTestCasecBs•tZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„ZRS(s— Unit tests for the Cache Manager within the ZopeXMLMethod Zope Product. These tests use the ZopeTestCase enhanced testing product. cCstƒiƒdS(N(sget_transactionsbegin(sself((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pys beforeSetUp/scCsdS(sAdd object to default fixtureN((sself((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pys afterSetUp2scCstƒiƒdS(N(sget_transactionscommit(sself((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pys beforeClose6scCsdS(sClean up after myselfN((sself((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pys afterClear:scCsštddƒ}|iidd|ƒtddƒ}|iidd|ƒti|iddd dƒ}ti|idd d dƒ}ti|idd d dƒ}|i |i ƒƒ|i |i ƒƒ|i |i ƒƒt i|id ƒ}|i|iiƒ|i|i ƒƒ|i|i ƒƒ|i|i ƒƒ|i|iiƒ|i |i ƒƒ|i |i ƒƒ|i |i ƒƒ|iƒ}d S(s<Ensure that cache manager can turn caching on/off in a batchstestfiles/simple.xslsrbs aTransformersstestfiles/simple.xmlsaSourcesids aXSLTMethodsxslTransformerIds aXSLTMethod2s aXSLTMethod3scmN(sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFiles XSLTMethods addInstancesxformsxform2sxform3s failUnlesss isCachingOns CacheManagerscmsbatchSetCachingOffsappsREQUESTsfailIfsbatchSetCachingOns clearCachesmessage(sselfsxmlFilescmsxsltFilesxform2sxform3smessagesxform((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_01Bs0   c CsÆtddƒ}|iidd|ƒtddƒ}|iidd|ƒti|iddd dƒ} |i | i ƒƒt i|id ƒ}t iid d ƒ|_|iii} t iiddƒ}t iit|ƒ}||iid <| | |iiƒ} |i| iƒdƒ|i|ƒ}di|itddfƒ}|i t ii|ƒƒ|i ƒ}|i ||jƒ|i|t ii"|ƒƒ|i#ƒ} |i%t ii|ƒƒdS(sEnsure basic caching worksstestfiles/simple.xslsrbs aTransformersstestfiles/simple.xmlsaSourcesids aXSLTMethodsxslTransformerIdscms testfilessTestsURLs Hello, worlds_N(&sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFiles XSLTMethods addInstancesxforms failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixsaSources aXSLTMethodstransformationPathsbasesurlsappsREQUESTsresults assertEqualssstripscacheFileTimeStamps cacheFileTSs _folder_names cacheFilesexistsslistCacheFilessfilessgetmtimes clearCachesmessagesfailIf( sselfsfilessxmlFilescmsurlsxsltFiles cacheFiles cacheFileTSstransformationPathsresultsmessagesxform((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_02ds0   c CsÏtddƒ}|iidd|ƒtddƒ}|iidd|ƒti|iddd dd dd dƒ} ti|idd d dd dd dƒ} ti|idd d dd dd dƒ}|i | i ƒƒ|i | i ƒƒ|i |i ƒƒt i|idƒ}tiiddƒ|_|iii} tiiddƒ}tiit|ƒ}||iid<| | |iiƒ}|i|iƒdƒ|iii} tiidd ƒ}tiit|ƒ}||iid<| | |iiƒ}|i|iƒdƒ|iii}tiidd ƒ}tiit|ƒ}||iid<|||iiƒ}|i|iƒdƒ|i!ƒ}di|it#ddfƒ} |i tii%| ƒƒ|i | |jƒdi|it#dd fƒ} |i tii%| ƒƒ|i | |jƒdi|it#dd fƒ} |i tii%| ƒƒ|i | |jƒ|i(ƒ}|i*tii%| ƒƒ|i*tii%| ƒƒ|i*tii%| ƒƒdS(s>Ensure that cache manager can cache multiple xforms in a batchstestfiles/simple.xslsrbs aTransformersstestfiles/simple.xmlsaSourcesids aXSLTMethod1stitles descriptionsxslTransformerIds aXSLTMethod2s aXSLTMethod3scms testfilessTestsURLs Hello, worlds_N(+sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFiles XSLTMethods addInstancesxform1sxform2sxform3s failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixsaSources aXSLTMethod1stransformationPath1sbasesurlsappsREQUESTsresults assertEqualssstrips aXSLTMethod2stransformationPath2s aXSLTMethod3stransformationPath3slistCacheFilessfiless _folder_names cacheFile1sexistss cacheFile2s cacheFile3s clearCachesmessagesfailIf(sselfscmsxsltFilestransformationPath1stransformationPath3stransformationPath2sresultsmessagesxmlFiles cacheFile2s cacheFile3s cacheFile1sxform1sxform2sxform3sfilessurl((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_03‰s`     cCstddƒ}|iidd|ƒtddƒ}|iidd|ƒti|iddd dƒ} ti|idd d dƒ} ti|idd d dƒ}|i | i ƒƒ|i | i ƒƒ|i |i ƒƒt i|id ƒ}tiid dƒ|_|iii} tiiddƒ}tiit|ƒ}||iid<| | |iiƒ}|i|iƒdƒ|iii} tiidd ƒ}tiit|ƒ}||iid<| | |iiƒ}|i|iƒdƒ|iii}tiidd ƒ}tiit|ƒ}||iid<|||iiƒ}|i|iƒdƒ|i!ƒ}di|it#ddfƒ} |i tii%| ƒƒ|i | |jƒdi|it#dd fƒ} |i tii%| ƒƒ|i | |jƒdi|it#dd fƒ} |i tii%| ƒƒ|i | |jƒti(| ƒ| | |iiƒ}|i|iƒdƒti(| ƒti(| ƒ|i)ƒ}|i+|i,dƒdjƒ|i+tii%| ƒƒ|i+tii%| ƒƒ|i+tii%| ƒƒdS(sTEnsure that cache manager can recover when cache files are deleted by external partystestfiles/simple.xslsrbs aTransformersstestfiles/simple.xmlsaSourcesids aXSLTMethod1sxslTransformerIds aXSLTMethod2s aXSLTMethod3scms testfilessTestsURLs Hello, worlds_snot removed, erroriÿÿÿÿN(-sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFiles XSLTMethods addInstancesxform1sxform2sxform3s failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixsaSources aXSLTMethod1stransformationPath1sbasesurlsappsREQUESTsresults assertEqualssstrips aXSLTMethod2stransformationPath2s aXSLTMethod3stransformationPath3slistCacheFilessfiless _folder_names cacheFile1sexistss cacheFile2s cacheFile3sunlinks clearCachesmessagesfailIfsfind(sselfscmsxsltFilestransformationPath1stransformationPath3stransformationPath2sresultsmessagesxmlFiles cacheFile2s cacheFile3s cacheFile1sxform1sxform2sxform3sfilessurl((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_04Ësl        c Csðtddƒ}|iidd|ƒtddƒ}|iidd|ƒti|iddd dƒ} ti|idd d dƒ} |i | i ƒƒ|i | i ƒƒt i|id ƒ}tiid d ƒ|_|iii} tiiddƒ}tiit|ƒ}||iid<| | |iiƒ}|i|iƒdƒ|iii} tiidd ƒ}tiit|ƒ}||iid<| | |iiƒ}|i|iƒdƒ||iid<|i| | |iiƒdƒ||iid<|i| | |iiƒdƒ|i | iƒƒ|i | iƒƒ|i ƒ|ii!d ƒ~t"}||iid<|i| | |iiƒdƒ||iid<|i| | |iiƒdƒ|i#| iƒƒ|i#| iƒƒdS(s3Ensure that removing cache manager causes no errorsstestfiles/simple.xslsrbs aTransformersstestfiles/simple.xmlsaSourcesids aXSLTMethod1sxslTransformerIds aXSLTMethod2scms testfilessTestsURLs Hello, worldN($sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFiles XSLTMethods addInstancesxform1sxform2s failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixsaSources aXSLTMethod1stransformationPath1sbasesurl1sappsREQUESTsresults assertEqualssstrips aXSLTMethod2stransformationPath2surl2sfindCacheManagers clearCaches _delObjectsNonesfailIf( sselfsxmlFilescmstransformationPath2surl2sxsltFilestransformationPath1surl1sresultsxform1sxform2((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_05sR   cCsÍtddƒ}|iidd|ƒtddƒ}|iidd|ƒ|iidƒ|id}ti |dd d dƒ} |iid ƒ|id }ti |dd d dƒ} |i | iƒƒ|i | iƒƒti |id ƒ}tiiddƒ|_tiiddd ƒ}tiit|ƒ} | |iid<|iiii} | | |iiƒ}tiidd d ƒ}tiit|ƒ}||iid<|iii i} | | |iiƒ}|i!||ƒ|i"ƒ} di|it$ddd fƒ} |i tii&| ƒƒ|i | | jƒdi|it$dd d fƒ}|i tii&|ƒƒ|i || jƒ|i(ƒ}|i*tii&| ƒƒ|i*tii&|ƒƒdS(sDEnsure two objects with same ID, in different folders, can be cachedstestfiles/simple.xslsrbs aTransformersstestfiles/simple.xmlsaSourcesfolder1sids aXSLTMethod1sxslTransformerIdsfolder2s aXSLTMethod2scms testfilessTestsURLs_N(+sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFilesmanage_addFoldersfolder1s XSLTMethods addInstancesxform1sfolder2sxform2s failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixstransformationPath1sbasesurl1sappsREQUESTsaSources aXSLTMethod1sresult1stransformationPath2surl2s aXSLTMethod2sresult2s assertEqualsslistCacheFilessfiless _folder_names cacheFile1sexistss cacheFile2s clearCachesmessagesfailIf(sselfsfolder2sfolder1scmsxsltFilestransformationPath1stransformationPath2smessagesxmlFilesurl1s cacheFile1sxform1sxform2sfilessurl2sresult2sresult1s cacheFile2((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_06TsT         !! c CsÁtddƒ}|iidd|ƒtddƒ}|iidd|ƒtddƒ}|iidd|ƒti|id d d dƒ}|i |i ƒƒt i|id ƒ}t iid dƒ|_|iii}t iidd ƒ}t iit|ƒ}||iid<|||iiƒ}|i|iƒdƒ|||iiƒ}|i|iƒdƒtidƒ|idƒ|||iiƒ}|i|iƒdƒ|iƒ}dS(sEEnsure that changing to a different transformer invalidates the cachestestfiles/simple.xslsrbstran1sstestfiles/alternate.xslstran2stestfiles/simple.xmlsaSourcesids aXSLTMethodsxslTransformerIdscms testfilessTestsURLs Hello, worldisHello, world and goodbyeN( sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFiles XSLTMethods addInstancesxforms failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixsaSources aXSLTMethodstransformationPathsbasesurlsappsREQUESTsresults assertEqualssstripstimessleeps editTransforms clearCachesmessage( sselfsxmlFilescmsurlsxsltFilestransformationPathsresultsmessagesxform((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_07s2   cCsKtddƒ}|iidd|ƒtddƒ}|iidd|ƒtddƒ}|iidd|ƒti|id d d dƒ}|i |i ƒƒt i|id ƒ}t iid dƒ|_|iii}t iiddƒ}t iit|ƒ}||iid<|||iiƒ}|i|iƒdƒ|||iiƒ}|i|iƒdƒ|i|i|iiƒdƒ|iii}t iiddƒ}t iit|ƒ}||iid<|i|i|iiƒdƒ|||iiƒ}|i|iƒdƒ|i|i|iiƒdƒ|iƒdS(sAEnsure that changing to a different XML doc invalidates the cachestestfiles/simple.xslsrbstransstestfiles/simple.xmlssrc1stestfiles/alternate.xmlssrc2sids aXSLTMethodsxslTransformerIdscms testfilessTestsURLs Hello, worldiisHello, yourselfN(sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFiles XSLTMethods addInstancesxforms failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixssrc1s aXSLTMethodstransformationPathsbasesurlsappsREQUESTsresults assertEqualssstripsisCacheFileUpToDatessrc2s clearCache(sselfsxmlFilescmsurlsxsltFilestransformationPathsresultsxform((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_08ºs< c Csstddƒ}|iidd|ƒtddƒ}|iidd|ƒ|id}ti|iddd dƒ}|i |i ƒƒt i|id ƒ}tiid d ƒ|_|iii}tiiddƒ}tiit|ƒ}||iid <|||iiƒ}|i|iƒdƒtidƒ|iddƒ|i|||iiƒdƒ|iƒdS(s<Ensure that editing the source XML doc invalidates the cachestestfiles/simple.xslsrbstransstestfiles/simple.xmlssrcsids aXSLTMethodsxslTransformerIdscms testfilessTestsURLs Hello, worldisOHello, zopesMy Titles Hello, zopeN(sopensxsltFilesselfsfoldersmanage_addDTMLMethodsxmlFilessrcs XSLTMethods addInstancesxforms failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixs aXSLTMethodstransformationPathsbasesurlsappsREQUESTsresults assertEqualssstripstimessleeps manage_edits clearCache( sselfssrcsxmlFilescmsurlsxsltFilestransformationPathsresultsxform((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_09ìs*   c CsŽtddƒ}|iidd|ƒ|id}tddƒ}|iidd|ƒti|iddd dƒ}|i |i ƒƒt i|id ƒ}tiid d ƒ|_|iii}tiiddƒ}tiit|ƒ}||iid <|||iiƒ}|i|iƒdƒtidƒtddƒ}|i|dƒ|||iiƒ}|i|iƒdƒ|iƒdS(s9Ensure that editing the transformer invalidates the cachestestfiles/simple.xslsrbstransstestfiles/simple.xmlssrcsids aXSLTMethodsxslTransformerIdscms testfilessTestsURLs Hello, worldistestfiles/alternate.xslsMy TitlesHello, world and goodbyeN( sopensxsltFilesselfsfoldersmanage_addDTMLMethodstransxmlFiles XSLTMethods addInstancesxforms failUnlesss isCachingOns CacheManagerscmsosspathsjoins cachePrefixssrcs aXSLTMethodstransformationPathsbasesurlsappsREQUESTsresults assertEqualssstripstimessleeps manage_edits clearCache( sselfsxmlFilescmsurlstransxsltFilestransformationPathsresultsxform((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_10s.   cCs€ti|idƒ}tiiddƒ|_t ddƒ}|ii dd|ƒt ddƒ}|ii d d|ƒt d dƒ}|ii d d|ƒt d dƒ}|ii d d|ƒt i|iddddƒt i|idddd ƒt i|idddd ƒd}|iididd|ƒ|id}|||iiƒ}|i|iƒdƒ|iƒ}dS(s Test XSLT Pipelines with cachingscms testfilessTeststestfiles/pipeline1.xslsrbsxslt1sstestfiles/pipeline2.xslsxslt2stestfiles/pipeline3.xslsxslt3stestfiles/simple.xmlsaSourcesidstran1sxslTransformerIdstran2stran3s@
Oh, crap
s PageTemplatessaZPTs Hello, worldN(s CacheManagers addInstancesselfsfolderscmsosspathsjoins cachePrefixsopensxsltFilesmanage_addDTMLMethodsxmlFiles XSLTMethodstextsmanage_addProductsmanage_addPageTemplatesaZPTsappsREQUESTsresults assertEqualssstrips clearCachesmessage(sselfsaZPTsxmlFilescmsxsltFilestextsresultsmessage((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pystest_113s0     (s__name__s __module__s__doc__s beforeSetUps afterSetUps beforeCloses afterClearstest_01stest_02stest_03stest_04stest_05stest_06stest_07stest_08stest_09stest_10stest_11(((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pysCacheManagerTestCase"s      " % B L = ; + 2 " %sUsing processor:s descriptionsis verbosityicCs*tiƒ}|ititƒƒ|SdS(N(sunittests TestSuitessuitesaddTests makeSuitesCacheManagerTestCase(ssuite((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pys test_suiteis (s__doc__s __cvstag__s__date__s __version__sosssysstimes__name__sexecfilespathsjoinsTestings ZopeTestCasesProducts.ZopeXMLMethodss CacheManagers XSLTMethodsProcessorChoosersinstallProductsTesting.ZopeTestCases _folder_names_standard_permissionssutilss startZServershostsportsbasesCacheManagerTestCasesdefaultProcessors frameworksunittests test_suite(s__date__s _folder_names ZopeTestCasesunittests CacheManagers_standard_permissionss XSLTMethodsProcessorChoosers __cvstag__shostsbasessysstimes test_suites __version__sossportsCacheManagerTestCase((sT/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/tests/TestCacheManager.pys? s*    $   ÿÿ<