Exemplo n.º 1
0
 /**
  * @param ConsoleLogger $logger
  * @param Config $config
  */
 public function logServerConfig(ConsoleLogger $logger, Config $config)
 {
     $logger->info("* config port       :" . $config->getPort());
     $logger->info("* config log_file   :" . $config->getLogFile());
     $logger->info("* config pid_file   :" . $config->getPidFile());
     $logger->info("* config classpaths :" . implode(',', $config->getClasspaths()));
     $logger->info("* config java_bin   :" . $config->getJavaBin());
     $logger->info("* config server_jar :" . $config->getServerJar());
 }
Exemplo n.º 2
0
 public function testReveal()
 {
     $app = new Application();
     $app->add($this->commandRepo->getRegisteredCommand('pjbserver:reveal'));
     $command = $app->find('pjbserver:reveal');
     $tester = new CommandTester($command);
     $port = $this->config->getPort();
     $tester->execute(['config-file' => PjbServerTestConfig::getBaseDir() . '/config/pjbserver.config.php.dist']);
     $this->assertEquals(1, $tester->getStatusCode());
     $this->assertRegexp("/java -cp(.*)JavaBridge.jar(.*)SERVLET:{$port}/", $tester->getDisplay());
 }
 /**
  * Return the content of the output_file.
  *
  * @throws Exception\RuntimeException
  *
  * @return string
  */
 public function getOutput()
 {
     $log_file = $this->config->getLogFile();
     if (!file_exists($log_file)) {
         $msg = "Server output log file does not exists '{$log_file}'";
         $this->logger->error("Get server output failed: {$msg}");
         throw new Exception\RuntimeException($msg);
     } elseif (!is_readable($log_file)) {
         $msg = "Cannot read log file do to missing read permission '{$log_file}'";
         $this->logger->error("Get server output failed: {$msg}");
         throw new Exception\RuntimeException($msg);
     }
     $output = file_get_contents($log_file);
     return $output;
 }
Exemplo n.º 4
0
 public function testThreadsDefault()
 {
     $config = PjbServerTestConfig::getStandaloneServerConfig()->getConfig();
     unset($config['threads']);
     $cfg = new Config($config);
     $this->assertEquals(50, $cfg->getThreads());
 }