Skip to content

Commit 87a8c9f

Browse files
committed
Fix test
1 parent 4b73835 commit 87a8c9f

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

src/test/java/com/rabbitmq/client/test/PublishWithByteBufferTest.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import com.rabbitmq.client.Connection;
2323
import com.rabbitmq.client.ConnectionFactory;
2424
import com.rabbitmq.client.WriteListener;
25-
import io.netty.buffer.ByteBuf;
26-
import io.netty.buffer.ByteBufAllocator;
2725
import java.io.IOException;
2826
import java.nio.ByteBuffer;
2927
import java.util.UUID;
@@ -89,40 +87,4 @@ public void publishByteBuffer() throws Exception {
8987
this.channel.basicCancel(ctag);
9088
}
9189
}
92-
93-
@Test
94-
public void publish() throws Exception {
95-
int size = 50_000;
96-
byte[] masterData = new byte[size];
97-
ThreadLocalRandom.current().nextBytes(masterData);
98-
ConnectionFactory cf = TestUtils.connectionFactory();
99-
ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
100-
try (Connection connection = cf.newConnection()) {
101-
AtomicReference<CountDownLatch> consumingLatch = new AtomicReference<>();
102-
AtomicReference<byte[]> dataRef = new AtomicReference<>();
103-
String ctag =
104-
this.channel.basicConsume(
105-
queue,
106-
true,
107-
(consumerTag, delivery) -> {
108-
dataRef.set(delivery.getBody());
109-
consumingLatch.get().countDown();
110-
},
111-
consumerTag -> {});
112-
Channel publishingChannel = connection.createChannel();
113-
boolean keepGoing = true;
114-
while (keepGoing) {
115-
ByteBuf buf = allocator.directBuffer(size);
116-
// ByteBuf buf = allocator.heapBuffer(size);
117-
buf.writeBytes(masterData);
118-
consumingLatch.set(new CountDownLatch(1));
119-
publishingChannel.basicPublish("", queue, null, buf.nioBuffer());
120-
assertTrue(
121-
consumingLatch.get().await(10, TimeUnit.SECONDS), "deliver should have been called");
122-
buf.release();
123-
}
124-
125-
this.channel.basicCancel(ctag);
126-
}
127-
}
12890
}

0 commit comments

Comments
 (0)