How to use updateEndOfQueueData method of org.cerberus.crud.service.impl.TagService class

Best Cerberus-source code snippet using org.cerberus.crud.service.impl.TagService.updateEndOfQueueData

Source:TagService.java Github

copy

Full Screen

...123 return tagDAO.update(tag, object);124 }125 126 @Override127 public Answer updateEndOfQueueData(String tag) {128 129 try {130 Tag mytag = convert(readByKey(tag));131 // Total execution.132 mytag.setNbExe(testCaseExecutionService.readNbByTag(tag));133 // End of queue is now.134 mytag.setDateEndQueue(new Timestamp(new Date().getTime()));135 // All the rest of the data are coming from ResultCI Servlet.136 JSONObject jsonResponse = ciService.getCIResult(tag, mytag.getCampaign());137 mytag.setCiScore(jsonResponse.getInt("CI_finalResult"));138 mytag.setCiScoreThreshold(jsonResponse.getInt("CI_finalResultThreshold"));139 140 if (jsonResponse.getString("result").equalsIgnoreCase("PE")) {141 // If result is PE that probably means that another execution was manually inserted in the queue or started after the end of last execution. It should not be considered.142 mytag.setCiResult(ciService.getFinalResult(jsonResponse.getInt("CI_finalResult"), jsonResponse.getInt("CI_finalResultThreshold"), jsonResponse.getInt("TOTAL_nbOfExecution"), jsonResponse.getInt("status_OK_nbOfExecution")));143 } else {144 mytag.setCiResult(jsonResponse.getString("result"));145 }146 147 mytag.setEnvironmentList(jsonResponse.getJSONArray("environment_List").toString());148 mytag.setCountryList(jsonResponse.getJSONArray("country_list").toString());149 mytag.setRobotDecliList(jsonResponse.getJSONArray("robotdecli_list").toString());150 mytag.setSystemList(jsonResponse.getJSONArray("system_list").toString());151 mytag.setApplicationList(jsonResponse.getJSONArray("application_list").toString());152 153 mytag.setNbOK(jsonResponse.getInt("status_OK_nbOfExecution"));154 mytag.setNbKO(jsonResponse.getInt("status_KO_nbOfExecution"));155 mytag.setNbFA(jsonResponse.getInt("status_FA_nbOfExecution"));156 mytag.setNbNA(jsonResponse.getInt("status_NA_nbOfExecution"));157 mytag.setNbNE(jsonResponse.getInt("status_NE_nbOfExecution"));158 mytag.setNbWE(jsonResponse.getInt("status_WE_nbOfExecution"));159 mytag.setNbPE(jsonResponse.getInt("status_PE_nbOfExecution"));160 mytag.setNbQU(jsonResponse.getInt("status_QU_nbOfExecution"));161 mytag.setNbQE(jsonResponse.getInt("status_QE_nbOfExecution"));162 mytag.setNbCA(jsonResponse.getInt("status_CA_nbOfExecution"));163 mytag.setNbExeUsefull(jsonResponse.getInt("TOTAL_nbOfExecution"));164 165 return tagDAO.updateDateEndQueue(mytag);166 167 } catch (CerberusException ex) {168 java.util.logging.Logger.getLogger(TagService.class.getName()).log(Level.SEVERE, null, ex);169 return null;170 171 } catch (Exception ex) {172 java.util.logging.Logger.getLogger(TagService.class.getName()).log(Level.SEVERE, null, ex);173 return null;174 }175 176 }177 178 @Override179 public Answer createAuto(String tagS, String campaign, String user, JSONArray reqEnvironmentList, JSONArray reqCountryList) {180 AnswerItem answerTag;181 answerTag = readByKey(tagS);182 Tag tag = (Tag) answerTag.getItem();183 if (tag == null) {184 LOG.debug("toto service : " + reqEnvironmentList.toString());185 Answer ans = tagDAO.create(factoryTag.create(0, tagS, "", campaign, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", "", "", "", "",186 reqEnvironmentList.toString(), reqCountryList.toString(), "", user, null, user, null));187 if (!StringUtil.isNullOrEmpty(campaign)) {188 notificationService.generateAndSendNotifyStartTagExecution(tagS, campaign);189 }190 return ans;191 // If campaign is not empty, we could notify the Start of campaign execution.192 } else {193 if ((StringUtil.isNullOrEmpty(tag.getCampaign())) && !StringUtil.isNullOrEmpty(campaign)) {194 tag.setCampaign(campaign);195 return tagDAO.update(tag.getTag(), tag);196 }197 return null;198 }199 }200 201 @Override202 public String enrichTagWithBrowserStackBuild(String system, String tagS, String user, String pass) {203 if (!StringUtil.isNullOrEmpty(tagS)) {204 LOG.debug("Trying to enrish tag '" + tagS + "' with BrowserStack Build hash.");205 AnswerItem answerTag;206 answerTag = readByKey(tagS);207 Tag tag = (Tag) answerTag.getItem();208 if ((tag != null) && StringUtil.isNullOrEmpty(tag.getBrowserstackBuildHash())) {209 String newBuildHash = browserstackService.getBrowserStackBuildHash(system, tagS, user, pass);210 tag.setBrowserstackBuildHash(newBuildHash);211 Answer ans = tagDAO.updateBrowserStackBuild(tagS, tag);212 return newBuildHash;213 }214 }215 return null;216 }217 218 @Override219 public Tag convert(AnswerItem<Tag> answerItem) throws CerberusException {220 if (answerItem.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {221 //if the service returns an OK message then we can get the item222 return (Tag) answerItem.getItem();223 }224 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));225 }226 227 @Override228 public List<Tag> convert(AnswerList<Tag> answerList) throws CerberusException {229 if (answerList.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {230 //if the service returns an OK message then we can get the item231 return (List<Tag>) answerList.getDataList();232 }233 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));234 }235 236 @Override237 public void convert(Answer answer) throws CerberusException {238 if (answer.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {239 //if the service returns an OK message then we can get the item240 return;241 }242 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));243 }244 245 @Override246 public AnswerList<String> readDistinctValuesByCriteria(String system, String searchParameter, Map<String, List<String>> individualSearch, String columnName) {247 return tagDAO.readDistinctValuesByCriteria(system, searchParameter, individualSearch, columnName);248 }249 250 @Override251 public void manageCampaignEndOfExecution(String tag) throws CerberusException {252 253 try {254 if (!StringUtil.isNullOrEmpty(tag)) {255 Tag currentTag = this.convert(this.readByKey(tag));256 if ((currentTag != null)) {257 if (currentTag.getDateEndQueue().before(Timestamp.valueOf("1980-01-01 01:01:01.000000001"))) {258 AnswerList answerListQueue = new AnswerList<>();259 answerListQueue = executionQueueService.readQueueOpen(tag);260 if (answerListQueue.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode()) && (answerListQueue.getDataList().isEmpty())) {261 LOG.debug("No More executions (in queue or running) on tag : " + tag + " - " + answerListQueue.getDataList().size() + " " + answerListQueue.getMessageCodeString() + " - ");262 this.updateEndOfQueueData(tag);263 if (!StringUtil.isNullOrEmpty(currentTag.getCampaign())) {264 // We get the campaig here and potencially send the notification.265 notificationService.generateAndSendNotifyEndTagExecution(tag, currentTag.getCampaign());266 }267 } else {268 LOG.debug("Still executions in queue on tag : " + tag + " - " + answerListQueue.getDataList().size() + " " + answerListQueue.getMessageCodeString());269 }270 } else {271 LOG.debug("Tag is already flaged with recent timestamp. " + currentTag.getDateEndQueue());272 }273 274 }275 }276 } catch (Exception e) {...

Full Screen

Full Screen

updateEndOfQueueData

Using AI Code Generation

copy

Full Screen

1TagService tagService = appContext.getBean(TagService.class);2tagService.updateEndOfQueueData(1);3TagService tagService = appContext.getBean(TagService.class);4tagService.updateEndOfQueueData(1, "2017-01-01 00:00:00");5TagService tagService = appContext.getBean(TagService.class);6tagService.updateEndOfQueueData(1, "2017-01-01 00:00:00", true);7TagService tagService = appContext.getBean(TagService.class);8tagService.updateEndOfQueueData(1, "2017-01-01 00:00:00", true, true);9TagService tagService = appContext.getBean(TagService.class);10tagService.updateEndOfQueueData(1, "2017-01-01 00:00:00", true, true, true);

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful