예제 #1
0
  /**
   * Test with a distributed execution with explicit colocation of two functions end up on the same
   * container.
   */
  @Test
  public void testSimpleDistributedColocate() throws Exception {
    assumeTrue(SC_OK);
    assumeTrue(getTesterType() == StreamsContext.Type.DISTRIBUTED_TESTER);

    Topology t = newTopology();

    TStream<String> sa = t.strings("a");
    TStream<String> sb = t.strings("b");

    sa = sa.transform(IsolateTest.getContainerId());
    sb = sb.transform(IsolateTest.getContainerId());

    sa.colocate(sb);

    sa = sa.isolate().filter(new AllowAll<String>());
    sb = sb.isolate().filter(new AllowAll<String>());

    sa = sa.union(sb);

    Condition<List<String>> pes = t.getTester().stringContents(sa, "");

    Condition<Long> tc = t.getTester().tupleCount(sa, 2);

    complete(t.getTester(), tc, 10, TimeUnit.SECONDS);

    Set<String> singlePe = new HashSet<>(pes.getResult());

    assertTrue(pes.getResult().toString(), singlePe.size() == 1);
  }
예제 #2
0
  @Test
  public void testNonplaceable() {
    assumeTrue(isMainRun());
    Topology t = newTopology();
    TStream<String> s1 = t.strings("3");
    TStream<String> s2 = t.strings("3");

    assertFalse(s1.union(s2).isPlaceable());
    assertFalse(s1.isolate().isPlaceable());

    TStream<String> sp = s1.parallel(3);
    assertFalse(sp.isPlaceable());
    assertFalse(sp.endParallel().isPlaceable());
  }