StreamTests only work on 64Bit JVMs

32bit JVMs have different buffer grow behavior. We simply ingore this
since it's a lucene feature that is tested in the upstream project.
This commit is contained in:
Simon Willnauer 2013-10-01 14:54:40 +02:00
parent 4ddfe89bdb
commit e826cfa494
1 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.common.io.streams; package org.elasticsearch.common.io.streams;
import org.apache.lucene.util.Constants;
import org.elasticsearch.common.io.stream.BytesStreamInput; import org.elasticsearch.common.io.stream.BytesStreamInput;
import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.junit.Test; import org.junit.Test;
@ -26,6 +27,7 @@ import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.closeTo; import static org.hamcrest.Matchers.closeTo;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assume.assumeTrue;
/** /**
* *
@ -34,6 +36,7 @@ public class BytesStreamsTests {
@Test @Test
public void testSimpleStreams() throws Exception { public void testSimpleStreams() throws Exception {
assumeTrue(Constants.JRE_IS_64BIT);
BytesStreamOutput out = new BytesStreamOutput(); BytesStreamOutput out = new BytesStreamOutput();
out.writeBoolean(false); out.writeBoolean(false);
out.writeByte((byte) 1); out.writeByte((byte) 1);
@ -46,7 +49,6 @@ public class BytesStreamsTests {
out.writeDouble(2.2); out.writeDouble(2.2);
out.writeString("hello"); out.writeString("hello");
out.writeString("goodbye"); out.writeString("goodbye");
BytesStreamInput in = new BytesStreamInput(out.bytes().toBytes(), false); BytesStreamInput in = new BytesStreamInput(out.bytes().toBytes(), false);
assertThat(in.readBoolean(), equalTo(false)); assertThat(in.readBoolean(), equalTo(false));
assertThat(in.readByte(), equalTo((byte) 1)); assertThat(in.readByte(), equalTo((byte) 1));
@ -63,6 +65,7 @@ public class BytesStreamsTests {
@Test @Test
public void testGrowLogic() throws Exception { public void testGrowLogic() throws Exception {
assumeTrue(Constants.JRE_IS_64BIT);
BytesStreamOutput out = new BytesStreamOutput(); BytesStreamOutput out = new BytesStreamOutput();
out.writeBytes(new byte[BytesStreamOutput.DEFAULT_SIZE - 5]); out.writeBytes(new byte[BytesStreamOutput.DEFAULT_SIZE - 5]);
assertThat(out.bufferSize(), equalTo(2048)); // remains the default assertThat(out.bufferSize(), equalTo(2048)); // remains the default