Java Code Examples for org.apache.flume.FlumeException#getCause()
The following examples show how to use
org.apache.flume.FlumeException#getCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestLog4jAppender.java From mt-flume with Apache License 2.0 | 6 votes |
private void sendAndAssertFail(Logger logger) throws Throwable { /* * Log4j internally defines levels as multiples of 10000. So if we * create levels directly using count, the level will be set as the * default. */ int level = 20000; try { logger.log(Level.toLevel(level), "Test Msg"); } catch (FlumeException ex) { ex.printStackTrace(); throw ex.getCause(); } Transaction transaction = ch.getTransaction(); transaction.begin(); Event event = ch.take(); Assert.assertNull(event); transaction.commit(); transaction.close(); }
Example 2
Source File: TestLog4jAppender.java From mt-flume with Apache License 2.0 | 6 votes |
@Test(expected = EventDeliveryException.class) public void testSlowness() throws Throwable { ch = new SlowMemoryChannel(2000); Configurables.configure(ch, new Context()); configureSource(); props.put("log4j.appender.out2.Timeout", "1000"); props.put("log4j.appender.out2.layout", "org.apache.log4j.PatternLayout"); props.put("log4j.appender.out2.layout.ConversionPattern", "%-5p [%t]: %m%n"); PropertyConfigurator.configure(props); Logger logger = LogManager.getLogger(TestLog4jAppender.class); Thread.currentThread().setName("Log4jAppenderTest"); int level = 10000; String msg = "This is log message number" + String.valueOf(1); try { logger.log(Level.toLevel(level), msg); } catch (FlumeException ex) { throw ex.getCause(); } }
Example 3
Source File: TestLoadBalancingLog4jAppender.java From mt-flume with Apache License 2.0 | 6 votes |
@Test (expected = EventDeliveryException.class) public void testTimeout() throws Throwable { File TESTFILE = new File(TestLoadBalancingLog4jAppender.class .getClassLoader() .getResource("flume-loadbalancinglog4jtest.properties") .getFile()); ch = new TestLog4jAppender.SlowMemoryChannel(2000); configureChannel(); slowDown = true; startSources(TESTFILE, false, new int[]{25430, 25431, 25432}); int level = 20000; String msg = "This is log message number" + String.valueOf(level); try { fixture.log(Level.toLevel(level), msg); } catch (FlumeException ex) { throw ex.getCause(); } }
Example 4
Source File: TestLoadBalancingLog4jAppender.java From mt-flume with Apache License 2.0 | 6 votes |
@Test(expected = EventDeliveryException.class) public void testRandomBackoffNotUnsafeMode() throws Throwable { File TESTFILE = new File(TestLoadBalancingLog4jAppender.class .getClassLoader() .getResource("flume-loadbalancing-backoff-log4jtest.properties") .getFile()); startSources(TESTFILE, false, new int[]{25430, 25431, 25432}); sources.get(0).setFail(); sources.get(1).setFail(); sources.get(2).setFail(); try { sendAndAssertFail(); } catch (FlumeException ex) { throw ex.getCause(); } }