本文整理汇总了Java中org.apache.flume.FlumeException.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java FlumeException.getCause方法的具体用法?Java FlumeException.getCause怎么用?Java FlumeException.getCause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flume.FlumeException
的用法示例。
在下文中一共展示了FlumeException.getCause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSlowness
import org.apache.flume.FlumeException; //导入方法依赖的package包/类
@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();
}
}
示例2: sendAndAssertFail
import org.apache.flume.FlumeException; //导入方法依赖的package包/类
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();
}
示例3: testTimeout
import org.apache.flume.FlumeException; //导入方法依赖的package包/类
@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();
}
}
示例4: testRandomBackoffNotUnsafeMode
import org.apache.flume.FlumeException; //导入方法依赖的package包/类
@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();
}
}