Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.dockerjava.core;

import static com.google.common.base.Preconditions.checkNotNull;
import static org.apache.commons.lang.BooleanUtils.isTrue;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -319,7 +320,7 @@ public static class Builder {
private String apiVersion, registryUsername, registryPassword, registryEmail, registryUrl, dockerConfig,
dockerCertPath;

private boolean dockerTlsVerify;
private Boolean dockerTlsVerify;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either setter should use boolean. If null - then docker-java default.


private SSLConfig customSslConfig = null;

Expand Down Expand Up @@ -419,7 +420,7 @@ public DefaultDockerClientConfig build() {
SSLConfig sslConfig = null;

if (customSslConfig == null) {
if (dockerTlsVerify) {
if (isTrue(dockerTlsVerify)) {
dockerCertPath = checkDockerCertPath(dockerCertPath);
sslConfig = new LocalDirectorySSLConfig(dockerCertPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,25 +180,25 @@ public void withDockerTlsVerify() throws Exception {
field.setAccessible(true);

builder.withDockerTlsVerify("");
assertThat(field.getBoolean(builder), is(false));
assertThat((Boolean) field.get(builder), is(false));

builder.withDockerTlsVerify("false");
assertThat(field.getBoolean(builder), is(false));
assertThat((Boolean) field.get(builder), is(false));

builder.withDockerTlsVerify("FALSE");
assertThat(field.getBoolean(builder), is(false));
assertThat((Boolean) field.get(builder), is(false));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, why not move setters directly into class, then getters would work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, don't get it...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

field is object, getBoolean() works only with primitive


builder.withDockerTlsVerify("true");
assertThat(field.getBoolean(builder), is(true));
assertThat((Boolean) field.get(builder), is(true));

builder.withDockerTlsVerify("TRUE");
assertThat(field.getBoolean(builder), is(true));
assertThat((Boolean) field.get(builder), is(true));

builder.withDockerTlsVerify("0");
assertThat(field.getBoolean(builder), is(false));
assertThat((Boolean) field.get(builder), is(false));

builder.withDockerTlsVerify("1");
assertThat(field.getBoolean(builder), is(true));
assertThat((Boolean) field.get(builder), is(true));
}

}