How to use NewEnvironmentEventV000 class of org.cerberus.servlet.zzpublic package

Best Cerberus-source code snippet using org.cerberus.servlet.zzpublic.NewEnvironmentEventV000

Source:NewEnvironmentEventV000.java Github

copy

Full Screen

...44import org.cerberus.service.email.IEmailService;45/**46 * @author vertigo47 */48@WebServlet(name = "NewEnvironmentEventV000", urlPatterns = {"/NewEnvironmentEventV000"})49public class NewEnvironmentEventV000 extends HttpServlet {50 private static final org.apache.logging.log4j.Logger LOG = org.apache.logging.log4j.LogManager.getLogger("NewEnvironmentEventV000");51 private final String OPERATION = "New Environment Event";52 private final String PARAMETERALL = "ALL";53 /**54 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>55 * methods.56 *57 * @param request servlet request58 * @param response servlet response59 * @throws ServletException if a servlet-specific error occurs60 * @throws IOException if an I/O error occurs61 */62 protected void processRequest(HttpServletRequest request, HttpServletResponse response)63 throws ServletException, IOException {64 PrintWriter out = response.getWriter();65 String charset = request.getCharacterEncoding();66 ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());67 /**68 * Adding Log entry.69 */70 ILogEventService logEventService = appContext.getBean(ILogEventService.class);71 logEventService.createForPublicCalls("/NewEnvironmentEventV000", "CALL", "NewEnvironmentEventV000 called : " + request.getRequestURL(), request);72 ICountryEnvParamService countryEnvParamService = appContext.getBean(ICountryEnvParamService.class);73 IInvariantService invariantService = appContext.getBean(IInvariantService.class);74 IBatchInvariantService batchInvariantService = appContext.getBean(IBatchInvariantService.class);75 IBuildRevisionBatchService buildRevisionBatchService = appContext.getBean(IBuildRevisionBatchService.class);76 IEmailService emailService = appContext.getBean(IEmailService.class);77 // Parsing all parameters.78 String system = ParameterParserUtil.parseStringParamAndDecodeAndSanitize(request.getParameter("system"), "", charset);79 String country = ParameterParserUtil.parseStringParamAndDecodeAndSanitize(request.getParameter("country"), "", charset);80 String environment = ParameterParserUtil.parseStringParamAndDecodeAndSanitize(request.getParameter("environment"), "", charset);81 String event = ParameterParserUtil.parseStringParamAndDecodeAndSanitize(request.getParameter("event"), "", charset);82 String helpMessage = "\nThis servlet is used to inform Cerberus about an event that occured on a given environment. For example when a treatment has been executed.\n\nParameter list :\n"83 + "- system [mandatory] : the system where the Build Revision has been deployed. [" + system + "]\n"84 + "- country [mandatory] : the country where the Build Revision has been deployed. You can use ALL if you want to perform the action for all countries that exist for the given system and environement. [" + country + "]\n"85 + "- environment [mandatory] : the environment where the Build Revision has been deployed. [" + environment + "]\n"86 + "- event [mandatory] : the event that should be recorded.. [" + event + "]\n";87 boolean error = false;88 // Checking the parameter validity. If application has been entered, does it exist ?89 if (system.equalsIgnoreCase("")) {90 out.println("Error - Parameter system is mandatory.");91 error = true;92 }93 if (!system.equalsIgnoreCase("") && !invariantService.isInvariantExist("SYSTEM", system)) {94 out.println("Error - System does not exist : " + system);95 error = true;96 }97 if (environment.equalsIgnoreCase("")) {98 out.println("Error - Parameter environment is mandatory.");99 error = true;100 }101 if (!environment.equalsIgnoreCase("") && !invariantService.isInvariantExist("ENVIRONMENT", environment)) {102 out.println("Error - Environment does not exist : " + environment);103 error = true;104 }105 if (country.equalsIgnoreCase("")) {106 out.println("Error - Parameter country is mandatory.");107 error = true;108 } else if (!country.equalsIgnoreCase(PARAMETERALL)) {109 if (!invariantService.isInvariantExist("COUNTRY", country)) {110 out.println("Error - Country does not exist : " + country);111 error = true;112 }113 if (!error) {114 if (!countryEnvParamService.exist(system, country, environment)) {115 out.println("Error - System/Country/Environment does not exist : " + system + "/" + country + "/" + environment);116 error = true;117 }118 }119 }120 if (event.equalsIgnoreCase("")) {121 out.println("Error - Parameter event is mandatory.");122 error = true;123 }124 if (!event.equalsIgnoreCase("") && !batchInvariantService.exist(event)) {125 out.println("Error - Event does not exist : " + event);126 error = true;127 }128 // Starting the database update only when no blocking error has been detected.129 if (error == false) {130 /**131 * Getting the list of objects to treat.132 */133 MessageEvent msg = new MessageEvent(MessageEventEnum.GENERIC_OK);134 Answer finalAnswer = new Answer(msg);135 AnswerList answerList = new AnswerList();136 if (country.equalsIgnoreCase(PARAMETERALL)) {137 country = null;138 }139 answerList = countryEnvParamService.readByVarious(system, country, environment, null, null, "Y");140 finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, (Answer) answerList);141 for (CountryEnvParam cepData : (List<CountryEnvParam>) answerList.getDataList()) {142 /**143 * For each object, we can update it.144 */145 // Adding CountryEnvParam Log entry.146 buildRevisionBatchService.create(cepData.getSystem(), cepData.getCountry(), cepData.getEnvironment(), cepData.getBuild(), cepData.getRevision(), event);147 /**148 * Email notification.149 */150 String OutputMessage = "";151 MessageEvent me = emailService.generateAndSendNewChainEmail(cepData.getSystem(), cepData.getCountry(), cepData.getEnvironment(), event);152 if (!"OK".equals(me.getMessage().getCodeString())) {153 LOG.warn(Infos.getInstance().getProjectNameAndVersion() + " - Exception catched." + me.getMessage().getDescription());154 logEventService.createForPrivateCalls("/NewEnvironmentEventV000", "NEW", "Warning on New environment event : ['" + cepData.getSystem() + "','" + cepData.getCountry() + "','" + cepData.getEnvironment() + "'] " + me.getMessage().getDescription(), request);155 OutputMessage = me.getMessage().getDescription();156 }157 if (OutputMessage.equals("")) {158 msg = new MessageEvent(MessageEventEnum.GENERIC_OK);159 Answer answerSMTP = new AnswerList(msg);160 finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, answerSMTP);161 } else {162 msg = new MessageEvent(MessageEventEnum.GENERIC_WARNING);163 msg.setDescription(msg.getDescription().replace("%REASON%", OutputMessage + " when sending email for " + cepData.getSystem() + "/" + cepData.getCountry() + "/" + cepData.getEnvironment()));164 Answer answerSMTP = new AnswerList(msg);165 finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, answerSMTP);166 }167 }168 /**...

Full Screen

Full Screen

NewEnvironmentEventV000

Using AI Code Generation

copy

Full Screen

1NewEnvironmentEventV000 newEnvEvent = new NewEnvironmentEventV000();2newEnvEvent.setEnvironment("DEV");3newEnvEvent.setCountry("SG");4newEnvEvent.setApplication("Cerberus");5newEnvEvent.setEvent("NEW");6newEnvEvent.setDescription("New application Cerberus");7newEnvEvent.setStart(new Date());8newEnvEvent.setEnd(new Date());9newEnvEvent.setControlStatus("OK");10newEnvEvent.setControlMessage("OK");11newEnvEvent.setVerbose(1);12newEnvEvent.setSeverity("1");13newEnvEvent.setActive("Y");14newEnvEvent.setMaintenanceAct("N");15newEnvEvent.setMaintenanceStr(new Date());16newEnvEvent.setMaintenanceEnd(new Date());17newEnvEvent.setMaintenanceUsr("Cerberus");18newEnvEvent.setMaintenanceDesc("Maintenance");19newEnvEvent.setMaintenanceStatus("OK");20newEnvEvent.setMaintenanceMessage("OK");21newEnvEvent.setMaintenanceVerbose(1);22newEnvEvent.setMaintenanceSeverity("1");23newEnvEvent.setMaintenanceActive("Y");24newEnvEvent.setMaintenanceType("ALL");25newEnvEvent.setMaintenanceImpact("ALL");26newEnvEvent.setMaintenanceId(0);27newEnvEvent.setMaintenanceOwner("Cerberus");28newEnvEvent.setMaintenanceDate(new Date());29newEnvEvent.setMaintenanceStart(new Date());30newEnvEvent.setMaintenanceEnd(new Date());31newEnvEvent.setMaintenanceDuration(0);32newEnvEvent.setMaintenancePlanned("Y");33newEnvEvent.setMaintenancePlannedDate(new Date());34newEnvEvent.setMaintenancePlannedStart(new Date());35newEnvEvent.setMaintenancePlannedEnd(new Date());36newEnvEvent.setMaintenancePlannedDuration(0);37newEnvEvent.setMaintenancePlannedStr(new Date());38newEnvEvent.setMaintenancePlannedEnd(new Date());39newEnvEvent.setMaintenancePlannedId(0);40newEnvEvent.setMaintenancePlannedOwner("Cerberus");41newEnvEvent.setMaintenancePlannedTicket("Cerberus");42newEnvEvent.setMaintenancePlannedUrl("Cerberus");

Full Screen

Full Screen

NewEnvironmentEventV000

Using AI Code Generation

copy

Full Screen

1import org.cerberus.servlet.zzpublic.NewEnvironmentEventV000;2NewEnvironmentEventV000 newEnv = new NewEnvironmentEventV000();3newEnv.setEnvironment("ENVIRONMENT_NAME");4newEnv.setEnvironmentType("ENVIRONMENT_TYPE");5newEnv.setCountry("ENVIRONMENT_COUNTRY");6newEnv.setDescription("ENVIRONMENT_DESCRIPTION");7newEnv.setActive("Y");8newEnv.setSort(1);9newEnv.setChain("ENVIRONMENT_CHAIN");10newEnv.setParent("ENVIRONMENT_PARENT");11newEnv.setDatabase("ENVIRONMENT_DATABASE");12newEnv.setUrl("ENVIRONMENT_URL");13newEnv.setDns("ENVIRONMENT_DNS");14newEnv.setIp("ENVIRONMENT_IP");15newEnv.setLogin("ENVIRONMENT_LOGIN");16newEnv.setPassword("ENVIRONMENT_PASSWORD");17newEnv.setDomain("ENVIRONMENT_DOMAIN");18newEnv.setSystem("ENVIRONMENT_SYSTEM");19newEnv.setPoolSize(1);20newEnv.setVerbose(1);21newEnv.setTimeout(1);22newEnv.setSeleniumIP("ENVIRONMENT_SELENIUM_IP");23newEnv.setSeleniumPort(1);24newEnv.setSeleniumLogin("ENVIRONMENT_SELENIUM_LOGIN");25newEnv.setSeleniumPassword("ENVIRONMENT_SELENIUM_PASSWORD");26newEnv.setSeleniumBrowser("ENVIRONMENT_SELENIUM_BROWSER");27newEnv.setSeleniumBrowserVersion("ENVIRONMENT_SELENIUM_BROWSER_VERSION");28newEnv.setSeleniumPlatform("ENVIRONMENT_SELENIUM_PLATFORM

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Cerberus-source automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in NewEnvironmentEventV000

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful