How to use CreateScheduleEntry class of org.cerberus.servlet.crud.scheduleentry package

Best Cerberus-source code snippet using org.cerberus.servlet.crud.scheduleentry.CreateScheduleEntry

Source:CreateScheduleEntry.java Github

copy

Full Screen

...51/**52 *53 * @author cdelage54 */55@WebServlet(name = "CreateScheduleEntry", urlPatterns = {"/CreateScheduleEntry"})56public class CreateScheduleEntry extends HttpServlet {57 private static final Logger LOG = LogManager.getLogger(CreateScheduleEntry.class);58 @Autowired59 CronExpression cronExpression;60 /**61 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>62 * methods.63 *64 * @param request servlet request65 * @param response servlet response66 * @throws ServletException if a servlet-specific error occurs67 * @throws IOException if an I/O error occurs68 */69 protected void processRequest(HttpServletRequest request, HttpServletResponse response)70 throws ServletException, IOException, JSONException {71 JSONObject jsonResponse = new JSONObject();72 Answer ans = new Answer();73 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);74 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));75 ans.setResultMessage(msg);76 PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);77 response.setContentType("application/json");78 // Calling Servlet Transversal Util.79 ServletUtil.servletStart(request);80 /**81 * Parsing and securing all required parameters.82 */83 String name = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("name"), "");84 String cronDefinition = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("cronDefinition"), "");85 String type = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("type"), "CAMPAIGN");86 String active = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("active"), "Y");87 String desc = ParameterParserUtil.parseStringParamAndSanitize(request.getParameter("description"), "Y");88 Boolean validCron = org.quartz.CronExpression.isValidExpression(cronDefinition);89 LOG.debug("validCron : " + validCron);90 /**91 * Checking all constrains before calling the services.92 */93 if (name.isEmpty() || cronDefinition.isEmpty() || !validCron) {94 msg = new MessageEvent(MessageEventEnum.SCHEDULER_ERROR_EXPECTED);95 msg.setDescription(msg.getDescription().replace("%ITEM%", "campaign")96 .replace("%OPERATION%", "Create")97 .replace("%REASON%", "Some mendatory fields are missing or iregular!"));98 ans.setResultMessage(msg);99 } else {100 /**101 * All data seems cleans so we can call the services.102 */103 ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());104 IFactoryScheduleEntry factoryScheduleEntry = appContext.getBean(IFactoryScheduleEntry.class);105 IScheduleEntryService scheduleEntryService = appContext.getBean(IScheduleEntryService.class);106 ScheduleEntry scheduleEntry = factoryScheduleEntry.create(0, type, name, cronDefinition, null, active, desc, request.getUserPrincipal().getName(), null, null, null);107 ans = scheduleEntryService.create(scheduleEntry);108 if (ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {109 /**110 * Object created. Updating Scheduler Version.111 */112 IMyVersionService myVersionService = appContext.getBean(IMyVersionService.class);113 myVersionService.updateMyVersionString("scheduler_version", String.valueOf(new Date()));114 /**115 * Object created. Adding Log entry.116 */117 ILogEventService logEventService = appContext.getBean(LogEventService.class);118 IFactoryLogEvent factoryLogEvent = appContext.getBean(FactoryLogEvent.class);119 logEventService.createForPrivateCalls("/CreateScheduleEntry", "CREATE", "Create schedule entry : ['" + scheduleEntry.getName() + "']", request);120 }121 }122 /**123 * Formating and returning the json result.124 */125 jsonResponse.put("messageType", ans.getResultMessage().getMessage().getCodeString());126 jsonResponse.put("message", ans.getResultMessage().getDescription());127 response.getWriter().print(jsonResponse);128 response.getWriter().flush();129 }130 // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">131 /**132 * Handles the HTTP <code>GET</code> method.133 *...

Full Screen

Full Screen

CreateScheduleEntry

Using AI Code Generation

copy

Full Screen

1import org.cerberus.servlet.crud.scheduleentry.CreateScheduleEntry;2CreateScheduleEntry cse = new CreateScheduleEntry();3cse.setTest("test");4cse.setTestCase("testcase");5cse.setCountry("country");6cse.setEnvironment("environment");7cse.setBrowser("browser");8cse.setRobot("robot");9cse.setRobotDecli("robotDecli");10cse.setRobotExecutor("robotExecutor");11cse.setApplication("application");12cse.setActive("Y");13cse.setScheduled(true);14cse.setSchedulerId(1);15cse.setSchedulerDate("2015-01-01 00:00:00");16cse.setSchedulerTime("00:00:00");17cse.setSchedulerCron("0 0 0 1 1 ?");18cse.setSchedulerCronDescription("cron description");19cse.setSchedulerCronNextTrigger("2015-01-01 00:00:00");20cse.setSchedulerCronPreviousTrigger("2015-01-01 00:00:00");

Full Screen

Full Screen

CreateScheduleEntry

Using AI Code Generation

copy

Full Screen

1CreateScheduleEntry cr = new CreateScheduleEntry();2cr.doPost(request, response);3ReadScheduleEntry rd = new ReadScheduleEntry();4rd.doGet(request, response);5UpdateScheduleEntry up = new UpdateScheduleEntry();6up.doPost(request, response);7DeleteScheduleEntry del = new DeleteScheduleEntry();8del.doPost(request, response);9ReadScheduleEntryActive rd = new ReadScheduleEntryActive();10rd.doGet(request, response);

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 CreateScheduleEntry

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