Exemplo n.º 1
0
<?php

require_once __DIR__ . '/../src/blaze/lang/Reflectable.php';
require_once __DIR__ . '/../src/blaze/lang/Object.php';
require_once __DIR__ . '/../src/blaze/lang/ClassLoader.php';
spl_autoload_register('blaze\\lang\\ClassLoader::autoLoad');
\blaze\lang\ClassLoader::getSystemClassLoader();
define('TESTS_PATH', __DIR__);
define('SRC_PATH', realpath(__DIR__ . '/../src/'));
define('TMP_PATH', __DIR__ . '/tmp/');
/**
 * Loading the users Test-Configuration or Fallback to default TestConfiguration
 */
if (file_exists(__DIR__ . '/TestConfiguration.php')) {
    require_once __DIR__ . '/TestConfiguration.php';
} elseif (file_exists(__DIR__ . '/TestConfiguration.php.dist')) {
    require_once __DIR__ . '/TestConfiguration.php.dist';
} else {
    echo 'No Configuration File found';
    exit;
}
Exemplo n.º 2
0
 /**
  * Finds a resource with a given name.  The rules for searching resources
  * associated with a given class are implemented by the defining
  * {@linkplain ClassLoader class loader} of the class.  This method
  * delegates to this object's class loader.  If this object was loaded by
  * the bootstrap class loader, the method delegates to {@link
  * ClassLoader#getSystemResource}.
  *
  * <p> Before delegation, an absolute resource name is constructed from the
  * given resource name using this algorithm:
  *
  * <ul>
  *
  * <li> If the <tt>name</tt> begins with a <tt>'/'</tt>
  * (<tt>'&#92;u002f'</tt>), then the absolute name of the resource is the
  * portion of the <tt>name</tt> following the <tt>'/'</tt>.
  *
  * <li> Otherwise, the absolute name is of the following form:
  *
  * <blockquote><pre>
  *   <tt>modified_package_name</tt>/<tt>name</tt>
  * </pre></blockquote>
  *
  * <p> Where the <tt>modified_package_name</tt> is the package name of this
  * object with <tt>'/'</tt> substituted for <tt>'.'</tt>
  * (<tt>'&#92;u002e'</tt>).
  *
  * </ul>
  *
  * @param blaze\lang\String|string $name name of the desired resource
  * @return      A  {@link java.net.URL} object or <tt>null</tt> if no
  *              resource with this name is found
  * @since  JDK1.1
  */
 public function getResource($name)
 {
     if ($name instanceof String) {
         return ClassLoader::getSystemClassLoader()->getResource($name);
     } else {
         return ClassLoader::getSystemClassLoader()->getResource(new String($name));
     }
 }
Exemplo n.º 3
0
 private function initApplication()
 {
     if ($this->netletContext != null) {
         return;
     }
     $f = new File(ClassLoader::getSystemClassLoader()->getClassPath(), $this->package . File::$directorySeparator . 'web.xml');
     $doc = new \DOMDocument();
     $doc->load($f->getAbsolutePath());
     $this->config = $doc;
     $useDefault = true;
     foreach ($doc->documentElement->childNodes as $node) {
         if ($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'netletConfig') {
             $this->netletContext = new NetletContextImpl(self::getInitParams($node), $this);
             $useDefault = false;
             self::handleConfigChildren($node);
         }
     }
     if ($useDefault) {
         $this->netletContext = new NetletContextImpl($this->getInitParams(self::$defaultNetletConfig), $this);
         self::handleConfigChildren(self::$defaultNetletConfig);
     }
 }