parent
de893d80de
commit
16a70d6005
|
@ -20,9 +20,11 @@
|
||||||
package org.elasticsearch.action.bulk;
|
package org.elasticsearch.action.bulk;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
|
import org.apache.lucene.util.Constants;
|
||||||
import org.elasticsearch.action.delete.DeleteRequest;
|
import org.elasticsearch.action.delete.DeleteRequest;
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
import org.elasticsearch.action.index.IndexRequest;
|
||||||
import org.elasticsearch.action.update.UpdateRequest;
|
import org.elasticsearch.action.update.UpdateRequest;
|
||||||
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -36,6 +38,10 @@ public class BulkRequestTests extends ElasticsearchTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleBulk1() throws Exception {
|
public void testSimpleBulk1() throws Exception {
|
||||||
String bulkAction = copyToStringFromClasspath("/org/elasticsearch/action/bulk/simple-bulk.json");
|
String bulkAction = copyToStringFromClasspath("/org/elasticsearch/action/bulk/simple-bulk.json");
|
||||||
|
// translate Windows line endings (\r\n) to standard ones (\n)
|
||||||
|
if (Constants.WINDOWS) {
|
||||||
|
bulkAction = Strings.replace(bulkAction, "\r\n", "\n");
|
||||||
|
}
|
||||||
BulkRequest bulkRequest = new BulkRequest();
|
BulkRequest bulkRequest = new BulkRequest();
|
||||||
bulkRequest.add(bulkAction.getBytes(Charsets.UTF_8), 0, bulkAction.length(), true, null, null);
|
bulkRequest.add(bulkAction.getBytes(Charsets.UTF_8), 0, bulkAction.length(), true, null, null);
|
||||||
assertThat(bulkRequest.numberOfActions(), equalTo(3));
|
assertThat(bulkRequest.numberOfActions(), equalTo(3));
|
||||||
|
|
Loading…
Reference in New Issue