Search in sources :

Example 11 with LogConfiguration

use of com.dtflys.forest.logging.LogConfiguration in project forest by dromara.

the class Test1 method testClient1.

@Test
public void testClient1() {
    StopWatch sw = new StopWatch();
    sw.start();
    ForestResponse response = baiduClient.testTimeout("xxx");
    sw.stop();
    assertNotNull(response);
    ForestRequest request = response.getRequest();
    int reqTimeout = request.getTimeout();
    assertEquals(50, reqTimeout);
    long time = sw.getTotalTimeMillis();
    assertTrue(time >= 50);
    assertTrue(time <= 3600);
    LogConfiguration logConfiguration = request.getLogConfiguration();
    assertTrue(logConfiguration.isLogEnabled());
    assertTrue(logConfiguration.isLogRequest());
// assertTrue(logConfiguration.isLogResponseStatus());
// assertTrue(!logConfiguration.isLogResponseContent());
// assertTrue(logConfiguration.getLogHandler() instanceof TestLogHandler);
}
Also used : ForestResponse(com.dtflys.forest.http.ForestResponse) ForestRequest(com.dtflys.forest.http.ForestRequest) LogConfiguration(com.dtflys.forest.logging.LogConfiguration) StopWatch(org.springframework.util.StopWatch) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

LogConfiguration (com.dtflys.forest.logging.LogConfiguration)11 ForestLogHandler (com.dtflys.forest.logging.ForestLogHandler)6 ForestConfiguration (com.dtflys.forest.config.ForestConfiguration)3 ForestRuntimeException (com.dtflys.forest.exceptions.ForestRuntimeException)3 ForestConverter (com.dtflys.forest.converter.ForestConverter)2 RequestLogMessage (com.dtflys.forest.logging.RequestLogMessage)2 ResponseLogMessage (com.dtflys.forest.logging.ResponseLogMessage)2 MetaRequest (com.dtflys.forest.reflection.MetaRequest)2 ForestDataType (com.dtflys.forest.utils.ForestDataType)2 ContentType (com.dtflys.forest.backend.ContentType)1 ForestEncoder (com.dtflys.forest.converter.ForestEncoder)1 DownloadFile (com.dtflys.forest.extensions.DownloadFile)1 ForestQueryParameter (com.dtflys.forest.http.ForestQueryParameter)1 ForestRequest (com.dtflys.forest.http.ForestRequest)1 ForestRequestType (com.dtflys.forest.http.ForestRequestType)1 ForestResponse (com.dtflys.forest.http.ForestResponse)1 DefaultLogHandler (com.dtflys.forest.logging.DefaultLogHandler)1 RequestProxyLogMessage (com.dtflys.forest.logging.RequestProxyLogMessage)1 MappingParameter (com.dtflys.forest.mapping.MappingParameter)1 MappingTemplate (com.dtflys.forest.mapping.MappingTemplate)1