How to use getType method of org.cerberus.dto.TreeNode class

Best Cerberus-source code snippet using org.cerberus.dto.TreeNode.getType

Source:ReadTestCaseExecutionByTag.java Github

copy

Full Screen

...363 * based on the key Test_TestCase364 */365 LinkedHashMap<String, JSONArray> testCaseWithLabel = new LinkedHashMap<>();366 for (TestCaseLabel label : (List<TestCaseLabel>) testCaseLabelList) {367 if (Label.TYPE_STICKER.equals(label.getLabel().getType())) { // We only display STICKER Type Label in Reporting By Tag Page..368 String key = label.getTest() + "_" + label.getTestcase();369 JSONObject jo = new JSONObject().put("name", label.getLabel().getLabel()).put("color", label.getLabel().getColor()).put("description", label.getLabel().getDescription());370 if (testCaseWithLabel.containsKey(key)) {371 testCaseWithLabel.get(key).put(jo);372 } else {373 testCaseWithLabel.put(key, new JSONArray().put(jo));374 }375 }376 }377 ttcObject.put("labels", testCaseWithLabel.get(testCaseExecution.getTest() + "_" + testCaseExecution.getTestCase()));378 }379 ttc.put(testCaseExecution.getTest() + "_" + testCaseExecution.getTestCase(), ttcObject);380 JSONObject column = new JSONObject();381 column.put("country", testCaseExecution.getCountry());382 column.put("environment", testCaseExecution.getEnvironment());383 column.put("robotDecli", testCaseExecution.getRobotDecli());384 columnMap.put(testCaseExecution.getRobotDecli() + "_" + testCaseExecution.getCountry() + "_" + testCaseExecution.getEnvironment(), column);385 }386 TreeMap<String, JSONObject> bugMap = new TreeMap<>();387 HashMap<String, Boolean> bugMapUniq = new HashMap<>();388 int nbTOCLEAN = 0;389 int nbPENDING = 0;390 int nbTOREPORT = 0;391 // building Bug Status.392 for (Map.Entry<String, JSONObject> entry : ttc.entrySet()) {393 JSONObject val = entry.getValue();394 JSONArray bugA = new JSONArray(val.getString("bugs"));395 int nbBug = bugA.length();396 if (nbBug > 0) {397 for (int i = 0; i < nbBug; i++) {398 bugMapUniq.put(bugA.getJSONObject(i).getString("id"), true);399 String key = bugA.getJSONObject(i).getString("id") + "#" + val.getString("test") + "#" + val.getString("testCase");400 if (bugMap.containsKey(key)) {401 JSONObject bugO = bugMap.get(key);402 } else {403 JSONObject bugO = new JSONObject();404 bugO.put("test", val.getString("test"));405 bugO.put("testCase", val.getString("testCase"));406 bugO.put("bug", bugA.getJSONObject(i).getString("id"));407 bugO.put("NbExeUsefullHasBug", val.getInt("NbExeUsefullHasBug"));408 bugO.put("testExist", val.getBoolean("testExist"));409 bugO.put("NbExeUsefull", val.getInt("NbExeUsefull"));410 bugO.put("NbExeUsefullIsPending", val.getInt("NbExeUsefullIsPending"));411 if (val.getInt("NbExeUsefullIsPending") > 0) {412 bugO.put("status", "STILL RUNNING...");413 nbPENDING++;414 } else {415 if (val.getInt("NbExeUsefull") == val.getInt("NbExeUsefullOK")) {416 bugO.put("status", "TO CLEAN");417 nbTOCLEAN++;418 }419 }420 bugMap.put(key, bugO);421 }422 }423 } else {424 if (val.getInt("NbExeUsefullHasBug") > 0) {425 String key = val.getString("test") + "#" + val.getString("testCase");426 JSONObject bugO = new JSONObject();427 bugO.put("test", val.getString("test"));428 bugO.put("testCase", val.getString("testCase"));429 bugO.put("bug", "");430 bugO.put("NbExeUsefullHasBug", val.getInt("NbExeUsefullHasBug"));431 bugO.put("testExist", val.getBoolean("testExist"));432 bugO.put("NbExeUsefull", val.getInt("NbExeUsefull"));433 bugO.put("NbExeUsefullIsPending", val.getInt("NbExeUsefullIsPending"));434 bugO.put("status", "TO REPORT...");435 nbTOREPORT++;436 bugMap.put(key, bugO);437 }438 }439 }440 JSONObject bugRes = new JSONObject();441 bugRes.put("bugSummary", bugMap.values());442 bugRes.put("nbTOREPORT", nbTOREPORT);443 bugRes.put("nbPENDING", nbPENDING);444 bugRes.put("nbTOCLEAN", nbTOCLEAN);445 bugRes.put("nbBugs", bugMapUniq.size());446 testCaseExecutionTable.put("bugContent", bugRes);447 // Now loading only necessary records to final structure (filtering testcase that have all usefull executions OK of QU).448 if (fullList) {449 testCaseExecutionTable.put("tableContent", ttc.values());450 testCaseExecutionTable.put("iTotalRecords", ttc.size());451 testCaseExecutionTable.put("iTotalDisplayRecords", ttc.size());452 } else {453 LinkedHashMap<String, JSONObject> newttc = new LinkedHashMap<>();454 for (Map.Entry<String, JSONObject> entry : ttc.entrySet()) {455 String key = entry.getKey();456 JSONObject val = entry.getValue();457 if ((val.getInt("NbExeUsefullToHide") != val.getInt("NbExeUsefull")) // One of the execution of the test case has a status <> QU and OK458 || (val.getJSONArray("bugs").length() > 0) // At least 1 bug has been assigned to the testcase.459 ) {460 newttc.put(key, val);461 }462 }463 testCaseExecutionTable.put("tableContent", newttc.values());464 testCaseExecutionTable.put("iTotalRecords", newttc.size());465 testCaseExecutionTable.put("iTotalDisplayRecords", newttc.size());466 }467 Map<String, JSONObject> treeMap = new TreeMap<>(columnMap);468 testCaseExecutionTable.put("tableColumns", treeMap.values());469 } catch (JSONException ex) {470 LOG.error("Error on generateTestCaseExecutionTable : " + ex, ex);471 } catch (Exception ex) {472 LOG.error("Error on generateTestCaseExecutionTable : " + ex, ex);473 }474 }475 return testCaseExecutionTable;476 }477 // We hide is status is QU of OK and there were no previous execution.478 private boolean isToHide(String controlStatus, String previousControlStatus) {479 return (controlStatus.equals(TestCaseExecution.CONTROLSTATUS_QU) && (StringUtil.isNullOrEmpty(previousControlStatus))480 || controlStatus.equals(TestCaseExecution.CONTROLSTATUS_OK));481 }482 private boolean isPending(String controlStatus) {483 return (controlStatus.equals(TestCaseExecution.CONTROLSTATUS_QU) || controlStatus.equals(TestCaseExecution.CONTROLSTATUS_WE) || controlStatus.equals(TestCaseExecution.CONTROLSTATUS_PE));484 }485 private boolean isBug(String controlStatus) {486 return (controlStatus.equals(TestCaseExecution.CONTROLSTATUS_FA) || controlStatus.equals(TestCaseExecution.CONTROLSTATUS_KO));487 }488 private boolean isNotBug(String controlStatus) {489 return (controlStatus.equals(TestCaseExecution.CONTROLSTATUS_OK) || controlStatus.equals(TestCaseExecution.CONTROLSTATUS_QE));490 }491 private JSONObject generateManualExecutionTable(ApplicationContext appContext, List<TestCaseExecution> testCaseExecutions, JSONObject statusFilter, JSONObject countryFilter) {492 JSONObject manualExecutionTable = new JSONObject();493 HashMap<String, JSONObject> manualExecutions = new HashMap<>();494 int totalManualExecution = 0;495 int totalManualWEExecution = 0;496 for (TestCaseExecution testCaseExecution : testCaseExecutions) {497 try {498 String controlStatus = testCaseExecution.getControlStatus();499 boolean isManual = StringUtil.parseBoolean(testCaseExecution.getManualExecution());500 // We check is Country and status is inside the fitered values.501 if (countryFilter.get(testCaseExecution.getCountry()).equals("on")) {502 if (isManual) {503 totalManualExecution++;504 String executor = "NoExecutorDefined";505 if (!StringUtil.isNullOrEmpty(testCaseExecution.getExecutor())) {506 executor = testCaseExecution.getExecutor();507 }508 if (manualExecutions.containsKey(executor)) {509 JSONObject executorObj = manualExecutions.get(executor);510 JSONArray array = (JSONArray) executorObj.get("executionList");511 array.put(testCaseExecution.getId());512 JSONArray arrayWE = (JSONArray) executorObj.get("executionWEList");513 if (controlStatus.equals(TestCaseExecution.CONTROLSTATUS_WE)) {514 arrayWE.put(testCaseExecution.getId());515 }516 executorObj.put("executionList", array);517 executorObj.put("executionWEList", arrayWE);518 executorObj.put("executor", executor);519 manualExecutions.put(executor, executorObj);520 } else {521 JSONObject executorObj = new JSONObject();522 JSONArray array = new JSONArray();523 array.put(testCaseExecution.getId());524 JSONArray arrayWE = new JSONArray();525 if (controlStatus.equals(TestCaseExecution.CONTROLSTATUS_WE)) {526 arrayWE.put(testCaseExecution.getId());527 }528 executorObj.put("executionList", array);529 executorObj.put("executionWEList", arrayWE);530 executorObj.put("executor", executor);531 manualExecutions.put(executor, executorObj);532 }533 if (controlStatus.equals(TestCaseExecution.CONTROLSTATUS_WE)) {534 totalManualWEExecution++;535 }536 }537 }538 JSONArray array = new JSONArray();539 for (Map.Entry<String, JSONObject> entry : manualExecutions.entrySet()) {540 Object key = entry.getKey();541 JSONObject val = entry.getValue();542 array.put(val);543 }544 manualExecutionTable.put("perExecutor", array);545 manualExecutionTable.put("totalExecution", totalManualExecution);546 manualExecutionTable.put("totalWEExecution", totalManualWEExecution);547 } catch (JSONException ex) {548 LOG.error("Error on generateManualExecutionTable : " + ex, ex);549 } catch (Exception ex) {550 LOG.error("Error on generateManualExecutionTable : " + ex, ex);551 }552 }553 return manualExecutionTable;554 }555 private JSONObject generateTestFolderChart(List<TestCaseExecution> testCaseExecutions, String tag, JSONObject statusFilter, JSONObject countryFilter) throws JSONException {556 JSONObject jsonResult = new JSONObject();557 Map<String, JSONObject> axisMap = new HashMap<String, JSONObject>();558 String globalStart = "";559 String globalEnd = "";560 long globalStartL = 0;561 long globalEndL = 0;562 String globalStatus = "Finished";563 for (TestCaseExecution testCaseExecution : testCaseExecutions) {564 String key;565 JSONObject control = new JSONObject();566 JSONObject function = new JSONObject();567 String controlStatus = testCaseExecution.getControlStatus();568 if (statusFilter.get(controlStatus).equals("on") && countryFilter.get(testCaseExecution.getCountry()).equals("on")) {569 key = testCaseExecution.getTest();570 controlStatus = testCaseExecution.getControlStatus();571 control.put("value", 1);572 control.put("color", getColor(controlStatus));573 control.put("label", controlStatus);574 function.put("name", key);575 if (axisMap.containsKey(key)) {576 function = axisMap.get(key);577 if (function.has(controlStatus)) {578 int prec = function.getJSONObject(controlStatus).getInt("value");579 control.put("value", prec + 1);580 }581 }582 function.put(controlStatus, control);583 axisMap.put(key, function);584 }585 if (testCaseExecution.getStart() != 0) {586 if ((globalStartL == 0) || (globalStartL > testCaseExecution.getStart())) {587 globalStartL = testCaseExecution.getStart();588 globalStart = String.valueOf(new Date(testCaseExecution.getStart()));589 }590 }591 if (!testCaseExecution.getControlStatus().equalsIgnoreCase("PE") && testCaseExecution.getEnd() != 0) {592 if ((globalEndL == 0) || (globalEndL < testCaseExecution.getEnd())) {593 globalEndL = testCaseExecution.getEnd();594 globalEnd = String.valueOf(new Date(testCaseExecution.getEnd()));595 }596 }597 if (testCaseExecution.getControlStatus().equalsIgnoreCase("PE")) {598 globalStatus = "Pending...";599 }600 }601 Gson gson = new Gson();602 List<JSONObject> axisList = new ArrayList<>();603 for (Map.Entry<String, JSONObject> entry : axisMap.entrySet()) {604 String key = entry.getKey();605 JSONObject value = entry.getValue();606 axisList.add(value);607 }608 Collections.sort(axisList, new SortExecution());609 jsonResult.put("axis", axisList);610 jsonResult.put("tag", tag);611 jsonResult.put("globalEnd", gson.toJson(new Timestamp(globalEndL)).replace("\"", ""));612 jsonResult.put("globalStart", globalStart);613 jsonResult.put("globalStatus", globalStatus);614 return jsonResult;615 }616 class SortExecution implements Comparator<JSONObject> {617 // Used for sorting in ascending order of618 // name value.619 @Override620 public int compare(JSONObject a, JSONObject b) {621 if (a != null && b != null) {622 try {623 String aS = (String) a.get("name");624 String bS = (String) b.get("name");625 return aS.compareToIgnoreCase(bS);626 } catch (JSONException ex) {627 LOG.error("JSON Error Exception", ex);628 return 1;629 }630 } else {631 return 1;632 }633 }634 }635 private JSONObject generateStats(HttpServletRequest request, List<TestCaseExecution> testCaseExecutions, JSONObject statusFilter, JSONObject countryFilter, boolean splitStats) throws JSONException {636 JSONObject jsonResult = new JSONObject();637 boolean env = request.getParameter("env") != null || !splitStats;638 boolean country = request.getParameter("country") != null || !splitStats;639 boolean robotDecli = request.getParameter("robotDecli") != null || !splitStats;640 boolean app = request.getParameter("app") != null || !splitStats;641 HashMap<String, SummaryStatisticsDTO> statMap = new HashMap<String, SummaryStatisticsDTO>();642 for (TestCaseExecution testCaseExecution : testCaseExecutions) {643 String controlStatus = testCaseExecution.getControlStatus();644 if (statusFilter.get(controlStatus).equals("on") && countryFilter.get(testCaseExecution.getCountry()).equals("on")) {645 StringBuilder key = new StringBuilder();646 key.append((env) ? testCaseExecution.getEnvironment() : "");647 key.append("_");648 key.append((country) ? testCaseExecution.getCountry() : "");649 key.append("_");650 key.append((robotDecli) ? testCaseExecution.getRobotDecli() : "");651 key.append("_");652 key.append((app) ? testCaseExecution.getApplication() : "");653 SummaryStatisticsDTO stat = new SummaryStatisticsDTO();654 stat.setEnvironment(testCaseExecution.getEnvironment());655 stat.setCountry(testCaseExecution.getCountry());656 stat.setRobotDecli(testCaseExecution.getRobotDecli());657 stat.setApplication(testCaseExecution.getApplication());658 statMap.put(key.toString(), stat);659 }660 }661 jsonResult.put("contentTable", getStatByEnvCountryRobotDecli(testCaseExecutions, statMap, env, country, robotDecli, app, statusFilter, countryFilter, splitStats));662 return jsonResult;663 }664 private JSONObject generateBugStats(HttpServletRequest request, List<TestCaseExecution> testCaseExecutions, JSONObject statusFilter, JSONObject countryFilter) throws JSONException {665 JSONObject jsonResult = new JSONObject();666 SummaryStatisticsBugTrackerDTO stat = new SummaryStatisticsBugTrackerDTO();667 String bugsToReport = "KO,FA";668 stat.setNbExe(1);669 int totalBugReported = 0;670 int totalBugToReport = 0;671 int totalBugToReportReported = 0;672 int totalBugToClean = 0;673 HashMap<String, SummaryStatisticsBugTrackerDTO> statMap = new HashMap<>();674 for (TestCaseExecution testCaseExecution : testCaseExecutions) {675 String controlStatus = testCaseExecution.getControlStatus();676 if (statusFilter.get(controlStatus).equals("on") && countryFilter.get(testCaseExecution.getCountry()).equals("on")) {677 String key = "";678 if (bugsToReport.contains(testCaseExecution.getControlStatus())) {679 totalBugToReport++;680 }681 if ((testCaseExecution.getTestCaseObj() != null) && (testCaseExecution.getTestCaseObj().getBugs().length() > 0)) {682 JSONArray arr = testCaseExecution.getTestCaseObj().getBugs();683 for (int i = 0; i < arr.length(); i++) {684 JSONObject bug = (JSONObject) arr.get(i);685 key = bug.getString("id");686 stat = statMap.get(key);687 totalBugReported++;688 if (stat == null) {689 stat = new SummaryStatisticsBugTrackerDTO();690 stat.setNbExe(1);691 stat.setBugId(key);692 stat.setBugIdURL(testCaseExecution.getApplicationObj().getBugTrackerUrl().replace("%BUGID%", key));693 stat.setExeIdLastStatus(testCaseExecution.getControlStatus());694 stat.setExeIdFirst(testCaseExecution.getId());695 stat.setExeIdLast(testCaseExecution.getId());696 stat.setTestFirst(testCaseExecution.getTest());697 stat.setTestLast(testCaseExecution.getTest());698 stat.setTestCaseFirst(testCaseExecution.getTestCase());699 stat.setTestCaseLast(testCaseExecution.getTestCase());700 } else {701 stat.setNbExe(stat.getNbExe() + 1);702 stat.setExeIdLastStatus(testCaseExecution.getControlStatus());703 stat.setExeIdLast(testCaseExecution.getId());704 stat.setTestLast(testCaseExecution.getTest());705 stat.setTestCaseLast(testCaseExecution.getTestCase());706 }707 if (!(bugsToReport.contains(testCaseExecution.getControlStatus()))) {708 totalBugToClean++;709 stat.setToClean(true);710 } else {711 totalBugToReportReported++;712 }713 statMap.put(key, stat);714 }715 }716 }717 }718 Gson gson = new Gson();719 JSONArray dataArray = new JSONArray();720 for (String key : statMap.keySet()) {721 SummaryStatisticsBugTrackerDTO sumStats = statMap.get(key);722 dataArray.put(new JSONObject(gson.toJson(sumStats)));723 }724 jsonResult.put("BugTrackerStat", dataArray);725 jsonResult.put("totalBugToReport", totalBugToReport);726 jsonResult.put("totalBugToReportReported", totalBugToReportReported);727 jsonResult.put("totalBugReported", totalBugReported);728 jsonResult.put("totalBugToClean", totalBugToClean);729 return jsonResult;730 }731 private JSONObject getStatByEnvCountryRobotDecli(List<TestCaseExecution> testCaseExecutions, HashMap<String, SummaryStatisticsDTO> statMap, boolean env, boolean country, boolean robotDecli, boolean app, JSONObject statusFilter, JSONObject countryFilter, boolean splitStats) throws JSONException {732 SummaryStatisticsDTO total = new SummaryStatisticsDTO();733 total.setEnvironment("Total");734 for (TestCaseExecution testCaseExecution : testCaseExecutions) {735 String controlStatus = testCaseExecution.getControlStatus();736 if (statusFilter.get(controlStatus).equals("on") && countryFilter.get(testCaseExecution.getCountry()).equals("on") || !splitStats) {737 StringBuilder key = new StringBuilder();738 key.append((env) ? testCaseExecution.getEnvironment() : "");739 key.append("_");740 key.append((country) ? testCaseExecution.getCountry() : "");741 key.append("_");742 key.append((robotDecli) ? testCaseExecution.getRobotDecli() : "");743 key.append("_");744 key.append((app) ? testCaseExecution.getApplication() : "");745 if (statMap.containsKey(key.toString())) {746 statMap.get(key.toString()).updateStatisticByStatus(testCaseExecution.getControlStatus());747 }748 total.updateStatisticByStatus(testCaseExecution.getControlStatus());749 }750 }751 return extractSummaryData(statMap, total, splitStats);752 }753 private JSONObject extractSummaryData(HashMap<String, SummaryStatisticsDTO> summaryMap, SummaryStatisticsDTO total, boolean splitStats) throws JSONException {754 JSONObject extract = new JSONObject();755 Gson gson = new Gson();756 if (splitStats) {757 JSONArray dataArray = new JSONArray();758 //sort keys759 TreeMap<String, SummaryStatisticsDTO> sortedKeys = new TreeMap<String, SummaryStatisticsDTO>(summaryMap);760 for (String key : sortedKeys.keySet()) {761 SummaryStatisticsDTO sumStats = summaryMap.get(key);762 //percentage values763 sumStats.updatePercentageStatistics();764 dataArray.put(new JSONObject(gson.toJson(sumStats)));765 }766 extract.put("split", dataArray);767 }768 total.updatePercentageStatistics();769 extract.put("total", new JSONObject(gson.toJson(total)));770 return extract;771 }772 private String getColor(String controlStatus) {773 String color = null;774 if ("OK".equals(controlStatus)) {775 color = TestCaseExecution.CONTROLSTATUS_OK_COL;776 } else if ("KO".equals(controlStatus)) {777 color = TestCaseExecution.CONTROLSTATUS_KO_COL;778 } else if ("FA".equals(controlStatus)) {779 color = TestCaseExecution.CONTROLSTATUS_FA_COL;780 } else if ("CA".equals(controlStatus)) {781 color = TestCaseExecution.CONTROLSTATUS_CA_COL;782 } else if ("NA".equals(controlStatus)) {783 color = TestCaseExecution.CONTROLSTATUS_NA_COL;784 } else if ("NE".equals(controlStatus)) {785 color = TestCaseExecution.CONTROLSTATUS_NE_COL;786 } else if ("WE".equals(controlStatus)) {787 color = TestCaseExecution.CONTROLSTATUS_WE_COL;788 } else if ("PE".equals(controlStatus)) {789 color = TestCaseExecution.CONTROLSTATUS_PE_COL;790 } else if ("QU".equals(controlStatus)) {791 color = TestCaseExecution.CONTROLSTATUS_QU_COL;792 } else if ("QE".equals(controlStatus)) {793 color = TestCaseExecution.CONTROLSTATUS_QE_COL;794 } else {795 color = "#000000";796 }797 return color;798 }799 private JSONObject convertTagToJSONObject(Tag tag) throws JSONException {800 Gson gson = new Gson();801 JSONObject result = new JSONObject(gson.toJson(tag));802 return result;803 }804 private JSONObject generateLabelStats(ApplicationContext appContext, HttpServletRequest request, List<TestCaseExecution> testCaseExecutions, JSONObject statusFilter, JSONObject countryFilter, List<TestCaseLabel> testCaseLabelList) throws JSONException {805 JSONObject jsonResult = new JSONObject();806 labelService = appContext.getBean(LabelService.class);807 TreeNode node;808 JSONArray jsonArraySTICKER = new JSONArray();809 JSONArray jsonArrayREQUIREMENT = new JSONArray();810 AnswerList<Label> resp = labelService.readByVarious(new ArrayList<>(), new ArrayList<>(asList(Label.TYPE_STICKER, Label.TYPE_REQUIREMENT)));811 // Building Label inputlist with target layout812 if (resp.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {813 HashMap<Integer, TreeNode> inputList = new HashMap<>();814 for (Label label : (List<Label>) resp.getDataList()) {815 String text = "";816 text += "<span class='label label-primary' style='background-color:" + label.getColor() + "' data-toggle='tooltip' data-labelid='" + label.getId() + "' title='' data-original-title=''>" + label.getLabel() + "</span>";817 text += "<span style='margin-left: 5px; margin-right: 5px;' class=''>" + label.getDescription() + "</span>";818 text += "%STATUSBAR%";819 text += "%COUNTER1TEXT%";820 text += "%COUNTER1WITHCHILDTEXT%";821 text += "%NBNODESWITHCHILDTEXT%";822 // Specific pills823 //text += "<span class='badge badge-pill badge-secondary'>666</span>";824 // Standard pills825 List<String> attributList = new ArrayList<>();826 if (Label.TYPE_REQUIREMENT.equals(label.getType())) {827 if (!StringUtil.isNullOrEmpty(label.getReqType()) && !"unknown".equalsIgnoreCase(label.getReqType())) {828 attributList.add("<span class='badge badge-pill badge-secondary'>" + label.getReqType() + "</span>");829 }830 if (!StringUtil.isNullOrEmpty(label.getReqStatus()) && !"unknown".equalsIgnoreCase(label.getReqStatus())) {831 attributList.add("<span class='badge badge-pill badge-secondary'>" + label.getReqStatus() + "</span>");832 }833 if (!StringUtil.isNullOrEmpty(label.getReqCriticity()) && !"unknown".equalsIgnoreCase(label.getReqCriticity())) {834 attributList.add("<span class='badge badge-pill badge-secondary'>" + label.getReqCriticity() + "</span>");835 }836 }837 // Create Node.838 node = new TreeNode(label.getId() + "-" + label.getSystem() + "-" + label.getLabel(), label.getSystem(), label.getLabel(), label.getId(), label.getParentLabelID(), text, null, null, false);839 node.setCounter1(0);840 node.setCounter1WithChild(0);841 node.setTags(attributList);842 node.setType(label.getType());843 node.setCounter1Text("<span style='background-color:#000000' class='cnt1 badge badge-pill badge-secondary'>%COUNTER1%</span>");844 node.setCounter1WithChildText("<span class='cnt1WC badge badge-pill badge-secondary'>%COUNTER1WITHCHILD%</span>");845 node.setNbNodesText("<span style='background-color:#337ab7' class='nbNodes badge badge-pill badge-primary'>%NBNODESWITHCHILD%</span>");846 node.setLabelObj(label);847 inputList.put(node.getId(), node);848// LOG.debug("Label : " + node.getId() + " T : " + node);849 }850 HashMap<String, List<Integer>> testCaseWithLabel1 = new HashMap<>();851 for (TestCaseLabel label : (List<TestCaseLabel>) testCaseLabelList) {852// LOG.debug("TCLabel : " + label.getLabel() + " T : " + label.getTest() + " C : " + label.getTestcase() + " Type : " + label.getLabel().getType());853 if ((Label.TYPE_STICKER.equals(label.getLabel().getType()))854 || (Label.TYPE_REQUIREMENT.equals(label.getLabel().getType()))) {855 String key = label.getTest() + "_" + label.getTestcase();856 List<Integer> curLabelIdList = new ArrayList<>();857 if (testCaseWithLabel1.get(key) != null) {858 curLabelIdList = testCaseWithLabel1.get(key);859 curLabelIdList.add(label.getLabelId());860 testCaseWithLabel1.put(key, curLabelIdList);861// LOG.debug(" ADDED");862 } else {863 curLabelIdList.add(label.getLabelId());864 testCaseWithLabel1.put(key, curLabelIdList);865// LOG.debug(" ADDED");866 }867 }868 }869 /**870 * For All execution, get all labels from the test case and add if871 * those labels were in the list add the stats of executions into872 * the counters.873 */874 for (TestCaseExecution testCaseExecution : testCaseExecutions) {875// LOG.debug("Exe : " + testCaseExecution.getId() + " T : " + testCaseExecution.getTest() + " C : " + testCaseExecution.getTestCase());876 String controlStatus = testCaseExecution.getControlStatus();877 if (statusFilter.get(controlStatus).equals("on") && countryFilter.get(testCaseExecution.getCountry()).equals("on")) {878 //Get label for current test_testcase879 List<Integer> labelsForTestCase = testCaseWithLabel1.get(testCaseExecution.getTest() + "_" + testCaseExecution.getTestCase());880 if (labelsForTestCase != null) {881 for (Integer integer : labelsForTestCase) {882// LOG.debug(" T : " + testCaseExecution.getTest() + " C : " + testCaseExecution.getTestCase() + " T : " + integer);883 TreeNode curTreenode = inputList.get(integer);884 if (curTreenode != null) {885// LOG.debug(" K : " + titi.getKey() + " C : " + titi.getCounter1());886 curTreenode.setCounter1(curTreenode.getCounter1() + 1);887 curTreenode.setCounter1WithChild(curTreenode.getCounter1WithChild() + 1);888 switch (testCaseExecution.getControlStatus()) {889 case TestCaseExecution.CONTROLSTATUS_OK:890 curTreenode.setNbOK(curTreenode.getNbOK() + 1);891 break;892 case TestCaseExecution.CONTROLSTATUS_KO:893 curTreenode.setNbKO(curTreenode.getNbKO() + 1);894 break;895 case TestCaseExecution.CONTROLSTATUS_FA:896 curTreenode.setNbFA(curTreenode.getNbFA() + 1);897 break;898 case TestCaseExecution.CONTROLSTATUS_NA:899 curTreenode.setNbNA(curTreenode.getNbNA() + 1);900 break;901 case TestCaseExecution.CONTROLSTATUS_NE:902 curTreenode.setNbNE(curTreenode.getNbNE() + 1);903 break;904 case TestCaseExecution.CONTROLSTATUS_WE:905 curTreenode.setNbWE(curTreenode.getNbWE() + 1);906 break;907 case TestCaseExecution.CONTROLSTATUS_PE:908 curTreenode.setNbPE(curTreenode.getNbPE() + 1);909 break;910 case TestCaseExecution.CONTROLSTATUS_QE:911 curTreenode.setNbQE(curTreenode.getNbQE() + 1);912 break;913 case TestCaseExecution.CONTROLSTATUS_QU:914 curTreenode.setNbQU(curTreenode.getNbQU() + 1);915 break;916 case TestCaseExecution.CONTROLSTATUS_CA:917 curTreenode.setNbCA(curTreenode.getNbCA() + 1);918 break;919 }920 inputList.put(curTreenode.getId(), curTreenode);921 }922 }923 }924 }925 }926 // Build Tres.927 List<TreeNode> finalList;928 jsonArraySTICKER = new JSONArray();929 jsonArrayREQUIREMENT = new JSONArray();930 finalList = labelService.hierarchyConstructor(inputList);931 for (TreeNode treeNode : finalList) {932 if (treeNode.getCounter1WithChild() > 0) {933 if (Label.TYPE_STICKER.equals(treeNode.getType())) {934 jsonArraySTICKER.put(treeNode.toJson());935 } else {936 jsonArrayREQUIREMENT.put(treeNode.toJson());937 }938 }939 }940 }941 if ((jsonArraySTICKER.length() <= 0) && (jsonArrayREQUIREMENT.length() <= 0)) {942 return null;943 }944 jsonResult.put("labelTreeSTICKER", jsonArraySTICKER);945 jsonResult.put("labelTreeREQUIREMENT", jsonArrayREQUIREMENT);946 return jsonResult;947 }...

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1var node = new org.cerberus.dto.TreeNode();2node.setType("MyType");3log.debug("Node type: " + node.getType());4var node = new org.cerberus.dto.TreeNode();5node.setType("MyType");6log.debug("Node type: " + node.getType());7var node = new org.cerberus.dto.TreeNode();8node.setType("MyType");9log.debug("Node type: " + node.getType());10var node = new org.cerberus.dto.TreeNode();11node.setType("MyType");12log.debug("Node type: " + node.getType());13var node = new org.cerberus.dto.TreeNode();14node.setType("MyType");15log.debug("Node type: " + node.getType());16var node = new org.cerberus.dto.TreeNode();17node.setType("MyType");18log.debug("Node type: " + node.getType());19var node = new org.cerberus.dto.TreeNode();20node.setType("MyType");21log.debug("Node type: " + node.getType());22var node = new org.cerberus.dto.TreeNode();23node.setType("MyType");24log.debug("Node type: " + node.getType());25var node = new org.cerberus.dto.TreeNode();26node.setType("MyType");27log.debug("Node type: " + node.getType());28var node = new org.cerberus.dto.TreeNode();29node.setType("MyType");30log.debug("Node type: " + node.getType());31var node = new org.cerberus.dto.TreeNode();32node.setType("MyType");33log.debug("Node type: " + node

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1import org.cerberus.dto.TreeNode;2import org.cerberus.dto.TreeNodeType;3TreeNode node = new TreeNode();4node.setType(TreeNodeType.FOLDER);5TreeNodeType nodeType = node.getType();6System.out.println(nodeType);7TreeNode node = new TreeNode();8node.setType(TreeNodeType.TEST);9TreeNodeType nodeType = node.getType();10System.out.println(nodeType);11TreeNode node = new TreeNode();12node.setType(TreeNodeType.CAMPAIGN);13TreeNodeType nodeType = node.getType();14System.out.println(nodeType);15TreeNode node = new TreeNode();16node.setType(TreeNodeType.ROBOT);17TreeNodeType nodeType = node.getType();18System.out.println(nodeType);19TreeNode node = new TreeNode();20node.setType(TreeNodeType.ROBOT_EXECUTION);21TreeNodeType nodeType = node.getType();22System.out.println(nodeType);23TreeNode node = new TreeNode();24node.setType(TreeNodeType.ROBOT_EXECUTION_BATCH);25TreeNodeType nodeType = node.getType();26System.out.println(nodeType);27TreeNode node = new TreeNode();28node.setType(TreeNodeType.ROBOT_EXECUTION_BATCH_DETAIL);29TreeNodeType nodeType = node.getType();30System.out.println(nodeType);31TreeNode node = new TreeNode();

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1import org.cerberus.dto.TreeNode;2def test = new TreeNode();3test.setType("TEST");4println test.getType();5import org.cerberus.dto.TreeNode;6def test = new TreeNode();7test.setType("TEST");8println test.getType();9import org.cerberus.dto.TreeNode;10def test = new TreeNode();11test.setType("TEST");12println test.getType();13import org.cerberus.dto.TreeNode;14def test = new TreeNode();15test.setType("TEST");16println test.getType();17import org.cerberus.dto.TreeNode;18def test = new TreeNode();19test.setType("TEST");20println test.getType();21import org.cerberus.dto.TreeNode;22def test = new TreeNode();23test.setType("TEST");24println test.getType();25import org.cerberus.dto.TreeNode;26def test = new TreeNode();27test.setType("TEST");28println test.getType();29import org.cerberus.dto.TreeNode;30def test = new TreeNode();31test.setType("TEST");

Full Screen

Full Screen

getType

Using AI Code Generation

copy

Full Screen

1import org.cerberus.dto.TreeNode;2import org.cerberus.engine.entity.Node;3public class getTypeExample {4 public static void main(String[] args) {5 Tree tree = new Tree();6 Node node = new Node();7 node.setType("NodeType");8 tree.addNode(node);9 String type = node.getType();10 System.out.println(type);11 }12}

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