Exemplo n.º 1
0
  protected void setUp() {
    eventService = SupportEventAdapterService.getService();
    EventType underlyingEventTypeSimple =
        eventService.addBeanType("underlyingSimpleBean", SupportBeanSimple.class, true, true, true);
    EventType underlyingEventTypeCombined =
        eventService.addBeanType(
            "underlyingCombinedBean", SupportBeanCombinedProps.class, true, true, true);

    Map<String, Object> typeMap = new HashMap<String, Object>();
    typeMap.put("string", String.class);
    typeMap.put("int", Integer.class);

    EventTypeMetadata meta = EventTypeMetadata.createWrapper("test", true, false, false);
    eventTypeSimple =
        new WrapperEventType(meta, "mytype", 1, underlyingEventTypeSimple, typeMap, eventService);
    eventTypeCombined =
        new WrapperEventType(meta, "mytype", 1, underlyingEventTypeCombined, typeMap, eventService);
    properties = new HashMap<String, Object>();
    properties.put("string", "xx");
    properties.put("int", 11);

    EventBean wrappedSimple = eventService.adapterForBean(new SupportBeanSimple("eventString", 0));
    eventBeanSimple =
        eventService.adapterForTypedWrapper(wrappedSimple, properties, eventTypeSimple);

    EventBean wrappedCombined =
        eventService.adapterForBean(SupportBeanCombinedProps.makeDefaultBean());
    eventBeanCombined =
        eventService.adapterForTypedWrapper(wrappedCombined, properties, eventTypeCombined);
  }
  private Object[] getTestDataTwo() {
    Map<String, Object> levelThree =
        makeMap(
            new Object[][] {
              {"simpleThree", 4000L},
              {"objectThree", new SupportBean_B("B1")},
            });

    Map<String, Object> levelTwo =
        makeMap(
            new Object[][] {
              {"simpleTwo", 300},
              {"objectTwo", SupportBeanCombinedProps.makeDefaultBean()},
              {"nodefmapTwo", makeMap(new Object[][] {{"key3", "val3"}})},
              {"mapTwo", levelThree},
            });

    Map<String, Object> levelOne =
        makeMap(
            new Object[][] {
              {"simpleOne", 10},
              {"objectOne", SupportBeanComplexProps.makeDefaultBean()},
              {"nodefmapOne", makeMap(new Object[][] {{"key2", "val2"}})},
              {"mapOne", levelTwo}
            });

    Object[] levelZero = {
      "abc", new SupportBean_A("A1"), makeMap(new Object[][] {{"key1", "val1"}}), levelOne
    };
    return levelZero;
  }
Exemplo n.º 3
0
  public void testPerfPropertyAccess() {
    String methodName = ".testPerfPropertyAccess";

    String joinStatement =
        "select * from "
            + SupportBeanCombinedProps.class.getName()
            + ".win:length(1)"
            + " where indexed[0].mapped('a').value = 'dummy'";

    joinView = epService.getEPAdministrator().createEPL(joinStatement);
    joinView.addListener(updateListener);

    // Send events for each stream
    SupportBeanCombinedProps event = SupportBeanCombinedProps.makeDefaultBean();
    log.info(methodName + " Sending events");

    long startTime = System.currentTimeMillis();
    for (int i = 0; i < 10000; i++) {
      sendEvent(event);
    }
    log.info(methodName + " Done sending events");

    long endTime = System.currentTimeMillis();
    log.info(methodName + " delta=" + (endTime - startTime));

    // Stays at 250, below 500ms
    assertTrue((endTime - startTime) < 1000);
  }