Example #1
0
  @Override
  protected void init() {
    super.init();

    counterSupport.init(this);

    loadingErrors = false;

    String[] limitStrings = getAttribute(LIMITS_ATTRIBUTE, "").split(";");
    for (String limit : limitStrings) {
      String[] parts = limit.split("=", 2);
      try {
        if (parts.length == 2) setLimit(parts[0], Long.parseLong(parts[1]));
      } catch (NumberFormatException e) {
        // Ignore
      }
    }

    createComponents();
    createConnections();
    removeBadComponents();
    removeBadConnections();

    addEventListener(BaseEvent.class, new ActionListener());

    testRunner.registerTask(executionTask, Phase.START, Phase.PRE_STOP, Phase.STOP);

    // timer.scheduleAtFixedRate( timerTask, 1000, 1000 );

    statisticHolderSupport.init();
    counterStatisticSupport.init();
  }
Example #2
0
  public CanvasItemImpl(Config config, CounterSupport counterSupport) {
    super(config);

    lastSavedHash = DigestUtils.md5Hex(config.xmlText());

    this.counterSupport = counterSupport;

    scheduler = BeanInjector.getBean(ScheduledExecutorService.class);
    componentRegistry = BeanInjector.getBean(ComponentRegistry.class);

    componentList = CollectionEventSupport.of(this, COMPONENTS);
    connectionList = CollectionEventSupport.of(this, CONNECTIONS);

    statisticHolderSupport = new StatisticHolderSupport(this);
    counterStatisticSupport = new CounterStatisticSupport(this);

    StatisticVariable.Mutable requestVariable =
        statisticHolderSupport.addStatisticVariable(REQUEST_VARIABLE);
    statisticHolderSupport.addStatisticsWriter(CounterStatisticsWriter.TYPE, requestVariable);
    counterStatisticSupport.addCounterVariable(REQUEST_COUNTER, requestVariable);

    StatisticVariable.Mutable failuresVariable =
        statisticHolderSupport.addStatisticVariable(FAILURE_VARIABLE);
    statisticHolderSupport.addStatisticsWriter(CounterStatisticsWriter.TYPE, failuresVariable);
    counterStatisticSupport.addCounterVariable(FAILURE_COUNTER, failuresVariable);

    StatisticVariable.Mutable assertionFailuresVariable =
        statisticHolderSupport.addStatisticVariable(ASSERTION_FAILURE_VARIABLE);
    statisticHolderSupport.addStatisticsWriter(
        CounterStatisticsWriter.TYPE, assertionFailuresVariable);
    counterStatisticSupport.addCounterVariable(
        ASSERTION_FAILURE_COUNTER, assertionFailuresVariable);

    StatisticVariable.Mutable requestFailuresVariable =
        statisticHolderSupport.addStatisticVariable(REQUEST_FAILURE_VARIABLE);
    statisticHolderSupport.addStatisticsWriter(
        CounterStatisticsWriter.TYPE, requestFailuresVariable);
    counterStatisticSupport.addCounterVariable(REQUEST_FAILURE_COUNTER, requestFailuresVariable);

    abortOnFinish = createProperty(ABORT_ON_FINISH_PROPERTY, Boolean.class, false);
  }