Skip to content

BlazeMeterUtils guide

Artem Fedorov edited this page Dec 7, 2017 · 12 revisions

Constructor parameters

  • apiKeyId and apiKeySecret - BlazeMeter Api Key Id and BlazeMeter Api Key Secret. You can find it under your Settings => API Keys.

  • address - BlazeMeter app address: https://a.blazemeter.com/

  • dataAddress - BlazeMeter data address: https://data.blazemeter.com/

  • notifier - user notifier. Notify to user about main steps of your workflow.

  • logger - logger, for log events of http requests / response etc.

HTTP Client

If you use proxy server see instructions how to set up proxy.

User Notifications

While your application in working you want to notify user about main stages of your process. For it you can implements UserNotifier interface and in notifyInfo(),notifyWarning() and notifyError() methods write in which place you want to write this messages. Also, if you unneeded user notifiers you can keep this method empty. For example write these messages in console:


public class ConsoleUserNotifier implements UserNotifier {
    @Override
    public void notifyInfo(String info) {
        System.out.println(info);
    }

    @Override
    public void notifyWarning(String warn) {
        System.out.println(warn);
    }

    @Override
    public void notifyError(String error) {
        System.out.println(error);
    }
}

Logging

Each developer or application use different logging libraries in their code such as slf4j, java logger, apache-logger etc. We provide an opportunity to save your favorite logging library in your application, because we use just logging wrapper in our code: our Logging interface. Example how add our logs to your log file:


public class BlazeMeterLoggingWrapper implements Logger {

    // or other Logger type.
    public static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BlazeMeterLoggingWrapper.class);

    @Override
    public void debug(String message) {
        logger.debug(message);
    }

    @Override
    public void debug(String message, Throwable throwable) {
        logger.debug(message, throwable);
    }

    @Override
    public void info(String message) {
        logger.info(message);
    }

    @Override
    public void info(String message, Throwable throwable) {
        logger.info(message, throwable);
    }

    @Override
    public void warn(String message) {
        logger.warn(message);
    }

    @Override
    public void warn(String message, Throwable throwable) {
        logger.warn(message, throwable);
    }

    @Override
    public void error(String message) {
        logger.error(message);
    }

    @Override
    public void error(String message, Throwable throwable) {
        logger.error(message, throwable);
    }
}

Clone this wiki locally