@Test public void testSendPurgeAllMessageSync() throws Exception { SxpConnection connection = mockConnection(Version.Version4); ChannelHandlerContext ctxtMock = mock(ChannelHandlerContext.class); when(connection.getChannelHandlerContext(any())).thenReturn(ctxtMock); boolean result = BindingDispatcher.sendPurgeAllMessageSync(connection); Assert.assertTrue(result); }
public static boolean sendPurgeAllMessageSync(final SxpConnection connection) { try { LOG.info("{} Sending PurgeAll {}", connection, connection.getNodeIdRemote()); connection.getChannelHandlerContext(SxpConnection.ChannelHandlerContextType.SPEAKER_CNTXT) .writeAndFlush(MessageFactory.createPurgeAll()); return true; } catch (ChannelHandlerContextNotFoundException | ChannelHandlerContextDiscrepancyException e) { LOG.error(connection + " Cannot send PURGE ALL message | {} | ", e.getClass().getSimpleName(), e); return false; } }
BindingDispatcher { public static boolean sendPurgeAllMessageSync(final SxpConnection connection) { try { LOG.info("{} Sending PurgeAll {}", connection, connection.getNodeIdRemote()); connection.getChannelHandlerContext(SxpConnection.ChannelHandlerContextType.SPEAKER_CNTXT) .writeAndFlush(MessageFactory.createPurgeAll()); return true; } catch (ChannelHandlerContextNotFoundException | ChannelHandlerContextDiscrepancyException e) { LOG.error(connection + " Cannot send PURGE ALL message | {} | ", e.getClass().getSimpleName(), e); return false; } } }
BindingDispatcher { public static boolean sendPurgeAllMessageSync(final SxpConnection connection) { try { LOG.info("{} Sending PurgeAll {}", connection, connection.getNodeIdRemote()); connection.getChannelHandlerContext(SxpConnection.ChannelHandlerContextType.SPEAKER_CNTXT) .writeAndFlush(MessageFactory.createPurgeAll()); return true; } catch (ChannelHandlerContextNotFoundException | ChannelHandlerContextDiscrepancyException e) { LOG.error(connection + " Cannot send PURGE ALL message | {} | ", e.getClass().getSimpleName(), e); return false; } } BindingDispatcher(SxpNode owner); }
BindingDispatcher { public static boolean sendPurgeAllMessageSync(final SxpConnection connection) { try { LOG.info("{} Sending PurgeAll {}", connection, connection.getNodeIdRemote()); connection.getChannelHandlerContext(SxpConnection.ChannelHandlerContextType.SPEAKER_CNTXT) .writeAndFlush(MessageFactory.createPurgeAll()); return true; } catch (ChannelHandlerContextNotFoundException | ChannelHandlerContextDiscrepancyException e) { LOG.error(connection + " Cannot send PURGE ALL message | {} | ", e.getClass().getSimpleName(), e); return false; } } BindingDispatcher(SxpNode owner); void setPartitionSize(int partitionSize); void propagateUpdate(List<T> deleteBindings, List<T> addBindings,
                                                             List<SxpConnection> connections); static ListenableFuture<Boolean> sendPurgeAllMessage(final SxpConnection connection); static boolean sendPurgeAllMessageSync(final SxpConnection connection); SxpNode getOwner(); }
BindingDispatcher { public static boolean sendPurgeAllMessageSync(final SxpConnection connection) { try { LOG.info("{} Sending PurgeAll {}", connection, connection.getNodeIdRemote()); connection.getChannelHandlerContext(SxpConnection.ChannelHandlerContextType.SPEAKER_CNTXT) .writeAndFlush(MessageFactory.createPurgeAll()); return true; } catch (ChannelHandlerContextNotFoundException | ChannelHandlerContextDiscrepancyException e) { LOG.error(connection + " Cannot send PURGE ALL message | {} | ", e.getClass().getSimpleName(), e); return false; } } BindingDispatcher(SxpNode owner); void setPartitionSize(int partitionSize); void propagateUpdate(List<T> deleteBindings, List<T> addBindings,
                                                             List<SxpConnection> connections); static ListenableFuture<Boolean> sendPurgeAllMessage(final SxpConnection connection); static boolean sendPurgeAllMessageSync(final SxpConnection connection); SxpNode getOwner();  }