Skip to content
代码片段 群组 项目
提交 d330764a 编辑于 作者: Stanislav Kozlovski's avatar Stanislav Kozlovski
浏览文件

MINOR: Fix broken KafkaChannel and SaslServer unit tests after June 15 ce-kafka merge

上级 33cbaeb5
No related branches found
No related tags found
无相关合并请求
......@@ -258,7 +258,7 @@ public class KafkaChannelTest {
@Test
public void testUnreadableSocket() throws IOException {
SelectionKey key = Mockito.mock(SelectionKey.class);
Mockito.when(key.readyOps()).thenReturn(0).thenReturn(SelectionKey.OP_READ);
Mockito.when(key.isReadable()).thenReturn(false).thenReturn(true);
SocketChannel socketChannel = Mockito.mock(SocketChannel.class);
Mockito.when(socketChannel.read(Mockito.any(ByteBuffer.class))).thenReturn(-1);
KafkaChannel channel = createKafkaChannel(new ProxyProtocolEngineFactory(ProxyProtocol.V1), key, socketChannel);
......@@ -269,7 +269,7 @@ public class KafkaChannelTest {
assertEquals(KafkaChannel.ChannelProxyState.PROXY_PENDING, channel.proxyState());
assertFalse(channel.hasBytesBuffered());
// Second prepare() call should throw and EOFException when reading from the socket channel
// Second prepare() call should throw an EOFException when reading from the socket channel
assertThrows(EOFException.class, channel::prepare);
}
......@@ -297,7 +297,7 @@ public class KafkaChannelTest {
if (key == null) {
key = Mockito.mock(SelectionKey.class);
Mockito.when(key.readyOps()).thenReturn(SelectionKey.OP_READ);
Mockito.when(key.isReadable()).thenReturn(true);
}
if (channel == null) {
channel = Mockito.mock(SocketChannel.class);
......
......@@ -244,7 +244,7 @@ public class SaslServerAuthenticatorTest {
mockRequest(saslHandshakeRequest(mechanism), transportLayer);
authenticator.authenticate();
when(saslServer.isComplete()).thenReturn(false).thenReturn(true);
when(saslServer.isComplete()).thenReturn(true);
mockRequest(saslAuthenticateRequest(), transportLayer);
authenticator.authenticate();
......@@ -277,7 +277,7 @@ public class SaslServerAuthenticatorTest {
mockRequest(saslHandshakeRequest(mechanism), transportLayer);
authenticator.authenticate();
when(saslServer.isComplete()).thenReturn(false).thenReturn(true);
when(saslServer.isComplete()).thenReturn(true);
mockRequest(saslAuthenticateRequest(), transportLayer);
authenticator.authenticate();
......@@ -310,7 +310,7 @@ public class SaslServerAuthenticatorTest {
mockRequest(saslHandshakeRequest(mechanism), transportLayer);
authenticator.authenticate();
when(saslServer.isComplete()).thenReturn(false).thenReturn(true);
when(saslServer.isComplete()).thenReturn(true);
mockRequest(saslAuthenticateRequest(), transportLayer);
authenticator.authenticate();
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册