Search in sources :

Example 1 with SupportService

use of io.elastest.etm.model.SupportService in project elastest-torm by elastest.

the class ExternalService method startEus.

public SupportService startEus() {
    List<SupportService> tssList = esmService.getRegisteredServices();
    SupportService eus = null;
    for (SupportService tss : tssList) {
        if ("eus".equals(tss.getName().toLowerCase())) {
            eus = tss;
            break;
        }
    }
    return eus;
}
Also used : SupportService(io.elastest.etm.model.SupportService)

Example 2 with SupportService

use of io.elastest.etm.model.SupportService in project elastest-torm by elastest.

the class ExternalService method createExternalTJobExecution.

public ExternalTJobExecution createExternalTJobExecution(ExternalTJobExecution exec) {
    exec = this.externalTJobExecutionRepository.save(exec);
    if (exec.getMonitoringIndex().isEmpty() || "".equals(exec.getMonitoringIndex())) {
        exec.generateMonitoringIndex();
        exec = this.externalTJobExecutionRepository.save(exec);
    }
    SupportService eus = this.startEus();
    if (eus != null) {
        String instanceId = utilTools.generateUniqueId();
        esmService.provisionExternalTJobExecServiceInstanceAsync(eus.getId(), exec, instanceId);
        exec.getEnvVars().put("EUS_ID", eus.getId());
        exec.getEnvVars().put("EUS_INSTANCE_ID", instanceId);
    }
    elasticsearchService.createMonitoringIndex(exec.getMonitoringIndicesList());
    return exec;
}
Also used : SupportService(io.elastest.etm.model.SupportService)

Example 3 with SupportService

use of io.elastest.etm.model.SupportService in project elastest-torm by elastest.

the class ExternalService method createExternalTJobExecutionByExternalTJobId.

public ExternalTJobExecution createExternalTJobExecutionByExternalTJobId(Long exTJobId) {
    ExternalTJob exTJob = this.externalTJobRepository.findById(exTJobId);
    ExternalTJobExecution exec = new ExternalTJobExecution();
    exec.setExTJob(exTJob);
    exec.setStartDate(new Date());
    this.externalTJobExecutionRepository.save(exec);
    exec.generateMonitoringIndex();
    exec = this.externalTJobExecutionRepository.save(exec);
    SupportService eus = this.startEus();
    if (eus != null) {
        String instanceId = utilTools.generateUniqueId();
        esmService.provisionExternalTJobExecServiceInstanceAsync(eus.getId(), exec, instanceId);
        exec.getEnvVars().put("EUS_ID", eus.getId());
        exec.getEnvVars().put("EUS_INSTANCE_ID", instanceId);
        exec = this.externalTJobExecutionRepository.save(exec);
    }
    elasticsearchService.createMonitoringIndex(exec.getMonitoringIndicesList());
    return exec;
}
Also used : SupportService(io.elastest.etm.model.SupportService) ExternalTJob(io.elastest.etm.model.external.ExternalTJob) ExternalTJobExecution(io.elastest.etm.model.external.ExternalTJobExecution) Date(java.util.Date)

Example 4 with SupportService

use of io.elastest.etm.model.SupportService in project elastest-torm by elastest.

the class EsmService method getRegisteredServicesName.

public List<String> getRegisteredServicesName() {
    logger.info("Get registered services names.");
    List<String> registeredServices = new ArrayList<>();
    List<SupportService> services = getRegisteredServices();
    for (SupportService service : services) {
        registeredServices.add(service.getName());
        logger.info("Service name: {} ", service.getName());
    }
    return registeredServices;
}
Also used : SupportService(io.elastest.etm.model.SupportService) ArrayList(java.util.ArrayList)

Example 5 with SupportService

use of io.elastest.etm.model.SupportService in project elastest-torm by elastest.

the class EsmService method getRegisteredServices.

public List<SupportService> getRegisteredServices() {
    logger.info("Get registered services.");
    List<SupportService> services = new ArrayList<>();
    JsonNode objs = esmServiceClient.getRegisteredServices();
    for (JsonNode esmService : objs) {
        JsonNode configJson = esmService.get("manifest") != null ? esmService.get("manifest").get("config") : null;
        String config = configJson != null ? configJson.toString() : "";
        services.add(new SupportService(esmService.get("id").toString().replaceAll("\"", ""), esmService.get("name").toString().replaceAll("\"", ""), // "")
        "", config));
    }
    return services;
}
Also used : SupportService(io.elastest.etm.model.SupportService) ArrayList(java.util.ArrayList) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Aggregations

SupportService (io.elastest.etm.model.SupportService)6 ArrayList (java.util.ArrayList)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ExternalTJob (io.elastest.etm.model.external.ExternalTJob)1 ExternalTJobExecution (io.elastest.etm.model.external.ExternalTJobExecution)1 Date (java.util.Date)1 Disabled (org.junit.jupiter.api.Disabled)1 Test (org.junit.jupiter.api.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1