From 9076c9d7062f12b2eade11b377d5982f05a97159 Mon Sep 17 00:00:00 2001 From: James Duong Date: Tue, 28 Nov 2023 03:41:29 -0800 Subject: [PATCH] Restructure Netty tests for modules Move tests outside of io.netty.buffer package because that causes a conflict with Netty's modules. Change functions marked as protected that are used in tests to be public to facilitate this refactoring. --- .../java/io/netty/buffer/NettyArrowBuf.java | 17 +++++++++++------ .../io/netty/buffer/TestExpandableByteBuf.java | 2 +- .../io/netty/buffer/TestNettyArrowBuf.java | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) rename java/memory/memory-netty/src/test/java/{ => org/apache/arrow}/io/netty/buffer/TestExpandableByteBuf.java (99%) rename java/memory/memory-netty/src/test/java/{ => org/apache/arrow}/io/netty/buffer/TestNettyArrowBuf.java (99%) diff --git a/java/memory/memory-netty-buffer-patch/src/main/java/io/netty/buffer/NettyArrowBuf.java b/java/memory/memory-netty-buffer-patch/src/main/java/io/netty/buffer/NettyArrowBuf.java index 466444c7d53e8..a5a5c2d40bc68 100644 --- a/java/memory/memory-netty-buffer-patch/src/main/java/io/netty/buffer/NettyArrowBuf.java +++ b/java/memory/memory-netty-buffer-patch/src/main/java/io/netty/buffer/NettyArrowBuf.java @@ -436,7 +436,8 @@ public byte getByte(int index) { } @Override - protected short _getShortLE(int index) { + @VisibleForTesting + public short _getShortLE(int index) { short s = getShort(index); return Short.reverseBytes(s); } @@ -452,7 +453,8 @@ public short getShort(int index) { } @Override - protected int _getIntLE(int index) { + @VisibleForTesting + public int _getIntLE(int index) { int value = getInt(index); return Integer.reverseBytes(value); } @@ -468,7 +470,8 @@ public int getInt(int index) { } @Override - protected long _getLongLE(int index) { + @VisibleForTesting + public long _getLongLE(int index) { long value = getLong(index); return Long.reverseBytes(value); } @@ -509,7 +512,8 @@ protected void _setShortLE(int index, int value) { } @Override - protected void _setShort(int index, int value) { + @VisibleForTesting + public void _setShort(int index, int value) { setShort(index, value); } @@ -581,7 +585,7 @@ public NettyArrowBuf setMedium(int index, int value) { @Override @VisibleForTesting - protected void _setInt(int index, int value) { + public void _setInt(int index, int value) { setInt(index, value); } @@ -599,7 +603,8 @@ public NettyArrowBuf setInt(int index, int value) { } @Override - protected void _setLong(int index, long value) { + @VisibleForTesting + public void _setLong(int index, long value) { setLong(index, value); } diff --git a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestExpandableByteBuf.java b/java/memory/memory-netty/src/test/java/org/apache/arrow/io/netty/buffer/TestExpandableByteBuf.java similarity index 99% rename from java/memory/memory-netty/src/test/java/io/netty/buffer/TestExpandableByteBuf.java rename to java/memory/memory-netty/src/test/java/org/apache/arrow/io/netty/buffer/TestExpandableByteBuf.java index 67557b65a6267..b4a7a70de73c2 100644 --- a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestExpandableByteBuf.java +++ b/java/memory/memory-netty/src/test/java/org/apache/arrow/io/netty/buffer/TestExpandableByteBuf.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.netty.buffer; +package org.apache.arrow.io.netty.buffer; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; diff --git a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestNettyArrowBuf.java b/java/memory/memory-netty/src/test/java/org/apache/arrow/io/netty/buffer/TestNettyArrowBuf.java similarity index 99% rename from java/memory/memory-netty/src/test/java/io/netty/buffer/TestNettyArrowBuf.java rename to java/memory/memory-netty/src/test/java/org/apache/arrow/io/netty/buffer/TestNettyArrowBuf.java index f18bccb4c9d8f..dc715d9b1acaa 100644 --- a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestNettyArrowBuf.java +++ b/java/memory/memory-netty/src/test/java/org/apache/arrow/io/netty/buffer/TestNettyArrowBuf.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.netty.buffer; +package org.apache.arrow.io.netty.buffer; import java.nio.ByteBuffer;