public void testAnyTypeStaggered() {
    // test insert into staggered with map
    ConfigurationVariantStream configVariantStream = new ConfigurationVariantStream();
    configVariantStream.setTypeVariance(ConfigurationVariantStream.TypeVariance.ANY);
    epService
        .getEPAdministrator()
        .getConfiguration()
        .addVariantStream("VarStream", configVariantStream);
    epService
        .getEPAdministrator()
        .getConfiguration()
        .addEventType("SupportBean", SupportBean.class);
    epService
        .getEPAdministrator()
        .getConfiguration()
        .addEventType("SupportMarketDataBean", SupportMarketDataBean.class);

    epService
        .getEPAdministrator()
        .createEPL("insert into MyStream select theString, intPrimitive from SupportBean");
    epService
        .getEPAdministrator()
        .createEPL("insert into VarStream select theString as abc from MyStream");
    epService
        .getEPAdministrator()
        .createEPL("@Name('Target') select * from VarStream.win:keepall()");

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));

    EventBean[] arr =
        EPAssertionUtil.iteratorToArray(
            epService.getEPAdministrator().getStatement("Target").iterator());
    EPAssertionUtil.assertPropsPerRow(arr, new String[] {"abc"}, new Object[][] {{"E1"}});

    epService
        .getEPAdministrator()
        .createEPL("insert into MyStream2 select feed from SupportMarketDataBean");
    epService
        .getEPAdministrator()
        .createEPL("insert into VarStream select feed as abc from MyStream2");

    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("IBM", 1, 1L, "E2"));

    arr =
        EPAssertionUtil.iteratorToArray(
            epService.getEPAdministrator().getStatement("Target").iterator());
    EPAssertionUtil.assertPropsPerRow(arr, new String[] {"abc"}, new Object[][] {{"E1"}, {"E2"}});
  }
示例#2
0
  public void testReclaimAgedHint() {
    epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
    epService
        .getEPAdministrator()
        .getConfiguration()
        .addEventType("SupportBean", SupportBean.class);
    String epl =
        "@Hint('reclaim_group_aged=5,reclaim_group_freq=1') "
            + "select * from SupportBean.std:groupwin(theString).win:keepall()";
    EPStatement stmt = epService.getEPAdministrator().createEPL(epl);

    int maxSlots = 10;
    int maxEventsPerSlot = 1000;
    for (int timeSlot = 0; timeSlot < maxSlots; timeSlot++) {
      epService.getEPRuntime().sendEvent(new CurrentTimeEvent(timeSlot * 1000 + 1));

      for (int i = 0; i < maxEventsPerSlot; i++) {
        epService.getEPRuntime().sendEvent(new SupportBean("E" + timeSlot, 0));
      }
    }

    EventBean[] iterator = EPAssertionUtil.iteratorToArray(stmt.iterator());
    assertTrue(iterator.length <= 6 * maxEventsPerSlot);
  }