How to use loadStatsFromResultSet method of org.cerberus.crud.dao.impl.TestCaseDAO class

Best Cerberus-source code snippet using org.cerberus.crud.dao.impl.TestCaseDAO.loadStatsFromResultSet

Source:TestCaseDAO.java Github

copy

Full Screen

...1136 }1137 try (ResultSet resultSet = preStat.executeQuery();) {1138 list = new ArrayList<>();1139 while (resultSet.next()) {1140 list.add(loadStatsFromResultSet(resultSet));1141 }1142 if (list.size() >= MAX_ROW_SELECTED) { // Result of SQl was limited by MAX_ROW_SELECTED constrain. That means that we may miss some lines in the resultList.1143 LOG.error("Partial Result in the query.");1144 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_PARTIAL_RESULT);1145 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Maximum row reached : " + MAX_ROW_SELECTED));1146 response = new AnswerList<>(list, list.size());1147 } else if (list.size() <= 0) {1148 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);1149 response = new AnswerList<>(list, list.size());1150 } else {1151 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1152 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));1153 response = new AnswerList<>(list, list.size());1154 }1155 } catch (SQLException exception) {1156 LOG.error("Unable to execute query : " + exception.toString());1157 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1158 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1159 }1160 } catch (SQLException exception) {1161 LOG.error("Unable to execute query : " + exception.toString());1162 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1163 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1164 }1165 response.setDataList(list);1166 response.setResultMessage(msg);1167 return response;1168 }1169 @Override1170 public AnswerItem<TestCase> readByKey(String test, String testCase) {1171 AnswerItem<TestCase> ans = new AnswerItem<>();1172 TestCase result = null;1173 final String query = "SELECT * FROM `testcase` tec "1174 + "LEFT OUTER JOIN application app "1175 + "ON app.application=tec.application "1176 + "WHERE tec.`test` = ? "1177 + "AND tec.`testcase` = ? "1178 + "AND " + UserSecurity.getSystemAllowForSQL("app.`system`");1179 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1180 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));1181 // Debug message on SQL.1182 if (LOG.isDebugEnabled()) {1183 LOG.debug("SQL : " + query);1184 }1185 try (Connection connection = this.databaseSpring.connect();1186 PreparedStatement preStat = connection.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);) {1187 preStat.setString(1, test);1188 preStat.setString(2, testCase);1189 try (ResultSet resultSet = preStat.executeQuery();) {1190 if (resultSet.first()) {1191 result = loadFromResultSet(resultSet);1192 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1193 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));1194 ans.setItem(result);1195 } else {1196 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);1197 }1198 } catch (SQLException exception) {1199 LOG.error("Unable to execute query : " + exception.toString());1200 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1201 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1202 }1203 } catch (SQLException exception) {1204 LOG.error("Unable to execute query : " + exception.toString());1205 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1206 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1207 }1208 //sets the message1209 ans.setResultMessage(msg);1210 return ans;1211 }1212 @Override1213 public AnswerList<String> readDistinctValuesByCriteria(List<String> system, String test, String searchTerm, Map<String, List<String>> individualSearch, String columnName) {1214 AnswerList<String> answer = new AnswerList<>();1215 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1216 String columnNameOri = columnName;1217 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));1218 List<String> distinctValues = new ArrayList<>();1219 StringBuilder searchSQL = new StringBuilder();1220 List<String> individalColumnSearchValues = new ArrayList<>();1221 StringBuilder query = new StringBuilder();1222 if (columnName.equals("lab.labelsSTICKER") || columnName.equals("lab.labelsREQUIREMENT") || columnName.equals("lab.labelsBATTERY")) {1223 columnName = "lab.label";1224 }1225 query.append("SELECT distinct ");1226 query.append(columnName);1227 query.append(" as distinctValues FROM testcase tec ");1228 query.append(" LEFT OUTER JOIN testcaselabel tel on tec.test = tel.test AND tec.testcase = tel.testcase ");1229 query.append(" LEFT OUTER JOIN label lab on tel.labelId = lab.id ");1230 query.append(" LEFT OUTER JOIN application app on app.application = tec.application ");1231 searchSQL.append("WHERE 1=1");1232 switch (columnNameOri) {1233 case "lab.labelsSTICKER":1234 searchSQL.append(" AND lab.`type` = 'STICKER' ");1235 break;1236 case "lab.labelsREQUIREMENT":1237 searchSQL.append(" AND lab.`type` = 'REQUIREMENT' ");1238 break;1239 case "lab.labelsBATTERY":1240 searchSQL.append(" AND lab.`type` = 'BATTERY' ");1241 break;1242 }1243 if (system != null && !system.isEmpty()) {1244 searchSQL.append(" AND ");1245 searchSQL.append(SqlUtil.generateInClause("app.`system`", system));1246 }1247 if (!StringUtil.isNullOrEmpty(test)) {1248 searchSQL.append(" AND tec.`test` = ?");1249 }1250 if (!StringUtil.isNullOrEmpty(searchTerm)) {1251 searchSQL.append(" and (tec.`testcase` like ?");1252 searchSQL.append(" or tec.`test` like ?");1253 searchSQL.append(" or tec.`application` like ?");1254 searchSQL.append(" or tec.`usrCreated` like ?");1255 searchSQL.append(" or tec.`usrModif` like ?");1256 searchSQL.append(" or tec.`isActive` like ?");1257 searchSQL.append(" or tec.`status` like ?");1258 searchSQL.append(" or tec.`type` like ?");1259 searchSQL.append(" or tec.`priority` like ?");1260 searchSQL.append(" or tec.`dateCreated` like ?");1261 searchSQL.append(" or lab.`label` like ?");1262 searchSQL.append(" or tec.`description` like ?)");1263 }1264 if (individualSearch != null && !individualSearch.isEmpty()) {1265 searchSQL.append(" and ( 1=1 ");1266 for (Map.Entry<String, List<String>> entry : individualSearch.entrySet()) {1267 searchSQL.append(" and ");1268 String toto = entry.getKey();1269 if (entry.getKey().equals("lab.labelsSTICKER") || entry.getKey().equals("lab.labelsREQUIREMENT") || entry.getKey().equals("lab.labelsBATTERY")) {1270 toto = "lab.label";1271 }1272 searchSQL.append(SqlUtil.getInSQLClauseForPreparedStatement(toto, entry.getValue()));1273 individalColumnSearchValues.addAll(entry.getValue());1274 }1275 searchSQL.append(" )");1276 }1277 query.append(searchSQL);1278 query.append(" order by ").append(columnName).append(" asc");1279 // Debug message on SQL.1280 if (LOG.isDebugEnabled()) {1281 LOG.debug("SQL : " + query.toString());1282 }1283 try (Connection connection = databaseSpring.connect();1284 PreparedStatement preStat = connection.prepareStatement(query.toString());1285 Statement stm = connection.createStatement();) {1286 int i = 1;1287 if (system != null && !system.isEmpty()) {1288 for (String string : system) {1289 preStat.setString(i++, string);1290 }1291 }1292 if (!StringUtil.isNullOrEmpty(test)) {1293 preStat.setString(i++, test);1294 }1295 if (!Strings.isNullOrEmpty(searchTerm)) {1296 preStat.setString(i++, "%" + searchTerm + "%");1297 preStat.setString(i++, "%" + searchTerm + "%");1298 preStat.setString(i++, "%" + searchTerm + "%");1299 preStat.setString(i++, "%" + searchTerm + "%");1300 preStat.setString(i++, "%" + searchTerm + "%");1301 preStat.setString(i++, "%" + searchTerm + "%");1302 preStat.setString(i++, "%" + searchTerm + "%");1303 preStat.setString(i++, "%" + searchTerm + "%");1304 preStat.setString(i++, "%" + searchTerm + "%");1305 preStat.setString(i++, "%" + searchTerm + "%");1306 preStat.setString(i++, "%" + searchTerm + "%");1307 preStat.setString(i++, "%" + searchTerm + "%");1308 }1309 for (String individualColumnSearchValue : individalColumnSearchValues) {1310 preStat.setString(i++, individualColumnSearchValue);1311 }1312 try (ResultSet resultSet = preStat.executeQuery();1313 ResultSet rowSet = stm.executeQuery("SELECT FOUND_ROWS()");) {1314 //gets the data1315 while (resultSet.next()) {1316 distinctValues.add(resultSet.getString("distinctValues") == null ? "" : resultSet.getString("distinctValues"));1317 }1318 //get the total number of rows1319 int nrTotalRows = 0;1320 if (rowSet != null && rowSet.next()) {1321 nrTotalRows = rowSet.getInt(1);1322 }1323 if (distinctValues.size() >= MAX_ROW_SELECTED) { // Result of SQl was limited by MAX_ROW_SELECTED constrain. That means that we may miss some lines in the resultList.1324 LOG.error("Partial Result in the query.");1325 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_PARTIAL_RESULT);1326 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Maximum row reached : " + MAX_ROW_SELECTED));1327 answer = new AnswerList<>(distinctValues, nrTotalRows);1328 } else if (distinctValues.size() <= 0) {1329 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);1330 answer = new AnswerList<>(distinctValues, nrTotalRows);1331 } else {1332 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1333 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));1334 answer = new AnswerList<>(distinctValues, nrTotalRows);1335 }1336 } catch (SQLException exception) {1337 LOG.error("Unable to execute query : " + exception.toString());1338 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1339 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1340 }1341 } catch (Exception e) {1342 LOG.warn("Unable to execute query : " + e.toString());1343 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED).resolveDescription("DESCRIPTION",1344 e.toString());1345 } finally {1346 // We always set the result message1347 answer.setResultMessage(msg);1348 }1349 answer.setResultMessage(msg);1350 answer.setDataList(distinctValues);1351 return answer;1352 }1353 @Override1354 public Answer update(String keyTest, String keyTestCase, TestCase tc) {1355 MessageEvent msg = null;1356 StringBuilder query = new StringBuilder("UPDATE testcase SET");1357 query.append(" test = ?,");1358 query.append(" testcase = ?,");1359 query.append(" implementer = ?,");1360 query.append(" Executor = ?,");1361 query.append(" application = ?,");1362 query.append(" isActiveQA = ?,");1363 query.append(" isActiveUAT = ?,");1364 query.append(" isActivePROD = ?,");1365 query.append(" status = ?,");1366 query.append(" description = ?,");1367 query.append(" DetailedDescription = ?,");1368 query.append(" isActive = ?,");1369 query.append(" FromMajor = ?,");1370 query.append(" FromMinor = ?,");1371 query.append(" ToMajor = ?,");1372 query.append(" ToMinor = ?,");1373 query.append(" Bugs = ?,");1374 query.append(" targetMajor = ?,");1375 query.append(" targetMinor = ?,");1376 query.append(" comment = ?,");1377 query.append(" priority = ?,");1378 query.append(" `type` = ?,");1379 query.append(" `origine` = ?,");1380 query.append(" `Reforigine` = ?,");1381 query.append(" `userAgent` = ?,");1382 query.append(" `screenSize` = ?,");1383 query.append(" UsrModif = ?,");1384 query.append(" conditionOperator = ?,");1385 query.append(" conditionValue1 = ?,");1386 query.append(" conditionValue2 = ?,");1387 query.append(" conditionValue3 = ?,");1388 query.append(" ConditionOptions = ?,");1389 query.append(" version = ?,");1390 query.append(" DateModif = CURRENT_TIMESTAMP");1391 query.append(" WHERE test = ? AND testcase = ?;");1392 if (LOG.isDebugEnabled()) {1393 LOG.debug("SQL : " + query.toString());1394 }1395 try (Connection connection = this.databaseSpring.connect();1396 PreparedStatement preStat = connection.prepareStatement(query.toString());) {1397 int i = 1;1398 preStat.setString(i++, tc.getTest());1399 preStat.setString(i++, tc.getTestcase());1400 preStat.setString(i++, tc.getImplementer());1401 preStat.setString(i++, tc.getExecutor());1402 preStat.setString(i++, tc.getApplication());1403 preStat.setBoolean(i++, tc.isActiveQA());1404 preStat.setBoolean(i++, tc.isActiveUAT());1405 preStat.setBoolean(i++, tc.isActivePROD());1406 preStat.setString(i++, tc.getStatus());1407 preStat.setString(i++, tc.getDescription());1408 preStat.setString(i++, tc.getDetailedDescription());1409 preStat.setBoolean(i++, tc.isActive());1410 preStat.setString(i++, tc.getFromMajor());1411 preStat.setString(i++, tc.getFromMinor());1412 preStat.setString(i++, tc.getToMajor());1413 preStat.setString(i++, tc.getToMinor());1414 preStat.setString(i++, tc.getBugs().toString());1415 preStat.setString(i++, tc.getTargetMajor());1416 preStat.setString(i++, tc.getTargetMinor());1417 preStat.setString(i++, tc.getComment());1418 preStat.setString(i++, Integer.toString(tc.getPriority()));1419 preStat.setString(i++, tc.getType());1420 preStat.setString(i++, tc.getOrigine());1421 preStat.setString(i++, tc.getRefOrigine());1422 preStat.setString(i++, tc.getUserAgent());1423 preStat.setString(i++, tc.getScreenSize());1424 preStat.setString(i++, tc.getUsrModif());1425 preStat.setString(i++, tc.getConditionOperator());1426 preStat.setString(i++, tc.getConditionValue1());1427 preStat.setString(i++, tc.getConditionValue2());1428 preStat.setString(i++, tc.getConditionValue3());1429 preStat.setString(i++, tc.getConditionOptions().toString());1430 preStat.setInt(i++, tc.getVersion());1431 preStat.setString(i++, keyTest);1432 preStat.setString(i++, keyTestCase);1433 preStat.executeUpdate();1434 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1435 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));1436 } catch (SQLException exception) {1437 LOG.error("Unable to execute query : " + exception.toString());1438 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1439 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1440 }1441 return new Answer(msg);1442 }1443 @Override1444 public Answer create(TestCase testCase) {1445 MessageEvent msg = null;1446 final StringBuilder sql = new StringBuilder("INSERT INTO `testcase` ")1447 .append(" ( `Test`, `TestCase`, `Application`, ")1448 .append("`Description`, `DetailedDescription`, ")1449 .append("`Priority`, `Status`, `isActive`, ")1450 .append("`Type`, `Origine`, `RefOrigine`, `Comment`, ")1451 .append("`FromMajor`, `FromMinor`, `ToMajor`, `ToMinor`, ")1452 .append("`Bugs`, `TargetMajor`, `TargetMinor`, `UsrCreated`, ")1453 .append("`Implementer`, `Executor`, `isActiveQA`, `isActiveUAT`, `isActivePROD`, `useragent`, `screenSize`, ")1454 .append("`conditionOperator`, `conditionValue1`, `conditionValue2`, `conditionValue3`, `conditionOptions`, `version`) ")1455 .append("VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ")1456 .append("?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); ");1457 // Debug message on SQL.1458 if (LOG.isDebugEnabled()) {1459 LOG.debug("SQL : " + sql.toString());1460 }1461 try (Connection connection = this.databaseSpring.connect();1462 PreparedStatement preStat = connection.prepareStatement(sql.toString());) {1463 int i = 1;1464 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getTest(), ""));1465 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getTestcase(), ""));1466 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getApplication(), ""));1467 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getDescription(), ""));1468 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getDetailedDescription(), ""));1469 preStat.setString(i++, Integer.toString(testCase.getPriority()));1470 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getStatus(), ""));1471 preStat.setBoolean(i++, testCase.isActive());1472 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getType(), ""));1473 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getOrigine(), ""));1474 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getRefOrigine(), ""));1475 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getComment(), ""));1476 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getFromMajor(), ""));1477 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getFromMinor(), ""));1478 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getToMajor(), ""));1479 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getToMinor(), ""));1480 if (testCase.getBugs() != null) {1481 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getBugs().toString(), ""));1482 } else {1483 preStat.setString(i++, "[]");1484 }1485 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getTargetMajor(), ""));1486 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getTargetMinor(), ""));1487 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getUsrCreated(), ""));1488 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getImplementer(), ""));1489 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getExecutor(), ""));1490 preStat.setBoolean(i++, testCase.isActiveQA());1491 preStat.setBoolean(i++, testCase.isActiveUAT());1492 preStat.setBoolean(i++, testCase.isActivePROD());1493 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getUserAgent(), ""));1494 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getScreenSize(), ""));1495 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getConditionOperator(), ""));1496 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getConditionValue1(), ""));1497 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getConditionValue2(), ""));1498 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getConditionValue3(), ""));1499 if (testCase.getConditionOptions() != null) {1500 preStat.setString(i++, ParameterParserUtil.parseStringParam(testCase.getConditionOptions().toString(), ""));1501 } else {1502 preStat.setString(i++, "[]");1503 }1504 preStat.setInt(i++, ParameterParserUtil.parseIntegerParam(testCase.getVersion(), 0));1505 preStat.executeUpdate();1506 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1507 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "INSERT"));1508 } catch (SQLException exception) {1509 LOG.error("Unable to execute query : " + exception.toString(), exception);1510 if (exception.getSQLState().equals(SQL_DUPLICATED_CODE)) { //23000 is the sql state for duplicate entries1511 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_DUPLICATE);1512 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "INSERT").replace("%REASON%", exception.toString()));1513 } else {1514 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1515 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1516 }1517 }1518 return new Answer(msg);1519 }1520 @Override1521 public Answer delete(TestCase testCase) {1522 MessageEvent msg = null;1523 final String query = "DELETE FROM testcase WHERE test = ? AND testcase = ?";1524 if (LOG.isDebugEnabled()) {1525 LOG.debug("SQL : " + query);1526 }1527 try (Connection connection = this.databaseSpring.connect();1528 PreparedStatement preStat = connection.prepareStatement(query);) {1529 preStat.setString(1, testCase.getTest());1530 preStat.setString(2, testCase.getTestcase());1531 preStat.executeUpdate();1532 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1533 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "DELETE"));1534 } catch (SQLException exception) {1535 LOG.error("Unable to execute query : " + exception.toString());1536 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1537 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1538 }1539 return new Answer(msg);1540 }1541 @Override1542 public TestCase loadFromResultSet(ResultSet resultSet) throws SQLException {1543 String test = resultSet.getString("tec.Test");1544 String testCase = resultSet.getString("tec.TestCase");1545 String tcapplication = resultSet.getString("tec.Application");1546 String description = resultSet.getString("tec.Description");1547 String detailedDescription = resultSet.getString("tec.DetailedDescription");1548 int priority = resultSet.getInt("tec.Priority");1549 int version = resultSet.getInt("tec.version");1550 String status = resultSet.getString("tec.Status");1551 boolean isActive = resultSet.getBoolean("tec.isActive");1552 String conditionOperator = resultSet.getString("tec.conditionOperator");1553 String conditionValue1 = resultSet.getString("tec.ConditionValue1");1554 String conditionValue2 = resultSet.getString("tec.ConditionValue2");1555 String conditionValue3 = resultSet.getString("tec.ConditionValue3");1556 JSONArray condOpts = SqlUtil.getJSONArrayFromColumn(resultSet, "tec.ConditionOptions");1557 String type = resultSet.getString("tec.Type");1558 String origin = resultSet.getString("tec.Origine");1559 String refOrigin = resultSet.getString("tec.RefOrigine");1560 String comment = resultSet.getString("tec.Comment");1561 String fromMajor = resultSet.getString("tec.FromMajor");1562 String fromMinor = resultSet.getString("tec.FromMinor");1563 String toMajor = resultSet.getString("tec.ToMajor");1564 String toMinor = resultSet.getString("tec.ToMinor");1565 JSONArray bugs = SqlUtil.getJSONArrayFromColumn(resultSet, "tec.Bugs");1566 String targetMajor = resultSet.getString("tec.TargetMajor");1567 String targetMinor = resultSet.getString("tec.TargetMinor");1568 String implementer = resultSet.getString("tec.Implementer");1569 String executor = resultSet.getString("tec.Executor");1570 boolean isActiveQA = resultSet.getBoolean("tec.isActiveQA");1571 boolean isActiveUAT = resultSet.getBoolean("tec.isActiveUAT");1572 boolean isActivePROD = resultSet.getBoolean("tec.isActivePROD");1573 String usrCreated = resultSet.getString("tec.UsrCreated");1574 Timestamp dateCreated = resultSet.getTimestamp("tec.DateCreated");1575 String usrModif = resultSet.getString("tec.UsrModif");1576 Timestamp dateModif = resultSet.getTimestamp("tec.DateModif");1577 String userAgent = resultSet.getString("tec.useragent");1578 String screenSize = resultSet.getString("tec.screensize");1579 String system = null;1580 try {1581 system = resultSet.getString("app.system");1582 } catch (SQLException e) {1583 LOG.debug("Column system does not Exist.");1584 }1585 TestCase newTestCase = factoryTestCase.create(test, testCase, origin, refOrigin, usrCreated, implementer, executor,1586 usrModif, tcapplication, isActiveQA, isActiveUAT, isActivePROD, priority, type,1587 status, description, detailedDescription, isActive, conditionOperator, conditionValue1, conditionValue2, conditionValue3, condOpts, fromMajor, fromMinor, toMajor,1588 toMinor, status, bugs, targetMajor, targetMinor, comment, dateCreated, userAgent, screenSize, dateModif, version);1589 newTestCase.setSystem(system);1590 return newTestCase;1591 }1592 private TestCase loadStatsFromResultSet(ResultSet resultSet) throws SQLException {1593 String status = resultSet.getString("tec.Status");1594 Timestamp dateCreated = resultSet.getTimestamp("tec.DateCreated");1595 String system = null;1596 try {1597 system = resultSet.getString("app.system");1598 } catch (SQLException e) {1599 LOG.debug("Column system does not Exist.");1600 }1601 TestCase newTestCase = factoryTestCase.create(null, null, null, null, null, null, null, null, null, false, false, false, 0, null, status, null,1602 null, false, null, null, null, null, null, null, null, null, null, status, null, null, null, null, dateCreated, null, null, null, 0);1603 newTestCase.setSystem(system);1604 return newTestCase;1605 }1606 private String createInClauseFromList(String[] list, String column, String preString, String postString) {...

Full Screen

Full Screen

loadStatsFromResultSet

Using AI Code Generation

copy

Full Screen

1 public static void loadStatsFromResultSet(ResultSet resultSet, TestCase testCase) throws SQLException {2 testCase.setTotalTC(resultSet.getInt("TotalTC"));3 testCase.setTotalTCOK(resultSet.getInt("TotalTCOK"));4 testCase.setTotalTCKO(resultSet.getInt("TotalTCKO"));5 testCase.setTotalTCAuto(resultSet.getInt("TotalTCAuto"));6 testCase.setTotalTCAutoOK(resultSet.getInt("TotalTCAutoOK"));7 testCase.setTotalTCAutoKO(resultSet.getInt("TotalTCAutoKO"));8 testCase.setTotalTCAutoNA(resultSet.getInt("TotalTCAutoNA"));9 testCase.setTotalTCAutoPE(resultSet.getInt("TotalTCAutoPE"));10 testCase.setTotalTCAutoQU(resultSet.getInt("TotalTCAutoQU"));11 testCase.setTotalTCAutoFA(resultSet.getInt("TotalTCAutoFA"));12 testCase.setTotalTCAutoWE(resultSet.getInt("TotalTCAutoWE"));13 testCase.setTotalTCAutoNA(resultSet.getInt("TotalTCAutoNA"));14 testCase.setTotalTCAutoOKPercent(resultSet.getInt("TotalTCAutoOKPercent"));15 testCase.setTotalTCAutoKOPercent(resultSet.getInt("TotalTCAutoKOPercent"));16 testCase.setTotalTCAutoNAPercent(resultSet.getInt("TotalTCAutoNAPercent"));17 testCase.setTotalTCAutoPEPercent(resultSet.getInt("TotalTCAutoPEPercent"));18 testCase.setTotalTCAutoQUPercent(resultSet.getInt("TotalTCAutoQUPercent"));19 testCase.setTotalTCAutoFAPercent(resultSet.getInt("TotalTCAutoFAPercent"));20 testCase.setTotalTCAutoWEPercent(resultSet.getInt("TotalTCAutoWEPercent"));21 testCase.setTotalTCAutoNAPercent(resultSet.getInt("TotalTCAutoNAPercent"));22 }23 public static void loadStatsFromResultSet(ResultSet resultSet, TestCase testCase) throws SQLException {24 testCase.setTotalTC(resultSet.getInt("TotalTC"));25 testCase.setTotalTCOK(resultSet.getInt("TotalTCOK"));26 testCase.setTotalTCKO(resultSet.getInt("TotalTCKO"));27 testCase.setTotalTCAuto(resultSet.getInt("TotalTCAuto"));28 testCase.setTotalTCAutoOK(resultSet.getInt("TotalTCAutoOK"));29 testCase.setTotalTCAutoKO(resultSet.getInt("TotalTCAutoKO"));30 testCase.setTotalTCAutoNA(resultSet.getInt("TotalTCAutoNA"));

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