/**
  * Checks if the resource identifier will be initialized
  * propertly from the data of a passed URL.
  *
  * @return void
  */
 public function testPopulateFromUrl()
 {
     // populate the identifier with the data of the passed URL
     $this->resourceIdentifier->populateFromUrl(ResourceIdentifierTest::TEST_URL);
     // check the data from the resource identifier
     $this->assertSame($this->resourceIdentifier->getScheme(), 'php');
     $this->assertSame($this->resourceIdentifier->getUser(), 'user');
     $this->assertSame($this->resourceIdentifier->getPass(), 'password');
     $this->assertSame($this->resourceIdentifier->getHost(), '127.0.0.1');
     $this->assertSame($this->resourceIdentifier->getPort(), 9080);
     $this->assertSame($this->resourceIdentifier->getPath(), '/example/index.pc/TechDivision/Example/Services/UserProcessor');
     $this->assertSame($this->resourceIdentifier->getQuery(), 'SESSID=sadf8dafs879sdfsad');
     $this->assertSame($this->resourceIdentifier->getFilename(), '/example/index.pc');
     $this->assertSame($this->resourceIdentifier->getContextName(), 'example');
     $this->assertSame($this->resourceIdentifier->getPathInfo(), '/TechDivision/Example/Services/UserProcessor');
 }
 /**
  * Finally this method does the lookup for the passed resource identifier
  * using the also passed connection.
  *
  * @param \TechDivision\Naming\ResourceIdentifier             $resourceIdentifier The identifier for the requested bean
  * @param \TechDivision\PersistenceContainerClient\Connection $connection         The connection we use for loading the bean
  * @param string                                              $sessionId          The session-ID, necessary for lookup stateful session beans
  *
  * @return object The been proxy instance
  */
 protected function doLookup(ResourceIdentifier $resourceIdentifier, Connection $connection, $sessionId = null)
 {
     // initialize the session
     $session = $connection->createContextSession();
     // check if we've a HTTP session-ID
     if ($sessionId == null && $this->getServletRequest() && ($servletSession = $this->getServletRequest()->getSession())) {
         $sessionId = $servletSession->getId();
         // if yes, use it for connecting to the stateful session bean
     } elseif ($sessionId == null) {
         $sessionId = Uuid::uuid4()->__toString();
         // simulate a unique session-ID
     } else {
         // do nothing, because a session-ID has been passed
     }
     // set the HTTP session-ID
     $session->setSessionId($sessionId);
     // load the class name from the resource identifier => that is the path information
     $className = $resourceIdentifier->getClassName();
     // lookup and return the requested remote bean instance
     return $session->createInitialContext()->lookup($className);
 }