@Test public void testLogSingleMessageInCollection() { testBatchedSending(1); Mockito.verify(source, Mockito.times(0)).appendBatch(Mockito.anyList()); Mockito.verify(source, Mockito.times(1)).append(Mockito.any(AvroFlumeEvent.class)); }
@Override public synchronized void append(LoggingEvent event) throws FlumeException { if (rpcClient == null) { String errorMsg = "Cannot Append to Appender! Appender either closed or" + " not setup correctly!"; LogLog.error(errorMsg); if (unsafeMode) { return; } throw new FlumeException(errorMsg); } if (!rpcClient.isActive()) { reconnect(); } List<Event> flumeEvents = parseEvents(event); try { switch (flumeEvents.size()) { case 0: break; case 1: rpcClient.append(flumeEvents.get(0)); break; default: rpcClient.appendBatch(flumeEvents); } } catch (EventDeliveryException e) { String msg = "Flume append() failed."; LogLog.error(msg); if (unsafeMode) { return; } throw new FlumeException(msg + " Exception follows.", e); } }
Log4jAppender extends AppenderSkeleton { @Override public synchronized void append(LoggingEvent event) throws FlumeException { if (rpcClient == null) { String errorMsg = "Cannot Append to Appender! Appender either closed or" + " not setup correctly!"; LogLog.error(errorMsg); if (unsafeMode) { return; } throw new FlumeException(errorMsg); } if (!rpcClient.isActive()) { reconnect(); } List<Event> flumeEvents = parseEvents(event); try { switch (flumeEvents.size()) { case 0: break; case 1: rpcClient.append(flumeEvents.get(0)); break; default: rpcClient.appendBatch(flumeEvents); } } catch (EventDeliveryException e) { String msg = "Flume append() failed."; LogLog.error(msg); if (unsafeMode) { return; } throw new FlumeException(msg + " Exception follows.", e); } } }
Log4jAppender extends AppenderSkeleton { @Override public synchronized void append(LoggingEvent event) throws FlumeException { if (rpcClient == null) { String errorMsg = "Cannot Append to Appender! Appender either closed or" + " not setup correctly!"; LogLog.error(errorMsg); if (unsafeMode) { return; } throw new FlumeException(errorMsg); } if (!rpcClient.isActive()) { reconnect(); } List<Event> flumeEvents = parseEvents(event); try { switch (flumeEvents.size()) { case 0: break; case 1: rpcClient.append(flumeEvents.get(0)); break; default: rpcClient.appendBatch(flumeEvents); } } catch (EventDeliveryException e) { String msg = "Flume append() failed."; LogLog.error(msg); if (unsafeMode) { return; } throw new FlumeException(msg + " Exception follows.", e); } } Log4jAppender();  Log4jAppender(String hostname, int port); }
Log4jAppender extends AppenderSkeleton { @Override public synchronized void append(LoggingEvent event) throws FlumeException { if (rpcClient == null) { String errorMsg = "Cannot Append to Appender! Appender either closed or" + " not setup correctly!"; LogLog.error(errorMsg); if (unsafeMode) { return; } throw new FlumeException(errorMsg); } if (!rpcClient.isActive()) { reconnect(); } List<Event> flumeEvents = parseEvents(event); try { switch (flumeEvents.size()) { case 0: break; case 1: rpcClient.append(flumeEvents.get(0)); break; default: rpcClient.appendBatch(flumeEvents); } } catch (EventDeliveryException e) { String msg = "Flume append() failed."; LogLog.error(msg); if (unsafeMode) { return; } throw new FlumeException(msg + " Exception follows.", e); } } Log4jAppender();  Log4jAppender(String hostname, int port); @Override synchronized void append(LoggingEvent event); @Override synchronized void close(); @Override boolean requiresLayout(); void setHostname(String hostname); void setPort(int port); void setUnsafeMode(boolean unsafeMode); boolean getUnsafeMode(); void setTimeout(long timeout); long getTimeout(); void setAvroReflectionEnabled(boolean avroReflectionEnabled); void setAvroSchemaUrl(String avroSchemaUrl); @Override void activateOptions(); }
Log4jAppender extends AppenderSkeleton { @Override public synchronized void append(LoggingEvent event) throws FlumeException { if (rpcClient == null) { String errorMsg = "Cannot Append to Appender! Appender either closed or" + " not setup correctly!"; LogLog.error(errorMsg); if (unsafeMode) { return; } throw new FlumeException(errorMsg); } if (!rpcClient.isActive()) { reconnect(); } List<Event> flumeEvents = parseEvents(event); try { switch (flumeEvents.size()) { case 0: break; case 1: rpcClient.append(flumeEvents.get(0)); break; default: rpcClient.appendBatch(flumeEvents); } } catch (EventDeliveryException e) { String msg = "Flume append() failed."; LogLog.error(msg); if (unsafeMode) { return; } throw new FlumeException(msg + " Exception follows.", e); } } Log4jAppender();  Log4jAppender(String hostname, int port); @Override synchronized void append(LoggingEvent event); @Override synchronized void close(); @Override boolean requiresLayout(); void setHostname(String hostname); void setPort(int port); void setUnsafeMode(boolean unsafeMode); boolean getUnsafeMode(); void setTimeout(long timeout); long getTimeout(); void setAvroReflectionEnabled(boolean avroReflectionEnabled); void setAvroSchemaUrl(String avroSchemaUrl); @Override void activateOptions();  }