本文整理汇总了Java中org.apache.storm.topology.IComponent类的典型用法代码示例。如果您正苦于以下问题:Java IComponent类的具体用法?Java IComponent怎么用?Java IComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IComponent类属于org.apache.storm.topology包,在下文中一共展示了IComponent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testRawType
import org.apache.storm.topology.IComponent; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testRawType() throws Exception {
IComponent boltOrSpout;
if (this.r.nextBoolean()) {
boltOrSpout = mock(IRichSpout.class);
} else {
boltOrSpout = mock(IRichBolt.class);
}
final SetupOutputFieldsDeclarer declarer = new SetupOutputFieldsDeclarer();
declarer.declare(new Fields("dummy1", "dummy2"));
PowerMockito.whenNew(SetupOutputFieldsDeclarer.class).withNoArguments().thenReturn(declarer);
WrapperSetupHelper.getNumberOfAttributes(boltOrSpout,
new HashSet<String>(singleton(Utils.DEFAULT_STREAM_ID)));
}
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:WrapperSetupHelperTest.java
示例2: testToManyAttributes
import org.apache.storm.topology.IComponent; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testToManyAttributes() throws Exception {
IComponent boltOrSpout;
if (this.r.nextBoolean()) {
boltOrSpout = mock(IRichSpout.class);
} else {
boltOrSpout = mock(IRichBolt.class);
}
final SetupOutputFieldsDeclarer declarer = new SetupOutputFieldsDeclarer();
final String[] schema = new String[26];
for (int i = 0; i < schema.length; ++i) {
schema[i] = "a" + i;
}
declarer.declare(new Fields(schema));
PowerMockito.whenNew(SetupOutputFieldsDeclarer.class).withNoArguments().thenReturn(declarer);
WrapperSetupHelper.getNumberOfAttributes(boltOrSpout, null);
}
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:WrapperSetupHelperTest.java
示例3: getNumberOfAttributes
import org.apache.storm.topology.IComponent; //导入依赖的package包/类
/**
* Computes the number of output attributes used by a {@link SpoutWrapper} or {@link BoltWrapper}
* per declared output stream. The number is {@code -1} for raw output type or a value within range [0;25] for
* output type {@link org.apache.flink.api.java.tuple.Tuple0 Tuple0} to
* {@link org.apache.flink.api.java.tuple.Tuple25 Tuple25}.
*
* @param spoutOrBolt
* The Storm {@link IRichSpout spout} or {@link IRichBolt bolt} to be used.
* @param rawOutputs
* Contains stream names if a single attribute output stream, should not be of type
* {@link org.apache.flink.api.java.tuple.Tuple1 Tuple1} but be of a raw type. (Can be {@code null}.)
* @return The number of attributes to be used for each stream.
* @throws IllegalArgumentException
* If {@code rawOutput} is {@code true} and the number of declared output attributes is not 1 or if
* {@code rawOutput} is {@code false} and the number of declared output attributes is not with range
* [0;25].
*/
static HashMap<String, Integer> getNumberOfAttributes(final IComponent spoutOrBolt,
final Collection<String> rawOutputs)
throws IllegalArgumentException {
final SetupOutputFieldsDeclarer declarer = new SetupOutputFieldsDeclarer();
spoutOrBolt.declareOutputFields(declarer);
for (Entry<String, Integer> schema : declarer.outputSchemas.entrySet()) {
int declaredNumberOfAttributes = schema.getValue();
if ((declaredNumberOfAttributes < 0) || (declaredNumberOfAttributes > 25)) {
throw new IllegalArgumentException(
"Provided bolt declares non supported number of output attributes. Must be in range [0;25] but "
+ "was " + declaredNumberOfAttributes);
}
if (rawOutputs != null && rawOutputs.contains(schema.getKey())) {
if (declaredNumberOfAttributes != 1) {
throw new IllegalArgumentException(
"Ouput type is requested to be raw type, but provided bolt declares more then one output "
+ "attribute.");
}
schema.setValue(-1);
}
}
return declarer.outputSchemas;
}
开发者ID:axbaretto,项目名称:flink,代码行数:44,代码来源:WrapperSetupHelper.java
示例4: testEmptyDeclarerBolt
import org.apache.storm.topology.IComponent; //导入依赖的package包/类
@Test
public void testEmptyDeclarerBolt() {
IComponent boltOrSpout;
if (this.r.nextBoolean()) {
boltOrSpout = mock(IRichSpout.class);
} else {
boltOrSpout = mock(IRichBolt.class);
}
Assert.assertEquals(new HashMap<String, Integer>(),
WrapperSetupHelper.getNumberOfAttributes(boltOrSpout, null));
}
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:WrapperSetupHelperTest.java
示例5: testTupleTypes
import org.apache.storm.topology.IComponent; //导入依赖的package包/类
private void testTupleTypes(final int numberOfAttributes) throws Exception {
String[] schema;
if (numberOfAttributes == -1) {
schema = new String[1];
} else {
schema = new String[numberOfAttributes];
}
for (int i = 0; i < schema.length; ++i) {
schema[i] = "a" + i;
}
IComponent boltOrSpout;
if (this.r.nextBoolean()) {
boltOrSpout = mock(IRichSpout.class);
} else {
boltOrSpout = mock(IRichBolt.class);
}
final SetupOutputFieldsDeclarer declarer = new SetupOutputFieldsDeclarer();
declarer.declare(new Fields(schema));
PowerMockito.whenNew(SetupOutputFieldsDeclarer.class).withNoArguments().thenReturn(declarer);
HashMap<String, Integer> attributes = new HashMap<String, Integer>();
attributes.put(Utils.DEFAULT_STREAM_ID, numberOfAttributes);
Assert.assertEquals(attributes, WrapperSetupHelper.getNumberOfAttributes(
boltOrSpout,
numberOfAttributes == -1 ? new HashSet<String>(singleton(Utils.DEFAULT_STREAM_ID)) : null));
}
开发者ID:axbaretto,项目名称:flink,代码行数:30,代码来源:WrapperSetupHelperTest.java
示例6: TestSourceSpout
import org.apache.storm.topology.IComponent; //导入依赖的package包/类
public TestSourceSpout(IComponent sourceComponent, String streamName, String streamId){
this.sourceComponent = sourceComponent;
this.streamName = streamName;
this.messageQueue = MessageQueue.getInstance();
this.streamId = streamId;
}
开发者ID:ping2ravi,项目名称:storm-integration-test,代码行数:7,代码来源:TestSourceSpout.java
示例7: buildBolt
import org.apache.storm.topology.IComponent; //导入依赖的package包/类
abstract public IComponent buildBolt();
开发者ID:Paleozoic,项目名称:storm_spring_boot_demo,代码行数:2,代码来源:BoltBuilder.java
注:本文中的org.apache.storm.topology.IComponent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论