"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/test/java/org/apache/http/impl/client/TestIdleConnectionEvictor.java" between
httpcomponents-client-4.5.6-src.tar.gz and httpcomponents-client-4.5.7-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

TestIdleConnectionEvictor.java  (httpcomponents-client-4.5.6-src):TestIdleConnectionEvictor.java  (httpcomponents-client-4.5.7-src)
skipping to change at line 35 skipping to change at line 35
* *
*/ */
package org.apache.http.impl.client; package org.apache.http.impl.client;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.conn.HttpClientConnectionManager;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mockito; import org.mockito.Mockito;
/** /**
* Unit tests for {@link org.apache.http.impl.client.IdleConnectionEvictor}. * Unit tests for {@link org.apache.http.impl.client.IdleConnectionEvictor}.
*/ */
public class TestIdleConnectionEvictor { public class TestIdleConnectionEvictor {
@Test @Test
public void testEvictExpiredAndIdle() throws Exception { public void testEvictExpiredAndIdle() throws Exception {
final HttpClientConnectionManager cm = Mockito.mock(HttpClientConnection Manager.class); final HttpClientConnectionManager cm = Mockito.mock(HttpClientConnection Manager.class);
skipping to change at line 71 skipping to change at line 72
@Test @Test
public void testEvictExpiredOnly() throws Exception { public void testEvictExpiredOnly() throws Exception {
final HttpClientConnectionManager cm = Mockito.mock(HttpClientConnection Manager.class); final HttpClientConnectionManager cm = Mockito.mock(HttpClientConnection Manager.class);
final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvicto r(cm, final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvicto r(cm,
500, TimeUnit.MILLISECONDS, 0, TimeUnit.SECONDS); 500, TimeUnit.MILLISECONDS, 0, TimeUnit.SECONDS);
connectionEvictor.start(); connectionEvictor.start();
Thread.sleep(1000); Thread.sleep(1000);
Mockito.verify(cm, Mockito.atLeast(1)).closeExpiredConnections(); Mockito.verify(cm, Mockito.atLeast(1)).closeExpiredConnections();
Mockito.verify(cm, Mockito.never()).closeIdleConnections(Mockito.anyLong (), Mockito.<TimeUnit>any()); Mockito.verify(cm, Mockito.never()).closeIdleConnections(Matchers.anyLon g(), Matchers.<TimeUnit>any());
Assert.assertTrue(connectionEvictor.isRunning()); Assert.assertTrue(connectionEvictor.isRunning());
connectionEvictor.shutdown(); connectionEvictor.shutdown();
connectionEvictor.awaitTermination(1, TimeUnit.SECONDS); connectionEvictor.awaitTermination(1, TimeUnit.SECONDS);
Assert.assertFalse(connectionEvictor.isRunning()); Assert.assertFalse(connectionEvictor.isRunning());
} }
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)