use of io.elastest.etm.api.model.TestSupportServices in project elastest-torm by elastest.
the class ExternalService method createElasTestEntitiesForExtJob.
private TJob createElasTestEntitiesForExtJob(ExternalJob externalJob) throws Exception {
logger.info("Creating external job entities.");
try {
logger.debug("Creating Project.");
Project project = projectService.getProjectByName(externalJob.getJobName());
if (project == null) {
project = new Project();
project.setId(0L);
project.setName(externalJob.getJobName());
project = projectService.createProject(project);
}
logger.debug("Creating TJob.");
TJob tJob = tJobService.getTJobByName(externalJob.getJobName());
if (tJob == null) {
tJob = new TJob();
tJob.setName(externalJob.getJobName());
tJob.setProject(project);
tJob.setExternal(true);
tJob = tJobService.createTJob(tJob);
}
if (externalJob.getTSServices() != null && externalJob.getTSServices().size() > 0) {
tJob.setSelectedServices("[");
for (TestSupportServices tSService : externalJob.getTSServices()) {
tJob.setSelectedServices(tJob.getSelectedServices() + tSService.toJsonString());
}
tJob.setSelectedServices(tJob.getSelectedServices() + "]");
}
return tJob;
} catch (Exception e) {
e.printStackTrace();
logger.error("Error message: " + e.getMessage());
throw e;
}
}
Aggregations