X Tutup
Skip to content

Commit adb85a8

Browse files
author
Gabe Ki
committed
fix unit tests
1 parent 19ec0db commit adb85a8

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

src/main/java/com/github/dockerjava/core/DockerClientConfig.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class DockerClientConfig implements Serializable {
3333
private static final String DOCKER_IO_READ_TIMEOUT_PROPERTY = "docker.io.readTimeout";
3434
// this is really confusing, as there are two ways to spell it
3535
private static final String DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY = "docker.io.enableLoggingFilter";
36-
private static final String DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY = "docker.io.followRedirectsFilterEnabled";
36+
private static final String DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY = "docker.io.followRedirectsFilter";
3737
private static final String DOCKER_IO_DOCKER_CERT_PATH_PROPERTY = "docker.io.dockerCertPath";
3838
private static final String DOCKER_IO_DOCKER_CFG_PATH_PROPERTY = "docker.io.dockerCfgPath";
3939
// connection pooling properties
@@ -54,7 +54,7 @@ public class DockerClientConfig implements Serializable {
5454
m.put("DOCKER_SERVER_ADDRESS", DOCKER_IO_SERVER_ADDRESS_PROPERTY);
5555
m.put("DOCKER_READ_TIMEOUT", DOCKER_IO_READ_TIMEOUT_PROPERTY);
5656
m.put("DOCKER_LOGGING_FILTER_ENABLED", DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY);
57-
m.put("DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY", DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY);
57+
m.put("DOCKER_FOLLOW_REDIRECTS_FILTER_ENABLED", DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY);
5858
m.put(DOCKER_CERT_PATH_PROPERTY, DOCKER_IO_DOCKER_CERT_PATH_PROPERTY);
5959
m.put("DOCKER_CFG_PATH", DOCKER_IO_DOCKER_CFG_PATH_PROPERTY);
6060
ENV_NAME_TO_IO_NAME = Collections.unmodifiableMap(m);
@@ -186,6 +186,7 @@ private static Properties overrideDockerPropertiesWithSystemProperties(Propertie
186186
DOCKER_IO_SERVER_ADDRESS_PROPERTY,
187187
DOCKER_IO_READ_TIMEOUT_PROPERTY,
188188
DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY,
189+
DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY,
189190
DOCKER_IO_DOCKER_CERT_PATH_PROPERTY,
190191
DOCKER_IO_DOCKER_CFG_PATH_PROPERTY,
191192
}) {
@@ -379,7 +380,7 @@ public DockerClientConfigBuilder withProperties(Properties p) {
379380
.withServerAddress(p.getProperty(DOCKER_IO_SERVER_ADDRESS_PROPERTY))
380381
.withReadTimeout(Integer.valueOf(p.getProperty(DOCKER_IO_READ_TIMEOUT_PROPERTY, "0")))
381382
.withLoggingFilter(Boolean.valueOf(p.getProperty(DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY, "true")))
382-
.withFollowRedirectsFilter(Boolean.valueOf(p.getProperty(DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY, "true")))
383+
.withFollowRedirectsFilter(Boolean.valueOf(p.getProperty(DOCKER_IO_FOLLOW_REDIRECTS_FILTER_PROPERTY, "false")))
383384
.withDockerCertPath(p.getProperty(DOCKER_IO_DOCKER_CERT_PATH_PROPERTY))
384385
.withDockerCfgPath(p.getProperty(DOCKER_IO_DOCKER_CFG_PATH_PROPERTY))
385386
.withMaxPerRouteConnections(Integer.valueOf(p.getProperty(DOCKER_IO_MAX_PER_ROUTE_PROPERTY, "2")))

src/main/java/com/github/dockerjava/core/util/FollowRedirectsFilter.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
*/
2222
public class FollowRedirectsFilter implements ClientResponseFilter {
2323

24-
@Override
24+
@Override
2525
public void filter(ClientRequestContext requestContext,
2626
ClientResponseContext responseContext) throws IOException {
27-
if (!responseContext.getStatusInfo().getFamily().equals(Response.Status.Family.REDIRECTION)) {
28-
return;
29-
}
27+
if (!responseContext.getStatusInfo().getFamily().equals(Response.Status.Family.REDIRECTION)) {
28+
return;
29+
}
3030

31-
Response resp = requestContext.getClient().target(responseContext.getLocation())
32-
.request().method(requestContext.getMethod());
33-
responseContext.setEntityStream((InputStream) resp.getEntity());
34-
responseContext.setStatusInfo(resp.getStatusInfo());
35-
responseContext.setStatus(resp.getStatus());
31+
Response resp = requestContext.getClient().target(responseContext.getLocation())
32+
.request().method(requestContext.getMethod());
33+
responseContext.setEntityStream((InputStream) resp.getEntity());
34+
responseContext.setStatusInfo(resp.getStatusInfo());
35+
responseContext.setStatus(resp.getStatus());
3636
}
3737
}

src/main/java/com/github/dockerjava/jaxrs/DockerCmdExecFactoryImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ public void init(DockerClientConfig dockerClientConfig) {
4848
clientConfig.connectorProvider(new ApacheConnectorProvider());
4949
clientConfig.property(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true);
5050

51-
clientConfig.register(ResponseStatusExceptionFilter.class);
52-
clientConfig.register(JsonClientFilter.class);
53-
clientConfig.register(JacksonJsonProvider.class);
5451
if (dockerClientConfig.followRedirectsFilterEnabled()) {
5552
clientConfig.register(FollowRedirectsFilter.class);
5653
}
54+
clientConfig.register(ResponseStatusExceptionFilter.class);
55+
clientConfig.register(JsonClientFilter.class);
56+
clientConfig.register(JacksonJsonProvider.class);
5757

5858
if (dockerClientConfig.isLoggingFilterEnabled()) {
5959
clientConfig.register(new SelectiveLoggingFilter(LOGGER, true));

src/test/java/com/github/dockerjava/core/DockerClientConfigTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public class DockerClientConfigTest {
1616
public static final DockerClientConfig EXAMPLE_CONFIG = newExampleConfig();
1717

1818
private static DockerClientConfig newExampleConfig() {
19-
return new DockerClientConfig(URI.create("http://foo"), "bar", "baz", "qux", "blam", "wham", "flam", 877, false, new LocalDirectorySSLConfig("flim"), 20, 2);
19+
return new DockerClientConfig(URI.create("http://foo"), "bar", "baz", "qux", "blam", "wham", "flam", 877, false, false, new LocalDirectorySSLConfig("flim"), 20, 2);
2020
}
2121

2222
@Test
2323
public void string() throws Exception {
24-
assertEquals("DockerClientConfig{uri=http://foo, version='bar', username='baz', password='qux', email='blam', serverAddress='wham', dockerCfgPath='flam', sslConfig='LocalDirectorySSLConfig{dockerCertPath=flim}', readTimeout=877, loggingFilterEnabled=false}",
24+
assertEquals("DockerClientConfig{uri=http://foo, version='bar', username='baz', password='qux', email='blam', serverAddress='wham', dockerCfgPath='flam', sslConfig='LocalDirectorySSLConfig{dockerCertPath=flim}', readTimeout=877, loggingFilterEnabled=false, followRedirectsFilterEnabled=false}",
2525
EXAMPLE_CONFIG.toString());
2626
}
2727

src/test/java/com/github/dockerjava/core/DockerClientImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class DockerClientImplTest {
1010
@Test
1111
public void configuredInstanceAuthConfig() throws Exception {
1212
// given a config with null serverAddress
13-
DockerClientConfig dockerClientConfig = new DockerClientConfig(null, null, "", "", "", null, null, 0, false, null, 20, 2);
13+
DockerClientConfig dockerClientConfig = new DockerClientConfig(null, null, "", "", "", null, null, 0, false, false, null, 20, 2);
1414
DockerClientImpl dockerClient = DockerClientImpl.getInstance(dockerClientConfig);
1515

1616
// when we get the auth config

0 commit comments

Comments
 (0)
X Tutup