zhenyuT commented on code in PR #133:
URL: 
https://github.com/apache/incubator-hugegraph-commons/pull/133#discussion_r1309524484


##########
hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java:
##########
@@ -192,51 +206,54 @@ public void testPostWithMaxTotalAndPerRoute() {
         Assert.assertEquals(200, restResult.status());
     }
 
-    @Test
-    public void testCleanExecutor() throws Exception {
-        // Modify IDLE_TIME 100ms to speed test
-        int newIdleTime = 100;
-        int newCheckPeriod = newIdleTime + 20;
-
-        RestClient client = new RestClientImpl("/test", 1000, newIdleTime,

Review Comment:
   okhttp没有显式清理连接的线程,因此也不需要进行测试



##########
hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java:
##########
@@ -192,51 +206,54 @@ public void testPostWithMaxTotalAndPerRoute() {
         Assert.assertEquals(200, restResult.status());
     }
 
-    @Test
-    public void testCleanExecutor() throws Exception {
-        // Modify IDLE_TIME 100ms to speed test
-        int newIdleTime = 100;
-        int newCheckPeriod = newIdleTime + 20;
-
-        RestClient client = new RestClientImpl("/test", 1000, newIdleTime,
-                                               10, 5, 200);
-
-        PoolingHttpClientConnectionManager pool;
-        pool = Whitebox.getInternalState(client, "pool");
-        pool = Mockito.spy(pool);
-        Whitebox.setInternalState(client, "pool", pool);
-        HttpRoute route = new HttpRoute(HttpHost.create(
-                                        "http://127.0.0.1:8080";));
-        // Create a connection manually, it will be put into leased list
-        HttpClientConnection conn = pool.requestConnection(route, null)
-                                        .get(1L, TimeUnit.SECONDS);
-        PoolStats stats = pool.getTotalStats();
-        int usingConns = stats.getLeased() + stats.getPending();
-        Assert.assertGte(1, usingConns);
-
-        // Sleep more than two check periods for busy connection
-        Thread.sleep(newCheckPeriod);
-        Mockito.verify(pool, Mockito.never()).closeExpiredConnections();
-        stats = pool.getTotalStats();
-        usingConns = stats.getLeased() + stats.getPending();
-        Assert.assertGte(1, usingConns);
-
-        // The connection will be put into available list
-        pool.releaseConnection(conn, null, 0, TimeUnit.SECONDS);
-
-        stats = pool.getTotalStats();
-        usingConns = stats.getLeased() + stats.getPending();
-        Assert.assertEquals(0, usingConns);
-        /*
-         * Sleep more than two check periods for free connection,
-         * ensure connection has been closed
-         */
-        Thread.sleep(newCheckPeriod);
-        Mockito.verify(pool, Mockito.atLeastOnce())
-               .closeExpiredConnections();
-        Mockito.verify(pool, Mockito.atLeastOnce())
-               .closeIdleConnections(newIdleTime, TimeUnit.MILLISECONDS);
-    }
+    /**
+     * okhttp does not need to manually clean Executor
+     */
+//    @Test
+//    public void testCleanExecutor() throws Exception {

Review Comment:
   okhttp没有显式清理连接的线程,因此也不需要进行测试



##########
hugegraph-common/src/test/java/org/apache/hugegraph/unit/rest/RestClientTest.java:
##########
@@ -192,51 +206,54 @@ public void testPostWithMaxTotalAndPerRoute() {
         Assert.assertEquals(200, restResult.status());
     }
 
-    @Test
-    public void testCleanExecutor() throws Exception {
-        // Modify IDLE_TIME 100ms to speed test
-        int newIdleTime = 100;
-        int newCheckPeriod = newIdleTime + 20;
-
-        RestClient client = new RestClientImpl("/test", 1000, newIdleTime,
-                                               10, 5, 200);
-
-        PoolingHttpClientConnectionManager pool;
-        pool = Whitebox.getInternalState(client, "pool");
-        pool = Mockito.spy(pool);
-        Whitebox.setInternalState(client, "pool", pool);
-        HttpRoute route = new HttpRoute(HttpHost.create(
-                                        "http://127.0.0.1:8080";));
-        // Create a connection manually, it will be put into leased list
-        HttpClientConnection conn = pool.requestConnection(route, null)
-                                        .get(1L, TimeUnit.SECONDS);
-        PoolStats stats = pool.getTotalStats();
-        int usingConns = stats.getLeased() + stats.getPending();
-        Assert.assertGte(1, usingConns);
-
-        // Sleep more than two check periods for busy connection
-        Thread.sleep(newCheckPeriod);
-        Mockito.verify(pool, Mockito.never()).closeExpiredConnections();
-        stats = pool.getTotalStats();
-        usingConns = stats.getLeased() + stats.getPending();
-        Assert.assertGte(1, usingConns);
-
-        // The connection will be put into available list
-        pool.releaseConnection(conn, null, 0, TimeUnit.SECONDS);
-
-        stats = pool.getTotalStats();
-        usingConns = stats.getLeased() + stats.getPending();
-        Assert.assertEquals(0, usingConns);
-        /*
-         * Sleep more than two check periods for free connection,
-         * ensure connection has been closed
-         */
-        Thread.sleep(newCheckPeriod);
-        Mockito.verify(pool, Mockito.atLeastOnce())
-               .closeExpiredConnections();
-        Mockito.verify(pool, Mockito.atLeastOnce())
-               .closeIdleConnections(newIdleTime, TimeUnit.MILLISECONDS);
-    }
+    /**
+     * okhttp does not need to manually clean Executor
+     */
+//    @Test
+//    public void testCleanExecutor() throws Exception {

Review Comment:
   okhttp没有显式清理连接的线程,因此也不需要进行测试



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to