|
| 1 | +/** |
| 2 | + * Copyright (c) 2018, Mihai Emil Andronache |
| 3 | + * All rights reserved. |
| 4 | + * Redistribution and use in source and binary forms, with or without |
| 5 | + * modification, are permitted provided that the following conditions are met: |
| 6 | + * 1)Redistributions of source code must retain the above copyright notice, |
| 7 | + * this list of conditions and the following disclaimer. |
| 8 | + * 2)Redistributions in binary form must reproduce the above copyright notice, |
| 9 | + * this list of conditions and the following disclaimer in the documentation |
| 10 | + * and/or other materials provided with the distribution. |
| 11 | + * 3)Neither the name of docker-java-api nor the names of its |
| 12 | + * contributors may be used to endorse or promote products derived from |
| 13 | + * this software without specific prior written permission. |
| 14 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 15 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 17 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 18 | + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 19 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 20 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 21 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 22 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 23 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 24 | + * POSSIBILITY OF SUCH DAMAGE. |
| 25 | + */ |
| 26 | +package com.amihaiemil.docker; |
| 27 | + |
| 28 | +import java.io.File; |
| 29 | +import java.io.IOException; |
| 30 | +import org.apache.http.client.HttpClient; |
| 31 | +import org.apache.http.client.methods.HttpGet; |
| 32 | +import org.junit.Ignore; |
| 33 | +import org.junit.Test; |
| 34 | + |
| 35 | +/** |
| 36 | + * Integration tests for {@link UnixHttpClient}. |
| 37 | + * |
| 38 | + * @author George Aristy (george.aristy@gmail.com) |
| 39 | + * @version $Id$ |
| 40 | + * @since 0.0.1 |
| 41 | + */ |
| 42 | +public final class UnixHttpClientITCase { |
| 43 | + /** |
| 44 | + * UnixHttpClient can be executed more than once without throwing a |
| 45 | + * ConnectionPoolTimeoutException, demonstrating its connection-pooling |
| 46 | + * capabilities. |
| 47 | + * @throws IOException unexpected |
| 48 | + * @see <a href="https://github.com/amihaiemil/docker-java-api/issues/44">bug</a> |
| 49 | + * @todo #44:30min This should be un-ignored and refactored after #41 is |
| 50 | + * done. The unix socket server needs to be spooled up, and the url |
| 51 | + * changed accordingly. |
| 52 | + */ |
| 53 | + @Ignore |
| 54 | + @Test |
| 55 | + public void canBeReused() throws IOException { |
| 56 | + final HttpClient client = new UnixHttpClient( |
| 57 | + new File("/var/run/docker.sock") |
| 58 | + ); |
| 59 | + client.execute(new HttpGet("http://localhost/ping")); |
| 60 | + client.execute(new HttpGet("http://localhost/ping")); |
| 61 | + } |
| 62 | +} |
0 commit comments