本文整理汇总了Java中org.apache.storm.utils.Utils.DEFAULT_STREAM_ID属性的典型用法代码示例。如果您正苦于以下问题:Java Utils.DEFAULT_STREAM_ID属性的具体用法?Java Utils.DEFAULT_STREAM_ID怎么用?Java Utils.DEFAULT_STREAM_ID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.storm.utils.Utils
的用法示例。
在下文中一共展示了Utils.DEFAULT_STREAM_ID属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFail
@Test
public void testFail() throws Exception {
setupExpectationsForTuple();
setupExpectationsForTopologyContextNoEmit();
EventCorrelatingOutputCollector sut = getSystemUnderTest();
Tuple anchor = new TupleImpl(mockedTopologyContext, new Values(PARENT_STREAMLINE_EVENT), TASK_0,
Utils.DEFAULT_STREAM_ID);
sut.fail(anchor);
new Verifications() {{
mockedOutputCollector.fail(anchor); times = 1;
}};
}
示例2: testAck
@Test
public void testAck() throws Exception {
setupExpectationsForTuple();
setupExpectationsForTopologyContextNoEmit();
EventCorrelatingOutputCollector sut = getSystemUnderTest();
Tuple anchor = new TupleImpl(mockedTopologyContext, new Values(PARENT_STREAMLINE_EVENT), TASK_0,
Utils.DEFAULT_STREAM_ID);
sut.ack(anchor);
new Verifications() {{
mockedOutputCollector.ack(anchor); times = 1;
}};
}
示例3: testResetTimeout
@Test
public void testResetTimeout() throws Exception {
setupExpectationsForTuple();
setupExpectationsForTopologyContextNoEmit();
EventCorrelatingOutputCollector sut = getSystemUnderTest();
Tuple anchor = new TupleImpl(mockedTopologyContext, new Values(PARENT_STREAMLINE_EVENT), TASK_0,
Utils.DEFAULT_STREAM_ID);
sut.resetTimeout(anchor);
new Verifications() {{
mockedOutputCollector.resetTimeout(anchor); times = 1;
}};
}
示例4: getOutputStreamId
/**
* @return The stream that tuples will be emitted out.
*/
String getOutputStreamId() {
if (outputStreamId == null) {
if (spoutConfig == null) {
throw new IllegalStateException("Missing required configuration! SpoutConfig not defined!");
}
outputStreamId = (String) getSpoutConfigItem(SpoutConfig.OUTPUT_STREAM_ID);
if (Strings.isNullOrEmpty(outputStreamId)) {
outputStreamId = Utils.DEFAULT_STREAM_ID;
}
}
return outputStreamId;
}
示例5: provideStreamIds
/**
* Provides various StreamIds to test emitting out of.
*/
@DataProvider
public static Object[][] provideStreamIds() {
return new Object[][]{
// No explicitly defined streamId should use the default streamId.
{ null, Utils.DEFAULT_STREAM_ID },
// Explicitly defined streamId should get used as is.
{ "SpecialStreamId", "SpecialStreamId" }
};
}
示例6: provideStreamIds
/**
* Provides various StreamIds to test emitting out of.
*/
@DataProvider
public static Object[][] provideStreamIds() {
return new Object[][]{
// No explicitly defined streamId should use the default streamId.
{ null, Utils.DEFAULT_STREAM_ID },
// Explicitly defined streamId should get used as is.
{ "SpecialStreamId", "SpecialStreamId" }
};
}
示例7: runDeclareTest
private void runDeclareTest(final int testCase, final int numberOfStreams,
final int numberOfAttributes) {
final FlinkOutputFieldsDeclarer declarer = new FlinkOutputFieldsDeclarer();
String[] streams = null;
if (numberOfStreams > 1 || r.nextBoolean()) {
streams = new String[numberOfStreams];
for (int i = 0; i < numberOfStreams; ++i) {
streams[i] = "stream" + i;
}
}
final String[] attributes = new String[numberOfAttributes];
for (int i = 0; i < attributes.length; ++i) {
attributes[i] = "a" + i;
}
switch (testCase) {
case 0:
this.declareSimple(declarer, streams, attributes);
break;
default:
this.declareNonDirect(declarer, streams, attributes);
}
if (streams == null) {
streams = new String[] { Utils.DEFAULT_STREAM_ID };
}
for (String stream : streams) {
final TypeInformation<?> type = declarer.getOutputType(stream);
Assert.assertEquals(numberOfAttributes + 1, type.getArity());
Assert.assertTrue(type.isTupleType());
}
}
示例8: testWrapperRawType
@Test(expected = IllegalArgumentException.class)
public void testWrapperRawType() throws Exception {
final SetupOutputFieldsDeclarer declarer = new SetupOutputFieldsDeclarer();
declarer.declare(new Fields("dummy1", "dummy2"));
PowerMockito.whenNew(SetupOutputFieldsDeclarer.class).withNoArguments().thenReturn(declarer);
new BoltWrapper<Object, Object>(mock(IRichBolt.class), new String[] { Utils.DEFAULT_STREAM_ID });
}
示例9: FiniteRandomSpout
public FiniteRandomSpout(long seed, int counter, int numberOfOutputStreams) {
this.r = new Random(seed);
this.counter = counter;
if (numberOfOutputStreams < 1) {
this.outputStreams = new String[] { Utils.DEFAULT_STREAM_ID };
} else {
this.outputStreams = new String[numberOfOutputStreams];
for (int i = 0; i < this.outputStreams.length; ++i) {
this.outputStreams[i] = STREAM_PREFIX + i;
}
}
}
示例10: SingleStreamRabbitMqMessageScheme
public SingleStreamRabbitMqMessageScheme() {
this(Utils.DEFAULT_STREAM_ID);
}
示例11: buildStreams
protected void buildStreams(EcoExecutionContext executionContext, TopologyBuilder builder,
ObjectBuilder objectBuilder)
throws IllegalAccessException, InstantiationException, ClassNotFoundException,
NoSuchFieldException, InvocationTargetException {
EcoTopologyDefinition topologyDefinition = executionContext.getTopologyDefinition();
Map<String, ComponentStream> componentStreams = new HashMap<>();
HashMap<String, BoltDeclarer> declarers = new HashMap<>();
for (StreamDefinition stream : topologyDefinition.getStreams()) {
Object boltObj = executionContext.getBolt(stream.getTo());
BoltDeclarer declarer = declarers.get(stream.getTo());
if (boltObj instanceof IRichBolt) {
if (declarer == null) {
declarer = builder.setBolt(stream.getTo(),
(IRichBolt) boltObj,
topologyDefinition.parallelismForBolt(stream.getTo()));
declarers.put(stream.getTo(), declarer);
}
} else if (boltObj instanceof IBasicBolt) {
if (declarer == null) {
declarer = builder.setBolt(
stream.getTo(),
(IBasicBolt) boltObj,
topologyDefinition.parallelismForBolt(stream.getTo()));
declarers.put(stream.getTo(), declarer);
}
} else if (boltObj instanceof IWindowedBolt) {
if (declarer == null) {
declarer = builder.setBolt(
stream.getTo(),
(IWindowedBolt) boltObj,
topologyDefinition.parallelismForBolt(stream.getTo()));
declarers.put(stream.getTo(), declarer);
}
} else {
throw new IllegalArgumentException("Class does not appear to be a bolt: "
+ boltObj.getClass().getName());
}
GroupingDefinition grouping = stream.getGrouping();
// if the streamId is defined, use it for the grouping,
// otherwise assume default stream
// Todo(joshfischer) Not sure if "default" is still valid
String streamId = grouping.getStreamId() == null
? Utils.DEFAULT_STREAM_ID : grouping.getStreamId();
switch (grouping.getType()) {
case SHUFFLE:
declarer.shuffleGrouping(stream.getFrom(), streamId);
break;
case FIELDS:
//TODO check for null grouping args
List<String> groupingArgs = grouping.getArgs();
if (groupingArgs == null) {
throw new IllegalArgumentException("You must supply arguments for Fields grouping");
}
declarer.fieldsGrouping(stream.getFrom(), streamId, new Fields(groupingArgs));
break;
case ALL:
declarer.allGrouping(stream.getFrom(), streamId);
break;
case GLOBAL:
declarer.globalGrouping(stream.getFrom(), streamId);
break;
case NONE:
declarer.noneGrouping(stream.getFrom(), streamId);
break;
case CUSTOM:
declarer.customGrouping(stream.getFrom(), streamId,
buildCustomStreamGrouping(stream.getGrouping().getCustomClass(),
executionContext,
objectBuilder));
break;
default:
throw new UnsupportedOperationException("unsupported grouping type: " + grouping);
}
}
executionContext.setStreams(componentStreams);
}
示例12: FixedTuple
public FixedTuple(List<Object> values) {
this.stream = Utils.DEFAULT_STREAM_ID;
this.values = values;
}
示例13: BoltWrapper
/**
* Instantiates a new {@link BoltWrapper} that wraps the given Storm {@link IRichBolt bolt} such that it can be used
* within a Flink streaming program. The given input schema enable attribute-by-name access for input types
* {@link Tuple0} to {@link Tuple25}. The output type can be any type if parameter {@code rawOutput} is {@code true}
* and the bolt's number of declared output tuples is 1. If {@code rawOutput} is {@code false} the output type will
* be one of {@link Tuple0} to {@link Tuple25} depending on the bolt's declared number of attributes.
*
* @param bolt
* The Storm {@link IRichBolt bolt} to be used.
* @param inputSchema
* The schema (ie, ordered field names) of the input 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
* @param rawOutputs
* Contains stream names if a single attribute output stream, should not be of type {@link Tuple1} but be
* of a raw type.
* @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].
*/
public BoltWrapper(final IRichBolt bolt, final Fields inputSchema,
final Collection<String> rawOutputs) throws IllegalArgumentException {
this(bolt, DEFUALT_BOLT_NAME, Utils.DEFAULT_STREAM_ID, DEFAULT_ID, inputSchema, rawOutputs);
}