Exemplo n.º 1
0
  @Test
  public void should_use_default_value_for_configuration() throws IOException {
    Configuration configuration =
        read(fixture("use_default_value_for_configuration.yml"), Configuration.class);

    HttpConfiguration http = configuration.getHttp();
    assertThat(http.getPort(), is(DEFAULT_PORT));
    assertThat(http.getHost().isPresent(), is(false));
    assertThat(http.getMinThread(), is(DEFAULT_MIN_THREAD));
    assertThat(http.getMaxThread(), is(DEFAULT_MAX_THREAD));
    assertThat(http.getAcceptorThreads(), is(DEFAULT_ACCEPTOR_THREADS));
    assertThat(http.getSelectorThreads(), is(DEFAULT_SELECTOR_THREADS));
    assertThat(http.getAcceptQueueSize(), is(DEFAULT_ACCEPT_QUEUE_SIZE));
    assertThat(http.getMaxIdleTime(), is(DEFAULT_MAX_IDLE_TIME));
    assertThat(http.getIdleTimeout(), is(DEFAULT_IDLE_TIMEOUT));
    assertThat(http.getSoLingerTime().isPresent(), is(false));

    assertThat(http.getSsl(), is(Optional.<SslConfiguration>absent()));

    LoggingConfiguration logging = configuration.getLogging();
    assertThat(logging.getLevel(), is(LogLevel.INFO));
    assertThat(logging.getLoggers().isEmpty(), is(true));
    assertThat(logging.getConsole().isPresent(), is(false));
    assertThat(logging.getFile().isPresent(), is(false));
  }
Exemplo n.º 2
0
 public void process(HttpRequest request, HttpContext context)
     throws HttpException, IOException {
   LoggingConfiguration configuration = curlConfiguration;
   if (configuration != null
       && configuration.isLoggable()
       && request instanceof HttpUriRequest) {
     configuration.println(toCurl((HttpUriRequest) request));
   }
 }