use of io.pravega.client.netty.impl.ClientConnection in project pravega by pravega.
the class SegmentOutputStreamTest method testConnectAndSend.
@Test(timeout = 10000)
public void testConnectAndSend() throws SegmentSealedException, ConnectionFailedException {
UUID cid = UUID.randomUUID();
PravegaNodeUri uri = new PravegaNodeUri("endpoint", SERVICE_PORT);
MockConnectionFactoryImpl cf = new MockConnectionFactoryImpl();
@Cleanup("shutdown") InlineExecutor inlineExecutor = new InlineExecutor();
cf.setExecutor(inlineExecutor);
MockController controller = new MockController(uri.getEndpoint(), uri.getPort(), cf);
ClientConnection connection = mock(ClientConnection.class);
cf.provideConnection(uri, connection);
SegmentOutputStreamImpl output = new SegmentOutputStreamImpl(SEGMENT, controller, cf, cid, segmentSealedCallback, RETRY_SCHEDULE, "");
output.reconnect();
verify(connection).send(new SetupAppend(1, cid, SEGMENT, ""));
cf.getProcessor(uri).appendSetup(new AppendSetup(1, SEGMENT, cid, 0));
sendAndVerifyEvent(cid, connection, output, getBuffer("test"), 1, null);
verifyNoMoreInteractions(connection);
}
use of io.pravega.client.netty.impl.ClientConnection in project pravega by pravega.
the class MockConnectionFactoryImpl method establishConnection.
@Override
@Synchronized
public CompletableFuture<ClientConnection> establishConnection(PravegaNodeUri location, ReplyProcessor rp) {
ClientConnection connection = connections.get(location);
Preconditions.checkState(connection != null, "Unexpected Endpoint");
processors.put(location, rp);
return CompletableFuture.completedFuture(connection);
}
Aggregations