use of com.cognizant.devops.platformdal.filemanagement.InsightsConfigFilesDAL in project Insights by CognizantOneDevOps.
the class AssessmentReportsTestData method preparePanelJson.
public JsonObject preparePanelJson(String vType, String vQuery, String title, int id) throws InsightsCustomException {
JsonObject panelTemplateJson = null;
try {
InsightsConfigFilesDAL configFilesDAL = new InsightsConfigFilesDAL();
byte[] panelTemplateByte = configFilesDAL.getConfigurationFile(vType).getFileData();
String template = new String(panelTemplateByte);
panelTemplateJson = JsonUtils.parseStringAsJsonObject(template);
panelTemplateJson.addProperty("title", title);
panelTemplateJson.addProperty("id", id);
panelTemplateJson.addProperty("datasource", "Neo4j Data Source");
panelTemplateJson.getAsJsonArray(AssessmentReportAndWorkflowConstants.TARGETS).get(0).getAsJsonObject().addProperty(AssessmentReportAndWorkflowConstants.QUERYTEXT, vQuery);
} catch (Exception e) {
log.error("Error while preparing panel JSON ====", e);
throw new InsightsCustomException(e.getMessage());
}
return panelTemplateJson;
}
use of com.cognizant.devops.platformdal.filemanagement.InsightsConfigFilesDAL in project Insights by CognizantOneDevOps.
the class AssessmentReportsTest method onInit.
@BeforeClass
public void onInit() throws Exception {
reportTypeId = saveWorkflowType("Report");
// save multiple Kpi definition in db
readKpiFileAndSave("KPIDefination.json");
InsightsConfigFilesDAL configFilesDAL = new InsightsConfigFilesDAL();
configFilesDAL.saveConfigurationFile(AssessmentReportsTestData.createConfigFileData());
// save multiple content definition in db
readContentFileAndSave("ContentsConfiguration.json");
getData();
generateGrafanaToken();
// save report template in db
readReportTempFileAndSave("REPORT_SONAR_JENKINS_PROD_RT.json", reportIdProdRT);
readReportTempFileAndSave("REPORT_SONAR_RT.json", reportIdSonarRT);
saveReportTemplate(reportTemplatekpi, reportIdkpiRT);
saveReportTemplate(reportTemplatekpis, reportIdkpisRT);
// save report template design files in db
uploadReportTemplateDesignFiles(reportIdProdRT);
typeId = saveWorkflowType("SYSTEM");
// save workflow task in db
saveWorkflowTask(taskKpiExecution);
saveWorkflowTask(taskPDFExecution);
saveWorkflowTask(taskEmailExecution);
saveWorkflowTask(taskSystemHealthNotificationExecution);
saveWorkflowTask(taskSystemEmailNotificationExecution);
// save assessment report
saveAssessmentReport(workflowIdProd, assessmentReport, 2);
saveAssessmentReport(workflowIdWithEmail, assessmentReportWithEmail, 3);
saveAssessmentReport(workflowIdWithoutEmail, assessmentReportWithoutEmail, 2);
saveAssessmentReport(workflowIdWrongkpi, assessmentReportWrongkpi, 2);
saveAssessmentReport(workflowIdWrongkpis, assessmentReportWrongkpis, 2);
saveAssessmentReport(workflowIdFail, assessmentReportFail, 1);
saveHealthNotificationWorkflowConfig();
grafanaPDFExportUrl = ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint();
smtpHostServer = ApplicationConfigProvider.getInstance().getEmailConfiguration().getSmtpHostServer();
ApplicationConfigProvider.getInstance().getAssessmentReport().setMaxWorkflowRetries(3);
initializeTask();
// run workflow executor
WorkflowExecutor executor = new WorkflowExecutor();
executor.executeWorkflow();
Thread.sleep(40000);
WorkflowImmediateJobExecutor immediateJobExecutor = new WorkflowImmediateJobExecutor();
immediateJobExecutor.executeImmediateWorkflow();
Thread.sleep(40000);
}
Aggregations