本文整理汇总了Java中org.apache.flume.conf.FlumeConfigurationError类的典型用法代码示例。如果您正苦于以下问题:Java FlumeConfigurationError类的具体用法?Java FlumeConfigurationError怎么用?Java FlumeConfigurationError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FlumeConfigurationError类属于org.apache.flume.conf包,在下文中一共展示了FlumeConfigurationError类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.apache.flume.conf.FlumeConfigurationError; //导入依赖的package包/类
public void configure(Context context) throws ConfigurationException {
super.configure(context);
this.channel = context.getString("channel");
if (this.channel == null || this.channel.isEmpty()) {
errors
.add(new FlumeConfigurationError(componentName, "channel",
FlumeConfigurationErrorType.PROPERTY_VALUE_NULL,
ErrorOrWarning.ERROR));
throw new ConfigurationException("No channel configured for sink: "
+ this.getComponentName());
}
}
示例2: testPropertyRead
import org.apache.flume.conf.FlumeConfigurationError; //导入依赖的package包/类
@Test
public void testPropertyRead() throws Exception {
FlumeConfiguration configuration = provider.getFlumeConfiguration();
Assert.assertNotNull(configuration);
/*
* Test the known errors in the file
*/
List<String> expected = Lists.newArrayList();
expected.add("host5 CONFIG_ERROR");
expected.add("host5 INVALID_PROPERTY");
expected.add("host4 CONFIG_ERROR");
expected.add("host4 CONFIG_ERROR");
expected.add("host4 PROPERTY_VALUE_NULL");
expected.add("host4 PROPERTY_VALUE_NULL");
expected.add("host4 PROPERTY_VALUE_NULL");
expected.add("host4 AGENT_CONFIGURATION_INVALID");
expected.add("ch2 ATTRS_MISSING");
expected.add("host3 CONFIG_ERROR");
expected.add("host3 PROPERTY_VALUE_NULL");
expected.add("host3 AGENT_CONFIGURATION_INVALID");
expected.add("host2 PROPERTY_VALUE_NULL");
expected.add("host2 AGENT_CONFIGURATION_INVALID");
List<String> actual = Lists.newArrayList();
for (FlumeConfigurationError error : configuration.getConfigurationErrors()) {
actual.add(error.getComponentName() + " " + error.getErrorType().toString());
}
Collections.sort(expected);
Collections.sort(actual);
Assert.assertEquals(expected, actual);
AgentConfiguration agentConfiguration =
configuration.getConfigurationFor("host1");
Assert.assertNotNull(agentConfiguration);
LOGGER.info(agentConfiguration.getPrevalidationConfig());
LOGGER.info(agentConfiguration.getPostvalidationConfig());
Set<String> sources = Sets.newHashSet("source1");
Set<String> sinks = Sets.newHashSet("sink1");
Set<String> channels = Sets.newHashSet("channel1");
Assert.assertEquals(sources, agentConfiguration.getSourceSet());
Assert.assertEquals(sinks, agentConfiguration.getSinkSet());
Assert.assertEquals(channels, agentConfiguration.getChannelSet());
}
示例3: verifyProperties
import org.apache.flume.conf.FlumeConfigurationError; //导入依赖的package包/类
protected void verifyProperties(AbstractConfigurationProvider cp) {
FlumeConfiguration configuration = cp.getFlumeConfiguration();
Assert.assertNotNull(configuration);
/*
* Test the known errors in the file
*/
List<String> expected = Lists.newArrayList();
expected.add("host5 CONFIG_ERROR");
expected.add("host5 INVALID_PROPERTY");
expected.add("host4 CONFIG_ERROR");
expected.add("host4 CONFIG_ERROR");
expected.add("host4 PROPERTY_VALUE_NULL");
expected.add("host4 PROPERTY_VALUE_NULL");
expected.add("host4 PROPERTY_VALUE_NULL");
expected.add("host4 AGENT_CONFIGURATION_INVALID");
expected.add("ch2 ATTRS_MISSING");
expected.add("host3 CONFIG_ERROR");
expected.add("host3 PROPERTY_VALUE_NULL");
expected.add("host3 AGENT_CONFIGURATION_INVALID");
expected.add("host2 PROPERTY_VALUE_NULL");
expected.add("host2 AGENT_CONFIGURATION_INVALID");
List<String> actual = Lists.newArrayList();
for (FlumeConfigurationError error : configuration.getConfigurationErrors()) {
actual.add(error.getComponentName() + " " + error.getErrorType().toString());
}
Collections.sort(expected);
Collections.sort(actual);
Assert.assertEquals(expected, actual);
FlumeConfiguration.AgentConfiguration agentConfiguration = configuration
.getConfigurationFor("host1");
Assert.assertNotNull(agentConfiguration);
Set<String> sources = Sets.newHashSet("source1");
Set<String> sinks = Sets.newHashSet("sink1");
Set<String> channels = Sets.newHashSet("channel1");
Assert.assertEquals(sources, agentConfiguration.getSourceSet());
Assert.assertEquals(sinks, agentConfiguration.getSinkSet());
Assert.assertEquals(channels, agentConfiguration.getChannelSet());
}
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:43,代码来源:TestAbstractZooKeeperConfigurationProvider.java
示例4: configure
import org.apache.flume.conf.FlumeConfigurationError; //导入依赖的package包/类
public void configure(Context context) throws ConfigurationException {
super.configure(context);
try {
String channelList = context.getString(
BasicConfigurationConstants.CONFIG_CHANNELS);
if (channelList != null) {
this.channels =
new HashSet<String>(Arrays.asList(channelList.split("\\s+")));
}
if (channels.isEmpty()) {
errors.add(new FlumeConfigurationError(componentName,
ComponentType.CHANNEL.getComponentType(),
FlumeConfigurationErrorType.PROPERTY_VALUE_NULL,
ErrorOrWarning.ERROR));
throw new ConfigurationException("No channels set for "
+ this.getComponentName());
}
Map<String, String> selectorParams = context.getSubProperties(
BasicConfigurationConstants.CONFIG_SOURCE_CHANNELSELECTOR_PREFIX);
String selType;
if (selectorParams != null && !selectorParams.isEmpty()) {
selType = selectorParams.get(BasicConfigurationConstants.CONFIG_TYPE);
} else {
selType = ChannelSelectorConfigurationType.REPLICATING.toString();
}
if (selType == null || selType.isEmpty()) {
selType = ChannelSelectorConfigurationType.REPLICATING.toString();
}
ChannelSelectorType selectorType =
this.getKnownChannelSelector(selType);
Context selectorContext = new Context();
selectorContext.putAll(selectorParams);
String config = null;
if (selectorType == null) {
config = selectorContext.getString(
BasicConfigurationConstants.CONFIG_CONFIG);
if (config == null || config.isEmpty()) {
config = "OTHER";
}
} else {
config = selectorType.toString().toUpperCase(Locale.ENGLISH);
}
this.selectorConf =
(ChannelSelectorConfiguration) ComponentConfigurationFactory
.create(ComponentType.CHANNELSELECTOR.getComponentType(), config,
ComponentType.CHANNELSELECTOR);
selectorConf.setChannels(channels);
selectorConf.configure(selectorContext);
} catch (Exception e) {
errors.add(new FlumeConfigurationError(componentName,
ComponentType.CHANNELSELECTOR.getComponentType(),
FlumeConfigurationErrorType.CONFIG_ERROR,
ErrorOrWarning.ERROR));
throw new ConfigurationException("Failed to configure component!", e);
}
}