gt:         s0Events = SupportBean_S0.makeS0("B", new String[] {"B-s0-1"});
context: /*
   * *************************************************************************************
   *  Copyright (C) 2008 EsperTech, Inc. All rights reserved.                            *
   *  http://esper.codehaus.org                                                          *
   *  http://www.espertech.com                                                           *
   *  ---------------------------------------------------------------------------------- *
   *  The software in this package is published under the terms of the GPL license       *
   *  a copy of which has been included with this distribution in the license.txt file.  *
   * *************************************************************************************
   */
  
  package com.espertech.esper.regression.epl;
  
  import com.espertech.esper.client.scopetest.EPAssertionUtil;
  import com.espertech.esper.client.scopetest.SupportUpdateListener;
  import junit.framework.TestCase;
   import com.espertech.esper.client.EPServiceProvider;
  import com.espertech.esper.client.EPServiceProviderManager;
  import com.espertech.esper.client.EPStatement;
  import com.espertech.esper.client.EventBean;
  import com.espertech.esper.support.bean.*;
  import com.espertech.esper.support.util.ArrayHandlingUtil;
  import com.espertech.esper.support.client.SupportConfigFactory;
  
  public class Test6StreamOuterJoin extends TestCase
  {
      private EPServiceProvider epService;
      private SupportUpdateListener updateListener;
  
      private final static String EVENT_S0 = SupportBean_S0.class.getName();
      private final static String EVENT_S1 = SupportBean_S1.class.getName();
      private final static String EVENT_S2 = SupportBean_S2.class.getName();
      private final static String EVENT_S3 = SupportBean_S3.class.getName();
      private final static String EVENT_S4 = SupportBean_S4.class.getName();
      private final static String EVENT_S5 = SupportBean_S5.class.getName();
  
      public void setUp()
      {
          epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
          epService.initialize();
          updateListener = new SupportUpdateListener();
      }
  
      protected void tearDown() throws Exception {
          updateListener = null;
      }
  
      public void testRoot_s0()
      {
          /**
           * Query:
           *          s0 <- s1
           *                  <- s3
           *             <- s2
           *                  <- s4
           *                  <- s5
           */
          String joinStatement = "select * from " +
                                     EVENT_S0 + ".win:length(1000) as s0 " +
              " right outer join " + EVENT_S1 + ".win:length(1000) as s1 on s0.p00 = s1.p10 " +
              " right outer join " + EVENT_S2 + ".win:length(1000) as s2 on s0.p00 = s2.p20 " +
              " right outer join " + EVENT_S3 + ".win:length(1000) as s3 on s1.p10 = s3.p30 " +
              " right outer join " + EVENT_S4 + ".win:length(1000) as s4 on s2.p20 = s4.p40 " +
              " right outer join " + EVENT_S5 + ".win:length(1000) as s5 on s2.p20 = s5.p50 ";
  
          EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement);
          joinView.addListener(updateListener);
  
          runAsserts();
      }
  
      public void testRoot_s1()
      {
          /**
           * Query:
           *          s0 <- s1
           *                  <- s3
           *             <- s2
           *                  <- s4
           *                  <- s5
           */
          String joinStatement = "select * from " +
                                     EVENT_S1 + ".win:length(1000) as s1 " +
              " left outer join " + EVENT_S0 + ".win:length(1000) as s0 on s0.p00 = s1.p10 " +
              " right outer join " + EVENT_S3 + ".win:length(1000) as s3 on s1.p10 = s3.p30 " +
              " right outer join " + EVENT_S2 + ".win:length(1000) as s2 on s0.p00 = s2.p20 " +
              " right outer join " + EVENT_S5 + ".win:length(1000) as s5 on s2.p20 = s5.p50 " +
              " right outer join " + EVENT_S4 + ".win:length(1000) as s4 on s2.p20 = s4.p40 ";
  
          EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement);
          joinView.addListener(updateListener);
  
          runAsserts();
      }
  
      public void testRoot_s2()
      {
          /**
           * Query:
           *          s0 <- s1
           *                  <- s3
           *             <- s2
           *                  <- s4
           *                  <- s5
           */
          String joinStatement = "select * from " +
                                     EVENT_S2 + ".win:length(1000) as s2 " +
              " left outer join " + EVENT_S0 + ".win:length(1000) as s0 on s0.p00 = s2.p20 " +
              " right outer join " + EVENT_S1 + ".win:length(1000) as s1 on s0.p00 = s1.p10 " +
              " right outer join " + EVENT_S3 + ".win:length(1000) as s3 on s1.p10 = s3.p30 " +
              " right outer join " + EVENT_S4 + ".win:length(1000) as s4 on s2.p20 = s4.p40 " +
              " right outer join " + EVENT_S5 + ".win:length(1000) as s5 on s2.p20 = s5.p50 ";
  
          EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement);
          joinView.addListener(updateListener);
  
          runAsserts();
      }
  
      public void testRoot_s3()
      {
          /**
           * Query:
           *          s0 <- s1
           *                  <- s3
           *             <- s2
           *                  <- s4
           *                  <- s5
           */
          String joinStatement = "select * from " +
                                     EVENT_S3 + ".win:length(1000) as s3 " +
              " left outer join " + EVENT_S1 + ".win:length(1000) as s1 on s1.p10 = s3.p30 " +
              " left outer join " + EVENT_S0 + ".win:length(1000) as s0 on s0.p00 = s1.p10 " +
              " right outer join " + EVENT_S2 + ".win:length(1000) as s2 on s0.p00 = s2.p20 " +
              " right outer join " + EVENT_S5 + ".win:length(1000) as s5 on s2.p20 = s5.p50 " +
              " right outer join " + EVENT_S4 + ".win:length(1000) as s4 on s2.p20 = s4.p40 ";
  
          EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement);
          joinView.addListener(updateListener);
  
          runAsserts();
      }
  
      public void testRoot_s4()
      {
          /**
           * Query:
           *          s0 <- s1
           *                  <- s3
           *             <- s2
           *                  <- s4
           *                  <- s5
           */
          String joinStatement = "select * from " +
                                     EVENT_S4 + ".win:length(1000) as s4 " +
              " left outer join " + EVENT_S2 + ".win:length(1000) as s2 on s2.p20 = s4.p40 " +
              " right outer join " + EVENT_S5 + ".win:length(1000) as s5 on s2.p20 = s5.p50 " +
              " left outer join " + EVENT_S0 + ".win:length(1000) as s0 on s0.p00 = s2.p20 " +
              " right outer join " + EVENT_S1 + ".win:length(1000) as s1 on s0.p00 = s1.p10 " +
              " right outer join " + EVENT_S3 + ".win:length(1000) as s3 on s1.p10 = s3.p30 ";
  
          EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement);
          joinView.addListener(updateListener);
  
          runAsserts();
      }
  
      public void testRoot_s5()
      {
          /**
           * Query:
           *          s0 <- s1
           *                  <- s3
           *             <- s2
           *                  <- s4
           *                  <- s5
           */
          String joinStatement = "select * from " +
                                     EVENT_S5 + ".win:length(1000) as s5 " +
              " left outer join " + EVENT_S2 + ".win:length(1000) as s2 on s2.p20 = s5.p50 " +
              " right outer join " + EVENT_S4 + ".win:length(1000) as s4 on s2.p20 = s4.p40 " +
              " left outer join " + EVENT_S0 + ".win:length(1000) as s0 on s0.p00 = s2.p20 " +
              " right outer join " + EVENT_S1 + ".win:length(1000) as s1 on s0.p00 = s1.p10 " +
              " right outer join " + EVENT_S3 + ".win:length(1000) as s3 on s1.p10 = s3.p30 ";
  
          EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement);
          joinView.addListener(updateListener);
  
          runAsserts();
      }
  
      private void runAsserts()
      {
          Object[] s0Events;
          Object[] s1Events;
          Object[] s2Events;
          Object[] s3Events;
          Object[] s4Events;
          Object[] s5Events;
  
          // Test s0 and s1=0, s2=0, s3=0, s4=0, s5=0
          //
          s0Events = SupportBean_S0.makeS0("A", new String[] {"A-s0-1"});
          sendEvent(s0Events);
          assertFalse(updateListener.isInvoked());
  
          // Test s0 and s1=1, s2=0, s3=0, s4=0, s5=0
          //
          s1Events = SupportBean_S1.makeS1("B", new String[] {"B-s1-1"});
          sendEvent(s1Events);
          assertFalse(updateListener.isInvoked());
  
  