Changeset 737
- Timestamp:
- 06/19/07 14:44:52 (1 year ago)
- Files:
-
- trunk/config/xml/processors.xml (modified) (1 diff)
- trunk/examples/config/xml/interceptors-xml.xml (added)
- trunk/examples/config/xml/interceptors.xml (modified) (1 diff)
- trunk/examples/config/xml/processors.xml (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/interceptors/stubInterceptorInitializer.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/ipo/interceptors/stubInterceptorXJConfInitializer.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueErrorXJConfFactory.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/rdbms/stubDatabaseInitializer.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/log/stubLoggerXJConfFactory.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/stubRegistryXJConfInitializer.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/xjconf/stubXJConfInitializer.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/xjconf/stubXJConfProxy.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessor.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessorResolver.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubDefaultProcessorResolver.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubProcessor.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubProcessorResolver.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/processors/stubProcessorResolverXJConfFactory.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/processors/stubSimpleProcessorResolver.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/stubFrontController.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/websites/variantmanager/stubVariantXJConfFactory.php (modified) (1 diff)
- trunk/src/main/resources/xjconf/processors.xml (modified) (1 diff)
- trunk/src/test/php/net/stubbles/ipo/interceptors/stubInterceptorXJConfInitializerTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/rdbms/stubDatabaseInitializerTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/util/log/stubLoggerXJConfFactoryTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/util/stubRegistryXJConfInitializerTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/TeststubFrontController.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/processors/stubAbstractProcessorResolverTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/processors/stubDefaultProcessorResolverTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/processors/stubProcessorResolverXJConfFactoryTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php (modified) (6 diffs)
- trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantXJConfFactoryTestCase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config/xml/processors.xml
r447 r737 5 5 <defaultResolver default="xml"> 6 6 <pageFactory type="net.stubbles.websites.stubPageXJConfFactory" /> 7 <processor name="xml" type="net.stubbles.websites.xml.stubXMLProcessor" />8 <processor name="page" type="net.stubbles.websites.memphis.stubMemphisProcessor" />9 <processor name="jsonrpc" type="net.stubbles.websites.memphis.stubJsonRpcProcessor" />7 <processor name="xml" type="net.stubbles.websites.xml.stubXMLProcessor" interceptorDescriptor="interceptors" /> 8 <processor name="page" type="net.stubbles.websites.memphis.stubMemphisProcessor" interceptorDescriptor="interceptors" /> 9 <processor name="jsonrpc" type="net.stubbles.websites.memphis.stubJsonRpcProcessor" interceptorDescriptor="interceptors" /> 10 10 </defaultResolver> 11 11 </xj:configuration> trunk/examples/config/xml/interceptors.xml
r398 r737 3 3 xmlns:xj="http://xjconf.net/XJConf" 4 4 xmlns="http://stubbles.net/ipo/interceptors"> 5 <preInterceptors> 6 <preInterceptor type="net.stubbles.websites.xml.stubShowLastXMLInterceptor" /> 7 </preInterceptors> 8 <postInterceptors> 9 <postInterceptor type="net.stubbles.websites.xml.stubShowLastXMLInterceptor" /> 10 <postInterceptor type="net.stubbles.websites.xml.stubXMLPostInterceptor" /> 11 </postInterceptors> 5 <preInterceptors /> 6 <postInterceptors /> 12 7 </xj:configuration> trunk/examples/config/xml/processors.xml
r447 r737 5 5 <defaultResolver default="xml"> 6 6 <pageFactory type="net.stubbles.websites.stubPageXJConfFactory" /> 7 <processor name="xml" type="net.stubbles.websites.xml.stubXMLProcessor" />8 <processor name="page" type="net.stubbles.websites.memphis.stubMemphisProcessor" />9 <processor name="jsonrpc" type="net.stubbles.websites.memphis.stubJsonRpcProcessor" />7 <processor name="xml" type="net.stubbles.websites.xml.stubXMLProcessor" interceptorDescriptor="interceptors-xml" /> 8 <processor name="page" type="net.stubbles.websites.memphis.stubMemphisProcessor" interceptorDescriptor="interceptors" /> 9 <processor name="jsonrpc" type="net.stubbles.websites.memphis.stubJsonRpcProcessor" interceptorDescriptor="interceptors" /> 10 10 </defaultResolver> 11 11 </xj:configuration> trunk/src/main/php/net/stubbles/ipo/interceptors/stubInterceptorInitializer.php
r398 r737 24 24 */ 25 25 public function init(); 26 26 27 /** 28 * sets the descriptor that identifies the initializer 29 * 30 * @param string $descriptor 31 */ 32 public function setDescriptor($descriptor); 33 27 34 /** 28 35 * returns the list of pre interceptors … … 31 38 */ 32 39 public function getPreInterceptors(); 33 40 34 41 /** 35 42 * returns the list of post interceptors trunk/src/main/php/net/stubbles/ipo/interceptors/stubInterceptorXJConfInitializer.php
r715 r737 8 8 */ 9 9 stubClassLoader::load('net.stubbles.ipo.interceptors.stubInterceptorInitializer', 10 'net.stubbles.util.xjconf.xjconf' 10 'net.stubbles.util.xjconf.xjconf', 11 'net.stubbles.util.exceptions.stubIllegalArgumentException' 11 12 ); 12 13 /** … … 19 20 { 20 21 /** 22 * descriptor that identifies the initializer 23 * 24 * @var string 25 */ 26 protected $descriptor = 'interceptors'; 27 /** 21 28 * list of pre interceptors 22 29 * … … 32 39 33 40 /** 34 * returns the descriptor that identifies this initializer 35 * 41 * sets the descriptor that identifies this initializer 42 * 43 * @param string $descriptor 44 */ 45 public function setDescriptor($descriptor) 46 { 47 $this->descriptor = $descriptor; 48 } 49 50 /** 51 * returns the descriptor that identifies the initializer 52 * 53 * @param string $type type of descriptor: config or definition 36 54 * @return string 37 */ 38 public function getDescriptor() 39 { 40 return 'interceptors'; 55 * @throws stubIllegalArgumentException 56 */ 57 public function getDescriptor($type) 58 { 59 switch ($type) { 60 case stubXJConfInitializer::DESCRIPTOR_CONFIG: 61 return $this->descriptor; 62 63 case stubXJConfInitializer::DESCRIPTOR_DEFINITION: 64 return 'interceptors'; 65 } 66 67 throw new stubIllegalArgumentException('Invalid descriptor type.'); 41 68 } 42 69 trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueErrorXJConfFactory.php
r585 r737 48 48 49 49 /** 50 * returns the descriptor that identifies th isinitializer50 * returns the descriptor that identifies the initializer 51 51 * 52 * @param string $type type of descriptor: config or definition 52 53 * @return string 53 54 */ 54 public function getDescriptor( )55 public function getDescriptor($type) 55 56 { 56 57 return 'request'; trunk/src/main/php/net/stubbles/rdbms/stubDatabaseInitializer.php
r584 r737 20 20 { 21 21 /** 22 * returns the descriptor that identifies th isinitializer22 * returns the descriptor that identifies the initializer 23 23 * 24 * @param string $type type of descriptor: config or definition 24 25 * @return string 25 26 */ 26 public function getDescriptor( )27 public function getDescriptor($type) 27 28 { 28 29 return 'rdbms'; trunk/src/main/php/net/stubbles/util/log/stubLoggerXJConfFactory.php
r584 r737 21 21 { 22 22 /** 23 * returns the descriptor that identifies th isinitializer23 * returns the descriptor that identifies the initializer 24 24 * 25 * @param string $type type of descriptor: config or definition 25 26 * @return string 26 27 */ 27 public function getDescriptor( )28 public function getDescriptor($type) 28 29 { 29 30 return 'logging'; trunk/src/main/php/net/stubbles/util/stubRegistryXJConfInitializer.php
r679 r737 37 37 38 38 /** 39 * returns the descriptor that identifies th isinitializer39 * returns the descriptor that identifies the initializer 40 40 * 41 * @param string $type type of descriptor: config or definition 41 42 * @return string 43 * @throws stubIllegalArgumentException 42 44 */ 43 public function getDescriptor( )45 public function getDescriptor($type) 44 46 { 45 return $this->source; 47 switch ($type) { 48 case stubXJConfInitializer::DESCRIPTOR_CONFIG: 49 return $this->source; 50 51 case stubXJConfInitializer::DESCRIPTOR_DEFINITION: 52 return 'config'; 53 } 54 55 throw new stubIllegalArgumentException('Invalid descriptor type.'); 46 56 } 47 57 trunk/src/main/php/net/stubbles/util/xjconf/stubXJConfInitializer.php
r584 r737 18 18 { 19 19 /** 20 * descriptor type: config 21 */ 22 const DESCRIPTOR_CONFIG = 'config'; 23 /** 24 * descriptor type: definition 25 */ 26 const DESCRIPTOR_DEFINITION = 'definition'; 27 28 /** 20 29 * returns the descriptor that identifies this initializer 21 30 * 31 * @param string $type type of descriptor: config or definition 22 32 * @return string 33 * @throws stubIllegalArgumentException 23 34 */ 24 public function getDescriptor( );35 public function getDescriptor($type); 25 36 26 37 /** trunk/src/main/php/net/stubbles/util/xjconf/stubXJConfProxy.php
r584 r737 53 53 } 54 54 55 $this->configFile = $configPath . '/' . $this->initializer->getDescriptor( ) . '.xml';56 $this->cacheFile = $cachePath . '/' . $this->initializer->getDescriptor( ) . '.cache';55 $this->configFile = $configPath . '/' . $this->initializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG) . '.xml'; 56 $this->cacheFile = $cachePath . '/' . $this->initializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG) . '.cache'; 57 57 } 58 58 … … 86 86 stubClassLoader::load('net.stubbles.util.xjconf.xjconfReal'); 87 87 $xjconf = new stubXJConfFacade(new XJConfFacade(array('__default' => stubXJConfLoader::getInstance()))); 88 $xjconf->addDefinitions(stubFactory::getResourceURIs('xjconf/' . $this->initializer->getDescriptor( ) . '.xml'));88 $xjconf->addDefinitions(stubFactory::getResourceURIs('xjconf/' . $this->initializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION) . '.xml')); 89 89 $xjconf->enableXIncludes(); 90 90 foreach ($this->initializer->getExtensions() as $extension) { trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessor.php
r369 r737 42 42 */ 43 43 protected $pageFactory; 44 /** 45 * the interceptor descriptor 46 * 47 * @var string 48 */ 49 protected $interceptorDescriptor = 'interceptors'; 44 50 45 51 /** … … 58 64 $this->pageFactory = $pageFactory; 59 65 } 60 66 67 /** 68 * sets the interceptor descriptor 69 * 70 * @param string $interceptorDescriptor 71 */ 72 public function setInterceptorDescriptor($interceptorDescriptor) 73 { 74 $this->interceptorDescriptor = $interceptorDescriptor; 75 } 76 77 /** 78 * returns the interceptor descriptor 79 * 80 * @return string 81 */ 82 public function getInterceptorDescriptor() 83 { 84 return $this->interceptorDescriptor; 85 } 86 61 87 /** 62 88 * processes the request … … 69 95 return $this; 70 96 } 71 97 72 98 /** 73 99 * does the real processing … … 84 110 return $this->response; 85 111 } 86 112 87 113 /** 88 114 * retrieves the page name trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessorResolver.php
r560 r737 32 32 $this->pageFactory = $pageFactory; 33 33 } 34 34 35 35 /** 36 36 * returns the page factory delivered within the constructor … … 66 66 } 67 67 68 $this->configureInterceptorDescriptor($processor); 68 69 return $processor; 69 70 } 70 71 71 72 /** 72 73 * does the real resolving work … … 79 80 */ 80 81 protected abstract function doResolve(stubRequest $request, stubSession $session, stubResponse $response); 81 82 83 /** 84 * configures the processor with the interceptor descriptor 85 * 86 * @param stubProcessor $processor 87 */ 88 protected abstract function configureInterceptorDescriptor(stubProcessor $processor); 89 82 90 /** 83 91 * ensure that all instances of stubSerializable are correctly serialized trunk/src/main/php/net/stubbles/websites/processors/stubDefaultProcessorResolver.php
r557 r737 24 24 * @var string 25 25 */ 26 protected $defaultProcessor = null;26 protected $defaultProcessor = null; 27 27 /** 28 28 * list of processors … … 30 30 * @var array<string,string> 31 31 */ 32 protected $processors = array(); 32 protected $processors = array(); 33 /** 34 * list of interceptor descriptors 35 * 36 * @var array<string,string> 37 */ 38 protected $interceptorDescriptors = array(); 33 39 34 40 /** 35 41 * adds a processor to the list of available processors 36 42 * 37 * @param string $paramValue value of the request parameter that identifies this processor 38 * @param string $fqClassName full qualified class name of the processor 43 * @param string $paramValue value of the request parameter that identifies this processor 44 * @param string $fqClassName full qualified class name of the processor 45 * @param string $interceptorDescriptor the interceptor descriptor 39 46 */ 40 public function addProcessor($paramValue, $fqClassName )47 public function addProcessor($paramValue, $fqClassName, $interceptorDescriptor) 41 48 { 42 $this->processors[$paramValue] = $fqClassName; 49 $this->processors[$paramValue] = $fqClassName; 50 $this->interceptorDescriptors[$fqClassName] = $interceptorDescriptor; 43 51 } 44 52 … … 80 88 return $this->processors[$paramValue]; 81 89 } 90 91 /** 92 * configures the processor with the interceptor descriptor 93 * 94 * @param stubProcessor $processor 95 */ 96 protected function configureInterceptorDescriptor(stubProcessor $processor) 97 { 98 if (isset($this->interceptorDescriptors[$processor->getClassName()]) == true && strlen($this->interceptorDescriptors[$processor->getClassName()]) > 0) { 99 $processor->setInterceptorDescriptor($this->interceptorDescriptors[$processor->getClassName()]); 100 } 101 } 82 102 } 83 103 ?> trunk/src/main/php/net/stubbles/websites/processors/stubProcessor.php
r315 r737 18 18 * @subpackage websites_processors 19 19 */ 20 interface stubProcessor 20 interface stubProcessor extends stubObject 21 21 { 22 22 /** … … 29 29 */ 30 30 #public function __construct(stubRequest $request, stubSession $session, , stubResponse $response, stubPageFactory $pageFactory); 31 32 /** 33 * sets the interceptor descriptor 34 * 35 * @param string $interceptorDescriptor 36 */ 37 public function setInterceptorDescriptor($interceptorDescriptor); 38 39 /** 40 * returns the interceptor descriptor 41 * 42 * @return string 43 */ 44 public function getInterceptorDescriptor(); 31 45 32 46 /** trunk/src/main/php/net/stubbles/websites/processors/stubProcessorResolver.php
r557 r737 17 17 * Interface for processor resolvers. 18 18 * 19 * @static20 19 * @package stubbles 21 20 * @subpackage websites_processors trunk/src/main/php/net/stubbles/websites/processors/stubProcessorResolverXJConfFactory.php
r584 r737 26 26 27 27 /** 28 * returns the descriptor that identifies th isinitializer28 * returns the descriptor that identifies the initializer 29 29 * 30 * @param string $type type of descriptor: config or definition 30 31 * @return string 31 32 */ 32 public function getDescriptor( )33 public function getDescriptor($type) 33 34 { 34 35 return 'processors'; trunk/src/main/php/net/stubbles/websites/processors/stubSimpleProcessorResolver.php
r557 r737 45 45 return $this->processor; 46 46 } 47 48 /** 49 * configures the processor with the interceptor descriptor 50 * 51 * @param stubProcessor $processor 52 */ 53 protected function configureInterceptorDescriptor(stubProcessor $processor) 54 { 55 $processor->setInterceptorDescriptor('interceptors'); 56 } 47 57 } 48 58 ?> trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r567 r737 30 30 const SESSION_EVENT_NAME = 'onSessionCreated'; 31 31 /** 32 * list of interceptors to call at startup32 * initializer for the interceptors 33 33 * 34 * @var array<stubPreInterceptor>34 * @var stubInterceptorInitializer 35 35 */ 36 protected $preInterceptors = array(); 37 /** 38 * list of interceptors to call at teardown 39 * 40 * @var array<stubPostInterceptor> 41 */ 42 protected $postInterceptors = array(); 36 protected $interceptorInitializer = array(); 43 37 /** 44 38 * the resolver to use for getting the correct processor … … 83 77 { 84 78 $registryInitializer->init(); 85 $interceptorInitializer->init(); 86 $this->preInterceptors = $interceptorInitializer->getPreInterceptors(); 87 $this->postInterceptors = $interceptorInitializer->getPostInterceptors(); 79 $this->interceptorInitializer = $interceptorInitializer; 88 80 $processorResolverFactory->init(); 89 81 $this->resolver = $processorResolverFactory->getResolver(); … … 141 133 public function process() 142 134 { 143 foreach ($this->preInterceptors as $preInterceptor) { 135 $processor = $this->resolver->resolve($this->request, $this->session, $this->response); 136 $this->interceptorInitializer->setDescriptor($processor->getInterceptorDescriptor()); 137 $this->interceptorInitializer->init(); 138 foreach ($this->interceptorInitializer->getPreInterceptors() as $preInterceptor) { 144 139 $preInterceptor->preProcess($this->request, $this->session, $this->response); 145 140 if ($this->request->isCancelled() == true) { … … 149 144 } 150 145 151 $this->response = $ this->resolver->resolve($this->request, $this->session, $this->response)->process()->getResponse();146 $this->response = $processor->process()->getResponse(); 152 147 if ($this->request->isCancelled() == false) { 153 foreach ($this-> postInterceptorsas $postInterceptor) {148 foreach ($this->interceptorInitializer->getPostInterceptors() as $postInterceptor) { 154 149 $postInterceptor->postProcess($this->request, $this->session, $this->response); 155 150 if ($this->request->isCancelled() == true) { trunk/src/main/php/net/stubbles/websites/variantmanager/stubVariantXJConfFactory.php
r584 r737 35 35 36 36 /** 37 * returns the descriptor that identifies th isinitializer37 * returns the descriptor that identifies the initializer 38 38 * 39 * @param string $type type of descriptor: config or definition 39 40 * @return string 40 41 */ 41 public function getDescriptor( )42 public function getDescriptor($type) 42 43 { 43 44 return 'variantmanager'; trunk/src/main/resources/xjconf/processors.xml
r335 r737 7 7 <attribute name="name" type="string" /> 8 8 <attribute name="type" type="string" /> 9 <attribute name="interceptorDescriptor" type="string" /> 9 10 </methodCallTag> 10 11 </tag> 11 12 <tag name="simpleResolver" type="net.stubbles.websites.processors.stubSimpleProcessorResolver" key="resolver"> 12 13 <attribute name="processor" type="string" /> 14 <attribute name="interceptorDescriptor" type="string" /> 13 15 </tag> 14 16 <abstractTag name="pageFactory" abstractType="net.stubbles.websites.stubPageFactory" concreteTypeAttribute="type" /> trunk/src/test/php/net/stubbles/ipo/interceptors/stubInterceptorXJConfInitializerTestCase.php
r547 r737 71 71 public function testDescriptor() 72 72 { 73 $this->assertEqual($this->interceptorXJConfInitializer->getDescriptor(), 'interceptors'); 73 $this->assertEqual($this->interceptorXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'interceptors'); 74 $this->assertEqual($this->interceptorXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'interceptors'); 75 $this->interceptorXJConfInitializer->setDescriptor('foo'); 76 $this->assertEqual($this->interceptorXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'foo'); 77 $this->assertEqual($this->interceptorXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'interceptors'); 78 $this->expectException('stubIllegalArgumentException'); 79 $this->interceptorXJConfInitializer->getDescriptor('bar'); 74 80 } 75 81 trunk/src/test/php/net/stubbles/rdbms/stubDatabaseInitializerTestCase.php
r538 r737 57 57 public function testDescriptor() 58 58 { 59 $this->assertEqual($this->dbXJConfInitializer->getDescriptor(), 'rdbms'); 59 $this->assertEqual($this->dbXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'rdbms'); 60 $this->assertEqual($this->dbXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'rdbms'); 60 61 } 61 62 trunk/src/test/php/net/stubbles/util/log/stubLoggerXJConfFactoryTestCase.php
r562 r737 59 59 public function testDescriptor() 60 60 { 61 $this->assertEqual($this->loggerXJConfFactory->getDescriptor(), 'logging'); 61 $this->assertEqual($this->loggerXJConfFactory->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'logging'); 62 $this->assertEqual($this->loggerXJConfFactory->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'logging'); 62 63 } 63 64 trunk/src/test/php/net/stubbles/util/stubRegistryXJConfInitializerTestCase.php
r679 r737 46 46 public function testDescriptor() 47 47 { 48 $this->assertEqual($this->registryXJConfInitializer->getDescriptor(), 'config'); 48 $this->assertEqual($this->registryXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'config'); 49 $this->assertEqual($this->registryXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'config'); 49 50 $this->registryXJConfInitializer->setConfigSource('test'); 50 $this->assertEqual($this->registryXJConfInitializer->getDescriptor(), 'test'); 51 $this->assertEqual($this->registryXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'test'); 52 $this->assertEqual($this->registryXJConfInitializer->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'config'); 53 $this->expectException('stubIllegalArgumentException'); 54 $this->registryXJConfInitializer->getDescriptor('bar'); 51 55 } 52 56 trunk/src/test/php/net/stubbles/websites/TeststubFrontController.php
r473 r737 15 15 class TeststubFrontController extends stubFrontController 16 16 { 17 public function setPreInterceptors(array $preInterceptors)18 {19 $this->preInterceptors = $preInterceptors;20 }21 22 public function setPostInterceptors(array $postInterceptors)23 {24 $this->postInterceptors = $postInterceptors;25 }26 27 17 public function setRequest(stubRequest $request) 28 18 { trunk/src/test/php/net/stubbles/websites/processors/stubAbstractProcessorResolverTestCase.php
r560 r737 13 13 Mock::generate('stubResponse'); 14 14 Mock::generate('stubSession'); 15 Mock::generatePartial('stubAbstractProcessorResolver', 'PartialMockstubAbstractProcessorResolver', array('doResolve' ));15 Mock::generatePartial('stubAbstractProcessorResolver', 'PartialMockstubAbstractProcessorResolver', array('doResolve', 'configureInterceptorDescriptor')); 16 16 /** 17 17 * Tests for net.stubbles.websites.processors.stubAbstractProcessorResolver trunk/src/test/php/net/stubbles/websites/processors/stubDefaultProcessorResolverTestCase.php
r559 r737 68 68 protected function addProcessors() 69 69 { 70 $this->defaultProcessorResolver->addProcessor('foo', '_test.FooProcessor' );71 $this->defaultProcessorResolver->addProcessor('bar', '_test.BarProcessor' );72 $this->defaultProcessorResolver->addProcessor('baz', '_test.BazProcessor' );70 $this->defaultProcessorResolver->addProcessor('foo', '_test.FooProcessor', 'interceptors-foo'); 71 $this->defaultProcessorResolver->addProcessor('bar', '_test.BarProcessor', 'interceptors-bar'); 72 $this->defaultProcessorResolver->addProcessor('baz', '_test.BazProcessor', 'interceptors-baz'); 73 73 $this->defaultProcessorResolver->setDefaultProcessor('foo'); 74 74 } trunk/src/test/php/net/stubbles/websites/processors/stubProcessorResolverXJConfFactoryTestCase.php
r561 r737 38 38 public function testDescriptor() 39 39 { 40 $this->assertEqual($this->processorResolverXJConfFactory->getDescriptor(), 'processors'); 40 $this->assertEqual($this->processorResolverXJConfFactory->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'processors'); 41 $this->assertEqual($this->processorResolverXJConfFactory->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'processors'); 41 42 } 42 43 trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php
r580 r737 33 33 */ 34 34 protected $frontController; 35 /** 36 * mocked interceptor initializer 37 * 38 * @var SimpleMock 39 */ 40 protected $mockInterceptorInitializer; 35 41 /** 36 42 * access to request … … 78 84 $this->mockProcessorResolver = new MockstubProcessorResolver(); 79 85 $mockProcessorResolverFactory->setReturnValue('getResolver', $this->mockProcessorResolver); 80 $mockInterceptorInitializer = new MockstubInterceptorInitializer(); 81 $mockInterceptorInitializer->setReturnValue('getPreInterceptors', array()); 82 $mockInterceptorInitializer->setReturnValue('getPostInterceptors', array()); 83 $this->frontController = new TeststubFrontController(new MockstubRegistryInitializer(), $mockInterceptorInitializer, $mockProcessorResolverFactory); 86 $this->mockInterceptorInitializer = new MockstubInterceptorInitializer(); 87 $this->frontController = new TeststubFrontController(new MockstubRegistryInitializer(), $this->mockInterceptorInitializer, $mockProcessorResolverFactory); 84 88 $this->mockRequest = new MockstubRequest(); 85 89 $this->frontController->setRequest($this->mockRequest); … … 104 108 $preInterceptor2 = new MockstubPreInterceptor(); 105 109 $preInterceptor2->expectNever('preProcess'); 106 $this->frontController->setPreInterceptors(array($preInterceptor1, $preInterceptor2)); 110 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array($preInterceptor1, $preInterceptor2)); 111 $this->mockInterceptorInitializer->expectNever('getPostInterceptors'); 107 112 $this->mockRequest->expectOnce('isCancelled'); 108 113 $this->mockRequest->setReturnValue('isCancelled', true); 109 114 $this->mockResponse->expectOnce('send'); 110 $this->mockProcessorResolver->expectNever('resolve'); 115 $this->mockProcessorResolver->expectOnce('resolve'); 116 $this->mockProcessor->expectOnce('getInterceptorDescriptor'); 117 $this->mockProcessor->setReturnValue('getInterceptorDescriptor', 'interceptors'); 118 $this->mockProcessor->expectNever('process'); 111 119 $this->frontController->process(); 112 120 } … … 121 129 $postInterceptor2 = new MockstubPostInterceptor(); 122 130 $postInterceptor2->expectNever('postProcess'); 123 $this->frontController->setPostInterceptors(array($postInterceptor1, $postInterceptor2)); 131 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array()); 132 $this->mockInterceptorInitializer->setReturnValue('getPostInterceptors', array($postInterceptor1, $postInterceptor2)); 124 133 $this->mockRequest->expectOnce('isCancelled'); 125 134 $this->mockRequest->setReturnValue('isCancelled', true); … … 138 147 $postInterceptor2 = new MockstubPostInterceptor(); 139 148 $postInterceptor2->expectNever('postProcess'); 140 $this->frontController->setPostInterceptors(array($postInterceptor1, $postInterceptor2)); 149 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array()); 150 $this->mockInterceptorInitializer->setReturnValue('getPostInterceptors', array($postInterceptor1, $postInterceptor2)); 141 151 $this->mockRequest->expectCallcount('isCancelled', 2); 142 152 $this->mockRequest->setReturnValueAt(0, 'isCancelled', false); … … 156 166 $preInterceptor2 = new MockstubPreInterceptor(); 157 167 $preInterceptor2->expectOnce('preProcess'); 158 $this-> frontController->setPreInterceptors(array($preInterceptor1, $preInterceptor2));168 $this->mockInterceptorInitializer->setReturnValue('getPreInterceptors', array($preInterceptor1, $preInterceptor2)); 159 169 $postInterceptor1 = new MockstubPostInterceptor(); 160 170 $postInterceptor1->expectOnce('postProcess'); 161 171 $postInterceptor2 = new MockstubPostInterceptor(); 162 172 $postInterceptor2->expectOnce('postProcess'); 163 $this-> frontController->setPostInterceptors(array($postInterceptor1, $postInterceptor2));173 $this->mockInterceptorInitializer->setReturnValue('getPostInterceptors', array($postInterceptor1, $postInterceptor2)); 164 174 $this->mockRequest->setReturnValue('isCancelled', false); 165 175 $this->mockResponse2->expectOnce('send'); trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantXJConfFactoryTestCase.php
r551 r737 66 66 public function testDescriptor() 67 67 { 68 $this->assertEqual($this->variantXJConfFactory->getDescriptor(), 'variantmanager'); 68 $this->assertEqual($this->variantXJConfFactory->getDescriptor(stubXJConfInitializer::DESCRIPTOR_CONFIG), 'variantmanager'); 69 $this->assertEqual($this->variantXJConfFactory->getDescriptor(stubXJConfInitializer::DESCRIPTOR_DEFINITION), 'variantmanager'); 69 70 } 70 71
