Jagger
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
ExampleLoadScenarioListener.java
Go to the documentation of this file.
1 package com.griddynamics.jagger.engine.e1.collector.loadscenario;
2 
3 import com.griddynamics.jagger.engine.e1.Provider;
4 import com.griddynamics.jagger.engine.e1.services.ServicesAware;
5 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory;
7 
16 public class ExampleLoadScenarioListener extends ServicesAware implements Provider<LoadScenarioListener> {
17 
18  private final static Logger log = LoggerFactory.getLogger(ExampleLoadScenarioListener.class);
19 
20  @Override
21  protected void init() {
22  super.init();
23  }
24 
25  @Override
27  return new LoadScenarioListener() {
28  @Override
29  public void onStart(LoadScenarioInfo loadScenarioInfo) {
30  log.info("Started {} session execution", loadScenarioInfo.getSessionId());
31  }
32 
33  @Override
34  public void onStop(LoadScenarioInfo loadScenarioInfo) {
35  log.info("{} session execution took {}ms", loadScenarioInfo.getSessionId(), loadScenarioInfo.getDuration());
36 
37  getSessionInfoService().appendToComment("We can add comment to the session. It will be stored together with the test results");
38  }
39  };
40  }
41 }