Exemplo n.º 1
0
  public void testSchemaXMLWSchemaWithRestriction() throws Exception {
    Configuration config = SupportConfigFactory.getConfiguration();
    ConfigurationEventTypeXMLDOM eventTypeMeta = new ConfigurationEventTypeXMLDOM();
    eventTypeMeta.setRootElementName("order");
    InputStream schemaStream =
        TestSchemaXMLEvent.class
            .getClassLoader()
            .getResourceAsStream(CLASSLOADER_SCHEMA_WITH_RESTRICTION_URI);
    assertNotNull(schemaStream);
    String schemaText = ParserTool.linesToText(ParserTool.readFile(schemaStream));
    eventTypeMeta.setSchemaText(schemaText);
    config.addEventType("OrderEvent", eventTypeMeta);

    epService = EPServiceProviderManager.getProvider("TestSchemaXML", config);
    epService.initialize();
    updateListener = new SupportUpdateListener();

    String text = "select order_amount from OrderEvent";
    EPStatement stmt = epService.getEPAdministrator().createEPL(text);
    stmt.addListener(updateListener);

    SupportXML.sendEvent(
        epService.getEPRuntime(),
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            + "<order>\n"
            + "<order_amount>202.1</order_amount>"
            + "</order>");
    EventBean theEvent = updateListener.getLastNewData()[0];
    assertEquals(Double.class, theEvent.get("order_amount").getClass());
    assertEquals(202.1d, theEvent.get("order_amount"));
    updateListener.reset();
  }
  public void testAfterCurrentRow() throws Exception {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MyEvent", SupportRecogBean.class);
    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();

    String text =
        "select * from MyEvent.win:keepall() "
            + "match_recognize ("
            + " measures A.theString as a, B[0].theString as b0, B[1].theString as b1"
            + " after match skip to current row"
            + " pattern (A B*)"
            + " define"
            + " A as A.theString like \"A%\","
            + " B as B.theString like \"B%\""
            + ")";

    EPStatement stmt = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    runAssertion(epService, listener, stmt);

    stmt.destroy();
    EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(text);
    SerializableObjectCopier.copy(model);
    assertEquals(text, model.toEPL());
    stmt = epService.getEPAdministrator().create(model);
    stmt.addListener(listener);
    assertEquals(text, stmt.getText());

    runAssertion(epService, listener, stmt);
  }
  public void testAfterNextRow() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MyEvent", SupportRecogBean.class);
    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();

    String[] fields = "a,b0,b1".split(",");
    String text =
        "select * from MyEvent.win:keepall() "
            + "match_recognize ("
            + "  measures A.theString as a, B[0].theString as b0, B[1].theString as b1"
            + "  AFTER MATCH SKIP TO NEXT ROW "
            + "  pattern (A B*) "
            + "  define "
            + "    A as A.theString like 'A%',"
            + "    B as B.theString like 'B%'"
            + ")";

    EPStatement stmt = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    epService.getEPRuntime().sendEvent(new SupportRecogBean("A1", 1));
    EPAssertionUtil.assertPropsPerRow(
        listener.getAndResetLastNewData(), fields, new Object[][] {{"A1", null, null}});
    EPAssertionUtil.assertPropsPerRow(stmt.iterator(), fields, new Object[][] {{"A1", null, null}});

    // since the first match skipped past A, we do not match again
    epService.getEPRuntime().sendEvent(new SupportRecogBean("B1", 2));
    assertFalse(listener.isInvoked()); // incremental skips to next
    EPAssertionUtil.assertPropsPerRow(stmt.iterator(), fields, new Object[][] {{"A1", "B1", null}});
  }
Exemplo n.º 4
0
 public void setUp() {
   epService =
       EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
   epService.initialize();
   feedListener = new SupportUpdateListener();
   resultListenerDelta = new SupportUpdateListener();
   resultListenerProduct = new SupportUpdateListener();
 }
Exemplo n.º 5
0
  protected void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("SupportBean", SupportBean.class);

    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    mergeListener = new SupportUpdateListener();
  }
 public void setUp() {
   Configuration config = SupportConfigFactory.getConfiguration();
   epService = (EPServiceProviderSPI) EPServiceProviderManager.getDefaultProvider(config);
   epService.initialize();
   epService.getEPAdministrator().getConfiguration().addEventType(SupportBean_S0.class);
   epService.getEPAdministrator().getConfiguration().addEventType(MyCountAccessEvent.class);
   listener = new SupportUpdateListener();
 }
Exemplo n.º 7
0
 public void setUp() {
   epService =
       EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
   epService.initialize();
   if (InstrumentationHelper.ENABLED) {
     InstrumentationHelper.startTest(epService, this.getClass(), getName());
   }
   updateListener = new SupportUpdateListener();
 }
 public void setUp() {
   Configuration configuration = SupportConfigFactory.getConfiguration();
   configuration.addEventType("SupportBean", SupportBean.class);
   configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
   configuration.addEventType("SupportBean_S1", SupportBean_S1.class);
   configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
   epService = EPServiceProviderManager.getDefaultProvider(configuration);
   epService.initialize();
 }
  public void setUp() {

    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("Bean", SupportBean_ST0_Container.class);
    config.addEventType("SupportCollection", SupportCollection.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    listener = new SupportUpdateListener();
  }
  public void testSkipToNextRow() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MyEvent", SupportRecogBean.class);
    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();

    String[] fields = "a_string,b_string".split(",");
    String text =
        "select * from MyEvent.win:keepall() "
            + "match_recognize ("
            + "  measures A.theString as a_string, B.theString as b_string "
            + "  all matches "
            + "  after match skip to next row "
            + "  pattern (A B) "
            + "  define B as B.value > A.value"
            + ") "
            + "order by a_string, b_string";

    EPStatement stmt = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E1", 5));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E2", 3));
    assertFalse(listener.isInvoked());
    assertFalse(stmt.iterator().hasNext());

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E3", 6));
    EPAssertionUtil.assertPropsPerRow(
        listener.getAndResetLastNewData(), fields, new Object[][] {{"E2", "E3"}});
    EPAssertionUtil.assertPropsPerRow(stmt.iterator(), fields, new Object[][] {{"E2", "E3"}});

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E4", 4));
    assertFalse(listener.isInvoked());
    EPAssertionUtil.assertPropsPerRow(stmt.iterator(), fields, new Object[][] {{"E2", "E3"}});

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E5", 6));
    EPAssertionUtil.assertPropsPerRow(
        listener.getAndResetLastNewData(), fields, new Object[][] {{"E4", "E5"}});
    EPAssertionUtil.assertPropsPerRow(
        stmt.iterator(), fields, new Object[][] {{"E2", "E3"}, {"E4", "E5"}});

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E6", 10));
    EPAssertionUtil.assertPropsPerRow(
        listener.getAndResetLastNewData(), fields, new Object[][] {{"E5", "E6"}});
    EPAssertionUtil.assertPropsPerRow(
        stmt.iterator(), fields, new Object[][] {{"E2", "E3"}, {"E4", "E5"}, {"E5", "E6"}});

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E7", 9));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E8", 4));
    assertFalse(listener.isInvoked());
    EPAssertionUtil.assertPropsPerRow(
        stmt.iterator(), fields, new Object[][] {{"E2", "E3"}, {"E4", "E5"}, {"E5", "E6"}});

    stmt.stop();
  }
 public void setUp() {
   Configuration config = SupportConfigFactory.getConfiguration();
   epService = EPServiceProviderManager.getDefaultProvider(config);
   epService.initialize();
   epService
       .getEPAdministrator()
       .getConfiguration()
       .addEventType("SupportBean", SupportBean.class);
   epService.getEPAdministrator().getConfiguration().addEventType("ABean", SupportBean_S0.class);
 }
 private Configuration getConfiguration() throws URISyntaxException {
   Configuration configuration = SupportConfigFactory.getConfiguration();
   configuration.addPlugInEventRepresentation(
       new URI("type://properties"), MyPlugInEventRepresentation.class.getName(), "r3");
   configuration.addPlugInEventRepresentation(
       new URI("type://properties/test1"), MyPlugInEventRepresentation.class.getName(), "r1");
   configuration.addPlugInEventRepresentation(
       new URI("type://properties/test2"), MyPlugInEventRepresentation.class.getName(), "r2");
   return configuration;
 }
Exemplo n.º 13
0
 public void setUp() {
   epService =
       EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
   epService.initialize();
   epService
       .getEPAdministrator()
       .getConfiguration()
       .addImport(DefaultSupportCaptureOp.class.getName());
   MyExceptionHandler.getContexts().clear();
 }
  private EPServiceProvider getEngineInitialized(
      String name, String[] propertyNames, Object[] propertyTypes) {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    if (name != null) {
      configuration.addEventType(name, propertyNames, propertyTypes);
    }

    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    return epService;
  }
Exemplo n.º 15
0
  public void testSchemaXMLWSchemaWithAll() throws Exception {
    Configuration config = SupportConfigFactory.getConfiguration();
    ConfigurationEventTypeXMLDOM eventTypeMeta = new ConfigurationEventTypeXMLDOM();
    eventTypeMeta.setRootElementName("event-page-visit");
    String schemaUri =
        TestSchemaXMLEvent.class
            .getClassLoader()
            .getResource(CLASSLOADER_SCHEMA_WITH_ALL_URI)
            .toString();
    eventTypeMeta.setSchemaResource(schemaUri);
    eventTypeMeta.addNamespacePrefix("ss", "samples:schemas:simpleSchemaWithAll");
    eventTypeMeta.addXPathProperty("url", "/ss:event-page-visit/ss:url", XPathConstants.STRING);
    config.addEventType("PageVisitEvent", eventTypeMeta);

    epService = EPServiceProviderManager.getProvider("TestSchemaXML", config);
    epService.initialize();
    updateListener = new SupportUpdateListener();

    // url='page4'
    String text = "select a.url as sesja from pattern [ every a=PageVisitEvent(url='page1') ]";
    EPStatement stmt = epService.getEPAdministrator().createEPL(text);
    stmt.addListener(updateListener);

    SupportXML.sendEvent(
        epService.getEPRuntime(),
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            + "<event-page-visit xmlns=\"samples:schemas:simpleSchemaWithAll\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"samples:schemas:simpleSchemaWithAll simpleSchemaWithAll.xsd\">\n"
            + "<url>page1</url>"
            + "</event-page-visit>");
    EventBean theEvent = updateListener.getLastNewData()[0];
    assertEquals("page1", theEvent.get("sesja"));
    updateListener.reset();

    SupportXML.sendEvent(
        epService.getEPRuntime(),
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            + "<event-page-visit xmlns=\"samples:schemas:simpleSchemaWithAll\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"samples:schemas:simpleSchemaWithAll simpleSchemaWithAll.xsd\">\n"
            + "<url>page2</url>"
            + "</event-page-visit>");
    assertFalse(updateListener.isInvoked());

    EventType type =
        epService.getEPAdministrator().createEPL("select * from PageVisitEvent").getEventType();
    EPAssertionUtil.assertEqualsAnyOrder(
        new Object[] {
          new EventPropertyDescriptor(
              "sessionId", Node.class, null, false, false, false, false, true),
          new EventPropertyDescriptor(
              "customerId", Node.class, null, false, false, false, false, true),
          new EventPropertyDescriptor("url", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor("method", Node.class, null, false, false, false, false, true),
        },
        type.getPropertyDescriptors());
  }
Exemplo n.º 16
0
  public void setUp() {
    listener = new SupportUpdateListener();
    priceLast3StatsListener = new SupportUpdateListener();
    priceAllStatsListener = new SupportUpdateListener();
    volumeLast3StatsListener = new SupportUpdateListener();
    volumeAllStatsListener = new SupportUpdateListener();

    epService =
        EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();
  }
Exemplo n.º 17
0
  public void setUp() {

    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("Bean", SupportBean_Container.class);
    config.addEventType("SupportCollection", SupportCollection.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
  }
Exemplo n.º 18
0
 public void setUp() {
   epService =
       EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
   epService.initialize();
   if (InstrumentationHelper.ENABLED) {
     InstrumentationHelper.startTest(epService, this.getClass(), getName());
   }
   epService
       .getEPAdministrator()
       .getConfiguration()
       .addImport(DefaultSupportCaptureOp.class.getName());
 }
Exemplo n.º 19
0
 public void setUp() {
   Configuration config = SupportConfigFactory.getConfiguration();
   config.addEventType("S0", SupportBean_S0.class);
   config.addEventType("S1", SupportBean_S1.class);
   config.addEventType("S2", SupportBean_S2.class);
   config.addEventType("S3", SupportBean_S3.class);
   config.addEventType("S4", SupportBean_S4.class);
   config.addEventType("S5", SupportBean_S5.class);
   epService = EPServiceProviderManager.getDefaultProvider(config);
   epService.initialize();
   listener = new SupportUpdateListener();
 }
Exemplo n.º 20
0
 public void setUp() {
   epService =
       EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
   epService.initialize();
   for (Class clazz :
       new Class[] {SupportBean.class, SupportBean_S0.class, SupportBean_S1.class}) {
     epService.getEPAdministrator().getConfiguration().addEventType(clazz);
   }
   listener = new SupportUpdateListener();
   if (InstrumentationHelper.ENABLED) {
     InstrumentationHelper.startTest(epService, this.getClass(), getName());
   }
 }
Exemplo n.º 21
0
  public void setUp() {
    listener = new SupportUpdateListener();

    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addPlugInSingleRowFunction(
        "power3", MySingleRowFunction.class.getName(), "computePower3");
    configuration.addPlugInSingleRowFunction(
        "chainTop", MySingleRowFunction.class.getName(), "getChainTop");
    configuration.addPlugInSingleRowFunction(
        "surroundx", MySingleRowFunction.class.getName(), "surroundx");
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
  }
Exemplo n.º 22
0
  public void setUp() {
    listener = new SupportUpdateListener();
    epService =
        EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();

    epService
        .getEPAdministrator()
        .getConfiguration()
        .addEventType("SupportBean", SupportBean.class);
    epService
        .getEPAdministrator()
        .getConfiguration()
        .addEventType("ArrayBean", SupportBeanArrayCollMap.class);
  }
Exemplo n.º 23
0
  public void testFailedValidation() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addPlugInSingleRowFunction(
        "singlerow", MySingleRowFunctionTwo.class.getName(), "testSingleRow");
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();

    try {
      String text = "select singlerow('a', 'b') from " + SupportBean.class.getName();
      epService.getEPAdministrator().createEPL(text);
    } catch (EPStatementException ex) {
      assertEquals(
          "Error starting statement: Could not find static method named 'testSingleRow' in class 'com.espertech.esper.regression.client.MySingleRowFunctionTwo' with matching parameter number and expected parameter type(s) 'String, String' (nearest match found was 'testSingleRow' taking type(s) 'String, int') [select singlerow('a', 'b') from com.espertech.esper.support.bean.SupportBean]",
          ex.getMessage());
    }
  }
  public void testObjectArrayInheritanceInitTime() {
    Configuration configuration = SupportConfigFactory.getConfiguration();

    configuration.addEventType("RootEvent", new String[] {"base"}, new Object[] {String.class});
    configuration.addEventType("Sub1Event", new String[] {"sub1"}, new Object[] {String.class});
    configuration.addEventType("Sub2Event", new String[] {"sub2"}, new Object[] {String.class});
    configuration.addEventType("SubAEvent", new String[] {"suba"}, new Object[] {String.class});
    configuration.addEventType("SubBEvent", new String[] {"subb"}, new Object[] {String.class});

    configuration.addObjectArraySuperType("Sub1Event", "RootEvent");
    configuration.addObjectArraySuperType("Sub2Event", "RootEvent");
    configuration.addObjectArraySuperType("SubAEvent", "Sub1Event");
    configuration.addObjectArraySuperType("SubBEvent", "SubAEvent");

    try {
      configuration.addObjectArraySuperType("SubBEvent", "Sub2Event");
      fail();
    } catch (ConfigurationException ex) {
      assertEquals("Object-array event types may not have multiple supertypes", ex.getMessage());
    }

    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }

    EPAssertionUtil.assertEqualsExactOrder(
        new Object[] {
          new EventPropertyDescriptor(
              "base", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor(
              "sub1", String.class, null, false, false, false, false, false),
          new EventPropertyDescriptor(
              "suba", String.class, null, false, false, false, false, false),
        },
        ((EPServiceProviderSPI) epService)
            .getEventAdapterService()
            .getExistsTypeByName("SubAEvent")
            .getPropertyDescriptors());

    runObjectArrInheritanceAssertion(epService);

    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.endTest();
    }
  }
  public void testConfiguredViaPropsAndXML() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration
        .getEngineDefaults()
        .getEventMeta()
        .setDefaultEventRepresentation(Configuration.EventRepresentation.OBJECTARRAY);
    configuration.addEventType(
        "MyOAType",
        "bean,theString,map".split(","),
        new Object[] {SupportBean.class.getName(), "string", "java.util.Map"});

    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }

    EventType eventType =
        epService.getEPAdministrator().getConfiguration().getEventType("MyOAType");
    assertEquals(Object[].class, eventType.getUnderlyingType());
    assertEquals(String.class, eventType.getPropertyType("theString"));
    assertEquals(Map.class, eventType.getPropertyType("map"));
    assertEquals(SupportBean.class, eventType.getPropertyType("bean"));

    EPStatement stmt =
        epService
            .getEPAdministrator()
            .createEPL("select bean, theString, map('key'), bean.theString from MyOAType");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    assertEquals(Object[].class, stmt.getEventType().getUnderlyingType());

    SupportBean bean = new SupportBean("E1", 1);
    epService
        .getEPRuntime()
        .sendEvent(
            new Object[] {bean, "abc", Collections.singletonMap("key", "value")}, "MyOAType");
    EPAssertionUtil.assertProps(
        listener.assertOneGetNew(),
        "bean,theString,map('key'),bean.theString".split(","),
        new Object[] {bean, "abc", "value", "E1"});

    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.endTest();
    }
  }
Exemplo n.º 26
0
  public void setUp() {
    Map<String, Object> typeInfo = new HashMap<String, Object>();
    typeInfo.put("id", String.class);
    typeInfo.put("p00", int.class);

    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MapS0", typeInfo);
    config.addEventType("MapS1", typeInfo);

    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
  }
  public void setUp() throws Exception {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType(MyEventA.class);
    configuration.addEventType(MyEventB.class);
    service = EPServiceProviderManager.getDefaultProvider(configuration);
    service.initialize();

    String epl =
        "create window A.std:unique(key) as MyEventA;\n"
            + "create window B.std:unique(key) as MyEventB;\n"
            + "insert into A select * from MyEventA;\n"
            + "insert into B select * from MyEventB;\n"
            + "\n"
            + "@Name('stmt') select sum(A.data) as aTotal,sum(B.data) as bTotal "
            + "from A unidirectional, B where A.key = B.key;\n";
    EPDeploymentAdmin deployment = service.getEPAdministrator().getDeploymentAdmin();
    deployment.parseDeploy(epl);
  }
Exemplo n.º 28
0
  private Configuration getConfig(
      long engineMetricInterval, long stmtMetricInterval, boolean shareViews) {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.getEngineDefaults().getViewResources().setShareViews(shareViews);
    configuration.getEngineDefaults().getMetricsReporting().setEnableMetricsReporting(true);
    configuration.getEngineDefaults().getMetricsReporting().setThreading(false);
    configuration.getEngineDefaults().getMetricsReporting().setEngineInterval(engineMetricInterval);
    configuration
        .getEngineDefaults()
        .getMetricsReporting()
        .setStatementInterval(stmtMetricInterval);

    configuration.addImport(MyMetricFunctions.class.getName());

    configuration.addEventType("SupportBean", SupportBean.class);

    return configuration;
  }
  public void testVariableMoreThenOnce() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MyEvent", SupportRecogBean.class);
    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();

    String[] fields = "a0,b,a1".split(",");
    String text =
        "select * from MyEvent.win:keepall() "
            + "match_recognize ("
            + "  measures A[0].theString as a0, B.theString as b, A[1].theString as a1 "
            + "  all matches "
            + "  after match skip to next row "
            + "  pattern ( A B A ) "
            + "  define "
            + "    A as (A.value = 1),"
            + "    B as (B.value = 2)"
            + ")";

    EPStatement stmt = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E1", 3));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E2", 1));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E3", 2));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E4", 5));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E5", 1));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E6", 2));
    assertFalse(listener.isInvoked());
    assertFalse(stmt.iterator().hasNext());

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E7", 1));
    EPAssertionUtil.assertPropsPerRow(
        listener.getAndResetLastNewData(), fields, new Object[][] {{"E5", "E6", "E7"}});
    EPAssertionUtil.assertPropsPerRow(stmt.iterator(), fields, new Object[][] {{"E5", "E6", "E7"}});

    epService.getEPRuntime().sendEvent(new SupportRecogBean("E8", 2));
    epService.getEPRuntime().sendEvent(new SupportRecogBean("E9", 1));
    EPAssertionUtil.assertPropsPerRow(
        listener.getAndResetLastNewData(), fields, new Object[][] {{"E7", "E8", "E9"}});
    EPAssertionUtil.assertPropsPerRow(
        stmt.iterator(), fields, new Object[][] {{"E5", "E6", "E7"}, {"E7", "E8", "E9"}});
  }
  public void testObjectArrayInheritanceRuntime() {
    Configuration configuration = SupportConfigFactory.getConfiguration();

    EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }

    ConfigurationOperations configOps = epService.getEPAdministrator().getConfiguration();
    configOps.addEventType("RootEvent", new String[] {"base"}, new Object[] {String.class});
    configOps.addEventType(
        "Sub1Event",
        new String[] {"sub1"},
        new Object[] {String.class},
        new ConfigurationEventTypeObjectArray(Collections.singleton("RootEvent")));
    configOps.addEventType(
        "Sub2Event",
        new String[] {"sub2"},
        new Object[] {String.class},
        new ConfigurationEventTypeObjectArray(Collections.singleton("RootEvent")));
    configOps.addEventType(
        "SubAEvent",
        new String[] {"suba"},
        new Object[] {String.class},
        new ConfigurationEventTypeObjectArray(Collections.singleton("Sub1Event")));
    configOps.addEventType(
        "SubBEvent",
        new String[] {"subb"},
        new Object[] {String.class},
        new ConfigurationEventTypeObjectArray(Collections.singleton("SubAEvent")));

    runObjectArrInheritanceAssertion(epService);

    if (InstrumentationHelper.ENABLED) {
      InstrumentationHelper.endTest();
    }
  }