use of com.orientechnologies.orient.server.network.protocol.binary.OLiveCommandResultListener in project orientdb by orientechnologies.
the class OLiveCommandResultListenerTest method testSimpleMessageSend.
@Test
public void testSimpleMessageSend() throws IOException {
OLiveCommandResultListener listener = new OLiveCommandResultListener(server, connection, 20, new TestResultListener());
ORecordOperation op = new ORecordOperation(new ODocument(), ORecordOperation.CREATED);
listener.onLiveResult(10, op);
Mockito.verify(channelBinary, VerificationModeFactory.atLeastOnce()).writeBytes(Mockito.any(byte[].class));
}
use of com.orientechnologies.orient.server.network.protocol.binary.OLiveCommandResultListener in project orientdb by orientechnologies.
the class OLiveCommandResultListenerTest method testNetworkError.
@Test
public void testNetworkError() throws IOException {
Mockito.when(channelBinary.writeInt(Mockito.anyInt())).thenThrow(new IOException("Mock Exception"));
OLiveCommandResultListener listener = new OLiveCommandResultListener(server, connection, 20, new TestResultListener());
OLiveQueryHook.subscribe(10, rawListener, db);
assertTrue(OLiveQueryHook.getOpsReference(db).getQueueThread().hasToken(10));
ORecordOperation op = new ORecordOperation(new ODocument(), ORecordOperation.CREATED);
listener.onLiveResult(10, op);
assertFalse(OLiveQueryHook.getOpsReference(db).getQueueThread().hasToken(10));
}
Aggregations