summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoredyta <edyta.krukowska@nokia.com>2020-04-17 14:55:56 +0200
committeredyta <edyta.krukowska@nokia.com>2020-04-17 16:15:39 +0200
commit70601d3f869cc9385d69afafb1f5a6235fd9cb2a (patch)
tree80d84e871be6e604116b57bd582c6873a2d6f02a
parent8566d36ed85a784d4f552f4b0e0dffc472deca34 (diff)
Fix sonar issue EventScheduler
Issue-ID: INT-1517 Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com> Change-Id: I77f0858d83aa1ccaab735bff9515366374ba4179
-rw-r--r--pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/scheduler/EventScheduler.java63
1 files changed, 31 insertions, 32 deletions
diff --git a/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/scheduler/EventScheduler.java b/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/scheduler/EventScheduler.java
index 08e24f8..bd2c577 100644
--- a/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/scheduler/EventScheduler.java
+++ b/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/scheduler/EventScheduler.java
@@ -20,22 +20,7 @@
package org.onap.pnfsimulator.simulator.scheduler;
-import static org.onap.pnfsimulator.simulator.scheduler.EventJob.BODY;
-import static org.onap.pnfsimulator.simulator.scheduler.EventJob.CLIENT_ADAPTER;
-import static org.onap.pnfsimulator.simulator.scheduler.EventJob.EVENT_ID;
-import static org.onap.pnfsimulator.simulator.scheduler.EventJob.KEYWORDS_HANDLER;
-import static org.onap.pnfsimulator.simulator.scheduler.EventJob.TEMPLATE_NAME;
-import static org.onap.pnfsimulator.simulator.scheduler.EventJob.VES_URL;
-import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
-
import com.google.gson.JsonObject;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.security.GeneralSecurityException;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
import org.onap.pnfsimulator.simulator.KeywordsHandler;
import org.onap.pnfsimulator.simulator.client.HttpClientAdapterImpl;
import org.onap.pnfsimulator.simulator.client.utils.ssl.SSLAuthenticationHelper;
@@ -51,23 +36,37 @@ import org.quartz.TriggerBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static org.onap.pnfsimulator.simulator.scheduler.EventJob.BODY;
+import static org.onap.pnfsimulator.simulator.scheduler.EventJob.CLIENT_ADAPTER;
+import static org.onap.pnfsimulator.simulator.scheduler.EventJob.EVENT_ID;
+import static org.onap.pnfsimulator.simulator.scheduler.EventJob.KEYWORDS_HANDLER;
+import static org.onap.pnfsimulator.simulator.scheduler.EventJob.TEMPLATE_NAME;
+import static org.onap.pnfsimulator.simulator.scheduler.EventJob.VES_URL;
+import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
+
@Component
public class EventScheduler {
private final Scheduler scheduler;
private final KeywordsHandler keywordsHandler;
- private final SSLAuthenticationHelper SSLAuthenticationHelper;
+ private final SSLAuthenticationHelper sslAuthenticationHelper;
@Autowired
- public EventScheduler(Scheduler scheduler, KeywordsHandler keywordsHandler, SSLAuthenticationHelper SSLAuthenticationHelper) {
+ public EventScheduler(Scheduler scheduler, KeywordsHandler keywordsHandler, SSLAuthenticationHelper sslAuthenticationHelper) {
this.scheduler = scheduler;
this.keywordsHandler = keywordsHandler;
- this.SSLAuthenticationHelper = SSLAuthenticationHelper;
+ this.sslAuthenticationHelper = sslAuthenticationHelper;
}
public String scheduleEvent(String vesUrl, Integer repeatInterval, Integer repeatCount,
- String templateName, String eventId, JsonObject body)
+ String templateName, String eventId, JsonObject body)
throws SchedulerException, IOException, GeneralSecurityException {
JobDetail jobDetail = createJobDetail(vesUrl, templateName, eventId, body);
@@ -89,10 +88,10 @@ public class EventScheduler {
private SimpleTrigger createTrigger(int interval, int repeatCount) {
return TriggerBuilder.newTrigger()
- .withSchedule(simpleSchedule()
- .withIntervalInSeconds(interval)
- .withRepeatCount(repeatCount - 1))
- .build();
+ .withSchedule(simpleSchedule()
+ .withIntervalInSeconds(interval)
+ .withRepeatCount(repeatCount - 1))
+ .build();
}
private JobDetail createJobDetail(String vesUrl, String templateName, String eventId, JsonObject body) throws IOException, GeneralSecurityException {
@@ -102,20 +101,20 @@ public class EventScheduler {
jobDataMap.put(EVENT_ID, eventId);
jobDataMap.put(KEYWORDS_HANDLER, keywordsHandler);
jobDataMap.put(BODY, body);
- jobDataMap.put(CLIENT_ADAPTER, new HttpClientAdapterImpl(vesUrl, SSLAuthenticationHelper));
+ jobDataMap.put(CLIENT_ADAPTER, new HttpClientAdapterImpl(vesUrl, sslAuthenticationHelper));
return JobBuilder
- .newJob(EventJob.class)
- .withDescription(templateName)
- .usingJobData(jobDataMap)
- .build();
+ .newJob(EventJob.class)
+ .withDescription(templateName)
+ .usingJobData(jobDataMap)
+ .build();
}
private List<JobKey> getActiveJobsKeys() throws SchedulerException {
return scheduler.getCurrentlyExecutingJobs()
- .stream()
- .map(JobExecutionContext::getJobDetail)
- .map(JobDetail::getKey)
- .collect(Collectors.toList());
+ .stream()
+ .map(JobExecutionContext::getJobDetail)
+ .map(JobDetail::getKey)
+ .collect(Collectors.toList());
}
}