Search in sources :

Example 1 with TestSupportServices

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;
    }
}
Also used : ExternalProject(io.elastest.etm.model.external.ExternalProject) Project(io.elastest.etm.model.Project) TestSupportServices(io.elastest.etm.api.model.TestSupportServices) TJob(io.elastest.etm.model.TJob) ExternalTJob(io.elastest.etm.model.external.ExternalTJob) HTTPException(javax.xml.ws.http.HTTPException)

Aggregations

TestSupportServices (io.elastest.etm.api.model.TestSupportServices)1 Project (io.elastest.etm.model.Project)1 TJob (io.elastest.etm.model.TJob)1 ExternalProject (io.elastest.etm.model.external.ExternalProject)1 ExternalTJob (io.elastest.etm.model.external.ExternalTJob)1 HTTPException (javax.xml.ws.http.HTTPException)1