diff --git a/scheduling-abstraction-layer/src/main/java/lombok.config b/scheduling-abstraction-layer/src/main/java/lombok.config new file mode 100644 index 0000000000000000000000000000000000000000..a15fe0c443b2c45d6080b6aae07b01bad743647f --- /dev/null +++ b/scheduling-abstraction-layer/src/main/java/lombok.config @@ -0,0 +1 @@ +lombok.log.fieldName = LOGGER \ No newline at end of file diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java index 6010551cf8bcae230c78e79c2f251e1db12985dd..41b93023c92364250d255d7a6c3a0ef8974a8666 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java @@ -7,17 +7,18 @@ import org.activeeon.morphemic.application.deployment.PASchedulerGateway; import org.activeeon.morphemic.infrastructure.deployment.PAConnectorIaasGateway; import org.activeeon.morphemic.infrastructure.deployment.PAResourceManagerGateway; import org.activeeon.morphemic.model.*; -import org.activeeon.morphemic.model.Job; import org.activeeon.morphemic.service.*; import org.apache.commons.lang3.Validate; -//import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONObject; import org.ow2.proactive.resourcemanager.common.event.RMNodeEvent; import org.ow2.proactive.resourcemanager.exception.RMException; import org.ow2.proactive.scheduler.common.exception.NotConnectedException; import org.ow2.proactive.scheduler.common.exception.UserException; -import org.ow2.proactive.scheduler.common.job.*; +import org.ow2.proactive.scheduler.common.job.JobId; +import org.ow2.proactive.scheduler.common.job.JobResult; +import org.ow2.proactive.scheduler.common.job.JobState; +import org.ow2.proactive.scheduler.common.job.TaskFlowJob; import org.ow2.proactive.scheduler.common.task.ScriptTask; import org.ow2.proactive.scheduler.common.task.TaskResult; import org.ow2.proactive.scheduler.common.task.TaskVariable; @@ -53,8 +54,6 @@ public class PAGateway { private static final String SCRIPTS_SEPARATION_GROOVY = NEW_LINE + NEW_LINE + "// Separation script" + NEW_LINE + NEW_LINE; -// private static final Logger LOGGER = Logger.getLogger(PAGateway.class); - /** * Construct a gateway to the ProActive server * @param paURL ProActive server URL (exp: http://try.activeeon.com:8080/) @@ -75,9 +74,9 @@ public class PAGateway { * @throws RMException In case an error happens in the RM */ public void connect(String username, String password) throws LoginException, KeyException, RMException { - log.debug("Connecting to ProActive's Resource Manager"); + LOGGER.debug("Connecting to ProActive's Resource Manager"); resourceManagerGateway.connect(username, password); - log.debug("Connecting to ProActive's Scheduler"); + LOGGER.debug("Connecting to ProActive's Scheduler"); schedulerGateway.connect(username,password); } @@ -86,9 +85,9 @@ public class PAGateway { * @throws NotConnectedException In case the user is not connected */ public void disconnect() throws NotConnectedException { - log.debug("Disconnecting from RM..."); + LOGGER.debug("Disconnecting from RM..."); resourceManagerGateway.disconnect(); - log.debug("Disconnecting from Scheduler..."); + LOGGER.debug("Disconnecting from Scheduler..."); schedulerGateway.disconnect(); } @@ -153,7 +152,7 @@ public class PAGateway { // if (Objects.equals("PortRequired", portEntry.optString("type")) // && portEntry.optBoolean("isMandatory")) { if (Objects.equals("PortRequired", portEntry.optString("type"))) { - log.debug("Mandatory required port detected"); + LOGGER.debug("Mandatory required port detected"); String providedPortName = findProvidedPort(job, portEntry.optString("name")); parentTasks.add(findTaskByProvidedPort(job.optJSONArray("tasks"), providedPortName)); } @@ -206,7 +205,7 @@ public class PAGateway { // Get the job by jobId from the DB Job applicationJob = EntityManagerHelper.find(Job.class, jobId); - log.debug("Dot graph creation for the job: "+applicationJob.toString()); + LOGGER.debug("Dot graph creation for the job: "+applicationJob.toString()); // Write the dot file header dotGraphSyntax.append("digraph g {\n"); @@ -245,7 +244,7 @@ public class PAGateway { // Write the dot file end character dotGraphSyntax.append("}\n"); - log.debug("Dot graph created"); + LOGGER.debug("Dot graph created"); return dotGraphSyntax.toString(); } @@ -281,7 +280,7 @@ public class PAGateway { installation.optJSONObject("environment").keySet().stream().filter(key -> !key.equals("port")).forEach(key -> vars.put(key, installation.optJSONObject("environment").optString(key))); environment.setEnvironmentVars(vars); newTask.setEnvironment(environment); - log.info("vars calculated" + vars); + LOGGER.info("vars calculated" + vars); case "commands": CommandsInstallation commands = new CommandsInstallation(); commands.setPreInstall(installation.optString("preInstall")); @@ -321,7 +320,7 @@ public class PAGateway { EntityManagerHelper.commit(); - log.info("Job created: " + newJob.toString()); + LOGGER.info("Job created: " + newJob.toString()); } /** @@ -402,7 +401,7 @@ public class PAGateway { variables.put("rm_host_name", endpointPa.getHost()); variables.put("pa_port", "" + endpointPa.getPort()); } catch (MalformedURLException e) { - log.error(String.valueOf(e.getStackTrace())); + LOGGER.error(String.valueOf(e.getStackTrace())); } switch (cloud.getCloudProviderName()) { case "aws-ec2": @@ -426,17 +425,17 @@ public class PAGateway { throw new IllegalArgumentException("Spark tasks are not handled yet."); } File fXmlFile = null; - log.info("NodeSource deployment workflow filename: " + filename); + LOGGER.info("NodeSource deployment workflow filename: " + filename); try { fXmlFile = TemporaryFilesHelper.createTempFileFromResource(filename); } catch (IOException ioe) { - log.error("Opening the NS deployment workflow file failed due to : " + Arrays.toString(ioe.getStackTrace())); + LOGGER.error("Opening the NS deployment workflow file failed due to : " + Arrays.toString(ioe.getStackTrace())); } assert fXmlFile != null; - log.info("Submitting the file: " + fXmlFile.toString()); - log.info("Trying to deploy the NS: " + nodeSourceName); + LOGGER.info("Submitting the file: " + fXmlFile.toString()); + LOGGER.info("Trying to deploy the NS: " + nodeSourceName); JobId jobId = schedulerGateway.submit(fXmlFile, variables); - log.info("Job submitted with ID: " + jobId); + LOGGER.info("Job submitted with ID: " + jobId); TemporaryFilesHelper.delete(fXmlFile); } @@ -485,9 +484,9 @@ public class PAGateway { EntityManagerHelper.commit(); } catch (MalformedURLException me) { - log.error(String.valueOf(me.getStackTrace())); + LOGGER.error(String.valueOf(me.getStackTrace())); } - log.info("EMS deployment definition finished."); + LOGGER.info("EMS deployment definition finished."); return failedDeploymentIdentification.get(); } @@ -519,19 +518,19 @@ public class PAGateway { cloud.addDeployedRegion(newDeployment.getLocationName(), newDeployment.getLocationName() + "/" + newDeployment.getImageProviderId()); } - log.info("Node source defined."); + LOGGER.info("Node source defined."); - log.info("Trying to retrieve task: " + node.optString("taskName")); + LOGGER.info("Trying to retrieve task: " + node.optString("taskName")); Task task = EntityManagerHelper.find(Job.class, jobId).findTask(node.optString("taskName")); newDeployment.setPaCloud(cloud); newDeployment.setTask(task); newDeployment.setNumber(task.getNextDeploymentID()); EntityManagerHelper.persist(newDeployment); - log.debug("Deployment created: " + newDeployment.toString()); + LOGGER.debug("Deployment created: " + newDeployment.toString()); EntityManagerHelper.persist(cloud); - log.info("Deployment added to the related cloud: " + cloud.toString()); + LOGGER.info("Deployment added to the related cloud: " + cloud.toString()); task.addDeployment(newDeployment); EntityManagerHelper.persist(task); @@ -539,7 +538,7 @@ public class PAGateway { EntityManagerHelper.commit(); - log.info("Nodes added properly."); + LOGGER.info("Nodes added properly."); return 0; } @@ -601,7 +600,7 @@ public class PAGateway { try { resourceManagerGateway.undeployNodeSource(cloud.getNodeSourceNamePrefix() + entry.getKey(), preempt); } catch (NotConnectedException | PermissionRestException e) { - log.error(String.valueOf(e.getStackTrace())); + LOGGER.error(String.valueOf(e.getStackTrace())); } } }); @@ -626,24 +625,24 @@ public class PAGateway { EntityManagerHelper.begin(); cloudIDs.forEach(cloudID -> { PACloud cloud = EntityManagerHelper.find(PACloud.class, cloudID); - log.info("Removing cloud : " + cloud.toString()); + LOGGER.info("Removing cloud : " + cloud.toString()); for (Map.Entry entry : cloud.getDeployedRegions().entrySet()) { try { String nodeSourceName = cloud.getNodeSourceNamePrefix() + entry.getKey(); - log.info("Removing node source " + nodeSourceName + " from the ProActive server."); + LOGGER.info("Removing node source " + nodeSourceName + " from the ProActive server."); resourceManagerGateway.removeNodeSource(nodeSourceName, preempt); } catch (NotConnectedException | PermissionRestException e) { - log.error(String.valueOf(e.getStackTrace())); + LOGGER.error(String.valueOf(e.getStackTrace())); } } if (cloud.getDeployments() != null) { - log.info("Cleaning deployments from related tasks " + cloud.getDeployments().toString()); + LOGGER.info("Cleaning deployments from related tasks " + cloud.getDeployments().toString()); cloud.getDeployments().forEach(deployment -> deployment.getTask().removeDeployment(deployment)); } - log.info("Cleaning deployments from the cloud entry"); + LOGGER.info("Cleaning deployments from the cloud entry"); cloud.clearDeployments(); EntityManagerHelper.remove(cloud); - log.info("Cloud removed."); + LOGGER.info("Cloud removed."); }); EntityManagerHelper.commit(); } @@ -666,9 +665,9 @@ public class PAGateway { try { String nodeUrl = resourceManagerGateway.searchNodes(Collections.singletonList(nodeName), true).get(0); resourceManagerGateway.removeNode(nodeUrl, preempt); - log.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully."); + LOGGER.info("Node " + nodeName + " with URL: " + nodeUrl + " has been removed successfully."); } catch (NotConnectedException | RestException e) { - log.error(String.valueOf(e.getStackTrace())); + LOGGER.error(String.valueOf(e.getStackTrace())); } }); } @@ -739,13 +738,13 @@ public class PAGateway { newCloud.setDummyInfrastructureName(dummyInfraName); EntityManagerHelper.persist(newCloud); - log.debug("Cloud created: " + newCloud.toString()); + LOGGER.debug("Cloud created: " + newCloud.toString()); savedCloudIds.add(newCloud.getCloudID()); }); EntityManagerHelper.commit(); - log.info("Clouds created properly."); + LOGGER.info("Clouds created properly."); updateNodeCandidatesAsync(savedCloudIds); @@ -857,7 +856,7 @@ public class PAGateway { } private ScriptTask createInfraTask(Task task, Deployment deployment, String taskNameSuffix, String nodeToken) { - log.debug("Acquiring node AWS script file: " + getClass().getResource(File.separator + "acquire_node_aws_script.groovy").toString()); + LOGGER.debug("Acquiring node AWS script file: " + getClass().getResource(File.separator + "acquire_node_aws_script.groovy").toString()); ScriptTask deployNodeTask = PAFactory.createGroovyScriptTaskFromFile("acquireAWSNode_" + task.getName() + taskNameSuffix, "acquire_node_aws_script.groovy"); @@ -879,19 +878,19 @@ public class PAGateway { try { nodeConfigJson += "\", \"portsToOpen\": " + mapper.writeValueAsString(task.getPortsToOpen()) + "}"; } catch (IOException e) { - log.error(String.valueOf(e.getStackTrace())); + LOGGER.error(String.valueOf(e.getStackTrace())); } } variablesMap.put("nodeConfigJson", new TaskVariable("nodeConfigJson", nodeConfigJson, "PA:JSON", false)); variablesMap.put("token", new TaskVariable("token", nodeToken)); - log.debug("Variables to be added to the task: " + variablesMap.toString()); + LOGGER.debug("Variables to be added to the task: " + variablesMap.toString()); deployNodeTask.setVariables(variablesMap); return deployNodeTask; } private ScriptTask createEmsDeploymentTask(EmsDeploymentRequest emsDeploymentRequest, String taskNameSuffix, String nodeToken) { - log.debug("Preparing EMS deployment task"); + LOGGER.debug("Preparing EMS deployment task"); ScriptTask emsDeploymentTask = PAFactory.createComplexScriptTaskFromFiles("emsDeployment" + taskNameSuffix,"emsdeploy_mainscript.groovy","groovy","emsdeploy_prescript.sh","bash","emsdeploy_postscript.sh","bash"); Map variablesMap = emsDeploymentRequest.getWorkflowMap(); emsDeploymentTask.addGenericInformation("NODE_ACCESS_TOKEN", nodeToken); @@ -914,7 +913,7 @@ public class PAGateway { // Let's find the jobId to retrieve the task Optional optJob = Optional.ofNullable(EntityManagerHelper.find(Job.class,jobId)); if (!optJob.isPresent()) { - log.error(String.format("Job [%s] not found", jobId)); + LOGGER.error(String.format("Job [%s] not found", jobId)); return 1; } EntityManagerHelper.refresh(optJob.get()); @@ -922,13 +921,13 @@ public class PAGateway { // Let's find the task: Optional optTask = Optional.ofNullable(optJob.get().findTask(taskName)); if (!optTask.isPresent()) { - log.error(String.format("Task [%s] not found", taskName)); + LOGGER.error(String.format("Task [%s] not found", taskName)); return 1; } // Let's retrieve the deployment to clone if (optTask.get().getDeployments() == null || optTask.get().getDeployments().isEmpty()) { - log.error(String.format("No previous deployment found in task [%s] ",taskName)); + LOGGER.error(String.format("No previous deployment found in task [%s] ",taskName)); return 2; } @@ -976,11 +975,11 @@ public class PAGateway { private void submitScalingOutJob(Job job, String scaledTaskName, List newNodesNumbers) { EntityManagerHelper.refresh(job); - log.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled out."); + LOGGER.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled out."); TaskFlowJob paJob = new TaskFlowJob(); paJob.setName(job.getName() + "_" + scaledTaskName + "_ScaleOut"); - log.info("Job created: " + paJob.toString()); + LOGGER.info("Job created: " + paJob.toString()); EntityManagerHelper.begin(); @@ -1002,7 +1001,7 @@ public class PAGateway { EntityManagerHelper.persist(job); EntityManagerHelper.commit(); - log.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); + LOGGER.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); } private void addAllScriptTasksToPAJob(TaskFlowJob paJob, Task task, List scriptTasks) { @@ -1010,7 +1009,7 @@ public class PAGateway { try { paJob.addTask(scriptTask); } catch (UserException e) { - log.error("Task " + task.getName() + " could not be added due to: " + e.toString()); + LOGGER.error("Task " + task.getName() + " could not be added due to: " + e.toString()); } }); } @@ -1061,11 +1060,11 @@ public class PAGateway { if (scaledTask.getParentTasks().contains(task.getName())) { // When the scaled task is a child the task to be built - log.info("Building task " + task.getName() + " as a parent of task " + scaledTaskName); + LOGGER.info("Building task " + task.getName() + " as a parent of task " + scaledTaskName); scriptTasks.addAll(createParentScaledTask(task, job)); } else { // Using buildScalingInPATask because it handles all the remaining cases - log.info("Moving to building with buildScalingInPATask() method"); + LOGGER.info("Moving to building with buildScalingInPATask() method"); scriptTasks.addAll(buildScalingInPATask(task, job, scaledTaskName)); } @@ -1138,7 +1137,7 @@ public class PAGateway { emsScriptTask.addDependence(scriptTasks.get(scriptTasks.size()-1)); scriptTasks.add(emsScriptTask); }); - log.info("Token added: " + token); + LOGGER.info("Token added: " + token); deployment.setIsDeployed(true); deployment.setNodeAccessToken(token); @@ -1218,7 +1217,7 @@ public class PAGateway { // Let's find the jobId to retrieve the task Optional optJob = Optional.ofNullable(EntityManagerHelper.find(Job.class,jobId)); if (!optJob.isPresent()) { - log.error(String.format("Job [%s] not found", jobId)); + LOGGER.error(String.format("Job [%s] not found", jobId)); throw new NotFoundException("Job " + jobId + " not found"); } EntityManagerHelper.refresh(optJob.get()); @@ -1226,13 +1225,13 @@ public class PAGateway { // Let's find the task: Optional optTask = Optional.ofNullable(optJob.get().findTask(taskName)); if (!optTask.isPresent()) { - log.error(String.format("Task [%s] not found", taskName)); + LOGGER.error(String.format("Task [%s] not found", taskName)); throw new NotFoundException("Task " + taskName + " not found"); } // Validating there will still be at least one deployment in the task if (optTask.get().getDeployments().size() - nodeNames.size() < 1) { - log.error("I stop the scale-in: the task will loose its last deployment"); + LOGGER.error("I stop the scale-in: the task will loose its last deployment"); throw new IllegalArgumentException("Task would loose its last deployment."); } @@ -1241,7 +1240,7 @@ public class PAGateway { // For deployed node, I flag their removal List nodesToBeRemoved = deployments.stream().filter(Deployment::getIsDeployed).map(Deployment::getNodeName).collect(Collectors.toList()); - log.info("Nodes to be removed are : " + nodesToBeRemoved); + LOGGER.info("Nodes to be removed are : " + nodesToBeRemoved); // For every node, I remove the deployment entree deployments.forEach( deployment -> { @@ -1265,11 +1264,11 @@ public class PAGateway { private void submitScalingInJob(Job job, String scaledTaskName) { EntityManagerHelper.refresh(job); - log.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled in."); + LOGGER.info("Task: " + scaledTaskName + " of job " + job.toString() + " to be scaled in."); TaskFlowJob paJob = new TaskFlowJob(); paJob.setName(job.getName() + "_" + scaledTaskName + "_ScaleIn"); - log.info("Job created: " + paJob.toString()); + LOGGER.info("Job created: " + paJob.toString()); EntityManagerHelper.begin(); @@ -1291,7 +1290,7 @@ public class PAGateway { EntityManagerHelper.persist(job); EntityManagerHelper.commit(); - log.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); + LOGGER.info("Scaling out of task \'" + scaledTaskName + "\' job, submitted successfully. ID = " + submittedJobId); } private List buildScalingInPATask(Task task, Job job, String scaledTaskName) { @@ -1299,14 +1298,14 @@ public class PAGateway { if (scaledTaskName.equals(task.getName())) { // When the scaled task is the task to be built - log.info("Building task " + task.getName() + " as it is scaled out"); + LOGGER.info("Building task " + task.getName() + " as it is scaled out"); scriptTasks.addAll(buildScaledPATask(task, job)); } else if (task.getParentTasks().contains(scaledTaskName)) { // When the scaled task is a parent of the task to be built - log.info("Building task " + task.getName() + " as a child of task " + scaledTaskName); + LOGGER.info("Building task " + task.getName() + " as a child of task " + scaledTaskName); scriptTasks.addAll(createChildScaledTask(task, job)); } else { - log.debug("Task " + task.getName() + " is not impacted by the scaling of task " + scaledTaskName); + LOGGER.debug("Task " + task.getName() + " is not impacted by the scaling of task " + scaledTaskName); } return scriptTasks; @@ -1322,7 +1321,7 @@ public class PAGateway { List scriptTasks = new LinkedList<>(); if (task.getDeployments() == null || task.getDeployments().isEmpty()) { - log.warn("The task " + task.getName() + " does not have a deployment. It will be scheduled on any free node."); + LOGGER.warn("The task " + task.getName() + " does not have a deployment. It will be scheduled on any free node."); scriptTasks.addAll(createAppTasks(task, "", "", job)); task.setDeploymentFirstSubmittedTaskName(scriptTasks.get(0).getName()); task.setDeploymentLastSubmittedTaskName(scriptTasks.get(scriptTasks.size()-1).getName()); @@ -1340,11 +1339,11 @@ public class PAGateway { emsScriptTask.addDependence(scriptTasks.get(scriptTasks.size()-1)); scriptTasks.add(emsScriptTask); }); - log.info("Token added: " + token); + LOGGER.info("Token added: " + token); deployment.setIsDeployed(true); deployment.setNodeAccessToken(token); - log.info("+++ Deployment number: " + deployment.getNumber()); + LOGGER.info("+++ Deployment number: " + deployment.getNumber()); // Creating application deployment tasks @@ -1394,7 +1393,7 @@ public class PAGateway { if (task.getInstallation().getOperatingSystemType().getOperatingSystemFamily().toLowerCase(Locale.ROOT).equals("ubuntu") && task.getInstallation().getOperatingSystemType().getOperatingSystemVersion() < 2000) { - log.info("Adding apt lock handler script since task: " + task.getName() + + LOGGER.info("Adding apt lock handler script since task: " + task.getName() + " is meant to be executed in: " + task.getInstallation().getOperatingSystemType().getOperatingSystemFamily() + " version: " + task.getInstallation().getOperatingSystemType().getOperatingSystemVersion()); @@ -1435,11 +1434,11 @@ public class PAGateway { public long submitJob(String jobId) { Job jobToSubmit = EntityManagerHelper.find(Job.class, jobId); EntityManagerHelper.refresh(jobToSubmit); - log.info("Job found to submit: " + jobToSubmit.toString()); + LOGGER.info("Job found to submit: " + jobToSubmit.toString()); TaskFlowJob paJob = new TaskFlowJob(); paJob.setName(jobToSubmit.getName()); - log.info("Job created: " + paJob.toString()); + LOGGER.info("Job created: " + paJob.toString()); EntityManagerHelper.begin(); @@ -1450,7 +1449,7 @@ public class PAGateway { try { paJob.addTask(scriptTask); } catch (UserException e) { - log.error("Task " + task.getName() + " could not be added due to: " + e.toString()); + LOGGER.error("Task " + task.getName() + " could not be added due to: " + e.toString()); } }); EntityManagerHelper.persist(task); @@ -1464,9 +1463,9 @@ public class PAGateway { if (!paJob.getTasks().isEmpty()) { submittedJobId = schedulerGateway.submit(paJob).longValue(); jobToSubmit.setSubmittedJobId(submittedJobId); - log.info("Job submitted successfully. ID = " + submittedJobId); + LOGGER.info("Job submitted successfully. ID = " + submittedJobId); } else { - log.warn("The job " + jobId + " is already deployed. Nothing to be submitted here."); + LOGGER.warn("The job " + jobId + " is already deployed. Nothing to be submitted here."); } EntityManagerHelper.persist(jobToSubmit); @@ -1491,11 +1490,11 @@ public class PAGateway { * @return The job state */ public JobState getJobState(String jobId) { - log.info("Getting job " + jobId + " state "); + LOGGER.info("Getting job " + jobId + " state "); Job submittedJob = EntityManagerHelper.find(Job.class, jobId); - log.info("Job skeleton " + jobId + " mapped to the submitted ProActive job: " + submittedJob.getSubmittedJobId()); + LOGGER.info("Job skeleton " + jobId + " mapped to the submitted ProActive job: " + submittedJob.getSubmittedJobId()); JobState jobState = schedulerGateway.getJobState(String.valueOf(submittedJob.getSubmittedJobId())); - log.info("Returned state: " + jobState.getStatus().toString() + " for job: " + jobId); + LOGGER.info("Returned state: " + jobState.getStatus().toString() + " for job: " + jobId); return jobState; } @@ -1508,7 +1507,7 @@ public class PAGateway { public JobResult waitForJob(String jobId, long timeout) { Job submittedJob = EntityManagerHelper.find(Job.class, jobId); JobResult jobResult = schedulerGateway.waitForJob(String.valueOf(submittedJob.getSubmittedJobId()), timeout); - log.info("Results of job: " + jobId + " fetched successfully: " + jobResult.toString()); + LOGGER.info("Results of job: " + jobId + " fetched successfully: " + jobResult.toString()); return jobResult; } @@ -1521,9 +1520,9 @@ public class PAGateway { Job submittedJob = EntityManagerHelper.find(Job.class, jobId); boolean result = schedulerGateway.killJob(String.valueOf(submittedJob.getSubmittedJobId())); if (result) { - log.info("The job : " + jobId + " could be killed successfully."); + LOGGER.info("The job : " + jobId + " could be killed successfully."); } else { - log.error("The job : " + jobId + " could not be killed."); + LOGGER.error("The job : " + jobId + " could not be killed."); } return result; } @@ -1545,7 +1544,7 @@ public class PAGateway { submittedTaskName, timeout)); }); - log.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); + LOGGER.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); return taskResultsMap; } @@ -1564,7 +1563,7 @@ public class PAGateway { String.valueOf(submittedJob.getSubmittedJobId()), submittedTaskName)); }); - log.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); + LOGGER.info("Results of task: " + taskName + " fetched successfully: " + taskResultsMap.toString()); return taskResultsMap; } } diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PAFactory.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PAFactory.java index 0b81fb4261a216f6ad8e1a13b02294203327760d..445c33781e49eba88c598e1bb7d5f72396c689ed 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PAFactory.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PAFactory.java @@ -1,8 +1,8 @@ package org.activeeon.morphemic.application.deployment; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.service.TemporaryFilesHelper; import org.activeeon.morphemic.service.Utils; -import org.apache.log4j.Logger; import org.ow2.proactive.scheduler.common.job.JobVariable; import org.ow2.proactive.scheduler.common.task.ScriptTask; import org.ow2.proactive.scheduler.common.task.TaskVariable; @@ -16,10 +16,9 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +@Slf4j public class PAFactory { - private static final Logger LOGGER = Logger.getLogger(PAFactory.class); - private PAFactory() { } diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PASchedulerGateway.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PASchedulerGateway.java index 0e5057e453dfdf5af921912f48c1ead269f96006..c4d90a66534fb03fb8f4313e58309fdf74a95f88 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PASchedulerGateway.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/application/deployment/PASchedulerGateway.java @@ -1,7 +1,7 @@ package org.activeeon.morphemic.application.deployment; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.service.SchedulerConnectionHelper; -import org.apache.log4j.Logger; import org.ow2.proactive.scheduler.common.exception.*; import org.ow2.proactive.scheduler.common.job.Job; import org.ow2.proactive.scheduler.common.job.JobId; @@ -17,12 +17,11 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeoutException; +@Slf4j public class PASchedulerGateway { private RestSmartProxyImpl restSmartProxy; - private static final Logger LOGGER = Logger.getLogger(PASchedulerGateway.class); - /** * Construct a gateway to the ProActive Scheduler * @param paUrl ProActive URL (exp: http://try.activeeon.com:8080/) diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAConnectorIaasGateway.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAConnectorIaasGateway.java index fe67485814645958aea32be39aa2c923607886a1..8e50d286a4ff6b7840a568d8389bfc95b038de96 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAConnectorIaasGateway.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAConnectorIaasGateway.java @@ -1,12 +1,11 @@ package org.activeeon.morphemic.infrastructure.deployment; import lombok.SneakyThrows; -import org.activeeon.morphemic.model.Credentials; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.model.PACloud; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.Validate; import org.apache.http.client.utils.URIBuilder; -import org.apache.log4j.Logger; import org.jboss.netty.handler.codec.http.HttpMethod; import org.json.JSONArray; import org.json.JSONTokener; @@ -22,14 +21,13 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +@Slf4j public class PAConnectorIaasGateway { private final String paURL; private final String CONNECTOR_IAAS_PATH = "/connector-iaas"; - private static final Logger LOGGER = Logger.getLogger(PAConnectorIaasGateway.class); - public PAConnectorIaasGateway(String paServerURL) { this.paURL = paServerURL; } diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java index b56d4d44761d29c4dcd776b38445c9acb41fb9e9..d51d80a8b14e32cbc86813be48e07005e0c06c9c 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGateway.java @@ -1,11 +1,10 @@ package org.activeeon.morphemic.infrastructure.deployment; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.service.RMConnectionHelper; import org.apache.http.conn.ConnectTimeoutException; -import org.apache.log4j.Logger; import org.ow2.proactive.resourcemanager.common.NSState; import org.ow2.proactive.resourcemanager.common.event.RMNodeEvent; -import org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent; import org.ow2.proactive.resourcemanager.common.event.dto.RMStateFull; import org.ow2.proactive.resourcemanager.exception.RMException; import org.ow2.proactive.resourcemanager.exception.RMNodeException; @@ -21,6 +20,7 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.*; +@Slf4j public class PAResourceManagerGateway { private RMRestInterface rmRestInterface; @@ -29,8 +29,6 @@ public class PAResourceManagerGateway { static final int INTERVAL = 10000; - private static final Logger LOGGER = Logger.getLogger(PAResourceManagerGateway.class); - /** * Get, in an asynchronous way, deployed nodes names * @param nodeSource The name of the node source diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/ByonNode.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/ByonNode.java index 67f59d7453bd1d991bb54fa658b2921ec0b2e1c9..17cb40ac4e34678edb7a774f3bf77950ba59c334 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/ByonNode.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/ByonNode.java @@ -1,15 +1,15 @@ package org.activeeon.morphemic.model; -import java.io.Serializable; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import org.hibernate.annotations.GenericGenerator; +import javax.persistence.*; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import javax.persistence.*; +import java.util.Objects; /** * Representation of a BYON used by Cloudiator diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddress.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddress.java index d00608b1f0f2e66a5de6a9580d8c708be38b7941..f41344ed8dc63bd0e5a041df839bf8e740c59fac 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddress.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddress.java @@ -1,13 +1,16 @@ package org.activeeon.morphemic.model; -import java.io.Serializable; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.sun.istack.NotNull; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; -import javax.persistence.*; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import java.io.Serializable; +import java.util.Objects; /** * IpAddress diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddressType.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddressType.java index e61a1698396eeeff12dd9b2252086f9e159b17db..a956d3629fb4cd0a37c5568e356934d09c557589 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddressType.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpAddressType.java @@ -1,7 +1,7 @@ package org.activeeon.morphemic.model; -import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; /** * Gets or Sets IpAddressType diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpVersion.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpVersion.java index c29c2dae96849d24e6351bcdbd2406a5932145dc..594b666eadf5b2a9d755f0ea05da01a1eca53d05 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpVersion.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/IpVersion.java @@ -1,7 +1,7 @@ package org.activeeon.morphemic.model; -import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; /** * Gets or Sets IpVersion diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/LoginCredential.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/LoginCredential.java index 9281f4eeefd0ad40e2976e7c17a36bdddf95b401..eaabd6d323d996c7d4642aacc1ccf2d3ca6a5930 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/LoginCredential.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/LoginCredential.java @@ -1,12 +1,12 @@ package org.activeeon.morphemic.model; -import java.io.Serializable; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; -import javax.persistence.*; +import javax.persistence.Embeddable; +import java.io.Serializable; +import java.util.Objects; /** * Credentials for remote access to the virtual machine. Typically, one of password or privateKey is set. diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/NodeProperties.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/NodeProperties.java index 191d0423f7164bccd7f551ff0b7b9c1cb3d6bef7..5834c4698e0d03e24d7fc267be2a994c45f9d8f2 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/NodeProperties.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/NodeProperties.java @@ -1,12 +1,13 @@ package org.activeeon.morphemic.model; -import java.io.Serializable; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; -import javax.persistence.*; +import javax.persistence.Embeddable; +import javax.persistence.Embedded; +import java.io.Serializable; +import java.util.Objects; /** * Attributes defining this node diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/RequirementOperator.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/RequirementOperator.java index 958b2c8c99452840fe33cfb1543aabee209f2334..a5a89e7156d7ab78db08951003d291e82cd89383 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/RequirementOperator.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/RequirementOperator.java @@ -3,8 +3,6 @@ package org.activeeon.morphemic.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import javax.management.BadStringOperationException; -import java.math.BigDecimal; import java.util.Locale; /** diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/Task.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/Task.java index cf926f03e90a8586f996f9ef37fd69b28f4e435d..a86bc88c7961768ee1f9854e5cdec95809b68557 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/Task.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/model/Task.java @@ -1,6 +1,9 @@ package org.activeeon.morphemic.model; -import lombok.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/EntityManagerHelper.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/EntityManagerHelper.java index 7d11f428bf1e62a14231765575fd1be730994e1f..71023cc4a85037dfaad1a10b3e0981a167074bad 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/EntityManagerHelper.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/EntityManagerHelper.java @@ -1,7 +1,7 @@ package org.activeeon.morphemic.service; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.configuration2.ex.ConfigurationException; -import org.apache.log4j.Logger; import org.hibernate.CacheMode; import org.hibernate.jpa.QueryHints; @@ -9,14 +9,13 @@ import javax.persistence.*; import java.util.HashMap; import java.util.Map; +@Slf4j public class EntityManagerHelper { private static final EntityManagerFactory emf; private static final ThreadLocal threadLocal; - private static final Logger LOGGER = Logger.getLogger(EntityManagerHelper.class); - static { Map persistenceConfiguration = new HashMap<>(); try { diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/GeoLocationUtils.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/GeoLocationUtils.java index 7b76cddd3de23bf76819f9dd9ba6f5bbb5abaf8d..ba7e454b509b49189d08927add467fe2b3b2518a 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/GeoLocationUtils.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/GeoLocationUtils.java @@ -6,12 +6,11 @@ import com.fasterxml.jackson.dataformat.csv.CsvMapper; import com.fasterxml.jackson.dataformat.csv.CsvSchema; import lombok.Getter; import lombok.Setter; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.model.GeoLocationData; -import org.apache.log4j.Logger; import java.io.File; import java.io.IOException; -import java.nio.file.Files; import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -20,12 +19,11 @@ import java.util.Map; @Getter @Setter +@Slf4j public class GeoLocationUtils { private final List cloudsGeoLocationData; - private static final Logger LOGGER = Logger.getLogger(GeoLocationUtils.class); - public GeoLocationUtils() { cloudsGeoLocationData = chargeCloudGLsDB(); LOGGER.debug("Clouds GeoLocation Database loaded successfully."); diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/JCloudsInstancesUtils.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/JCloudsInstancesUtils.java index 22953f6835c26af30a21e35c1b87e8de496ab963..7aa53126c2f0a856bd595d235ca6523b501e8629 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/JCloudsInstancesUtils.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/JCloudsInstancesUtils.java @@ -1,25 +1,24 @@ package org.activeeon.morphemic.service; -import org.apache.log4j.Logger; +import lombok.extern.slf4j.Slf4j; import org.jclouds.ec2.domain.InstanceType; import java.util.Arrays; import java.util.HashSet; import java.util.Set; +@Slf4j public class JCloudsInstancesUtils { private static final Set handledAWSInstanceTypes; - private static final Logger LOGGER = Logger.getLogger(JCloudsInstancesUtils.class); - static { handledAWSInstanceTypes = new HashSet<>(); Arrays.stream(InstanceType.class.getFields()).forEach(field -> { try { handledAWSInstanceTypes.add(field.get(InstanceType.class).toString()); } catch (IllegalAccessException e) { - LOGGER.warn(e.getStackTrace()); + LOGGER.warn(String.valueOf(e.getStackTrace())); } }); } diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/NodeCandidateUtils.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/NodeCandidateUtils.java index 3f943daaf68da576119ccc16e570b9504c29e202..0fe199ef9f965459146f459f5944fdc40bc77fbf 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/NodeCandidateUtils.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/NodeCandidateUtils.java @@ -1,26 +1,28 @@ package org.activeeon.morphemic.service; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.infrastructure.deployment.PAConnectorIaasGateway; import org.activeeon.morphemic.model.*; import org.apache.commons.lang3.StringUtils; -import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONObject; import java.io.IOException; import java.math.BigDecimal; -import java.util.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; import java.util.stream.Collectors; +@Slf4j public class NodeCandidateUtils { public PAConnectorIaasGateway connectorIaasGateway; private final GeoLocationUtils geoLocationUtils; - private static final Logger LOGGER = Logger.getLogger(NodeCandidateUtils.class); - public NodeCandidateUtils(String paURL) { connectorIaasGateway = new PAConnectorIaasGateway(paURL); geoLocationUtils = new GeoLocationUtils(); diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/PersistenceConfiguration.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/PersistenceConfiguration.java index e8231b259ab080896ccb6862acbaa5eb4fc2e959..71887a068cd17776f81e53fe255510b743296d6a 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/PersistenceConfiguration.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/PersistenceConfiguration.java @@ -1,5 +1,6 @@ package org.activeeon.morphemic.service; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; @@ -8,17 +9,15 @@ import org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParamet import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler; import org.apache.commons.configuration2.convert.ListDelimiterHandler; import org.apache.commons.configuration2.ex.ConfigurationException; -import org.apache.log4j.Logger; import java.util.HashMap; import java.util.Map; +@Slf4j public class PersistenceConfiguration { private static final ListDelimiterHandler DELIMITER = new DefaultListDelimiterHandler(';'); - private static final Logger LOGGER = Logger.getLogger(PersistenceConfiguration.class); - public static String PERSISTENCE_URL = "sal.persistence.url"; public static String PERSISTENCE_USERNAME = "sal.persistence.username"; diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/RMConnectionHelper.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/RMConnectionHelper.java index 29ca69c4f007b40a5a8653042b118b9117d408c1..87b5cb72b1e0ffaec2110b954dd27cfefee7a9e8 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/RMConnectionHelper.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/RMConnectionHelper.java @@ -1,22 +1,22 @@ package org.activeeon.morphemic.service; -import org.apache.log4j.Logger; +import lombok.extern.slf4j.Slf4j; import org.ow2.proactive.resourcemanager.exception.RMException; import org.ow2.proactive.scheduler.common.exception.NotConnectedException; import org.ow2.proactive_grid_cloud_portal.common.RMRestInterface; import org.ow2.proactive_grid_cloud_portal.rm.client.RMRestClient; + import javax.security.auth.login.LoginException; import java.security.KeyException; import java.util.prefs.Preferences; +@Slf4j public class RMConnectionHelper { private static final Preferences userPreferences = Preferences.userRoot().node("USER_PREFERENCES"); private static String sessionPreferencesId; - private static final Logger LOGGER = Logger.getLogger(RMConnectionHelper.class); - private static final String RESOURCE_MANAGER_REST_PATH = "/rest"; private static String sessionId = ""; diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/SchedulerConnectionHelper.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/SchedulerConnectionHelper.java index 77ee0d9af992d2b2f30539be5b703313b042720c..65c8185685146b191eab502277208dc1e436542c 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/SchedulerConnectionHelper.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/SchedulerConnectionHelper.java @@ -1,15 +1,14 @@ package org.activeeon.morphemic.service; -import org.apache.log4j.Logger; +import lombok.extern.slf4j.Slf4j; import org.ow2.proactive.authentication.ConnectionInfo; import org.ow2.proactive.scheduler.common.exception.PermissionException; import org.ow2.proactive_grid_cloud_portal.smartproxy.RestSmartProxyImpl; +@Slf4j public class SchedulerConnectionHelper { - private static final Logger LOGGER = Logger.getLogger(SchedulerConnectionHelper.class); - private static final String SCHEDULER_REST_PATH = "/rest"; private static RestSmartProxyImpl restSmartProxy = new RestSmartProxyImpl(); diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/TemporaryFilesHelper.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/TemporaryFilesHelper.java index 73d74fb270c7b67c4cefa3a7f6be0a1c7cfdc45c..4f7b3d296e38a1985d237b6eba450289b424f838 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/TemporaryFilesHelper.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/TemporaryFilesHelper.java @@ -1,10 +1,11 @@ package org.activeeon.morphemic.service; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; -import org.apache.log4j.Logger; import java.io.*; +@Slf4j public class TemporaryFilesHelper { private static final String TMP_SYS_PROPERTY = "java.io.tmpdir"; @@ -13,8 +14,6 @@ public class TemporaryFilesHelper { private static final File TMP_DIRECTORY_FILE; - private static final Logger LOGGER = Logger.getLogger(TemporaryFilesHelper.class); - static { TMP_DIRECTORY = ((System.getProperty(TMP_SYS_PROPERTY).endsWith(File.separator)) ? System.getProperty(TMP_SYS_PROPERTY) + "proactive_tmp" : diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/UpdatingNodeCandidatesThread.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/UpdatingNodeCandidatesThread.java index 19a43dcf70f4efbe5164a1c8f3b9cde4a5b6ec96..1e33ebb3fc01a66c5ad7555686ce877c64ee68bf 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/UpdatingNodeCandidatesThread.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/UpdatingNodeCandidatesThread.java @@ -2,19 +2,18 @@ package org.activeeon.morphemic.service; import lombok.AllArgsConstructor; import lombok.SneakyThrows; -import org.apache.log4j.Logger; +import lombok.extern.slf4j.Slf4j; import java.util.List; @AllArgsConstructor +@Slf4j public class UpdatingNodeCandidatesThread extends Thread { private final String paURL; private final List newCloudIds; - private static final Logger LOGGER = Logger.getLogger(UpdatingNodeCandidatesThread.class); - @SneakyThrows @Override public void run() { diff --git a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/Utils.java b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/Utils.java index e54a1c93b6d5b8e87a3cf81753435bd0388cdc6b..623e7ae7cbc1413830b8a6ef987742460dc68c15 100644 --- a/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/Utils.java +++ b/scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/Utils.java @@ -1,7 +1,7 @@ package org.activeeon.morphemic.service; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.application.deployment.PAFactory; -import org.apache.log4j.Logger; import java.io.BufferedReader; import java.io.File; @@ -9,10 +9,9 @@ import java.io.InputStreamReader; import java.util.stream.Collectors; import java.util.stream.Stream; +@Slf4j public class Utils { - private static final Logger LOGGER = Logger.getLogger(Utils.class); - private Utils() { } public static String getContentWithFileName(String fileName) { diff --git a/scheduling-abstraction-layer/src/main/resources/emsdeploy_mainscript.groovy b/scheduling-abstraction-layer/src/main/resources/emsdeploy_mainscript.groovy index 1573798ed2a177a16e5b4157ddb1bf83dcfcaea0..b16b80d348e543eaccdcd117bd8786da6e363be9 100644 --- a/scheduling-abstraction-layer/src/main/resources/emsdeploy_mainscript.groovy +++ b/scheduling-abstraction-layer/src/main/resources/emsdeploy_mainscript.groovy @@ -1,10 +1,5 @@ -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.TrustManager; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.X509TrustManager; -import java.security.cert.X509Certificate; +import javax.net.ssl.* +import java.security.cert.X509Certificate // Calculing privatekey fingerprint println "== Baguette request preparation" diff --git a/scheduling-abstraction-layer/src/test/java/lombok.config b/scheduling-abstraction-layer/src/test/java/lombok.config new file mode 100644 index 0000000000000000000000000000000000000000..a15fe0c443b2c45d6080b6aae07b01bad743647f --- /dev/null +++ b/scheduling-abstraction-layer/src/test/java/lombok.config @@ -0,0 +1 @@ +lombok.log.fieldName = LOGGER \ No newline at end of file diff --git a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/application/deployment/PASchedulerGatewayTest.java b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/application/deployment/PASchedulerGatewayTest.java index 63eb97ff71847f5b29d23e5d103711a0968be3bf..bbcdebf2dad44dcb1db1afc8e794e3856acf52b8 100644 --- a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/application/deployment/PASchedulerGatewayTest.java +++ b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/application/deployment/PASchedulerGatewayTest.java @@ -1,6 +1,7 @@ package org.activeeon.morphemic.application.deployment; import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.service.SchedulerConnectionHelper; import org.apache.log4j.Level; import org.apache.log4j.Logger; @@ -33,10 +34,9 @@ import static org.mockito.AdditionalMatchers.not; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; +@Slf4j class PASchedulerGatewayTest { - private static final Logger LOGGER = Logger.getLogger(PASchedulerGatewayTest.class); - private final String DUMMY_USERNAME = "username"; private final String DUMMY_PASSWORD = "password"; diff --git a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGatewayTest.java b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGatewayTest.java index 1183e3ba11ac275b2362ed7384e41344ef4a3b7e..b877987d53336bcefc5cc35fddc24f8de7a4e944 100644 --- a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGatewayTest.java +++ b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/infrastructure/deployment/PAResourceManagerGatewayTest.java @@ -1,6 +1,7 @@ package org.activeeon.morphemic.infrastructure.deployment; import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; import org.activeeon.morphemic.service.RMConnectionHelper; import org.apache.log4j.Level; import org.apache.log4j.Logger; @@ -15,19 +16,22 @@ import org.mockito.MockitoAnnotations; import org.ow2.proactive.resourcemanager.common.NSState; import org.ow2.proactive_grid_cloud_portal.common.RMRestInterface; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.AdditionalMatchers.not; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.*; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; +@Slf4j class PAResourceManagerGatewayTest { - private static final Logger LOGGER = Logger.getLogger(PAResourceManagerGatewayTest.class); - PAResourceManagerGateway paResourceManagerGateway; private final String DUMMY_USERNAME = "username"; diff --git a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/RMConnectionHelperTest.java b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/RMConnectionHelperTest.java index 57cea96eabd7966195e0bfedbdc9e2ec7d35b46a..ca9c6adfbe227674bb5a4c4e66801e8b988c1ffd 100644 --- a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/RMConnectionHelperTest.java +++ b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/RMConnectionHelperTest.java @@ -2,12 +2,11 @@ package org.activeeon.morphemic.service; import org.apache.log4j.Level; import org.apache.log4j.Logger; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.*; - +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.ow2.proactive.resourcemanager.exception.RMException; import org.ow2.proactive.scheduler.common.exception.NotConnectedException; import org.ow2.proactive_grid_cloud_portal.common.RMRestInterface; @@ -16,8 +15,10 @@ import javax.security.auth.login.LoginException; import java.security.KeyException; import java.util.prefs.Preferences; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.when; class RMConnectionHelperTest { diff --git a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/SchedulerConnectionHelperTest.java b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/SchedulerConnectionHelperTest.java index e05818a1fe3ac72396a7637416c165e9a4230dbd..353dc2be1c1ed287db696d846304635a7ea879de 100644 --- a/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/SchedulerConnectionHelperTest.java +++ b/scheduling-abstraction-layer/src/test/java/org/activeeon/morphemic/service/SchedulerConnectionHelperTest.java @@ -11,7 +11,8 @@ import org.ow2.proactive.authentication.ConnectionInfo; import org.ow2.proactive_grid_cloud_portal.smartproxy.RestSmartProxyImpl; import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.when; class SchedulerConnectionHelperTest {