Github user dineshjoshi commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/253#discussion_r216180830
--- Diff: test/unit/org/apache/cassandra/net/async/ChannelWriterTest.java ---
@@ -70,32 +86,71 @@ public static void before()
@Before
public void setup()
{
- OutboundConnectionIdentifier id = OutboundConnectionIdentifier.small(InetAddressAndPort.getByAddressOverrideDefaults(InetAddresses.forString("127.0.0.1"),
0),
- InetAddressAndPort.getByAddressOverrideDefaults(InetAddresses.forString("127.0.0.2"),
0));
+ if (type == ChannelWriterType.LARGE_MESSAGE)
+ {
+ id = OutboundConnectionIdentifier.large(InetAddressAndPort.getByAddressOverrideDefaults(InetAddresses.forString("127.0.0.1"),
0),
+ InetAddressAndPort.getByAddressOverrideDefaults(InetAddresses.forString("127.0.0.2"),
0));
+ }
+ else
+ {
+ id = OutboundConnectionIdentifier.small(InetAddressAndPort.getByAddressOverrideDefaults(InetAddresses.forString("127.0.0.1"),
0),
+ InetAddressAndPort.getByAddressOverrideDefaults(InetAddresses.forString("127.0.0.2"),
0));
+ }
+
channel = new EmbeddedChannel();
omc = new NonSendingOutboundMessagingConnection(id, null, Optional.empty());
- channelWriter = ChannelWriter.create(channel, omc::handleMessageResult, Optional.empty());
- channel.pipeline().addFirst(new MessageOutHandler(id, MessagingService.current_version,
channelWriter, () -> null));
- coalescingStrategy = CoalescingStrategies.newCoalescingStrategy(CoalescingStrategies.Strategy.FIXED.name(),
COALESCE_WINDOW_MS, null, "test");
+ wrapper = new MessageOutWrapper();
+ OutboundConnectionParams.Builder builder = OutboundConnectionParams.builder()
+ .messageResultConsumer(this::handleMessageResult)
+ .coalescingStrategy(Optional.empty())
+ .protocolVersion(MessagingService.current_version)
+ .connectionId(id);
+
+ if (type == ChannelWriterType.COALESCING)
+ coalescingStrategy = CoalescingStrategies.newCoalescingStrategy(CoalescingStrategies.Strategy.FIXED.name(),
COALESCE_WINDOW_MS, null, "test");
+ else
+ coalescingStrategy = Optional.empty();
--- End diff --
This is beyond the scope of this PR, however, we should refactor `OutboundConnectionParams`
to not store an `Optional`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
|