From 940a5b13ffab3b3a337cada6e7dadb4688cc9d63 Mon Sep 17 00:00:00 2001 From: siarhei_hrabko Date: Mon, 8 Jul 2024 12:49:01 +0300 Subject: [PATCH] EPMRPP-92477 rename variable --- .../jobs/statistics/DefectUpdateStatisticsJob.java | 12 ++++++------ src/main/resources/application.yml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/epam/reportportal/jobs/statistics/DefectUpdateStatisticsJob.java b/src/main/java/com/epam/reportportal/jobs/statistics/DefectUpdateStatisticsJob.java index a193ed8..233ce70 100644 --- a/src/main/java/com/epam/reportportal/jobs/statistics/DefectUpdateStatisticsJob.java +++ b/src/main/java/com/epam/reportportal/jobs/statistics/DefectUpdateStatisticsJob.java @@ -62,7 +62,7 @@ public class DefectUpdateStatisticsJob extends BaseJob { private final RestTemplate restTemplate; private final String measurementId; - private final String apiSecret; + private final String gaId; /** @@ -73,11 +73,11 @@ public class DefectUpdateStatisticsJob extends BaseJob { @Autowired public DefectUpdateStatisticsJob(JdbcTemplate jdbcTemplate, @Value("${rp.environment.variable.ga.measurementId}") String measurementId, - @Value("${rp.environment.variable.ga.apiSecret}") String apiSecret, + @Value("${rp.environment.variable.ga.id}") String gaId, NamedParameterJdbcTemplate namedParameterJdbcTemplate) { super(jdbcTemplate); this.measurementId = measurementId; - this.apiSecret = apiSecret; + this.gaId = gaId; this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; this.restTemplate = new RestTemplate(); } @@ -92,9 +92,9 @@ public DefectUpdateStatisticsJob(JdbcTemplate jdbcTemplate, @Transactional public void execute() { LOGGER.info("Start sending items defect update statistics"); - if (StringUtils.isEmpty(measurementId) || StringUtils.isEmpty(apiSecret)) { + if (StringUtils.isEmpty(measurementId) || StringUtils.isEmpty(gaId)) { LOGGER.info( - "Both 'measurementId' and 'apiSecret' environment variables should be provided in order to run the job 'defectUpdateStatisticsJob'"); + "Both 'measurementId' and 'gaId' environment variables should be provided in order to run the job 'defectUpdateStatisticsJob'"); return; } @@ -179,7 +179,7 @@ private void sendRequest(JSONObject requestBody) { headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity request = new HttpEntity<>(requestBody.toString(), headers); - String url = String.format(GA_URL, measurementId, apiSecret); + String url = String.format(GA_URL, measurementId, gaId); var response = restTemplate.exchange(url, POST, request, String.class); if (response.getStatusCodeValue() != 204) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 26b2ddd..1723b9c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -40,7 +40,7 @@ rp: ## 1 minute cron: '0 */1 * * * *' ga: - apiSecret: + id: measurementId: cron: '0 0 */24 * * *' executor: