Search in sources :

Example 1 with CompleteMessage

use of org.apache.cassandra.streaming.messages.CompleteMessage in project cassandra by apache.

the class StreamingMultiplexedChannelTest method onControlMessageComplete_Exception.

@Test
public void onControlMessageComplete_Exception() throws InterruptedException, ExecutionException, TimeoutException {
    Assert.assertTrue(channel.isOpen());
    Assert.assertTrue(sender.connected());
    ChannelPromise promise = channel.newPromise();
    promise.setFailure(new RuntimeException("this is just a testing exception"));
    Future f = sender.onMessageComplete(promise, new CompleteMessage());
    f.get(5, TimeUnit.SECONDS);
    Assert.assertFalse(channel.isOpen());
    Assert.assertFalse(sender.connected());
    Assert.assertEquals(StreamSession.State.FAILED, session.state());
}
Also used : CompleteMessage(org.apache.cassandra.streaming.messages.CompleteMessage) Future(java.util.concurrent.Future) StreamResultFuture(org.apache.cassandra.streaming.StreamResultFuture) ChannelPromise(io.netty.channel.ChannelPromise) Test(org.junit.Test)

Example 2 with CompleteMessage

use of org.apache.cassandra.streaming.messages.CompleteMessage in project cassandra by apache.

the class StreamingInboundHandlerTest method StreamDeserializingTask_deriveSession_NoSession.

@Test(expected = UnsupportedOperationException.class)
public void StreamDeserializingTask_deriveSession_NoSession() {
    CompleteMessage msg = new CompleteMessage();
    StreamDeserializingTask task = new StreamDeserializingTask(null, streamingChannel, streamingChannel.messagingVersion);
    task.deriveSession(msg);
}
Also used : CompleteMessage(org.apache.cassandra.streaming.messages.CompleteMessage) StreamDeserializingTask(org.apache.cassandra.streaming.StreamDeserializingTask) Test(org.junit.Test)

Example 3 with CompleteMessage

use of org.apache.cassandra.streaming.messages.CompleteMessage in project cassandra by apache.

the class StreamingMultiplexedChannelTest method onControlMessageComplete_HappyPath.

@Test
public void onControlMessageComplete_HappyPath() {
    Assert.assertTrue(channel.isOpen());
    Assert.assertTrue(sender.connected());
    ChannelPromise promise = channel.newPromise();
    promise.setSuccess();
    Assert.assertNull(sender.onMessageComplete(promise, new CompleteMessage()));
    Assert.assertTrue(channel.isOpen());
    Assert.assertTrue(sender.connected());
    Assert.assertNotEquals(StreamSession.State.FAILED, session.state());
}
Also used : CompleteMessage(org.apache.cassandra.streaming.messages.CompleteMessage) ChannelPromise(io.netty.channel.ChannelPromise) Test(org.junit.Test)

Aggregations

CompleteMessage (org.apache.cassandra.streaming.messages.CompleteMessage)3 Test (org.junit.Test)3 ChannelPromise (io.netty.channel.ChannelPromise)2 Future (java.util.concurrent.Future)1 StreamDeserializingTask (org.apache.cassandra.streaming.StreamDeserializingTask)1 StreamResultFuture (org.apache.cassandra.streaming.StreamResultFuture)1