@Test public void testSkipWhenLocalJtlNotExists() { Settings settings = new Settings(); settings.setProperty(JMeterPluginConst.LOCAL_JTL_PATH_PROPERTY, "classpath:/notexistingpath/test.jtl.xml"); JMeterSensor sensor = new JMeterSensor(settings); Project project = new Project("mytestproject","","notexisting"); Assert.assertNull(sensor.getGlobalSummary(project)); }
protected GlobalSummary getGlobalSummary(Project project) { GlobalSummary globalSummary = null; String localJtlPath = getLocalJtlFilePath(project); String projectName = project.getName(); try { if (!StringUtils.isBlank(localJtlPath)) { LOG.info("Getting JMeter results from local file"); ConfigInfo configInfo = new ConfigInfo(localJtlPath); configService.setTestConfigInfo(projectName, configInfo); globalSummary = metricService.getGlobalSummary(projectName); } else { LOG.info("Getting JMeter results from remote server"); configService.setTestConfigInfo(projectName, null); JMeterReportClient client = getReportClient(project); String config = getTestConfigName(project); globalSummary = client.getGlobalSummary(config); } } catch(JTLFileNotFoundException e) { skipIfNotJtlOrThrowException(e); } catch(ServerErrorException e) { skipIfNotJtlOrThrowException(e); } return globalSummary; }
JMeterSensor implements Sensor { protected GlobalSummary getGlobalSummary(Project project) { GlobalSummary globalSummary = null; String localJtlPath = getLocalJtlFilePath(project); String projectName = project.getName(); try { if (!StringUtils.isBlank(localJtlPath)) { LOG.info("Getting JMeter results from local file"); ConfigInfo configInfo = new ConfigInfo(localJtlPath); configService.setTestConfigInfo(projectName, configInfo); globalSummary = metricService.getGlobalSummary(projectName); } else { LOG.info("Getting JMeter results from remote server"); configService.setTestConfigInfo(projectName, null); JMeterReportClient client = getReportClient(project); String config = getTestConfigName(project); globalSummary = client.getGlobalSummary(config); } } catch(JTLFileNotFoundException e) { skipIfNotJtlOrThrowException(e); } catch(ServerErrorException e) { skipIfNotJtlOrThrowException(e); } return globalSummary; } }
JMeterSensor implements Sensor { protected GlobalSummary getGlobalSummary(Project project) { GlobalSummary globalSummary = null; String localJtlPath = getLocalJtlFilePath(project); String projectName = project.getName(); try { if (!StringUtils.isBlank(localJtlPath)) { LOG.info("Getting JMeter results from local file"); ConfigInfo configInfo = new ConfigInfo(localJtlPath); configService.setTestConfigInfo(projectName, configInfo); globalSummary = metricService.getGlobalSummary(projectName); } else { LOG.info("Getting JMeter results from remote server"); configService.setTestConfigInfo(projectName, null); JMeterReportClient client = getReportClient(project); String config = getTestConfigName(project); globalSummary = client.getGlobalSummary(config); } } catch(JTLFileNotFoundException e) { skipIfNotJtlOrThrowException(e); } catch(ServerErrorException e) { skipIfNotJtlOrThrowException(e); } return globalSummary; } JMeterSensor(Settings settings); }
JMeterSensor implements Sensor { protected GlobalSummary getGlobalSummary(Project project) { GlobalSummary globalSummary = null; String localJtlPath = getLocalJtlFilePath(project); String projectName = project.getName(); try { if (!StringUtils.isBlank(localJtlPath)) { LOG.info("Getting JMeter results from local file"); ConfigInfo configInfo = new ConfigInfo(localJtlPath); configService.setTestConfigInfo(projectName, configInfo); globalSummary = metricService.getGlobalSummary(projectName); } else { LOG.info("Getting JMeter results from remote server"); configService.setTestConfigInfo(projectName, null); JMeterReportClient client = getReportClient(project); String config = getTestConfigName(project); globalSummary = client.getGlobalSummary(config); } } catch(JTLFileNotFoundException e) { skipIfNotJtlOrThrowException(e); } catch(ServerErrorException e) { skipIfNotJtlOrThrowException(e); } return globalSummary; } JMeterSensor(Settings settings); boolean shouldExecuteOnProject(Project project); void analyse(Project project, SensorContext context); @Override String toString(); }
JMeterSensor implements Sensor { protected GlobalSummary getGlobalSummary(Project project) { GlobalSummary globalSummary = null; String localJtlPath = getLocalJtlFilePath(project); String projectName = project.getName(); try { if (!StringUtils.isBlank(localJtlPath)) { LOG.info("Getting JMeter results from local file"); ConfigInfo configInfo = new ConfigInfo(localJtlPath); configService.setTestConfigInfo(projectName, configInfo); globalSummary = metricService.getGlobalSummary(projectName); } else { LOG.info("Getting JMeter results from remote server"); configService.setTestConfigInfo(projectName, null); JMeterReportClient client = getReportClient(project); String config = getTestConfigName(project); globalSummary = client.getGlobalSummary(config); } } catch(JTLFileNotFoundException e) { skipIfNotJtlOrThrowException(e); } catch(ServerErrorException e) { skipIfNotJtlOrThrowException(e); } return globalSummary; } JMeterSensor(Settings settings); boolean shouldExecuteOnProject(Project project); void analyse(Project project, SensorContext context); @Override String toString();  }