-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Initial push #2
base: develop
Are you sure you want to change the base?
Initial push #2
Conversation
* Intitial commit * Update gitignore * Implement review feedback * Add travis.yml * Add gradle wrappers * Renamed consulresolver -> consulnameresolver, added deploy script * move ossh credentials
} | ||
|
||
dependencies { | ||
compile "io.grpc:grpc-all:${grpcVersion}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I read at a glance here, you need either grpc-all
or the other deps?
testCompile "junit:junit:4.12" | ||
testCompile 'org.hamcrest:hamcrest-library:1.3' | ||
testCompile 'org.awaitility:awaitility:2.0.0' | ||
testCompile 'com.pszymczyk.consul:embedded-consul:0.2.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! 👍
private ImmutableCatalogOptions buildCatalogOptions() { | ||
ImmutableCatalogOptions.Builder options = ImmutableCatalogOptions.builder(); | ||
|
||
if (this.datacenter.isPresent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For conciseness I'd use ifPresent
here like so
this.datacenter.ifPresent(d -> options.datacenter(com.google.common.base.Optional.of(d)));
but that's just matter of taste though.
options.datacenter(com.google.common.base.Optional.of(this.datacenter.get())); | ||
} | ||
|
||
if (this.tags.isPresent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.tags.ifPresent(tags -> tags.forEach(options::tag));
return options.build(); | ||
} | ||
|
||
private void updateListenerWithEmptyResult() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably rename method to something like propagateServiceUnavailableToListeners
?
|
||
public Builder(String service) { | ||
if (service == null) { | ||
throw new RuntimeException("Service cannot be null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a RuntimeException
required here? Otherwise I favor a NullPointerException
and go with
this.service = Preconditions.checkNotNull(service, "Service cannot be null");
Optional<String> address = Optional.ofNullable(this.consulAddress); | ||
Optional<String> datacenter = Optional.ofNullable(this.datacenter); | ||
Optional<List<String>> tags; | ||
if (this.tags.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does using Optional<List<String>>
have a special semantic here? If not, I'd rather go with just using an empty list.
This also applies to ConsulNameResolver
.
read -p "Enter the version (e.g. 0.0.1) " -r VERSION | ||
if [ -z "$VERSION" ]; then | ||
echo "Version cannot be empty!" | ||
exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit 1
@Rule | ||
public ExpectedException thrown = ExpectedException.none(); | ||
|
||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen other test classes below omit the test
prefix, probably the test methods in this class should be renamed to avoid the superfluous prefix.
private final int port; | ||
|
||
public PingPongServer() { | ||
this(55551); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better use a random value here to decrease possibility of already taken ports?
public final Optional<List<String>> tags; | ||
|
||
private ConsulQueryParameter(Optional<String> consulAddress, String service, | ||
Optional<String> datacenter, Optional<List<String>> tags) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private ConsulQueryParameter(Builder builder) {
@Override | ||
public void start(Listener listener) { | ||
Preconditions.checkState(this.listener == null, "already started"); | ||
this.listener = Preconditions.checkNotNull(listener, "listener"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error message "listener"? Should probably be more informative: "listener cannot be empty".
} | ||
|
||
@Test | ||
public void testSanitizeInputBadScheme() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove test prefix, like in other test class.
echo "Deploying artifact to maven central" | ||
read -p "Are you sure you want to deploy? (yes/NO)? " -r DO_DEPLOYMENT | ||
|
||
if ( [ "$DO_DEPLOYMENT" == "yes" ] ); then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this outer ( ... ) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting rid of this review
No description provided.