/*
 *  Copyright (c) 2012-2013 Malhar, Inc.
 *  All Rights Reserved.
 */
package com.malhartech.demos.yahoofinance;

import com.malhartech.stram.StramLocalCluster;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;

/**
 * Run Yahoo Finance application demo.
 *
 * @author Locknath Shil <locknath@malhar-inc.com>
 */
public class YahooFinanceTest
{

  /**
   * This will run for ever.
   *
   * @throws Exception
   */
  //@Test
  public void testApplication() throws Exception
  {
    YahooFinanceApplication app = new YahooFinanceApplication();
    StramLocalCluster lc = new StramLocalCluster(app.getApplication(new Configuration(false)));
    lc.setHeartbeatMonitoringEnabled(false);
    lc.run();
  }

  /**
   * This will run for specified sleep time.
   *
   * @throws Exception
   */
 @Test
  public void testApplication2() throws Exception
  {
    YahooFinanceApplication app = new YahooFinanceApplication();
    final StramLocalCluster lc = new StramLocalCluster(app.getApplication(new Configuration(false)));
    new Thread()
    {
      @Override
      public void run()
      {
        try {
          Thread.sleep(20000);
        }
        catch (InterruptedException ex) {
        }
        lc.shutdown();
      }
    }.start();

    lc.run();
  }
}

@@ -114,55 +114,8 @@
 e;%0A%0A
-import com.malhartech.stram.StramLocalCluster;%0A
 impo
@@ -179,16 +179,231 @@
 .Test;%0A%0A
+import com.malhartech.api.DAG;%0Aimport com.malhartech.api.Operator.InputPort;%0Aimport com.malhartech.api.Operator.OutputPort;%0Aimport com.malhartech.lib.util.KeyValPair;%0Aimport com.malhartech.stram.StramLocalCluster;%0A%0A
 /**%0A * R
@@ -1440,11 +1440,325 @@
 n();%0A  %7D
+%0A%0A  //@Test%0A  public void testTypeCompatibility() %7B%0A%0A    OutputPort%3CKeyValPair%3CString, Double%3E%3E oport = null;%0A    InputPort%3CKeyValPair%3CString, Double%3E%3E iport1 = null;%0A    InputPort%3CKeyValPair%3CString, ? extends Number%3E%3E iport2 = null;%0A%0A    DAG dag = new DAG();%0A    dag.addStream(%22id%22, oport, iport1, iport2);%0A%0A  %7D%0A%0A
 %0A%7D%0A

test code for port type parameters