@Test(dataProvider = "getIterable")
  public void testExpand(Iterable iterable, int size) {
    final TridentTuple tuple = mock(TridentTuple.class);
    final TridentCollector collector = mock(TridentCollector.class);
    when(tuple.getValue(0)).thenReturn(iterable);
    Expand expand = new Expand();
    expand.execute(tuple, collector);

    verify(tuple, times(1)).getValue(0);
    verify(collector, times(size)).emit(any(Values.class));
  }
예제 #2
0
  public Expand getExpand(PExpand declaration) {

    if (declaration == null) {
      throw new InternalException("declaration may not be null");
    }

    Expand expand = getGlobalIndex().getExpand(declaration, this);

    if (expand.getEnclosingMacro() != this) {
      throw new InternalError("getExpand must be called on its enclosing macro");
    }

    ExpandSignature signature = expand.getSignature();
    this.expandSignatures.add(signature);

    for (Macro macro : signature.getMacroSet()) {
      this.explicitlyExpandedMacros.add(macro);
      macro.addCaller(this);
    }

    return expand;
  }
예제 #3
0
 @Override
 public XStream<String> expand() {
   return new XStreamImpl<>(Expand.expand().apply(new Stringify<T>().apply(stream)));
 }
예제 #4
0
 /** Expand entities in the attributes of the current Node. */
 public ActiveAttrList expandAttrs(ActiveAttrList attrs) {
   return Expand.expandAttrs(this, attrs);
 }