/**
   * Note: this test fails if we don't have the synchronized block in {@link
   * org.apache.flink.streaming.runtime.tasks.SourceStreamTask.SourceOutput}
   */
  @Test
  public void testOneInputOperatorWithoutChaining() throws Exception {
    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    env.setParallelism(1);

    DataStream<String> source = env.addSource(new InfiniteTestSource());

    source.transform(
        "Custom Operator",
        BasicTypeInfo.STRING_TYPE_INFO,
        new TimerOperator(StreamOperator.ChainingStrategy.NEVER));

    boolean testSuccess = false;
    try {
      env.execute("Timer test");
    } catch (JobExecutionException e) {
      if (e.getCause() instanceof TimerException) {
        TimerException te = (TimerException) e.getCause();
        if (te.getCause() instanceof RuntimeException) {
          RuntimeException re = (RuntimeException) te.getCause();
          if (re.getMessage().equals("TEST SUCCESS")) {
            testSuccess = true;
          } else {
            throw e;
          }
        } else {
          throw e;
        }
      } else {
        throw e;
      }
    }
    Assert.assertTrue(testSuccess);
  }
 /**
  * This method wrapps the throwing of the dns exception.
  *
  * @param message The message to put in the exception
  * @param ex The exception stack.
  * @exception DNSException
  */
 private void throwTimerException(String message, Throwable ex) throws TimerException {
   TimerException exception = new TimerException();
   exception.message = message;
   ByteArrayOutputStream output = new ByteArrayOutputStream();
   PrintStream outStream = new PrintStream(output);
   ex.printStackTrace(outStream);
   outStream.flush();
   exception.cause = output.toString();
   throw exception;
 }