Search in sources :

Example 1 with AgentConfig

use of com.cognizant.devops.platformdal.agentConfig.AgentConfig in project Insights by CognizantOneDevOps.

the class GraphdbCorrelationConfiguration method testRegisterAgentInDatabase.

public boolean testRegisterAgentInDatabase() throws InsightsCustomException {
    List<AgentConfig> registeredAgents = getRegisteredAgents();
    log.info("agent size {}", registeredAgents.size());
    for (AgentConfig agentConfig : registeredAgents) {
        log.info("Tool name: {}", agentConfig.getToolName());
    }
    if (!registeredAgents.isEmpty()) {
        return true;
    }
    return false;
}
Also used : AgentConfig(com.cognizant.devops.platformdal.agentConfig.AgentConfig)

Example 2 with AgentConfig

use of com.cognizant.devops.platformdal.agentConfig.AgentConfig in project Insights by CognizantOneDevOps.

the class GraphdbCorrelationConfiguration method testAgentIdInDatabase.

public boolean testAgentIdInDatabase(String agentId) throws InsightsCustomException {
    List<AgentConfig> registeredAgents = getRegisteredAgents();
    log.info("agent size {}", registeredAgents.size());
    for (AgentConfig agentConfig : registeredAgents) {
        if ((agentConfig.getAgentKey()).contains(agentId))
            return true;
        else
            continue;
    }
    return false;
}
Also used : AgentConfig(com.cognizant.devops.platformdal.agentConfig.AgentConfig)

Example 3 with AgentConfig

use of com.cognizant.devops.platformdal.agentConfig.AgentConfig in project Insights by CognizantOneDevOps.

the class AgentManagementTest method getAgentDetailsForException.

@Test(priority = 18)
public void getAgentDetailsForException() throws InsightsCustomException {
    AgentConfig agentConfig = new AgentConfig();
    AgentConfigDAL agentConfigDAL = new AgentConfigDAL();
    AgentConfigTO agentConfigDetails = agentManagementServiceImpl.getAgentDetails(agentId);
}
Also used : AgentConfigDAL(com.cognizant.devops.platformdal.agentConfig.AgentConfigDAL) AgentConfig(com.cognizant.devops.platformdal.agentConfig.AgentConfig) AgentConfigTO(com.cognizant.devops.platformservice.agentmanagement.service.AgentConfigTO) Test(org.testng.annotations.Test)

Example 4 with AgentConfig

use of com.cognizant.devops.platformdal.agentConfig.AgentConfig in project Insights by CognizantOneDevOps.

the class AgentManagementTest method getAgentDetails.

@Test(priority = 17)
public void getAgentDetails() throws InsightsCustomException {
    AgentConfig agentConfig = new AgentConfig();
    AgentConfigDAL agentConfigDAL = new AgentConfigDAL();
    agentConfig = agentConfigDAL.getAgentConfigurations(agentId);
    AgentConfigTO agentConfigDetails = new AgentConfigTO();
    agentConfigDetails = agentManagementServiceImpl.getAgentDetails(agentId);
    Assert.assertNotNull(agentConfigDetails.getAgentId());
    Assert.assertEquals(agentConfigDetails.getToolCategory(), "SCM");
}
Also used : AgentConfigDAL(com.cognizant.devops.platformdal.agentConfig.AgentConfigDAL) AgentConfig(com.cognizant.devops.platformdal.agentConfig.AgentConfig) AgentConfigTO(com.cognizant.devops.platformservice.agentmanagement.service.AgentConfigTO) Test(org.testng.annotations.Test)

Example 5 with AgentConfig

use of com.cognizant.devops.platformdal.agentConfig.AgentConfig in project Insights by CognizantOneDevOps.

the class HealthUtil method getAgentHealthQueueName.

/**
 * Method to get Agent Health Queue name
 *
 * @param agentId
 * @return String
 */
public String getAgentHealthQueueName(String agentId) {
    String healthRoutingKey = null;
    try {
        AgentConfigDAL agentConfigDal = new AgentConfigDAL();
        AgentConfig agentConfig = agentConfigDal.getAgentConfigurations(agentId);
        JsonObject config = JsonUtils.parseStringAsJsonObject(agentConfig.getAgentJson());
        JsonObject json = config.get("publish").getAsJsonObject();
        healthRoutingKey = json.get("health").getAsString().replace(".", ":");
    } catch (Exception e) {
        log.error(" No DB record found for agentId {} ", agentId);
    }
    return healthRoutingKey;
}
Also used : AgentConfigDAL(com.cognizant.devops.platformdal.agentConfig.AgentConfigDAL) AgentConfig(com.cognizant.devops.platformdal.agentConfig.AgentConfig) JsonObject(com.google.gson.JsonObject) InsightsCustomException(com.cognizant.devops.platformcommons.exception.InsightsCustomException)

Aggregations

AgentConfig (com.cognizant.devops.platformdal.agentConfig.AgentConfig)13 InsightsCustomException (com.cognizant.devops.platformcommons.exception.InsightsCustomException)6 AgentConfigDAL (com.cognizant.devops.platformdal.agentConfig.AgentConfigDAL)6 JsonObject (com.google.gson.JsonObject)6 IOException (java.io.IOException)3 TimeoutException (java.util.concurrent.TimeoutException)3 WebHookConfig (com.cognizant.devops.platformdal.webhookConfig.WebHookConfig)2 AgentConfigTO (com.cognizant.devops.platformservice.agentmanagement.service.AgentConfigTO)2 JsonArray (com.google.gson.JsonArray)2 HashMap (java.util.HashMap)2 IntrusionException (org.owasp.esapi.errors.IntrusionException)2 ValidationException (org.owasp.esapi.errors.ValidationException)2 Test (org.testng.annotations.Test)2 GraphDBHandler (com.cognizant.devops.platformcommons.dal.neo4j.GraphDBHandler)1 InsightsAssessmentReportTemplate (com.cognizant.devops.platformdal.assessmentreport.InsightsAssessmentReportTemplate)1 InsightsContentConfig (com.cognizant.devops.platformdal.assessmentreport.InsightsContentConfig)1 InsightsKPIConfig (com.cognizant.devops.platformdal.assessmentreport.InsightsKPIConfig)1 InsightsReportTemplateConfigFiles (com.cognizant.devops.platformdal.assessmentreport.InsightsReportTemplateConfigFiles)1 InsightsReportVisualizationContainer (com.cognizant.devops.platformdal.assessmentreport.InsightsReportVisualizationContainer)1 AutoMLConfig (com.cognizant.devops.platformdal.autoML.AutoMLConfig)1