Changeset 1647
- Timestamp:
- 06/23/08 23:34:06 (2 months ago)
- Files:
-
- trunk/projects/dist/config/json-rpc-service.ini (modified) (1 diff)
- trunk/projects/dist/config/xml/config.xml (modified) (1 diff)
- trunk/projects/examples/config/json-rpc-service.ini (modified) (1 diff)
- trunk/projects/examples/config/xml/config.xml (modified) (1 diff)
- trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcAbstractGenerateSubProcessor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateProxiesSubProcessor.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateSmdSubProcessor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGetSubProcessor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcPostSubProcessor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcSubProcessor.php (modified) (1 diff)
- trunk/src/main/php/org/stubbles/phing/tasks/stubGenerateJsonRpcProxiesTask.php (modified) (5 diffs)
- trunk/src/main/resources/phing/build-stubbles.xml (modified) (1 diff)
- trunk/src/test/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessorTestCase.php (modified) (6 diffs)
- trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcAbstractGenerateSubProcessorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateProxiesSubProcessorTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateSmdSubProcessorTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGetSubProcessorTestCase.php (modified) (10 diffs)
- trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcPostSubProcessorTestCase.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/dist/config/json-rpc-service.ini
r1361 r1647 1 [config] 2 namespace = "stubbles.json.proxy" 3 genjsdir = "javascript/genjs" 4 5 [classmap] 1 6 MathService = "org::stubbles::examples::service::MathService" 2 7 NameService = "org::stubbles::examples::service::RememberNameService" trunk/projects/dist/config/xml/config.xml
r1534 r1647 3 3 xmlns:xj="http://xjconf.net/XJConf" 4 4 xmlns="http://stubbles.net/lang/registry"> 5 <config name="net.stubbles.language" value="en_EN" /> 6 <config name="net.stubbles.number.decimals" value="4" /> 7 <config name="net.stubbles.util.log.class" value="net::stubbles::util::log::stubBaseLogData" /> 8 <config name="net.stubbles.ipo.request.class" value="net::stubbles::ipo::request::stubWebRequest" /> 9 <config name="net.stubbles.ipo.session.class" value="net::stubbles::ipo::session::stubPHPSession" /> 10 <config name="net.stubbles.service.jsonrpc.configfile" value="json-rpc-service.ini" /> 5 <config name="net.stubbles.language" value="en_EN"/> 6 <config name="net.stubbles.number.decimals" value="4"/> 7 <config name="net.stubbles.util.log.class" value="net::stubbles::util::log::stubBaseLogData"/> 8 <config name="net.stubbles.ipo.request.class" value="net::stubbles::ipo::request::stubWebRequest"/> 9 <config name="net.stubbles.ipo.session.class" value="net::stubbles::ipo::session::stubPHPSession"/> 11 10 </xj:configuration> trunk/projects/examples/config/json-rpc-service.ini
r1361 r1647 1 [config] 2 namespace = "stubbles.json.proxy" 3 genjsdir = "javascript/genjs" 4 5 [classmap] 1 6 MathService = "org::stubbles::examples::service::MathService" 2 7 NameService = "org::stubbles::examples::service::RememberNameService" trunk/projects/examples/config/xml/config.xml
r1534 r1647 3 3 xmlns:xj="http://xjconf.net/XJConf" 4 4 xmlns="http://stubbles.net/lang/registry"> 5 <config name="net.stubbles.mode" value="test" /> 6 <config name="net.stubbles.language" value="en_EN" /> 7 <config name="net.stubbles.number.decimals" value="4" /> 8 <config name="net.stubbles.util.log.class" value="net::stubbles::util::log::stubBaseLogData" /> 9 <config name="net.stubbles.ipo.request.class" value="net::stubbles::ipo::request::stubWebRequest" /> 10 <config name="net.stubbles.ipo.session.class" value="net::stubbles::ipo::session::stubPHPSession" /> 11 <config name="net.stubbles.service.jsonrpc.configfile" value="json-rpc-service.ini" /> 5 <config name="net.stubbles.language" value="en_EN"/> 6 <config name="net.stubbles.number.decimals" value="4"/> 7 <config name="net.stubbles.util.log.class" value="net::stubbles::util::log::stubBaseLogData"/> 8 <config name="net.stubbles.ipo.request.class" value="net::stubbles::ipo::request::stubWebRequest"/> 9 <config name="net.stubbles.ipo.session.class" value="net::stubbles::ipo::session::stubPHPSession"/> 12 10 </xj:configuration> trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php
r1544 r1647 22 22 { 23 23 /** 24 * registry key for the service config file25 */26 const KEY_SERVICE_FILE = 'net.stubbles.service.jsonrpc.configfile';27 /**28 24 * configuration file with list of client classes 29 25 * … … 37 33 protected function doConstruct() 38 34 { 39 $this->configFile = stubConfig::getConfigPath() . DIRECTORY_SEPARATOR . stubRegistry::getConfig(self::KEY_SERVICE_FILE, 'json-rpc-service.ini');35 $this->configFile = stubConfig::getConfigPath() . DIRECTORY_SEPARATOR . 'json-rpc-service.ini'; 40 36 } 41 37 … … 54 50 55 51 $subProcessor = new $nqClassName(); 56 $subProcessor->process($this->request, $this->session, $this->response, $this->loadClassMap()); 52 $config = $this->loadConfig(); 53 $subProcessor->process($this->request, $this->session, $this->response, $config['classmap'], $config['config']); 57 54 } 58 55 … … 63 60 * @throws stubFileNotFoundException 64 61 */ 65 protected function loadC lassMap()62 protected function loadConfig() 66 63 { 67 64 if (file_exists($this->configFile) === false || is_readable($this->configFile) === false) { … … 70 67 } 71 68 72 return parse_ini_file($this->configFile );69 return parse_ini_file($this->configFile, true); 73 70 } 74 71 trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcAbstractGenerateSubProcessor.php
r1547 r1647 21 21 abstract class stubJsonRpcAbstractGenerateSubProcessor extends stubBaseObject implements stubJsonRpcSubProcessor 22 22 { 23 /** 24 * default javascript namespace 25 * 26 * @var string 27 */ 28 protected $jsNamespace = 'stubbles.json.proxy'; 29 23 30 /** 24 31 * helper method to detect the service url trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateProxiesSubProcessor.php
r1547 r1647 23 23 { 24 24 /** 25 * default javascript namespace26 *27 * @var string28 */29 protected $jsNamespace = 'stubbles.json.proxy';30 31 /**32 25 * does the processing of the subtask 33 26 * … … 36 29 * @param stubResponse $response the current response 37 30 * @param array<string,array<string,string>> $classMap list of available webservice classes 31 * @param array<string,string> $config json-rpc config 38 32 */ 39 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap )33 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap, array $config) 40 34 { 35 if (isset($config['namespace']) === false) { 36 $config['namespace'] = $this->jsNamespace; 37 } 38 41 39 $classes = $request->getValidatedValue(new stubRegexValidator('/^[A-Za-z,0-9_\.]+$/'), '__generateProxy'); 42 40 if ('__all' !== $classes) { … … 44 42 } 45 43 46 $response->write($ this->jsNamespace. " = {};\n\n");44 $response->write($config['namespace'] . " = {};\n\n"); 47 45 $generator = $this->getProxyGenerator(); 48 46 foreach ($classMap as $jsClass => $fqClassName) { 49 47 if (is_array($classes) === false || in_array($jsClass, $classes) === true) { 50 48 try { 51 $response->write($generator->generateJavascriptProxy($fqClassName, $jsClass ));49 $response->write($generator->generateJavascriptProxy($fqClassName, $jsClass, $config['namespace'])); 52 50 } catch (Exception $e) { 53 51 $this->handleException($e, $response, 'Generation of proxy for ' . $fqClassName . ' failed.'); trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateSmdSubProcessor.php
r1547 r1647 26 26 * @param stubResponse $response the current response 27 27 * @param array<string,array<string,string>> $classMap list of available webservice classes 28 * @param array<string,string> $config json-rpc config 28 29 */ 29 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap )30 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap, array $config) 30 31 { 32 if (isset($config['namespace']) === false) { 33 $config['namespace'] = $this->jsNamespace; 34 } 35 31 36 $class = $request->getValidatedValue(new stubRegexValidator('/^[A-Za-z0-9_\.]+$/'), '__smd'); 32 37 $generator = $this->getSmdGenerator($this->getServiceURL($request) . '&__class=' . $class); 33 38 // get rid of namespace for class matching 34 $class = preg_replace('/ stubbles\.json\.proxy\./', '', $class);39 $class = preg_replace('/' . preg_quote($config['namespace']) . '\./', '', $class); 35 40 try { 36 41 $response->write($generator->generateSmd($classMap[$class], $class)); trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGetSubProcessor.php
r1547 r1647 47 47 * @param stubResponse $response the current response 48 48 * @param array<string,array<string,string>> $classMap list of available webservice classes 49 * @param array<string,string> $config json-rpc config 49 50 */ 50 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap )51 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap, array $config) 51 52 { 52 53 $requestId = $request->getValidatedValue(new stubRegexValidator(self::ID_PATTERN), 'id'); trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcPostSubProcessor.php
r1547 r1647 29 29 * @param stubResponse $response the current response 30 30 * @param array<string,array<string,string>> $classMap list of available webservice classes 31 * @param array<string,string> $config json-rpc config 31 32 */ 32 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap )33 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap, array $config) 33 34 { 34 35 $requestJsonObj = $request->getValidatedRawData(new stubPassThruValidator()); trunk/src/main/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcSubProcessor.php
r1434 r1647 26 26 * @param stubResponse $response the current response 27 27 * @param array<string,array<string,string>> $classMap list of available webservice classes 28 * @param array<string,string> $config json-rpc config 28 29 */ 29 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap );30 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap, array $config); 30 31 } 31 32 ?> trunk/src/main/php/org/stubbles/phing/tasks/stubGenerateJsonRpcProxiesTask.php
r1646 r1647 24 24 * Target folder of the generated proxy files 25 25 * 26 * @var string26 * @var string 27 27 */ 28 protected $targetFolder; 29 28 protected $docroot; 30 29 /** 31 30 * File containing the service definitions 32 31 * 33 * @var string32 * @var string 34 33 */ 35 34 protected $serviceFile; 36 37 35 /** 38 36 * Namespace for the generated javascript code 39 37 * 40 * @var string38 * @var string 41 39 */ 42 40 protected $javaScriptNamespace = 'stubbles.json.proxy'; 41 /** 42 * default target dir within docroot 43 * 44 * @var string 45 */ 46 protected $genJsDir = 'javascript/genjs'; 43 47 44 48 /** 45 49 * Set the target folder for the generated proxies 46 50 * 47 * @param string $targetFolder51 * @param string $docroot 48 52 */ 49 public function set TargetFolder($targetFolder)53 public function setDocroot($docroot) 50 54 { 51 $this-> targetFolder = $targetFolder;55 $this->docroot = $docroot; 52 56 } 53 57 … … 60 64 { 61 65 $this->serviceFile = $serviceFile; 62 }63 64 /**65 * Set the namespace for the generated javascript code66 * (keeping the gloabl js namespace clean)67 *68 * @param string $namespace69 */70 public function setJavaScriptNamespace($namespace)71 {72 $this->javaScriptNamespace = $namespace;73 66 } 74 67 … … 87 80 { 88 81 stubClassLoader::load('net::stubbles::service::jsonrpc::util::stubJsonRpcProxyGenerator'); 89 $services = parse_ini_file($this->serviceFile );82 $services = parse_ini_file($this->serviceFile, true); 90 83 $generator = new stubJsonRpcProxyGenerator(); 91 $fullJsCode = "{$this->javaScriptNamespace} = {};\n\n"; 92 foreach ($services as $class => $fqClassName) { 84 if (isset($services['config']['namespace']) === false) { 85 $services['config']['namespace'] = $this->javaScriptNamespace; 86 } 87 88 if (isset($services['config']['genjsdir']) === false) { 89 $services['config']['genjsdir'] = $this->genJsDir; 90 } 91 92 if (file_exists($this->docroot . '/' . $services['config']['genjsdir']) === false) { 93 mkdir($this->docroot . '/' . $services['config']['genjsdir'], null, true); 94 } 95 96 $fullJsCode = $services['config']['namespace'] . " = {};\n\n"; 97 foreach ($services['classmap'] as $class => $fqClassName) { 93 98 try { 94 $jsCode = $generator->generateJavascriptProxy($fqClassName, $class, $ this->javaScriptNamespace);99 $jsCode = $generator->generateJavascriptProxy($fqClassName, $class, $services['config']['namespace']); 95 100 } catch (stubClassNotFoundException $e) { 96 101 $this->log("Cannot generate proxy for {$fqClassName}, class does not exist.", Project::MSG_ERR); … … 98 103 } 99 104 100 $targetFile = $this-> targetFolder. '/' . $class . '.js';105 $targetFile = $this->docroot . '/' . $services['config']['genjsdir'] . '/' . $class . '.js'; 101 106 if (@file_put_contents($targetFile, $jsCode)) {; 102 107 $this->log("Wrote proxy for {$fqClassName} to {$targetFile}."); … … 113 118 } 114 119 115 $targetFile = $this-> targetFolder. '/allClients.js';120 $targetFile = $this->docroot . '/' . $services['config']['genjsdir'] . '/allClients.js'; 116 121 if (@file_put_contents($targetFile, $fullJsCode)) {; 117 122 $this->log("Wrote proxy for all classes to {$targetFile}."); trunk/src/main/resources/phing/build-stubbles.xml
r1646 r1647 187 187 <mkdir dir="${stubbles.projects.path}/${stubbles.project}/docroot/${jsonrpc.clients.dir}"/> 188 188 <stubGenerateJsonRpcProxies serviceFile="${stubbles.projects.path}/${stubbles.project}/config/json-rpc-service.ini" 189 targetFolder="${stubbles.projects.path}/${stubbles.project}/docroot/${jsonrpc.clients.dir}"/>189 docroot="${stubbles.projects.path}/${stubbles.project}/docroot"/> 190 190 </then> 191 191 <else> trunk/src/test/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessorTestCase.php
r1443 r1647 33 33 34 34 /** 35 * access to protected c lass maploading35 * access to protected config loading 36 36 * 37 37 * @return array<string,string> 38 38 */ 39 public function callLoadC lassMap()40 { 41 return $this->loadC lassMap();39 public function callLoadConfig() 40 { 41 return $this->loadConfig(); 42 42 } 43 43 … … 98 98 $subProcessorClass = get_class($this->getMock('stubJsonRpcSubProcessor')); 99 99 $jsonRpcProcessor = $this->getMock('stubJsonRpcProcessor', 100 array('loadC lassMap',100 array('loadConfig', 101 101 'getSubProcessorClassName' 102 102 ), … … 107 107 ); 108 108 $jsonRpcProcessor->expects($this->once())->method('getSubProcessorClassName')->will($this->returnValue($subProcessorClass)); 109 $jsonRpcProcessor->expects($this->once())->method('loadClassMap')->will($this->returnValue(array())); 109 $jsonRpcProcessor->expects($this->once()) 110 ->method('loadConfig') 111 ->will($this->returnValue(array('config' => array('namespace' => 'foo'), 112 'classmap' => array() 113 ) 114 ) 115 ); 110 116 $jsonRpcProcessor->process(); 111 117 } … … 130 136 ); 131 137 $jsonRpcProcessor->setConfigFile(vfsStream::url('config/doesNotExist.ini')); 132 $jsonRpcProcessor->callLoadC lassMap();133 } 134 135 /** 136 * loading the c lass map should return a list of classes137 * 138 * @test 139 */ 140 public function loadC lassMap()138 $jsonRpcProcessor->callLoadConfig(); 139 } 140 141 /** 142 * loading the config 143 * 144 * @test 145 */ 146 public function loadConfig() 141 147 { 142 148 if (class_exists('vfsStream', false) === false) { … … 146 152 vfsStreamWrapper::register(); 147 153 vfsStreamWrapper::setRoot(new vfsStreamDirectory('config')); 148 vfsStream::newFile('json-rpc-service.ini.ini')->at(vfsStreamWrapper::getRoot())->withContent(" MathService = \"org::stubbles::examples::service::MathService\"\nNameService = \"org::stubbles::examples::service::RememberNameService\"");154 vfsStream::newFile('json-rpc-service.ini.ini')->at(vfsStreamWrapper::getRoot())->withContent("[config]\nnamespace = \"stubbles.json.proxy\"\ngenjsdir = \"javascript/genjs\"\n[classmap]\nMathService = \"org::stubbles::examples::service::MathService\"\nNameService = \"org::stubbles::examples::service::RememberNameService\""); 149 155 $jsonRpcProcessor = new TeststubJsonRpcProcessor($this->mockRequest, 150 156 $this->mockSession, … … 152 158 ); 153 159 $jsonRpcProcessor->setConfigFile(vfsStream::url('config/json-rpc-service.ini.ini')); 154 $this->assertEquals(array('MathService' => 'org::stubbles::examples::service::MathService', 155 'NameService' => 'org::stubbles::examples::service::RememberNameService' 160 $this->assertEquals(array('config' => array('namespace' => 'stubbles.json.proxy', 161 'genjsdir' => 'javascript/genjs' 162 ), 163 'classmap' => array('MathService' => 'org::stubbles::examples::service::MathService', 164 'NameService' => 'org::stubbles::examples::service::RememberNameService' 165 ) 156 166 ), 157 $jsonRpcProcessor->callLoadC lassMap()167 $jsonRpcProcessor->callLoadConfig() 158 168 ); 159 169 } trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcAbstractGenerateSubProcessorTestCase.php
r1434 r1647 23 23 * @param stubResponse $response the current response 24 24 * @param array<string,array<string,string>> $classMap list of available webservice classes 25 * @param array<string,string> $config json-rpc config 25 26 */ 26 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap )27 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $classMap, array $config) 27 28 { 28 29 // intentionally empty trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateProxiesSubProcessorTestCase.php
r1434 r1647 91 91 $this->jsonRpcGenerateProxiesSubProcessor->expects($this->never()) 92 92 ->method('handleException'); 93 $this->jsonRpcGenerateProxiesSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap); 93 $this->jsonRpcGenerateProxiesSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap, array()); 94 } 95 96 /** 97 * retrieve service url 98 * 99 * @test 100 */ 101 public function successfulWithConfiguredNamespace() 102 { 103 $this->mockRequest->expects($this->once())->method('getValidatedValue')->will($this->returnValue('__all')); 104 $this->jsonRpcGenerateProxiesSubProcessor->expects($this->never())->method('getServiceURL'); 105 $this->mockProxyGenerator = $this->getMock('stubJsonRpcProxyGenerator'); 106 $this->mockProxyGenerator->expects($this->at(0)) 107 ->method('generateJavascriptProxy') 108 ->with($this->equalTo('TestService'), $this->equalTo('Test')) 109 ->will($this->returnValue('javascript proxy1')); 110 $this->mockProxyGenerator->expects($this->at(1)) 111 ->method('generateJavascriptProxy') 112 ->with($this->equalTo('DoesNotExist'), $this->equalTo('Nope')) 113 ->will($this->returnValue('javascript proxy2')); 114 $this->jsonRpcGenerateProxiesSubProcessor->expects($this->once()) 115 ->method('getProxyGenerator') 116 ->will($this->returnValue($this->mockProxyGenerator)); 117 $this->mockResponse->expects($this->at(0))->method('write')->with($this->equalTo("foo.bar = {};\n\n")); 118 $this->mockResponse->expects($this->at(1))->method('write')->with($this->equalTo('javascript proxy1')); 119 $this->mockResponse->expects($this->at(2))->method('write')->with($this->equalTo('javascript proxy2')); 120 $this->jsonRpcGenerateProxiesSubProcessor->expects($this->never()) 121 ->method('handleException'); 122 $this->jsonRpcGenerateProxiesSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap, array('namespace' => 'foo.bar')); 94 123 } 95 124 … … 115 144 ->method('handleException') 116 145 ->with($this->equalTo($exception, $this->mockResponse, 'Generation of proxy for TestService failed.')); 117 $this->jsonRpcGenerateProxiesSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap );146 $this->jsonRpcGenerateProxiesSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap, array()); 118 147 } 119 148 } trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGenerateSmdSubProcessorTestCase.php
r1434 r1647 89 89 $this->jsonRpcGenerateSmdSubProcessor->expects($this->never()) 90 90 ->method('handleException'); 91 $this->jsonRpcGenerateSmdSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap); 91 $this->jsonRpcGenerateSmdSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap, array()); 92 } 93 94 /** 95 * retrieve service url 96 * 97 * @test 98 */ 99 public function successfulWithConfiguredNamespace() 100 { 101 $this->mockRequest->expects($this->once())->method('getValidatedValue')->will($this->returnValue('foo.bar.Test')); 102 $this->jsonRpcGenerateSmdSubProcessor->expects($this->once()) 103 ->method('getServiceURL') 104 ->with($this->equalTo($this->mockRequest)) 105 ->will($this->returnValue('serviceUrl')); 106 $this->mockSmdGenerator = $this->getMock('stubSmdGenerator', array(), array('serviceUrl')); 107 $this->mockSmdGenerator->expects($this->once()) 108 ->method('generateSmd') 109 ->with($this->equalTo('TestService'), $this->equalTo('Test')) 110 ->will($this->returnValue('smdDescription')); 111 $this->jsonRpcGenerateSmdSubProcessor->expects($this->once()) 112 ->method('getSmdGenerator') 113 ->with($this->equalTo('serviceUrl&__class=foo.bar.Test')) 114 ->will($this->returnValue($this->mockSmdGenerator)); 115 $this->mockResponse->expects($this->once())->method('write')->with($this->equalTo('smdDescription')); 116 $this->jsonRpcGenerateSmdSubProcessor->expects($this->never()) 117 ->method('handleException'); 118 $this->jsonRpcGenerateSmdSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap, array('namespace' => 'foo.bar')); 92 119 } 93 120 … … 118 145 ->method('handleException') 119 146 ->with($this->equalTo($exception, $this->mockResponse, 'Generation of SMD for TestService failed.')); 120 $this->jsonRpcGenerateSmdSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap );147 $this->jsonRpcGenerateSmdSubProcessor->process($this->mockRequest, $this->mockSession, $this->mockResponse, $this->classMap, array()); 121 148 } 122 149 } trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcGetSubProcessorTestCase.php
r1434 r1647 84 84 $this->mockSession, 85 85 $this->mockResponse, 86 $this->classMap 86 $this->classMap, 87 array() 87 88 ); 88 89 } … … 100 101 $this->mockSession, 101 102 $this->mockResponse, 102 $this->classMap 103 $this->classMap, 104 array() 103 105 ); 104 106 } … … 116 118 $this->mockSession, 117 119 $this->mockResponse, 118 $this->classMap 120 $this->classMap, 121 array() 119 122 ); 120 123 } … … 132 135 $this->mockSession, 133 136 $this->mockResponse, 134 $this->classMap 137 $this->classMap, 138 array() 135 139 ); 136 140 } … … 148 152 $this->mockSession, 149 153 $this->mockResponse, 150 $this->classMap 154 $this->classMap, 155 array() 151 156 ); 152 157 } … … 164 169 $this->mockSession, 165 170 $this->mockResponse, 166 $this->classMap 171 $this->classMap, 172 array() 167 173 ); 168 174 } … … 180 186 $this->mockSession, 181 187 $this->mockResponse, 182 $this->classMap 188 $this->classMap, 189 array() 183 190 ); 184 191 } … … 196 203 $this->mockSession, 197 204 $this->mockResponse, 198 $this->classMap 205 $this->classMap, 206 array() 199 207 ); 200 208 } … … 212 220 $this->mockSession, 213 221 $this->mockResponse, 214 $this->classMap 222 $this->classMap, 223 array() 215 224 ); 216 225 } … … 229 238 $this->mockSession, 230 239 $this->mockResponse, 231 $this->classMap 240 $this->classMap, 241 array() 232 242 ); 233 243 } trunk/src/test/php/net/stubbles/service/jsonrpc/subprocessors/stubJsonRpcPostSubProcessorTestCase.php
r1434 r1647 84 84 $this->mockSession, 85 85 $this->mockResponse, 86 $this->classMap 86 $this->classMap, 87 array() 87 88 ); 88 89 } … … 100 101 $this->mockSession, 101 102 $this->mockResponse, 102 $this->classMap 103 $this->classMap, 104 array() 103 105 ); 104 106 } … … 116 118 $this->mockSession, 117 119 $this->mockResponse, 118 $this->classMap 120 $this->classMap, 121 array() 119 122 ); 120 123 } … … 132 135 $this->mockSession, 133 136 $this->mockResponse, 134 $this->classMap 137 $this->classMap, 138 array() 135 139 ); 136 140 } … … 148 152 $this->mockSession, 149 153 $this->mockResponse, 150 $this->classMap 154 $this->classMap, 155 array() 151 156 ); 152 157 } … … 164 169 $this->mockSession, 165 170 $this->mockResponse, 166 $this->classMap 171 $this->classMap, 172 array() 167 173 ); 168 174 } … … 180 186 $this->mockSession, 181 187 $this->mockResponse, 182 $this->classMap 188 $this->classMap, 189 array() 183 190 ); 184 191 } … … 196 203 &nb
