Best Cerberus-source code snippet using org.cerberus.crud.entity.TestCaseExecutionQueue.setApplicationObj
Source:TestCaseExecutionQueueDAO.java
...794 tmp.setBrowser("");795 }796 if (app) {797 Application application = factoryApplication.create(resultSet.getString("Application"));798 tmp.setApplicationObj(application);799 }800 column.add(tmp);801 }802 msg.setDescription(msg.getDescription().replace("%ITEM%", "TestCaseExecution").replace("%OPERATION%", "SELECT"));803 answer = new AnswerList(column, column.size());804 } catch (SQLException exception) {805 LOG.warn("Unable to execute query : " + exception.toString());806 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);807 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));808 column = null;809 } finally {810 if (resultSet != null) {811 resultSet.close();812 }813 }814 } catch (SQLException ex) {815 LOG.warn("Unable to execute query : " + ex.toString());816 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);817 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));818 column = null;819 } finally {820 if (preStat != null) {821 preStat.close();822 }823 }824 } catch (SQLException ex) {825 LOG.warn(ex.toString());826 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);827 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));828 } finally {829 try {830 if (connection != null) {831 connection.close();832 }833 } catch (SQLException ex) {834 LOG.warn("Unable to execute query : " + ex.toString());835 }836 }837 answer.setResultMessage(msg);838 return answer;839 }840 @Override841 public AnswerList readDistinctValuesByCriteria(String columnName, String sort, String searchTerm, Map<String, List<String>> individualSearch, String column) {842 AnswerList answer = new AnswerList();843 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);844 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));845 List<String> distinctValues = new ArrayList<>();846 StringBuilder searchSQL = new StringBuilder();847 List<String> individalColumnSearchValues = new ArrayList<String>();848 StringBuilder query = new StringBuilder();849 query.append("SELECT distinct exq.");850 query.append(columnName);851 query.append(" as distinctValues FROM testcaseexecutionqueue exq");852 query.append(" where 1=1");853 if (!StringUtil.isNullOrEmpty(searchTerm)) {854 searchSQL.append(" and (exq.ID like ?");855 searchSQL.append(" or exq.Test like ?");856 searchSQL.append(" or exq.TestCase like ?");857 searchSQL.append(" or exq.Country like ?");858 searchSQL.append(" or exq.Environment like ?");859 searchSQL.append(" or exq.Browser like ?");860 searchSQL.append(" or exq.Tag like ?");861 searchSQL.append(" or exq.State like ?)");862 }863 if (individualSearch != null && !individualSearch.isEmpty()) {864 searchSQL.append(" and ( 1=1 ");865 for (Map.Entry<String, List<String>> entry : individualSearch.entrySet()) {866 searchSQL.append(" and exq.");867 searchSQL.append(SqlUtil.getInSQLClauseForPreparedStatement(entry.getKey(), entry.getValue()));868 individalColumnSearchValues.addAll(entry.getValue());869 }870 searchSQL.append(" )");871 }872 query.append(searchSQL);873 query.append(" group by ifnull(exq.").append(columnName).append(",'')");874 query.append(" order by exq.").append(columnName).append(" asc");875 // Debug message on SQL.876 if (LOG.isDebugEnabled()) {877 LOG.debug("SQL : " + query.toString());878 }879 try (Connection connection = databaseSpring.connect();880 PreparedStatement preStat = connection.prepareStatement(query.toString());881 Statement stm = connection.createStatement();) {882 int i = 1;883 if (!StringUtil.isNullOrEmpty(searchTerm)) {884 preStat.setString(i++, "%" + searchTerm + "%");885 preStat.setString(i++, "%" + searchTerm + "%");886 preStat.setString(i++, "%" + searchTerm + "%");887 preStat.setString(i++, "%" + searchTerm + "%");888 preStat.setString(i++, "%" + searchTerm + "%");889 preStat.setString(i++, "%" + searchTerm + "%");890 preStat.setString(i++, "%" + searchTerm + "%");891 preStat.setString(i++, "%" + searchTerm + "%");892 }893 for (String individualColumnSearchValue : individalColumnSearchValues) {894 preStat.setString(i++, individualColumnSearchValue);895 }896 try(ResultSet resultSet = preStat.executeQuery();897 ResultSet rowSet = stm.executeQuery("SELECT FOUND_ROWS()");){898 //gets the data899 while (resultSet.next()) {900 distinctValues.add(resultSet.getString("distinctValues") == null ? "" : resultSet.getString("distinctValues"));901 }902 //get the total number of rows903 904 int nrTotalRows = 0;905 if (rowSet != null && rowSet.next()) {906 nrTotalRows = rowSet.getInt(1);907 }908 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.909 LOG.error("Partial Result in the query.");910 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_PARTIAL_RESULT);911 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Maximum row reached : " + MAX_ROW_SELECTED));912 answer = new AnswerList(distinctValues, nrTotalRows);913 } else if (distinctValues.size() <= 0) {914 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);915 answer = new AnswerList(distinctValues, nrTotalRows);916 } else {917 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);918 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "SELECT"));919 answer = new AnswerList(distinctValues, nrTotalRows);920 }921 }catch (SQLException e) {922 LOG.warn("Unable to execute query : " + e.toString());923 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED).resolveDescription("DESCRIPTION",924 e.toString());925 }926 } catch (Exception e) {927 LOG.warn("Unable to execute query : " + e.toString());928 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED).resolveDescription("DESCRIPTION",929 e.toString());930 } finally {931 // We always set the result message932 answer.setResultMessage(msg);933 }934 answer.setResultMessage(msg);935 answer.setDataList(distinctValues);936 return answer;937 }938 @Override939 public AnswerList findTagList(int tagnumber) {940 AnswerList response = new AnswerList();941 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);942 List<String> list = null;943 StringBuilder query = new StringBuilder();944 query.append("SELECT DISTINCT tag FROM testcaseexecutionqueue WHERE tag != ''");945 if (tagnumber != 0) {946 query.append("ORDER BY id desc LIMIT ");947 query.append(tagnumber);948 }949 query.append(";");950 Connection connection = this.databaseSpring.connect();951 try {952 PreparedStatement preStat = connection.prepareStatement(query.toString());953 try {954 ResultSet resultSet = preStat.executeQuery();955 try {956 list = new ArrayList<String>();957 while (resultSet.next()) {958 list.add(resultSet.getString("tag"));959 }960 msg.setDescription(msg.getDescription().replace("%ITEM%", "TagList").replace("%OPERATION%", "SELECT"));961 } catch (SQLException exception) {962 LOG.error("Unable to execute query : " + exception.toString());963 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);964 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));965 } finally {966 resultSet.close();967 }968 } catch (SQLException exception) {969 LOG.error("Unable to execute query : " + exception.toString());970 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);971 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));972 } finally {973 preStat.close();974 }975 } catch (SQLException exception) {976 LOG.error("Unable to execute query : " + exception.toString());977 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);978 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));979 } finally {980 try {981 if (connection != null) {982 connection.close();983 }984 } catch (SQLException e) {985 LOG.warn(e.toString());986 }987 }988 response.setResultMessage(msg);989 response.setDataList(list);990 return response;991 }992 @Override993 public AnswerList readBySystemByVarious(String system, List<String> testList, List<String> applicationList, List<String> projectList, List<String> tcstatusList, List<String> groupList, List<String> tcactiveList, List<String> priorityList, List<String> targetsprintList, List<String> targetrevisionList, List<String> creatorList, List<String> implementerList, List<String> buildList, List<String> revisionList, List<String> environmentList, List<String> countryList, List<String> browserList, List<String> tcestatusList, String ip, String port, String tag, String browserversion, String comment, String bugid, String ticket) {994 AnswerList answer = new AnswerList();995 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);996 List<TestCaseExecutionQueue> tceList = new ArrayList<TestCaseExecutionQueue>();997 List<String> whereClauses = new LinkedList<String>();998 StringBuilder query = new StringBuilder();999 int paramNumber = 0;1000 query.append(" select t.ID as statusExecutionID, t.* from ( ");1001 query.append(" select exq.*, tec.*, app.* ");1002 query.append(" from testcaseexecutionqueue exq ");1003 query.append(" inner join testcase tec on exq.test = tec.test and exq.testcase = tec.testcase ");1004 query.append(" inner join application app on tec.application = app.application ");1005 String testClause = SqlUtil.generateInClause("exq.test", testList);1006 if (!StringUtil.isNullOrEmpty(testClause)) {1007 whereClauses.add(testClause);1008 }1009 String applicationClause = SqlUtil.generateInClause("tec.application", applicationList);1010 if (!StringUtil.isNullOrEmpty(applicationClause)) {1011 whereClauses.add(applicationClause);1012 }1013 String projectClause = SqlUtil.generateInClause("tec.project", projectList);1014 if (!StringUtil.isNullOrEmpty(projectClause)) {1015 whereClauses.add(projectClause);1016 }1017 //test case status: working, fully_implemented, ...1018 String tcsClause = SqlUtil.generateInClause("exq.status", tcstatusList);1019 if (!StringUtil.isNullOrEmpty(tcsClause)) {1020 whereClauses.add(tcsClause);1021 }1022 //group 1023 String groupClause = SqlUtil.generateInClause("tec.group", groupList);1024 if (!StringUtil.isNullOrEmpty(groupClause)) {1025 whereClauses.add(groupClause);1026 }1027 //test case active1028 String tcactiveClause = SqlUtil.generateInClause("tec.tcactive", tcactiveList);1029 if (!StringUtil.isNullOrEmpty(tcactiveClause)) {1030 whereClauses.add(tcactiveClause);1031 }1032 //test case active1033 String priorityClause = SqlUtil.generateInClause("tec.Priority", priorityList);1034 if (!StringUtil.isNullOrEmpty(priorityClause)) {1035 whereClauses.add(priorityClause);1036 }1037 //target sprint1038 String targetsprintClause = SqlUtil.generateInClause("tec.TargetBuild", targetsprintList);1039 if (!StringUtil.isNullOrEmpty(targetsprintClause)) {1040 whereClauses.add(targetsprintClause);1041 }1042 //target revision1043 String targetrevisionClause = SqlUtil.generateInClause("tec.TargetRev", targetrevisionList);1044 if (!StringUtil.isNullOrEmpty(targetrevisionClause)) {1045 whereClauses.add(targetrevisionClause);1046 }1047 //creator1048 String creatorClause = SqlUtil.generateInClause("tec.UsrCreated", creatorList);1049 if (!StringUtil.isNullOrEmpty(creatorClause)) {1050 whereClauses.add(creatorClause);1051 }1052 //implementer1053 String implementerClause = SqlUtil.generateInClause("tec.Implementer", implementerList);1054 if (!StringUtil.isNullOrEmpty(implementerClause)) {1055 whereClauses.add(implementerClause);1056 }1057 //build1058 String buildClause = SqlUtil.generateInClause("exq.Build", buildList);1059 if (!StringUtil.isNullOrEmpty(buildClause)) {1060 whereClauses.add(buildClause);1061 }1062 //revision1063 String revisionClause = SqlUtil.generateInClause("exq.Revision", revisionList);1064 if (!StringUtil.isNullOrEmpty(revisionClause)) {1065 whereClauses.add(revisionClause);1066 }1067 //environment1068 String environmentClause = SqlUtil.generateInClause("exq.Environment", environmentList);1069 if (!StringUtil.isNullOrEmpty(environmentClause)) {1070 whereClauses.add(environmentClause);1071 }1072 //country1073 String countryClause = SqlUtil.generateInClause("exq.Country", countryList);1074 if (!StringUtil.isNullOrEmpty(countryClause)) {1075 whereClauses.add(countryClause);1076 }1077 //browser1078 String browserClause = SqlUtil.generateInClause("exq.Browser", browserList);1079 if (!StringUtil.isNullOrEmpty(browserClause)) {1080 whereClauses.add(browserClause);1081 }1082 //test case execution1083 String tcestatusClause = SqlUtil.generateInClause("exq.ControlStatus", tcestatusList);1084 if (!StringUtil.isNullOrEmpty(tcestatusClause)) {1085 whereClauses.add(tcestatusClause);1086 }1087 if (!StringUtil.isNullOrEmpty(system)) {1088 whereClauses.add(" app.system like ? ");1089 }1090 if (!StringUtil.isNullOrEmpty(ip)) {1091 whereClauses.add(" exq.IP like ? ");1092 }1093 if (!StringUtil.isNullOrEmpty(port)) {1094 whereClauses.add(" exq.port like ? ");1095 }1096 if (!StringUtil.isNullOrEmpty(tag)) {1097 whereClauses.add(" exq.tag like ? ");1098 }1099 if (!StringUtil.isNullOrEmpty(browserversion)) {1100 whereClauses.add(" exq.browserfullversion like ? ");1101 }1102 if (!StringUtil.isNullOrEmpty(comment)) {1103 whereClauses.add(" exq.comment like ? ");1104 }1105 if (!StringUtil.isNullOrEmpty(bugid)) {1106 whereClauses.add(" tec.BugID like ? ");1107 }1108 if (!StringUtil.isNullOrEmpty(ticket)) {1109 whereClauses.add(" tec.Ticket like ? ");1110 }1111 if (whereClauses.size() > 0) {1112 query.append("where ");1113 String joined = StringUtils.join(whereClauses, " and ");1114 query.append(joined);1115 }1116 query.append(" order by exq.ID desc ");1117 query.append(" ) as t group by t.test, t.testcase, t.environment, t.browser, t.country");1118 Connection connection = this.databaseSpring.connect();1119 try {1120 PreparedStatement preStat = connection.prepareStatement(query.toString());1121 if (testList != null) {1122 for (String param : testList) {1123 preStat.setString(++paramNumber, param);1124 }1125 }1126 if (applicationList != null) {1127 for (String param : applicationList) {1128 preStat.setString(++paramNumber, param);1129 }1130 }1131 if (projectList != null) {1132 for (String param : projectList) {1133 preStat.setString(++paramNumber, param);1134 }1135 }1136 if (tcstatusList != null) {1137 for (String param : tcstatusList) {1138 preStat.setString(++paramNumber, param);1139 }1140 }1141 if (groupList != null) {1142 for (String param : groupList) {1143 preStat.setString(++paramNumber, param);1144 }1145 }1146 if (tcactiveList != null) {1147 for (String param : tcactiveList) {1148 preStat.setString(++paramNumber, param);1149 }1150 }1151 if (priorityList != null) {1152 for (String param : priorityList) {1153 preStat.setString(++paramNumber, param);1154 }1155 }1156 if (targetsprintList != null) {1157 for (String param : targetsprintList) {1158 preStat.setString(++paramNumber, param);1159 }1160 }1161 if (targetrevisionList != null) {1162 for (String param : targetrevisionList) {1163 preStat.setString(++paramNumber, param);1164 }1165 }1166 if (creatorList != null) {1167 for (String param : creatorList) {1168 preStat.setString(++paramNumber, param);1169 }1170 }1171 if (implementerList != null) {1172 for (String param : implementerList) {1173 preStat.setString(++paramNumber, param);1174 }1175 }1176 if (buildList != null) {1177 for (String param : buildList) {1178 preStat.setString(++paramNumber, param);1179 }1180 }1181 if (revisionList != null) {1182 for (String param : revisionList) {1183 preStat.setString(++paramNumber, param);1184 }1185 }1186 //environment1187 if (environmentList != null) {1188 for (String param : environmentList) {1189 preStat.setString(++paramNumber, param);1190 }1191 }1192 //country1193 if (countryList != null) {1194 for (String param : countryList) {1195 preStat.setString(++paramNumber, param);1196 }1197 }1198 //browser 1199 if (browserList != null) {1200 for (String param : browserList) {1201 preStat.setString(++paramNumber, param);1202 }1203 }1204 //controlstatus1205 if (tcestatusList != null) {1206 for (String param : tcestatusList) {1207 preStat.setString(++paramNumber, param);1208 }1209 }1210 if (!StringUtil.isNullOrEmpty(system)) {1211 preStat.setString(++paramNumber, system);1212 }1213 if (!StringUtil.isNullOrEmpty(ip)) {1214 preStat.setString(++paramNumber, "%" + ip + "%");1215 }1216 if (!StringUtil.isNullOrEmpty(port)) {1217 preStat.setString(++paramNumber, "%" + port + "%");1218 }1219 if (!StringUtil.isNullOrEmpty(tag)) {1220 preStat.setString(++paramNumber, "%" + tag + "%");1221 }1222 if (!StringUtil.isNullOrEmpty(browserversion)) {1223 preStat.setString(++paramNumber, "%" + browserversion + "%");1224 }1225 if (!StringUtil.isNullOrEmpty(comment)) {1226 preStat.setString(++paramNumber, "%" + comment + "%");1227 }1228 if (!StringUtil.isNullOrEmpty(bugid)) {1229 preStat.setString(++paramNumber, "%" + bugid + "%");1230 }1231 if (!StringUtil.isNullOrEmpty(ticket)) {1232 preStat.setString(++paramNumber, "%" + ticket + "%");1233 }1234 try {1235 ResultSet resultSet = preStat.executeQuery();1236 try {1237 while (resultSet.next()) {1238 tceList.add(this.loadWithDependenciesFromResultSet(resultSet));1239 }1240 if (tceList.isEmpty()) {1241 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);1242 } else {1243 msg.setDescription(msg.getDescription().replace("%ITEM%", "TestCaseExecutionInQueue").replace("%OPERATION%", "SELECT"));1244 }1245 } catch (SQLException exception) {1246 LOG.warn("Unable to execute query : " + exception.toString());1247 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1248 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));1249 tceList.clear();1250 } catch (FactoryCreationException ex) {1251 LOG.warn("Unable to execute query : " + ex.toString());1252 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1253 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));1254 tceList.clear();1255 } finally {1256 if (resultSet != null) {1257 resultSet.close();1258 }1259 }1260 } catch (SQLException ex) {1261 LOG.warn("Unable to execute query : " + ex.toString());1262 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1263 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));1264 } finally {1265 if (preStat != null) {1266 preStat.close();1267 }1268 }1269 } catch (SQLException ex) {1270 LOG.warn(ex.toString());1271 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1272 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));1273 } finally {1274 try {1275 if (connection != null) {1276 connection.close();1277 }1278 } catch (SQLException ex) {1279 LOG.warn("Unable to execute query : " + ex.toString());1280 }1281 }1282 answer.setTotalRows(tceList.size());1283 answer.setDataList(tceList);1284 answer.setResultMessage(msg);1285 return answer;1286 }1287 @Override1288 public TestCaseExecutionQueue findByKeyWithDependencies(long id) throws CerberusException {1289 String query = "SELECT * FROM `" + TABLE + "` exq "1290 + "INNER JOIN `" + TABLE_TEST_CASE + "` tec ON (exq.`" + COLUMN_TEST + "` = tec.`Test` AND exq.`" + COLUMN_TEST_CASE + "` = tec.`TestCase`) "1291 + "INNER JOIN `" + TABLE_APPLICATION + "` app ON (tec.`Application` = app.`Application`) "1292 + "WHERE `" + COLUMN_ID + "` = ?";1293 try (Connection connection = this.databaseSpring.connect();1294 PreparedStatement selectStatement = connection.prepareStatement(query);) {1295 selectStatement.setLong(1, id);1296 try(ResultSet result = selectStatement.executeQuery();){1297 if (!result.next()) {1298 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.NO_DATA_FOUND));1299 }1300 return loadWithDependenciesFromResultSet(result);1301 }catch (SQLException exception) {1302 LOG.error("Unable to execute query : " + exception.toString());1303 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1304 } 1305 } catch (SQLException | FactoryCreationException e) {1306 LOG.warn("Unable to find test case execution in queue " + id, e);1307 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1308 }1309 }1310 @Override1311 public AnswerItem<TestCaseExecutionQueue> create(TestCaseExecutionQueue object) {1312 TestCaseExecutionQueue newObject = object;1313 MessageEvent msg = null;1314 StringBuilder query = new StringBuilder();1315 query.append("INSERT INTO `" + TABLE + "` (`" + COLUMN_TEST + "`, `" + COLUMN_TEST_CASE + "`, `" + COLUMN_COUNTRY + "`, `" + COLUMN_ENVIRONMENT + "`, `" + COLUMN_ROBOT1316 + "`, `" + COLUMN_ROBOT_IP + "`, `" + COLUMN_ROBOT_PORT + "`, `" + COLUMN_BROWSER + "`, `" + COLUMN_BROWSER_VERSION + "`, `" + COLUMN_PLATFORM1317 + "`, `" + COLUMN_SCREENSIZE + "`, `" + COLUMN_MANUAL_URL + "`, `" + COLUMN_MANUAL_HOST + "`, `" + COLUMN_MANUAL_CONTEXT_ROOT + "`, `"1318 + COLUMN_MANUAL_LOGIN_RELATIVE_URL + "`, `" + COLUMN_MANUAL_ENV_DATA + "`, `" + COLUMN_TAG + "`, `" + COLUMN_SCREENSHOT + "`, `" + COLUMN_VERBOSE + "`, `"1319 + COLUMN_TIMEOUT + "`, `" + COLUMN_PAGE_SOURCE + "`, `" + COLUMN_SELENIUM_LOG + "`, `" + COLUMN_RETRIES + "`, `"1320 + COLUMN_MANUAL_EXECUTION + "`, `" + COLUMN_USRCREATED + "`, `" + COLUMN_STATE + "`, `" + COLUMN_COMMENT + "`, `" + COLUMN_DEBUGFLAG + "`, `" + COLUMN_PRIORITY + "`) "1321 + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");1322 // Debug message on SQL.1323 if (LOG.isDebugEnabled()) {1324 LOG.debug("SQL : " + query.toString());1325 LOG.debug("SQL.param.prio : " + object.getPriority());1326 LOG.debug("SQL.param.debug : " + object.getDebugFlag());1327 LOG.debug("SQL.param.exeid : " + object.getExeId());1328 LOG.debug("SQL.param.comment : " + object.getComment());1329 LOG.debug("SQL.param.state : " + object.getState());1330 }1331 1332 try(Connection connection = this.databaseSpring.connect();1333 PreparedStatement preStat = connection.prepareStatement(query.toString(), Statement.RETURN_GENERATED_KEYS);) {1334 1335 int i = 1;1336 preStat.setString(i++, object.getTest());1337 preStat.setString(i++, object.getTestCase());1338 preStat.setString(i++, object.getCountry());1339 preStat.setString(i++, object.getEnvironment());1340 preStat.setString(i++, object.getRobot());1341 preStat.setString(i++, object.getRobotIP());1342 preStat.setString(i++, object.getRobotPort());1343 preStat.setString(i++, object.getBrowser());1344 preStat.setString(i++, object.getBrowserVersion());1345 preStat.setString(i++, object.getPlatform());1346 preStat.setString(i++, object.getScreenSize());1347 preStat.setInt(i++, object.getManualURL());1348 preStat.setString(i++, object.getManualHost());1349 preStat.setString(i++, object.getManualContextRoot());1350 preStat.setString(i++, object.getManualLoginRelativeURL());1351 preStat.setString(i++, object.getManualEnvData());1352 preStat.setString(i++, object.getTag());1353 preStat.setInt(i++, object.getScreenshot());1354 preStat.setInt(i++, object.getVerbose());1355 preStat.setString(i++, object.getTimeout());1356 preStat.setInt(i++, object.getPageSource());1357 preStat.setInt(i++, object.getSeleniumLog());1358 preStat.setInt(i++, object.getRetries());1359 preStat.setString(i++, object.getManualExecution());1360 String user = object.getUsrCreated() == null ? "" : object.getUsrCreated();1361 preStat.setString(i++, user);1362 if (object.getState() == null) {1363 preStat.setString(i++, object.getState().WAITING.name());1364 } else {1365 preStat.setString(i++, object.getState().name());1366 }1367 preStat.setString(i++, object.getComment());1368 preStat.setString(i++, object.getDebugFlag());1369 preStat.setInt(i++, object.getPriority());1370 preStat.executeUpdate();1371 try (ResultSet resultSet = preStat.getGeneratedKeys()) {1372 if (resultSet.first()) {1373 newObject.setId(resultSet.getInt(1));1374 }1375 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1376 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "INSERT"));1377 } catch (SQLException exception) {1378 LOG.error("Unable to execute query : " + exception.toString());1379 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1380 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1381 }1382 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1383 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "INSERT"));1384 } catch (SQLException exception) {1385 LOG.error("Unable to execute query : " + exception.toString());1386 if (exception.getSQLState().equals(SQL_DUPLICATED_CODE)) { //23000 is the sql state for duplicate entries1387 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_DUPLICATE);1388 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "INSERT").replace("%REASON%", exception.toString()));1389 } else {1390 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1391 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1392 }1393 } 1394 return new AnswerItem(newObject, msg);1395 }1396 @Override1397 public Answer update(TestCaseExecutionQueue object) {1398 MessageEvent msg = null;1399 String query = "UPDATE testcaseexecutionqueue exq SET `Test` = ?, `TestCase` = ?, `Country` = ?, Environment = ?, Robot = ?, "1400 + "RobotIP = ?, `RobotPort` = ?, Browser = ?, BrowserVersion = ?, `Platform`= ?, `ScreenSize` = ?, "1401 + "ManualURL = ?, `ManualHost` = ?, ManualContextRoot = ?, `ManualLoginRelativeUrl`= ?, `ManualEnvData` = ?, "1402 + "Tag = ?, `Screenshot` = ?, Verbose = ?, `Timeout`= ?, `PageSource` = ?, `debugFlag` = ?, `priority` = ?, "1403 + "SeleniumLog = ?, `Retries`= ?, `ManualExecution` = ?, "1404 + "`UsrModif`= ?, `DateModif` = now() ";1405 query += " WHERE `ID` = ?";1406 // Debug message on SQL.1407 if (LOG.isDebugEnabled()) {1408 LOG.debug("SQL : " + query);1409 LOG.debug("SQL.param.id : " + object.getId());1410 }1411 Connection connection = this.databaseSpring.connect();1412 try {1413 PreparedStatement preStat = connection.prepareStatement(query);1414 try {1415 int i = 1;1416 preStat.setString(i++, object.getTest());1417 preStat.setString(i++, object.getTestCase());1418 preStat.setString(i++, object.getCountry());1419 preStat.setString(i++, object.getEnvironment());1420 preStat.setString(i++, object.getRobot());1421 preStat.setString(i++, object.getRobotIP());1422 preStat.setString(i++, object.getRobotPort());1423 preStat.setString(i++, object.getBrowser());1424 preStat.setString(i++, object.getBrowserVersion());1425 preStat.setString(i++, object.getPlatform());1426 preStat.setString(i++, object.getScreenSize());1427 preStat.setInt(i++, object.getManualURL());1428 preStat.setString(i++, object.getManualHost());1429 preStat.setString(i++, object.getManualContextRoot());1430 preStat.setString(i++, object.getManualLoginRelativeURL());1431 preStat.setString(i++, object.getManualEnvData());1432 preStat.setString(i++, object.getTag());1433 preStat.setInt(i++, object.getScreenshot());1434 preStat.setInt(i++, object.getVerbose());1435 preStat.setString(i++, object.getTimeout());1436 preStat.setInt(i++, object.getPageSource());1437 preStat.setString(i++, object.getDebugFlag());1438 preStat.setInt(i++, object.getPriority());1439 preStat.setInt(i++, object.getSeleniumLog());1440 preStat.setInt(i++, object.getRetries());1441 preStat.setString(i++, object.getManualExecution());1442 preStat.setString(i++, object.getUsrModif());1443 preStat.setLong(i++, object.getId());1444 preStat.executeUpdate();1445 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1446 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));1447 } catch (SQLException exception) {1448 LOG.error("Unable to execute query : " + exception.toString());1449 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1450 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1451 } finally {1452 preStat.close();1453 }1454 } catch (SQLException exception) {1455 LOG.error("Unable to execute query : " + exception.toString());1456 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1457 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1458 } finally {1459 try {1460 if (connection != null) {1461 connection.close();1462 }1463 } catch (SQLException exception) {1464 LOG.warn("Unable to close connection : " + exception.toString());1465 }1466 }1467 return new Answer(msg);1468 }1469 @Override1470 public Answer updateComment(long id, String comment) {1471 MessageEvent msg = null;1472 String query1473 = "UPDATE `" + TABLE + "` "1474 + "SET `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now(), `" + COLUMN_COMMENT + "` = ? "1475 + "WHERE `" + COLUMN_ID + "` = ? ;";1476 // Debug message on SQL.1477 if (LOG.isDebugEnabled()) {1478 LOG.debug("SQL : " + query);1479 LOG.debug("SQL.param.id : " + id);1480 }1481 Connection connection = this.databaseSpring.connect();1482 try {1483 PreparedStatement preStat = connection.prepareStatement(query);1484 try {1485 int i = 1;1486 preStat.setString(i++, comment);1487 preStat.setLong(i++, id);1488 int updateResult = preStat.executeUpdate();1489 if (updateResult <= 0) {1490 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_NOUPDATE);1491 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%DESCRIPTION%", "Unable to update comment for execution in queue " + id + " (update result: " + updateResult + ")."));1492 LOG.warn("Unable to update comment for execution in queue " + id + " (update result: " + updateResult + ").");1493 } else {1494 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1495 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));1496 }1497 } catch (SQLException exception) {1498 LOG.error("Unable to execute query : " + exception.toString());1499 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1500 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1501 } finally {1502 preStat.close();1503 }1504 } catch (SQLException exception) {1505 LOG.error("Unable to execute query : " + exception.toString());1506 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1507 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1508 } finally {1509 try {1510 if (connection != null) {1511 connection.close();1512 }1513 } catch (SQLException exception) {1514 LOG.warn("Unable to close connection : " + exception.toString());1515 }1516 }1517 return new Answer(msg);1518 }1519 @Override1520 public Answer updateToQueued(long id, String comment) {1521 MessageEvent msg = null;1522 String query1523 = "UPDATE `" + TABLE + "` "1524 + "SET `" + COLUMN_STATE + "` = 'QUEUED', `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now(), `" + COLUMN_COMMENT + "` = ? "1525 + "WHERE `" + COLUMN_ID + "` = ? "1526 + "AND `" + COLUMN_STATE + "` IN ('CANCELLED', 'ERROR')";1527 // Debug message on SQL.1528 if (LOG.isDebugEnabled()) {1529 LOG.debug("SQL : " + query);1530 LOG.debug("SQL.param.id : " + id);1531 }1532 Connection connection = this.databaseSpring.connect();1533 try {1534 PreparedStatement preStat = connection.prepareStatement(query);1535 try {1536 int i = 1;1537 preStat.setString(i++, comment);1538 preStat.setLong(i++, id);1539 int updateResult = preStat.executeUpdate();1540 if (updateResult <= 0) {1541 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_NOUPDATE);1542 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%DESCRIPTION%", "Unable to move state to QUEUD for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in CANCELLED or ERROR ?"));1543 LOG.warn("Unable to move state to QUEUED for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in CANCELLED or ERROR ?");1544 } else {1545 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1546 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));1547 }1548 } catch (SQLException exception) {1549 LOG.error("Unable to execute query : " + exception.toString());1550 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1551 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1552 } finally {1553 preStat.close();1554 }1555 } catch (SQLException exception) {1556 LOG.error("Unable to execute query : " + exception.toString());1557 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1558 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1559 } finally {1560 try {1561 if (connection != null) {1562 connection.close();1563 }1564 } catch (SQLException exception) {1565 LOG.warn("Unable to close connection : " + exception.toString());1566 }1567 }1568 return new Answer(msg);1569 }1570 @Override1571 public boolean updateToWaiting(final Long id) throws CerberusException {1572 String queryUpdate = "UPDATE `" + TABLE + "` "1573 + "SET `" + COLUMN_STATE + "` = 'WAITING', `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now() "1574 + "WHERE `" + COLUMN_ID + "` = ? "1575 + "AND `" + COLUMN_STATE + "` = 'QUEUED'";1576 try (1577 Connection connection = this.databaseSpring.connect();1578 PreparedStatement updateStateStatement = connection.prepareStatement(queryUpdate)) {1579 try {1580 // Debug message on SQL.1581 if (LOG.isDebugEnabled()) {1582 LOG.debug("SQL : " + queryUpdate);1583 LOG.debug("SQL.param.id : " + id);1584 }1585 updateStateStatement.setLong(1, id);1586 int updateResult = updateStateStatement.executeUpdate();1587 if (updateResult <= 0) {1588 LOG.warn("Unable to move state to WAITING for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is not in QUEUED ?");1589 return false;1590 }1591 return true;1592 } catch (SQLException e) {1593 LOG.warn("Unable to move state to WAITING for execution in queue " + id + ". Maybe execution is not in QUEUED ?", e);1594 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1595 }1596 } catch (SQLException e) {1597 LOG.warn("Unable to state from QUEUED to WAITING state for executions in queue", e);1598 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1599 }1600 }1601 @Override1602 public void updateToExecuting(long id, String comment, long exeId) throws CerberusException {1603 String queryUpdate = "UPDATE `" + TABLE + "` "1604 + "SET `" + COLUMN_STATE + "` = 'EXECUTING', `" + COLUMN_EXEID + "` = ?, `" + COLUMN_COMMENT + "` = ?, `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now() "1605 + "WHERE `" + COLUMN_ID + "` = ? "1606 + "AND `" + COLUMN_STATE + "` in ('STARTING')";1607 // Debug message on SQL.1608 if (LOG.isDebugEnabled()) {1609 LOG.debug("SQL : " + queryUpdate);1610 LOG.debug("SQL.param.id : " + id);1611 }1612 try (1613 Connection connection = databaseSpring.connect();1614 PreparedStatement updateStateStatement = connection.prepareStatement(queryUpdate)) {1615 updateStateStatement.setLong(1, exeId);1616 updateStateStatement.setString(2, comment);1617 updateStateStatement.setLong(3, id);1618 int updateResult = updateStateStatement.executeUpdate();1619 if (updateResult <= 0) {1620 LOG.warn("Unable to move state to EXECUTING for execution in queue " + id + " (update result: " + updateResult + "). Is the execution currently STARTING ?");1621 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1622 }1623 } catch (SQLException e) {1624 LOG.warn("Unable to move state from STARTING to EXECUTING for execution in queue " + id, e);1625 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1626 }1627 }1628 @Override1629 public void updateToStarting(long id) throws CerberusException {1630 String queryUpdate = "UPDATE `" + TABLE + "` "1631 + "SET `" + COLUMN_STATE + "` = 'STARTING', `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now() "1632 + "WHERE `" + COLUMN_ID + "` = ? "1633 + "AND `" + COLUMN_STATE + "` = 'WAITING'";1634 // Debug message on SQL.1635 if (LOG.isDebugEnabled()) {1636 LOG.debug("SQL : " + queryUpdate);1637 LOG.debug("SQL.param.id : " + id);1638 }1639 try (1640 Connection connection = databaseSpring.connect();1641 PreparedStatement updateStateStatement = connection.prepareStatement(queryUpdate)) {1642 updateStateStatement.setLong(1, id);1643 int updateResult = updateStateStatement.executeUpdate();1644 if (updateResult <= 0) {1645 LOG.warn("Unable to move state to STARTING for execution in queue " + id + " (update result: " + updateResult + "). Is the execution currently WAITING ?");1646 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1647 }1648 } catch (SQLException e) {1649 LOG.warn("Unable to move state from WAITING to STARTING for execution in queue " + id, e);1650 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1651 }1652 }1653 @Override1654 public void updateToError(long id, String comment) throws CerberusException {1655 String query1656 = "UPDATE `" + TABLE + "` "1657 + "SET `" + COLUMN_STATE + "` = 'ERROR', `" + COLUMN_COMMENT + "` = ?, `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now() "1658 + "WHERE `" + COLUMN_ID + "` = ? "1659 + "AND `" + COLUMN_STATE + "` = 'STARTING'";1660 // Debug message on SQL.1661 if (LOG.isDebugEnabled()) {1662 LOG.debug("SQL : " + query);1663 LOG.debug("SQL.param.id : " + id);1664 }1665 try (Connection connection = databaseSpring.connect();1666 PreparedStatement updateStateAndCommentStatement = connection.prepareStatement(query)) {1667 updateStateAndCommentStatement.setString(1, comment);1668 updateStateAndCommentStatement.setLong(2, id);1669 int updateResult = updateStateAndCommentStatement.executeUpdate();1670 if (updateResult <= 0) {1671 LOG.warn("Unable to move state to ERROR for execution in queue " + id + " (update result: " + updateResult + ")");1672 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1673 }1674 } catch (SQLException e) {1675 LOG.warn("Unable to set move to ERROR for execution in queue id " + id, e);1676 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1677 }1678 }1679 @Override1680 public void updateToDone(long id, String comment, long exeId) throws CerberusException {1681 String query1682 = "UPDATE `" + TABLE + "` "1683 + "SET `" + COLUMN_STATE + "` = 'DONE', `" + COLUMN_EXEID + "` = ?, `" + COLUMN_COMMENT + "` = ?, `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now() "1684 + "WHERE `" + COLUMN_ID + "` = ? ";1685 // Debug message on SQL.1686 if (LOG.isDebugEnabled()) {1687 LOG.debug("SQL : " + query);1688 LOG.debug("SQL.param.id : " + id);1689 }1690 try (1691 Connection connection = databaseSpring.connect();1692 PreparedStatement updateStateAndCommentStatement = connection.prepareStatement(query)) {1693// fillUpdateStateAndCommentAndIdStatement(id, TestCaseExecutionQueue.State.DONE, comment, exeId, updateStateAndCommentStatement);1694 updateStateAndCommentStatement.setLong(1, exeId);1695 updateStateAndCommentStatement.setString(2, comment);1696 updateStateAndCommentStatement.setLong(3, id);1697 int updateResult = updateStateAndCommentStatement.executeUpdate();1698 if (updateResult <= 0) {1699 LOG.warn("Unable to move state to DONE for execution in queue " + id + " (update result: " + updateResult + ")");1700 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1701 }1702 } catch (SQLException e) {1703 LOG.warn("Unable to set move to DONE for execution in queue id " + id, e);1704 throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1705 }1706 }1707 @Override1708 public Answer updateToCancelled(long id, String comment) {1709 MessageEvent msg = null;1710 String query1711 = "UPDATE `" + TABLE + "` "1712 + "SET `" + COLUMN_STATE + "` = 'CANCELLED', `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now(), `" + COLUMN_COMMENT + "` = ? "1713 + "WHERE `" + COLUMN_ID + "` = ? "1714 + "AND `" + COLUMN_STATE + "` IN ('ERROR','QUEUED')";1715 // Debug message on SQL.1716 if (LOG.isDebugEnabled()) {1717 LOG.debug("SQL : " + query);1718 LOG.debug("SQL.param.id : " + id);1719 }1720 Connection connection = this.databaseSpring.connect();1721 try {1722 PreparedStatement preStat = connection.prepareStatement(query);1723 try {1724 int i = 1;1725 preStat.setString(i++, comment);1726 preStat.setLong(i++, id);1727 int updateResult = preStat.executeUpdate();1728 if (updateResult <= 0) {1729 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_NOUPDATE);1730 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%DESCRIPTION%", "Unable to move state to CANCELLED for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in ERROR or QUEUED ?"));1731 LOG.warn("Unable to move state to CANCELLED for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in ERROR or QUEUED ?");1732// throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1733 } else {1734 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1735 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));1736 }1737 } catch (SQLException exception) {1738 LOG.error("Unable to execute query : " + exception.toString());1739 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1740 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1741 } finally {1742 preStat.close();1743 }1744 } catch (SQLException exception) {1745 LOG.error("Unable to execute query : " + exception.toString());1746 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1747 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1748 } finally {1749 try {1750 if (connection != null) {1751 connection.close();1752 }1753 } catch (SQLException exception) {1754 LOG.warn("Unable to close connection : " + exception.toString());1755 }1756 }1757 return new Answer(msg);1758 }1759 @Override1760 public Answer updateToCancelledForce(long id, String comment) {1761 MessageEvent msg = null;1762 String query1763 = "UPDATE `" + TABLE + "` "1764 + "SET `" + COLUMN_STATE + "` = 'CANCELLED', `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now(), `" + COLUMN_COMMENT + "` = ? "1765 + "WHERE `" + COLUMN_ID + "` = ? "1766 + "AND `" + COLUMN_STATE + "` IN ('WAITING','STARTING','EXECUTING')";1767 // Debug message on SQL.1768 if (LOG.isDebugEnabled()) {1769 LOG.debug("SQL : " + query);1770 }1771 Connection connection = this.databaseSpring.connect();1772 try {1773 PreparedStatement preStat = connection.prepareStatement(query);1774 try {1775 int i = 1;1776 preStat.setString(i++, comment);1777 preStat.setLong(i++, id);1778 int updateResult = preStat.executeUpdate();1779 if (updateResult <= 0) {1780 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_NOUPDATE);1781 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%DESCRIPTION%", "Unable to move state to CANCELLED (forced) for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in WAITING or STARTING or EXECUTING ?"));1782 LOG.warn("Unable to move state to CANCELLED (forced) for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in WAITING or STARTING or EXECUTING ?");1783// throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1784 } else {1785 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1786 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));1787 }1788 } catch (SQLException exception) {1789 LOG.error("Unable to execute query : " + exception.toString());1790 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1791 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1792 } finally {1793 preStat.close();1794 }1795 } catch (SQLException exception) {1796 LOG.error("Unable to execute query : " + exception.toString());1797 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1798 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1799 } finally {1800 try {1801 if (connection != null) {1802 connection.close();1803 }1804 } catch (SQLException exception) {1805 LOG.warn("Unable to close connection : " + exception.toString());1806 }1807 }1808 return new Answer(msg);1809 }1810 @Override1811 public Answer updateToErrorForce(long id, String comment) {1812 MessageEvent msg = null;1813 String query1814 = "UPDATE `" + TABLE + "` "1815 + "SET `" + COLUMN_STATE + "` = 'ERROR', `" + COLUMN_REQUEST_DATE + "` = now(), `" + COLUMN_DATEMODIF + "` = now(), `" + COLUMN_COMMENT + "` = ? "1816 + "WHERE `" + COLUMN_ID + "` = ? "1817 + "AND `" + COLUMN_STATE + "` IN ('QUEUED')";1818 // Debug message on SQL.1819 if (LOG.isDebugEnabled()) {1820 LOG.debug("SQL : " + query);1821 }1822 Connection connection = this.databaseSpring.connect();1823 try {1824 PreparedStatement preStat = connection.prepareStatement(query);1825 try {1826 int i = 1;1827 preStat.setString(i++, comment);1828 preStat.setLong(i++, id);1829 int updateResult = preStat.executeUpdate();1830 if (updateResult <= 0) {1831 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_WARNING_NOUPDATE);1832 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%DESCRIPTION%", "Unable to move state to ERROR (forced) for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in QUEUED state ?"));1833 LOG.warn("Unable to move state to ERROR (forced) for execution in queue " + id + " (update result: " + updateResult + "). Maybe execution is no longuer in QUEUED state ?");1834// throw new CerberusException(new MessageGeneral(MessageGeneralEnum.DATA_OPERATION_ERROR));1835 } else {1836 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1837 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "UPDATE"));1838 }1839 } catch (SQLException exception) {1840 LOG.error("Unable to execute query : " + exception.toString());1841 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1842 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1843 } finally {1844 preStat.close();1845 }1846 } catch (SQLException exception) {1847 LOG.error("Unable to execute query : " + exception.toString());1848 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1849 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1850 } finally {1851 try {1852 if (connection != null) {1853 connection.close();1854 }1855 } catch (SQLException exception) {1856 LOG.warn("Unable to close connection : " + exception.toString());1857 }1858 }1859 return new Answer(msg);1860 }1861 @Override1862 public Answer delete(TestCaseExecutionQueue object) {1863 MessageEvent msg = null;1864 final String query = "DELETE FROM testcaseexecutionqueue WHERE `ID` = ? ";1865 // Debug message on SQL.1866 if (LOG.isDebugEnabled()) {1867 LOG.debug("SQL : " + query);1868 }1869 Connection connection = this.databaseSpring.connect();1870 try {1871 PreparedStatement preStat = connection.prepareStatement(query);1872 try {1873 preStat.setLong(1, object.getId());1874 preStat.executeUpdate();1875 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1876 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "DELETE"));1877 } catch (SQLException exception) {1878 LOG.error("Unable to execute query : " + exception.toString());1879 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1880 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1881 } finally {1882 preStat.close();1883 }1884 } catch (SQLException exception) {1885 LOG.error("Unable to execute query : " + exception.toString());1886 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1887 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1888 } finally {1889 try {1890 if (connection != null) {1891 connection.close();1892 }1893 } catch (SQLException exception) {1894 LOG.warn("Unable to close connection : " + exception.toString());1895 }1896 }1897 return new Answer(msg);1898 }1899 @Override1900 public Answer delete(Long id) {1901 MessageEvent msg = null;1902 final String query = "DELETE FROM testcaseexecutionqueue WHERE `ID` = ? ";1903 // Debug message on SQL.1904 if (LOG.isDebugEnabled()) {1905 LOG.debug("SQL : " + query);1906 }1907 Connection connection = this.databaseSpring.connect();1908 try {1909 PreparedStatement preStat = connection.prepareStatement(query);1910 try {1911 preStat.setLong(1, id);1912 preStat.executeUpdate();1913 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);1914 msg.setDescription(msg.getDescription().replace("%ITEM%", OBJECT_NAME).replace("%OPERATION%", "DELETE"));1915 } catch (SQLException exception) {1916 LOG.error("Unable to execute query : " + exception.toString());1917 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1918 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1919 } finally {1920 preStat.close();1921 }1922 } catch (SQLException exception) {1923 LOG.error("Unable to execute query : " + exception.toString());1924 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);1925 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", exception.toString()));1926 } finally {1927 try {1928 if (connection != null) {1929 connection.close();1930 }1931 } catch (SQLException exception) {1932 LOG.warn("Unable to close connection : " + exception.toString());1933 }1934 }1935 return new Answer(msg);1936 }1937 @Override1938 public TestCaseExecutionQueue loadFromResultSet(ResultSet resultSet) throws FactoryCreationException, SQLException {1939 return factoryTestCaseExecutionInQueue.create(1940 resultSet.getLong(COLUMN_ID),1941 resultSet.getString(COLUMN_TEST),1942 resultSet.getString(COLUMN_TEST_CASE),1943 resultSet.getString(COLUMN_COUNTRY),1944 resultSet.getString(COLUMN_ENVIRONMENT),1945 resultSet.getString(COLUMN_ROBOT),1946 resultSet.getString(COLUMN_ROBOT_IP),1947 resultSet.getString(COLUMN_ROBOT_PORT),1948 resultSet.getString(COLUMN_BROWSER),1949 resultSet.getString(COLUMN_BROWSER_VERSION),1950 resultSet.getString(COLUMN_PLATFORM),1951 resultSet.getString(COLUMN_SCREENSIZE),1952 resultSet.getInt(COLUMN_MANUAL_URL),1953 resultSet.getString(COLUMN_MANUAL_HOST),1954 resultSet.getString(COLUMN_MANUAL_CONTEXT_ROOT),1955 resultSet.getString(COLUMN_MANUAL_LOGIN_RELATIVE_URL),1956 resultSet.getString(COLUMN_MANUAL_ENV_DATA),1957 resultSet.getString(COLUMN_TAG),1958 resultSet.getInt(COLUMN_SCREENSHOT),1959 resultSet.getInt(COLUMN_VERBOSE),1960 resultSet.getString(COLUMN_TIMEOUT),1961 resultSet.getInt(COLUMN_PAGE_SOURCE),1962 resultSet.getInt(COLUMN_SELENIUM_LOG),1963 new Date(resultSet.getTimestamp(COLUMN_REQUEST_DATE).getTime()),1964 TestCaseExecutionQueue.State.valueOf(resultSet.getString(COLUMN_STATE)),1965 resultSet.getInt(COLUMN_PRIORITY),1966 resultSet.getString(COLUMN_COMMENT),1967 resultSet.getString(COLUMN_DEBUGFLAG),1968 resultSet.getInt(COLUMN_RETRIES),1969 resultSet.getString(COLUMN_MANUAL_EXECUTION),1970 resultSet.getLong(COLUMN_EXEID),1971 resultSet.getString(COLUMN_USRCREATED),1972 resultSet.getTimestamp(COLUMN_DATECREATED),1973 resultSet.getString(COLUMN_USRMODIF),1974 resultSet.getTimestamp(COLUMN_DATEMODIF)1975 );1976 }1977 private TestCaseExecutionQueueToTreat loadQueueToTreatFromResultSet(ResultSet resultSet) throws SQLException {1978 TestCaseExecutionQueueToTreat inQueue = new TestCaseExecutionQueueToTreat();1979 try {1980 inQueue.setId(resultSet.getInt("exq.id"));1981 inQueue.setManualExecution(resultSet.getString("exq.manualexecution"));1982 inQueue.setSystem(resultSet.getString("app.system"));1983 inQueue.setEnvironment(resultSet.getString("cea.environment"));1984 inQueue.setCountry(resultSet.getString("cea.country"));1985 inQueue.setApplication(resultSet.getString("cea.application"));1986 inQueue.setPoolSizeApplication(resultSet.getInt("cea.poolsize"));1987 inQueue.setDebugFlag(resultSet.getString("exq.DebugFlag"));1988 /**1989 * Robot host is feed only if application type really required a1990 * robot. data comes from robot by priority or exe when exist.1991 */1992 String robotHost = "";1993 String appType = resultSet.getString("app.type");1994 if (appType == null) {1995 appType = "";1996 }1997 // If application type require a selenium/appium/sikuli server, we get the robot host from robot and not execution queue.1998 if ((appType.equals(Application.TYPE_APK)) || (appType.equals(Application.TYPE_GUI)) || (appType.equals(Application.TYPE_FAT)) || (appType.equals(Application.TYPE_IPA))) {1999 robotHost = resultSet.getString("rbt.host");2000 if (StringUtil.isNullOrEmpty(robotHost)) {2001 robotHost = resultSet.getString("exq.robotIP");2002 }2003 }2004 inQueue.setRobotHost(robotHost);2005 } catch (Exception e) {2006 LOG.debug("Exception in load queue from resultset : " + e.toString());2007 }2008 return inQueue;2009 }2010 /**2011 * Uses data of ResultSet to create object {@link TestCaseExecutionQueue}2012 *2013 * @param resultSet ResultSet relative to select from table2014 * TestCaseExecutionInQueue2015 * @return object {@link TestCaseExecutionQueue} with objects2016 * {@link ResultSet} and {@link Application}2017 * @throws SQLException when trying to get value from2018 * {@link java.sql.ResultSet#getString(String)}2019 * @see TestCaseExecutionQueue2020 */2021 private TestCaseExecutionQueue loadWithDependenciesFromResultSet(ResultSet resultSet) throws SQLException, FactoryCreationException {2022 TestCaseExecutionQueue testCaseExecutionInQueue = this.loadFromResultSet(resultSet);2023 testCaseExecutionInQueue.setTestCaseObj(testCaseDAO.loadFromResultSet(resultSet));2024 testCaseExecutionInQueue.setApplicationObj(applicationDAO.loadFromResultSet(resultSet));2025 return testCaseExecutionInQueue;2026 }2027}...
Source:TestCaseExecution.java
...514 }515 public Application getApplicationObj() {516 return applicationObj;517 }518 public void setApplicationObj(Application applicationObj) {519 this.applicationObj = applicationObj;520 }521 public String getBrowser() {522 return browser;523 }524 public void setBrowser(String browser) {525 this.browser = browser;526 }527 public String getBrowserFullVersion() {528 return browserFullVersion;529 }530 public void setBrowserFullVersion(String browserFullVersion) {531 this.browserFullVersion = browserFullVersion;532 }...
Source:GetExecutionQueue.java
...171 validator.setMessage(mes.getDescription());172 exception = true;173 }174 try {175 execution.setApplicationObj(applicationService.convert(applicationService.readByKey(execution.getTestCaseObj().getApplication())));176 } catch (CerberusException ex) {177 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_APPLICATION_NOT_FOUND);178 mes.setDescription(mes.getDescription().replace("%APPLI%", execution.getTestCaseObj().getApplication()));179 validator.setValid(false);180 validator.setMessage(mes.getDescription());181 exception = true;182 }183 execution.setEnvironmentData(execution.getEnvironment());184 try {185 execution.setCountryEnvParam(cepService.convert(cepService.readByKey(execution.getApplicationObj().getSystem(), execution.getCountry(), execution.getEnvironment())));186 } catch (CerberusException ex) {187 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_COUNTRYENV_NOT_FOUND);188 mes.setDescription(mes.getDescription().replace("%SYSTEM%", execution.getApplicationObj().getSystem()));189 mes.setDescription(mes.getDescription().replace("%COUNTRY%", execution.getCountry()));...
setApplicationObj
Using AI Code Generation
1package org.cerberus.crud.entity;2import java.util.ArrayList;3import java.util.List;4public class TestCaseExecutionQueue {5 private String applicationObj;6 public String getApplicationObj() {7 return applicationObj;8 }9 public void setApplicationObj(String applicationObj) {10 this.applicationObj = applicationObj;11 }12 public static void main(String[] args) {13 List<TestCaseExecutionQueue> list = new ArrayList<>();14 TestCaseExecutionQueue testCaseExecutionQueue = new TestCaseExecutionQueue();15 testCaseExecutionQueue.setApplicationObj("test");16 list.add(testCaseExecutionQueue);17 System.out.println(list.get(0).getApplicationObj());18 }19}
setApplicationObj
Using AI Code Generation
1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.TestCaseExecutionQueue;3public class TestCaseExecutionQueue {4 private TestCaseExecutionQueue applicationObj;5 public void setApplicationObj(TestCaseExecutionQueue applicationObj) {6 this.applicationObj = applicationObj;7 }8 public TestCaseExecutionQueue getApplicationObj() {9 return applicationObj;10 }11}12package org.cerberus.crud.entity;13import org.cerberus.crud.entity.TestCaseExecutionQueue;14public class TestCaseExecutionQueue {15 private TestCaseExecutionQueue applicationObj;16 public void setApplicationObj(TestCaseExecutionQueue applicationObj) {17 this.applicationObj = applicationObj;18 }19 public TestCaseExecutionQueue getApplicationObj() {20 return applicationObj;21 }22}23package org.cerberus.crud.entity;24import org.cerberus.crud.entity.TestCaseExecutionQueue;25public class TestCaseExecutionQueue {26 private TestCaseExecutionQueue applicationObj;27 public void setApplicationObj(TestCaseExecutionQueue applicationObj) {28 this.applicationObj = applicationObj;29 }30 public TestCaseExecutionQueue getApplicationObj() {31 return applicationObj;32 }33}34package org.cerberus.crud.entity;35import org.cerberus.crud.entity.TestCaseExecutionQueue;36public class TestCaseExecutionQueue {37 private TestCaseExecutionQueue applicationObj;38 public void setApplicationObj(TestCaseExecutionQueue applicationObj) {39 this.applicationObj = applicationObj;40 }41 public TestCaseExecutionQueue getApplicationObj() {42 return applicationObj;43 }44}45package org.cerberus.crud.entity;46import org.cerberus.crud.entity.TestCaseExecutionQueue;47public class TestCaseExecutionQueue {48 private TestCaseExecutionQueue applicationObj;49 public void setApplicationObj(TestCaseExecutionQueue applicationObj) {50 this.applicationObj = applicationObj;51 }52 public TestCaseExecutionQueue getApplicationObj() {
setApplicationObj
Using AI Code Generation
1package org.cerberus.crud.entity;2import java.io.Serializable;3import java.util.Date;4public class TestCaseExecutionQueue implements Serializable {5 private long id;6 private String application;7 private String country;8 private String environment;9 private String robot;10 private String robotDecli;11 private String robotIP;12 private String robotPort;13 private String browser;14 private String browserVersion;15 private String platform;16 private String screenSize;17 private String host;18 private String port;19 private String tag;20 private String exeqCerberusUrl;21 private String exeqCerberusUser;22 private String exeqCerberusPassword;23 private String exeqCerberusProxyHost;24 private String exeqCerberusProxyPort;25 private String exeqCerberusProxyLogin;26 private String exeqCerberusProxyPassword;27 private String exeqCerberusProxyDomain;28 private String exeqCerberusProxyWorkstation;29 private String exeqCerberusProxyExcludeList;30 private String exeqCerberusProxyScript;31 private String exeqCerberusSeleniumIP;32 private String exeqCerberusSeleniumPort;33 private String exeqCerberusSeleniumBrowser;34 private String exeqCerberusSeleniumVersion;35 private String exeqCerberusSeleniumPlatform;36 private String exeqCerberusSeleniumScreenSize;37 private String exeqCerberusSeleniumTimeout;38 private String exeqCerberusSeleniumCapabilities;39 private String exeqCerberusSeleniumOptions;40 private String exeqCerberusSeleniumProxyHost;41 private String exeqCerberusSeleniumProxyPort;42 private String exeqCerberusSeleniumProxyLogin;43 private String exeqCerberusSeleniumProxyPassword;44 private String exeqCerberusSeleniumProxyDomain;45 private String exeqCerberusSeleniumProxyWorkstation;46 private String exeqCerberusSeleniumProxyExcludeList;47 private String exeqCerberusSeleniumProxyScript;48 private String exeqCerberusSeleniumProxyCapabilities;
setApplicationObj
Using AI Code Generation
1package org.cerberus.crud.entity;2import java.util.Date;3public class TestCaseExecutionQueue {4 private long id;5 private String test;6 private String testCase;7 private String country;8 private String environment;9 private String browser;10 private String browserVersion;11 private String platform;12 private String robot;13 private String robotDecli;14 private String robotIP;15 private String robotPort;16 private String screenSize;17 private String tag;18 private String verbose;19 private String outputFormat;20 private String screenshot;21 private String pageSource;22 private String seleniumLog;23 private String manualURL;24 private String manualHost;25 private String manualContextRoot;26 private String manualLoginRelativeURL;27 private String manualEnvData;28 private String manualExecution;29 private String myHost;30 private String myContextRoot;31 private String myLoginRelativeURL;32 private String myEnvData;33 private String mySystem;34 private String seleniumIP;35 private String seleniumPort;36 private String state;37 private String controlStatus;38 private String controlMessage;39 private String controlProperty;40 private String queueState;41 private String queueStateRequest;42 private String queueStateChained;43 private long priority;44 private Date requestDate;45 private String requester;46 private String request;47 private String application;48 private String applicationObj;49 private String campaign;50 private String testCaseObj;51 private String countryObj;52 private String environmentObj;53 private String browserObj;54 private String browserVersionObj;55 private String platformObj;56 private String tagObj;57 private String verboseObj;58 private String outputFormatObj;59 private String screenshotObj;60 private String pageSourceObj;61 private String seleniumLogObj;62 private String manualURLObj;63 private String manualHostObj;64 private String manualContextRootObj;65 private String manualLoginRelativeURLObj;66 private String manualEnvDataObj;67 private String manualExecutionObj;68 private String myHostObj;69 private String myContextRootObj;70 private String myLoginRelativeURLObj;71 private String myEnvDataObj;72 private String mySystemObj;73 private String seleniumIPObj;74 private String seleniumPortObj;75 private String priorityObj;76 private String campaignObj;
setApplicationObj
Using AI Code Generation
1package com.mycompany.myapp;2import org.cerberus.crud.entity.TestCaseExecutionQueue;3public class TestClass {4 public static void main(String[] args) {5 TestCaseExecutionQueue tc = new TestCaseExecutionQueue();6 tc.setApplicationObj(null);7 }8}9package com.mycompany.myapp;10import org.cerberus.crud.entity.TestCaseExecutionQueue;11public class TestClass {12 public static void main(String[] args) {13 TestCaseExecutionQueue tc = new TestCaseExecutionQueue();14 tc.setApplicationObj(new org.cerberus.crud.entity.Application());15 }16}17package com.mycompany.myapp;18import org.cerberus.crud.entity.TestCaseExecutionQueue;19public class TestClass {20 public static void main(String[] args) {21 TestCaseExecutionQueue tc = new TestCaseExecutionQueue();
setApplicationObj
Using AI Code Generation
1package org.cerberus.crud.entity;2import java.util.Date;3public class TestCaseExecutionQueue {4 private long id;5 private String test;6 private String testCase;7 private int queue;8 private int state;9 private String stateDesc;10 private String country;11 private String environment;12 private String browser;13 private String browserVersion;14 private String platform;15 private String screenSize;16 private String tag;17 private String robot;18 private String robotDecli;19 private String robotIP;20 private String robotPort;21 private String screenshot;22 private String verbose;23 private String timeout;24 private String pageSource;25 private String seleniumLog;26 private String retries;27 private String manualURL;28 private String manualHost;29 private String manualContextRoot;30 private String manualLoginRelativeURL;31 private String manualEnvData;32 private String manualExecution;33 private String usrCreated;34 private Date dateCreated;35 private String usrModif;36 private Date dateModif;37 private String applicationObj;38 public long getId() {39 return id;40 }41 public void setId(long id) {42 this.id = id;43 }44 public String getTest() {45 return test;46 }47 public void setTest(String test) {48 this.test = test;49 }50 public String getTestCase() {51 return testCase;52 }53 public void setTestCase(String testCase) {54 this.testCase = testCase;55 }56 public int getQueue() {57 return queue;58 }59 public void setQueue(int queue) {60 this.queue = queue;61 }62 public int getState() {63 return state;64 }65 public void setState(int state) {66 this.state = state;67 }68 public String getStateDesc() {69 return stateDesc;70 }71 public void setStateDesc(String stateDesc) {72 this.stateDesc = stateDesc;73 }74 public String getCountry() {75 return country;76 }77 public void setCountry(String country) {78 this.country = country;79 }80 public String getEnvironment() {81 return environment;82 }83 public void setEnvironment(String environment) {84 this.environment = environment;85 }86 public String getBrowser() {87 return browser;88 }89 public void setBrowser(String browser) {90 this.browser = browser;91 }
setApplicationObj
Using AI Code Generation
1package org.cerberus.crud.entity;2import org.cerberus.crud.entity.Application;3public class TestCaseExecutionQueue {4 private String applicationObj;5 private Application application;6 public void setApplicationObj(String applicationObj) {7 this.applicationObj = applicationObj;8 }9 public void setApplication(Application application) {10 this.application = application;11 }12 public String getApplicationObj() {13 return applicationObj;14 }15 public Application getApplication() {16 return application;17 }18}19package org.cerberus.crud.entity;20import org.cerberus.crud.entity.Application;21public class TestCaseExecutionQueue {22 private String applicationObj;23 private Application application;24 public void setApplicationObj(String applicationObj) {25 this.applicationObj = applicationObj;26 }27 public void setApplication(Application application) {28 this.application = application;29 }30 public String getApplicationObj() {31 return applicationObj;32 }33 public Application getApplication() {34 return application;35 }36}37package org.cerberus.crud.entity;38import org.cerberus.crud.entity.Application;39public class TestCaseExecutionQueue {40 private String applicationObj;41 private Application application;42 public void setApplicationObj(String applicationObj) {43 this.applicationObj = applicationObj;44 }45 public void setApplication(Application application) {46 this.application = application;47 }48 public String getApplicationObj() {49 return applicationObj;50 }51 public Application getApplication() {52 return application;53 }54}55package org.cerberus.crud.entity;56import org.cerberus.crud.entity.Application
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!