Changeset 1014
- Timestamp:
- 11/09/07 12:31:44 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/ipo/session/resourcemanager/stubSessionResourceManager.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/lang/exceptions/stubConfigurationException.php (added)
- trunk/src/test/php/net/stubbles/ipo/IPOTestSuite.php (modified) (3 diffs)
- trunk/src/test/php/net/stubbles/ipo/session/resourcemanager (added)
- trunk/src/test/php/net/stubbles/ipo/session/resourcemanager/stubSessionResourceManagerTestCase.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/session/resourcemanager/stubSessionResourceManager.php
r984 r1014 12 12 */ 13 13 stubClassLoader::load('net.stubbles.ipo.session.resourcemanager.stubSessionResource', 14 'net.stubbles.lang.exceptions.stubConfigurationException', 14 15 'net.stubbles.ioc.stubInjectionProvider'); 15 16 … … 108 109 109 110 $this->resources[$implementation] = $this->createResource($implementation); 111 $interfaceClazz = new stubReflectionClass($interface); 112 $shortInterfaceName = $interfaceClazz->getName(); 113 if (!$this->resources[$implementation] instanceof $shortInterfaceName) { 114 throw new stubConfigurationException("{$implementation} does not implement interface {$interface}."); 115 } 116 110 117 $this->session->putValue($sessionKey, $this->resources[$implementation]); 111 118 return $this->resources[$implementation]; … … 120 127 * @param string|stubReflectionClass $interface 121 128 * @return string 122 * @todo check, whether the interface exists and extends stubSession Resource123 129 */ 124 130 protected function getFullQualifiedInterfaceName($interface) { 125 131 if (is_string($interface) === true) { 132 $interfaceClazz = new stubReflectionClass($interface); 133 if ($interfaceClazz->isInterface() === false) { 134 throw new stubIllegalArgumentException($interfaceClazz->getFullQualifiedClassName() . ' is no interface.'); 135 } 136 if (!$interfaceClazz->isSubclassOf(new stubReflectionClass('stubSessionResource'))) { 137 throw new stubIllegalArgumentException($interfaceClazz->getFullQualifiedClassName() . ' is no session resource interface.'); 138 } 126 139 return $interface; 127 140 } 128 141 if ($interface instanceof stubReflectionClass) { 129 142 if ($interface->isInterface() === false) { 130 throw new stubIllegalArgumentException($interface->getFullQualifiedClassName . ' is no interface.'); 131 } 132 $interface = $interface->getFullQualifiedClassName(); 143 throw new stubIllegalArgumentException($interface->getFullQualifiedClassName() . ' is no interface.'); 144 } 145 if (!$interface->isSubclassOf(new stubReflectionClass('stubSessionResource'))) { 146 throw new stubIllegalArgumentException($interface->getFullQualifiedClassName() . ' is no session resource interface.'); 147 } 148 return $interface->getFullQualifiedClassName(); 133 149 } 134 150 throw new stubIllegalArgumentException('Neither string nor stubReflectionClass instance given.'); … … 155 171 protected function getImplementation($interface) { 156 172 if (isset($this->resourceDefinitions[$interface]) === false) { 157 throw new stub Exception('Resource ' . $interface . ' is not availabale.');173 throw new stubIllegalArgumentException('Resource ' . $interface . ' is not availabale.'); 158 174 } 159 175 return $this->resourceDefinitions[$interface]; … … 165 181 * @param string $implementation 166 182 * @return stubSessionResource 167 *168 * @todo check, whether the implementation actually implements the interface169 183 */ 170 184 protected function createResource($implementation) { trunk/src/test/php/net/stubbles/ipo/IPOTestSuite.php
r817 r1014 23 23 $this->TestSuite('All ipo tests'); 24 24 $this->addTestFile($dir . '/interceptors/stubInterceptorXJConfInitializerTestCase.php'); 25 25 26 26 $this->addTestFile($dir . '/request/stubAbstractRequestTestCase.php'); 27 27 $this->addTestFile($dir . '/request/stubRequestPrefixDecoratorTestCase.php'); 28 28 $this->addTestFile($dir . '/request/stubRequestValueErrorTestCase.php'); 29 29 30 30 $this->addTestFile($dir . '/request/broker/stubRequestBrokerTestCase.php'); 31 31 $this->addTestFile($dir . '/request/broker/annotations/stubAbstractFilterAnnotationTestCase.php'); … … 37 37 $this->addTestFile($dir . '/request/broker/annotations/stubStringFilterAnnotationTestCase.php'); 38 38 $this->addTestFile($dir . '/request/broker/annotations/stubTextFilterAnnotationTestCase.php'); 39 39 40 40 $this->addTestFile($dir . '/request/filters/stubFloatFilterTestCase.php'); 41 41 $this->addTestFile($dir . '/request/filters/stubHTTPURLFilterTestCase.php'); … … 47 47 $this->addTestFile($dir . '/request/filters/stubStringFilterTestCase.php'); 48 48 $this->addTestFile($dir . '/request/filters/stubTextFilterTestCase.php'); 49 49 50 50 $this->addTestFile($dir . '/response/stubCookieTestCase.php'); 51 51 $this->addTestFile($dir . '/response/stubDecoratedResponseTestCase.php'); 52 52 53 53 $this->addTestFile($dir . '/session/stubAbstractSessionTestCase.php'); 54 54 $this->addTestFile($dir . '/session/stubNoneDurableSessionTestCase.php'); 55 55 $this->addTestFile($dir . '/session/stubPHPSessionTestCase.php'); 56 $this->addTestFile($dir . '/session/resourcemanager/stubSessionResourceManagerTestCase.php'); 56 57 } 57 58 }
