Skip to content

Unit test ensuring that utf-8 characters work #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2013
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
Expand Up @@ -77,7 +77,7 @@ public abstract class RiverMongoDBTestAbstract {
public static final String TEST_MONGODB_RIVER_WITH_SCRIPT_JSON = "/org/elasticsearch/river/mongodb/script/test-mongodb-river-with-script.json";
public static final String TEST_MONGODB_RIVER_EXCLUDE_FIELDS_JSON = "/org/elasticsearch/river/mongodb/simple/test-simple-mongodb-river-exclude-fields.json";
public static final String TEST_MONGODB_RIVER_INCLUDE_FIELDS_JSON = "/org/elasticsearch/river/mongodb/simple/test-simple-mongodb-river-include-fields.json";
public static final String TEST_SIMPLE_MONGODB_DOCUMENT_JSON = "/org/elasticsearch/river/mongodb/script/test-simple-mongodb-document.json";
public static final String TEST_SIMPLE_MONGODB_DOCUMENT_JSON = "/org/elasticsearch/river/mongodb/simple/test-simple-mongodb-document.json";

protected final ESLogger logger = Loggers.getLogger(getClass());
protected final static long wait = 2000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.count.CountResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.river.mongodb.RiverMongoDBTestAbstract;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
Expand Down Expand Up @@ -104,12 +107,17 @@ public void simpleBSONObject() throws Throwable {
.exists(new IndicesExistsRequest(getIndex()));
assertThat(response.actionGet().isExists(), equalTo(true));
refreshIndex();
CountResponse countResponse = getNode()
SearchRequest search = getNode().client()
.prepareSearch(getIndex())
.setQuery(QueryBuilders.fieldQuery("name", "Richard"))
.request();
SearchResponse searchResponse = getNode()
.client()
.count(countRequest(getIndex()).query(
fieldQuery("name", "Richard"))).actionGet();
logger.info("Document count: {}", countResponse.getCount());
countResponse = getNode()
.search(search).actionGet();
assertThat(searchResponse.getHits().getTotalHits(), equalTo(1l));
String chinese = (String) searchResponse.getHits().getAt(0).getSource().get("chinese");
assertThat(chinese, equalTo("中国菜很好吃。"));
CountResponse countResponse = getNode()
.client()
.count(countRequest(getIndex())
.query(fieldQuery("_id", id))).actionGet();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
name: "Richard",
chinese: "中国菜很好吃。",
score: 100
}