How to use NewBuildRev class of org.cerberus.servlet.integration package

Best Cerberus-source code snippet using org.cerberus.servlet.integration.NewBuildRev

Source:NewBuildRev.java Github

copy

Full Screen

...48import org.cerberus.service.email.IEmailService;49/**50 * @author vertigo51 */52@WebServlet(name = "NewBuildRev", urlPatterns = {"/NewBuildRev"})53public class NewBuildRev extends HttpServlet {54 private final String OBJECT_NAME = "CountryEnvParam";55 private final String ITEM = "Environment";56 private final String OPERATION = "New Build/Revision";57 private static final Logger LOG = LogManager.getLogger("NewBuildRev");58 /**59 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>60 * methods.61 *62 * @param request servlet request63 * @param response servlet response64 * @throws ServletException if a servlet-specific error occurs65 * @throws IOException if an I/O error occurs66 */67 protected void processRequest(HttpServletRequest request, HttpServletResponse response)68 throws ServletException, IOException, JSONException {69 JSONObject jsonResponse = new JSONObject();70 AnswerItem answerItem = new AnswerItem();71 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);72 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));73 answerItem.setResultMessage(msg);74 PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);75 response.setContentType("application/json");76 /**77 * Parsing and securing all required parameters.78 */79 String system = policy.sanitize(request.getParameter("system"));80 String country = policy.sanitize(request.getParameter("country"));81 String env = policy.sanitize(request.getParameter("environment"));82 String build = policy.sanitize(request.getParameter("build"));83 String revision = policy.sanitize(request.getParameter("revision"));84 // Init Answer with potencial error from Parsing parameter.85// AnswerItem answer = new AnswerItem(msg);86 String eMailContent;87 ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());88 IEmailService emailService = appContext.getBean(IEmailService.class);89 IEmailGenerationService emailGenerationService = appContext.getBean(IEmailGenerationService.class);90 IParameterService parameterService = appContext.getBean(IParameterService.class);91 ICountryEnvParamService countryEnvParamService = appContext.getBean(ICountryEnvParamService.class);92 ICountryEnvParam_logService countryEnvParam_logService = appContext.getBean(ICountryEnvParam_logService.class);93 ILogEventService logEventService = appContext.getBean(LogEventService.class);94 if (request.getParameter("system") == null) {95 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);96 msg.setDescription(msg.getDescription().replace("%ITEM%", ITEM)97 .replace("%OPERATION%", OPERATION)98 .replace("%REASON%", "System name is missing!"));99 answerItem.setResultMessage(msg);100 } else if (request.getParameter("country") == null) {101 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);102 msg.setDescription(msg.getDescription().replace("%ITEM%", ITEM)103 .replace("%OPERATION%", OPERATION)104 .replace("%REASON%", "Country is missing!"));105 answerItem.setResultMessage(msg);106 } else if (request.getParameter("environment") == null) {107 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);108 msg.setDescription(msg.getDescription().replace("%ITEM%", ITEM)109 .replace("%OPERATION%", OPERATION)110 .replace("%REASON%", "Environment is missing!"));111 answerItem.setResultMessage(msg);112 } else if (request.getParameter("build") == null) {113 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);114 msg.setDescription(msg.getDescription().replace("%ITEM%", ITEM)115 .replace("%OPERATION%", OPERATION)116 .replace("%REASON%", "Build is missing!"));117 answerItem.setResultMessage(msg);118 } else if (request.getParameter("revision") == null) {119 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);120 msg.setDescription(msg.getDescription().replace("%ITEM%", ITEM)121 .replace("%OPERATION%", OPERATION)122 .replace("%REASON%", "Revision is missing!"));123 answerItem.setResultMessage(msg);124 } else { // All parameters are OK we can start performing the operation.125 // Getting the contryEnvParam based on the parameters.126 answerItem = countryEnvParamService.readByKey(system, country, env);127 if (!(answerItem.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()) && answerItem.getItem() != null)) {128 /**129 * Object could not be found. We stop here and report the error.130 */131 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);132 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME)133 .replace("%OPERATION%", OPERATION)134 .replace("%REASON%", OBJECT_NAME + " ['" + system + "','" + country + "','" + env + "'] does not exist. Cannot activate it!"));135 answerItem.setResultMessage(msg);136 } else {137 /**138 * The service was able to perform the query and confirm the139 * object exist, then we can update it.140 */141 // Email Calculation. Email must be calcuated before we update the Build and revision in order to have the old build revision still available in the mail.142 String OutputMessage = "";143 Email email = null;144 try {145 email = emailGenerationService.generateRevisionChangeEmail(system, country, env, build, revision);146 } catch (Exception ex) {147 LOG.warn(Infos.getInstance().getProjectNameAndVersion() + " - Exception catched.", ex);148 logEventService.createForPrivateCalls("/NewBuildRev", "NEWBUILDREV", "Warning on New Build/Revision environment : ['" + system + "','" + country + "','" + env + "'] " + ex.getMessage(), request);149 OutputMessage = ex.getMessage();150 }151 // We update the object.152 CountryEnvParam cepData = (CountryEnvParam) answerItem.getItem();153 cepData.setBuild(build);154 cepData.setRevision(revision);155 cepData.setActive(true);156 Answer answer = countryEnvParamService.update(cepData);157 if (!(answer.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()))) {158 /**159 * Object could not be updated. We stop here and report the160 * error.161 */162 answerItem.setResultMessage(answer.getResultMessage());163 } else {164 /**165 * Update was successful.166 */167 // Adding Log entry.168 logEventService.createForPrivateCalls("/NewBuildRev", "UPDATE", "Updated CountryEnvParam : ['" + system + "','" + country + "','" + env + "']", request);169 // Adding CountryEnvParam Log entry.170 countryEnvParam_logService.createLogEntry(system, country, env, build, revision, "New Build Revision.", request.getUserPrincipal().getName());171 /**172 * Email notification.173 */174 try {175 emailService.sendHtmlMail(email);176 } catch (Exception e) {177 LOG.warn(Infos.getInstance().getProjectNameAndVersion() + " - Exception catched.", e);178 logEventService.createForPrivateCalls("/NewBuildRev", "NEWBUILDREV", "Warning on New Build/Revision environment : ['" + system + "','" + country + "','" + env + "'] " + e.getMessage(), request);179 OutputMessage = e.getMessage();180 }181 if (OutputMessage.equals("")) {182 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);183 msg.setDescription(msg.getDescription().replace("%ITEM%", "Environment")184 .replace("%OPERATION%", OPERATION));185 answerItem.setResultMessage(msg);186 } else {187 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);188 msg.setDescription(msg.getDescription().replace("%ITEM%", "Environment")189 .replace("%OPERATION%", OPERATION).concat(" Just one warning : ").concat(OutputMessage));190 answerItem.setResultMessage(msg);191 }192 }...

Full Screen

Full Screen

NewBuildRev

Using AI Code Generation

copy

Full Screen

1NewBuildRev buildRev = new NewBuildRev();2buildRev.setCerberusUser("admin");3buildRev.setCerberusPassword("admin");4buildRev.setProject("Cerberus");5buildRev.setRevision("1.1.0");6buildRev.setBuild("1");7buildRev.setEnvironment("DEV");8buildRev.setCountry("FRA");9buildRev.setVerbose(true);10buildRev.setVerboseLevel("DEBUG");11buildRev.setVerboseLimit(100);12buildRev.setScreenshot(true);13buildRev.setScreenshotOnPassed(false);14buildRev.setScreenshotOnFailed(true);15buildRev.setScreenshotOnError(true);16buildRev.setScreenshotOnWarning(true);17buildRev.setScreenshotOnException(true);18buildRev.setScreenshotOnCerberusException(true);19buildRev.setScreenshotOnStepFailed(true);20buildRev.setScreenshotOnStepError(true);21buildRev.setScreenshotOnStepWarning(true);22buildRev.setScreenshotOnStepException(true);23buildRev.setScreenshotOnStepCerberusException(true);24buildRev.setScreenshotOnTestCaseFailed(true);25buildRev.setScreenshotOnTestCaseError(true);26buildRev.setScreenshotOnTestCaseWarning(true);27buildRev.setScreenshotOnTestCaseException(true);28buildRev.setScreenshotOnTestCaseCerberusException(true);29buildRev.setScreenshotOnStepFailed(true);30buildRev.setScreenshotOnStepError(true);31buildRev.setScreenshotOnStepWarning(true);32buildRev.setScreenshotOnStepException(true);33buildRev.setScreenshotOnStepCerberusException(true);34buildRev.setScreenshotOnTestCaseFailed(true);35buildRev.setScreenshotOnTestCaseError(true);36buildRev.setScreenshotOnTestCaseWarning(true);37buildRev.setScreenshotOnTestCaseException(true);38buildRev.setScreenshotOnTestCaseCerberusException(true);39buildRev.setScreenshotOnTestCaseStepFailed(true);40buildRev.setScreenshotOnTestCaseStepError(true);41buildRev.setScreenshotOnTestCaseStepWarning(true);42buildRev.setScreenshotOnTestCaseStepException(true);43buildRev.setScreenshotOnTestCaseStepCerberusException(true);44buildRev.setScreenshotOnStepFailed(true);45buildRev.setScreenshotOnStepError(true);46buildRev.setScreenshotOnStepWarning(true);47buildRev.setScreenshotOnStepException(true);48buildRev.setScreenshotOnStepCerberusException(true);49buildRev.setScreenshotOnTestCaseFailed(true);50buildRev.setScreenshotOnTestCaseError(true);

Full Screen

Full Screen

NewBuildRev

Using AI Code Generation

copy

Full Screen

1import org.cerberus.servlet.integration.NewBuildRev;2import java.io.IOException;3import java.io.PrintWriter;4import java.util.logging.Level;5import java.util.logging.Logger;6import javax.servlet.ServletException;7import javax.servlet.http.HttpServlet;8import javax.servlet.http.HttpServletRequest;9import javax.servlet.http.HttpServletResponse;10import org.apache.commons.lang3.exception.ExceptionUtils;11import org.cerberus.engine.entity.MessageEvent;12import org.cerberus.engine.entity.MessageGeneral;13import org.cerberus.exception.CerberusException;14import org.cerberus.log.MyLogger;15import org.cerberus.servlet.api.GetApplicationList;16import org.cerberus.servlet.api.GetApplicationListFromSystem;17import org.cerberus.servlet.api.GetBuildRevisionInvariantList;18import org.cerberus.servlet.api.GetBuildRevisionInvariantListFromSystem;19import org.cerberus.servlet.api.GetCountryEnvironmentParameters;20import org.cerberus.servlet.api.GetCountryEnvironmentParametersFromSystem;21import org.cerberus.servlet.api.GetEnvironmentList;22import org.cerberus.servlet.api.GetEnvironmentListFromSystem;23import org.cerberus.servlet.api.GetInvariantList;24import org.cerberus.servlet.api.GetInvariantListFromSystem;25import org.cerberus.servlet.api.GetSystemList;26import org.cerberus.servlet.api.GetSystemListFromSystem;27import org.cerberus.servlet.api.GetTagList;28import org.cerberus.servlet.api.GetTagListFromSystem;29import org.cerberus.servlet.api.GetTestBattery;30import org.cerberus.servlet.api.GetTestBatteryFromSystem;31import org.cerberus.servlet.api.GetTestCaseList;32import org.cerberus.servlet.api.GetTestCaseListFromSystem;33import org.cerberus.servlet.api.GetTestList;34import org.cerberus.servlet.api.GetTestListFromSystem;35import org.cerberus.servlet.api.GetVersionList;36import org.cerberus.servlet.api.GetVersionListFromSystem;37import org.cerberus.servlet.api.GetCampaignList;38import org.cerberus.servlet.api.GetCampaignListFromSystem;39import org.cerberus.servlet.api.GetCampaignListFrom

Full Screen

Full Screen

NewBuildRev

Using AI Code Generation

copy

Full Screen

1import org.cerberus.servlet.integration.NewBuildRev;2import org.cerberus.servlet.integration.BuildRevServlet;3import org.cerberus.servlet.integration.BuildRevHandler;4NewBuildRev buildRev = new NewBuildRev();5buildRev.setBuild("1.0.0");6buildRev.setRevision("1");7buildRev.setEnvironment("MyEnvironment");8buildRev.setCountry("MyCountry");9buildRev.setRobot("MyRobot");10buildRev.setRobotIp("

Full Screen

Full Screen

NewBuildRev

Using AI Code Generation

copy

Full Screen

1import org.cerberus.servlet.integration.NewBuildRev;2NewBuildRev buildRev = new NewBuildRev();3buildRev.setBuildRevName("BuildRevName");4buildRev.setBuildRevDescription("BuildRevDescription");5buildRev.setBuildRevActive("Y");6buildRev.setBuildRevType("RC");7buildRev.setBuildRevMajor("1");8buildRev.setBuildRevMinor("0");9buildRev.setBuildRevPatch("0");10buildRev.setBuildRevBuild("0");11buildRev.setBuildRevRevision("0");12buildRev.setBuildRevDate("2017-01-01");

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 NewBuildRev

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