Skip to content

Commit

Permalink
Update elasticsearch and all dependencies. Start fixes
Browse files Browse the repository at this point in the history
one of which is elastic/elasticsearch#4310 "no more ok in elasticsearch responses"
  • Loading branch information
dirkraft committed Sep 14, 2015
1 parent ec0b60e commit 98b7948
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 34 deletions.
31 changes: 16 additions & 15 deletions build.gradle
Expand Up @@ -25,16 +25,16 @@ def defaultBlank(closure) {
ext {
deps = [
commons_io: 'commons-io:commons-io:2.4',
commons_lang3: 'org.apache.commons:commons-lang3:3.1',
elasticsearch: 'org.elasticsearch:elasticsearch:0.90.7',
guava: 'com.google.guava:guava:15.0',
httpclient: 'org.apache.httpcomponents:httpclient:4.3.1',
jackson_databind: 'com.fasterxml.jackson.core:jackson-databind:2.3.0',
jsr305: 'com.google.code.findbugs:jsr305:2.0.2',
junit: 'junit:junit:4.11',
reflections: 'org.reflections:reflections:0.9.8',
slf4j_api: 'org.slf4j:slf4j-api:1.7.5',
slf4j_simple: 'org.slf4j:slf4j-simple:1.7.5',
commons_lang3: 'org.apache.commons:commons-lang3:3.4',
elasticsearch: 'org.elasticsearch:elasticsearch:1.7.1',
guava: 'com.google.guava:guava:18.0',
httpclient: 'org.apache.httpcomponents:httpclient:4.5',
jackson_databind: 'com.fasterxml.jackson.core:jackson-databind:2.6.1',
jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
junit: 'junit:junit:4.12',
reflections: 'org.reflections:reflections:0.9.10',
slf4j_api: 'org.slf4j:slf4j-api:1.7.12',
slf4j_simple: 'org.slf4j:slf4j-simple:1.7.12',
]
}

Expand All @@ -48,14 +48,15 @@ buildscript {
}

dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.5.0'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0'
}
}
allprojects {
apply plugin: 'license'

license {
header rootProject.file('src/license/HEADER')
exclude '**/*.json'
}
}

Expand All @@ -72,8 +73,8 @@ subprojects {
// Plugins

apply plugin: 'java'
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceCompatibility = 1.7
targetCompatibility = 1.7

apply plugin: 'maven'
apply plugin: 'signing'
Expand Down Expand Up @@ -172,11 +173,11 @@ subprojects {
// Misc

task wrapper(type: Wrapper) {
gradleVersion = '1.10'
gradleVersion = '2.6'
}

idea {
project {
languageLevel = '1.6'
languageLevel = '1.7'
}
}
Expand Up @@ -19,7 +19,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;

public class Hit {

Expand Down Expand Up @@ -76,7 +76,7 @@ public <T> T getSourceAsType(TypeReference<T> typeReference) {

@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("index", index)
.add("type", type)
.add("id", id)
Expand Down
Expand Up @@ -23,8 +23,6 @@
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.io.ByteSource;
import com.google.common.io.ByteStreams;
import com.google.common.io.InputSupplier;
import org.apache.http.client.methods.HttpPost;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -63,7 +61,7 @@ public Object getPayload() {
// Note that while _bulk requests are made up of JSON, the body as a whole isn't actually valid JSON.
final InputStream input;
try {
input = ByteStreams.join(Iterables.transform(actions, new PayloadFn())).getInput();
input = ByteSource.concat(Iterables.transform(actions, new PayloadFn())).openStream();
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand All @@ -72,9 +70,9 @@ public Object getPayload() {

private static final ByteSource NEW_LINE = ByteSource.wrap("\n".getBytes());

private static class PayloadFn implements Function<JresBulkable, InputSupplier<InputStream>> {
private static class PayloadFn implements Function<JresBulkable, ByteSource> {
@Override
public InputSupplier<InputStream> apply(JresBulkable action) {
public ByteSource apply(JresBulkable action) {
try {

ByteSource lines = ByteSource.concat(
Expand Down
Expand Up @@ -27,13 +27,8 @@
*/
public class JresAcknowledgedReply extends JresJsonReply {

private Boolean ok;
private Boolean acknowledged;

public Boolean getOk() {
return ok;
}

public Boolean getAcknowledged() {
return acknowledged;
}
Expand Down
Expand Up @@ -20,7 +20,7 @@
import com.blacklocus.jres.request.index.JresUpdateDocument;
import com.blacklocus.jres.request.search.JresSearch;
import com.blacklocus.jres.response.search.JresSearchReply;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -117,7 +117,7 @@ static class Document {

@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("name", name)
.add("the_number", the_number)
Expand Down
Expand Up @@ -42,7 +42,7 @@ public void happy() {
Assert.assertEquals(Arrays.asList(alias), retrieveAliasesResponse.getAliases(index));

JresAcknowledgedReply response = jres.quest(new JresDeleteAlias(index, alias));
Assert.assertTrue(response.getOk() && response.getAcknowledged());
Assert.assertTrue(response.getAcknowledged());
try {
retrieveAliasesResponse = jres.quest(new JresRetrieveAliases(index, "*"));
Assert.assertEquals(0, retrieveAliasesResponse.getAliases(index).size());
Expand Down
Expand Up @@ -30,7 +30,6 @@ public void testExisting() {
Assert.assertTrue(jres.bool(new JresIndexExists(index)).verity());

JresAcknowledgedReply deleteReply = jres.quest(new JresDeleteIndex(index));
Assert.assertTrue(deleteReply.getOk());
Assert.assertTrue(deleteReply.getAcknowledged());
}

Expand Down
Expand Up @@ -74,7 +74,7 @@ public void happy() {
jres.quest(new JresCreateIndex(index));
{
JresAcknowledgedReply response = jres.quest(new JresPutMapping(index, type, "{\"test\":{}}"));
Assert.assertTrue(response.getOk() && response.getAcknowledged());
Assert.assertTrue(response.getAcknowledged());
}

{
Expand Down
Expand Up @@ -20,7 +20,7 @@
import com.blacklocus.jres.request.index.JresRefresh;
import com.blacklocus.jres.request.search.JresSearch;
import com.blacklocus.jres.request.search.JresSearchBody;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.junit.Assert;
Expand Down Expand Up @@ -91,7 +91,7 @@ public int hashCode() {

@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("the_answer", the_answer)
.toString();
}
Expand Down

0 comments on commit 98b7948

Please sign in to comment.