Search in sources :

Example 6 with TestCaseExecution

use of org.cerberus.crud.entity.TestCaseExecution in project cerberus-source by cerberustesting.

the class TestCaseExecutionDAO method readBySystemByVarious.

@Override
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) {
    AnswerList answer = new AnswerList();
    MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);
    List<TestCaseExecution> tceList = new ArrayList<TestCaseExecution>();
    List<String> whereClauses = new LinkedList<String>();
    StringBuilder query = new StringBuilder();
    int paramNumber = 0;
    query.append(" select t.ID as statusExecutionID, t.* from ( ");
    query.append(" select exe.*, tec.*, app.* ");
    query.append(" from testcaseexecution exe ");
    query.append(" inner join testcase tec on exe.test = tec.test and exe.testcase = tec.testcase ");
    query.append(" inner join application app on exe.application = app.application ");
    String testClause = SqlUtil.generateInClause("exe.test", testList);
    if (!StringUtil.isNullOrEmpty(testClause)) {
        whereClauses.add(testClause);
    }
    String applicationClause = SqlUtil.generateInClause("exe.application", applicationList);
    if (!StringUtil.isNullOrEmpty(applicationClause)) {
        whereClauses.add(applicationClause);
    }
    String projectClause = SqlUtil.generateInClause("tec.project", projectList);
    if (!StringUtil.isNullOrEmpty(projectClause)) {
        whereClauses.add(projectClause);
    }
    // test case status: working, fully_implemented, ...
    String tcsClause = SqlUtil.generateInClause("exe.status", tcstatusList);
    if (!StringUtil.isNullOrEmpty(tcsClause)) {
        whereClauses.add(tcsClause);
    }
    // group
    String groupClause = SqlUtil.generateInClause("tec.group", groupList);
    if (!StringUtil.isNullOrEmpty(groupClause)) {
        whereClauses.add(groupClause);
    }
    // test case active
    String tcactiveClause = SqlUtil.generateInClause("tec.tcactive", tcactiveList);
    if (!StringUtil.isNullOrEmpty(tcactiveClause)) {
        whereClauses.add(tcactiveClause);
    }
    // test case active
    String priorityClause = SqlUtil.generateInClause("tec.Priority", priorityList);
    if (!StringUtil.isNullOrEmpty(priorityClause)) {
        whereClauses.add(priorityClause);
    }
    // target sprint
    String targetsprintClause = SqlUtil.generateInClause("tec.TargetBuild", targetsprintList);
    if (!StringUtil.isNullOrEmpty(targetsprintClause)) {
        whereClauses.add(targetsprintClause);
    }
    // target revision
    String targetrevisionClause = SqlUtil.generateInClause("tec.TargetRev", targetrevisionList);
    if (!StringUtil.isNullOrEmpty(targetrevisionClause)) {
        whereClauses.add(targetrevisionClause);
    }
    // creator
    String creatorClause = SqlUtil.generateInClause("tec.UsrCreated", creatorList);
    if (!StringUtil.isNullOrEmpty(creatorClause)) {
        whereClauses.add(creatorClause);
    }
    // implementer
    String implementerClause = SqlUtil.generateInClause("tec.Implementer", implementerList);
    if (!StringUtil.isNullOrEmpty(implementerClause)) {
        whereClauses.add(implementerClause);
    }
    // build
    String buildClause = SqlUtil.generateInClause("exe.Build", buildList);
    if (!StringUtil.isNullOrEmpty(buildClause)) {
        whereClauses.add(buildClause);
    }
    // revision
    String revisionClause = SqlUtil.generateInClause("exe.Revision", revisionList);
    if (!StringUtil.isNullOrEmpty(revisionClause)) {
        whereClauses.add(revisionClause);
    }
    // environment
    String environmentClause = SqlUtil.generateInClause("exe.Environment", environmentList);
    if (!StringUtil.isNullOrEmpty(environmentClause)) {
        whereClauses.add(environmentClause);
    }
    // country
    String countryClause = SqlUtil.generateInClause("exe.Country", countryList);
    if (!StringUtil.isNullOrEmpty(countryClause)) {
        whereClauses.add(countryClause);
    }
    // browser
    String browserClause = SqlUtil.generateInClause("exe.Browser", browserList);
    if (!StringUtil.isNullOrEmpty(browserClause)) {
        whereClauses.add(browserClause);
    }
    // test case execution
    String tcestatusClause = SqlUtil.generateInClause("exe.ControlStatus", tcestatusList);
    if (!StringUtil.isNullOrEmpty(tcestatusClause)) {
        whereClauses.add(tcestatusClause);
    }
    if (!StringUtil.isNullOrEmpty(system)) {
        whereClauses.add(" app.system like ? ");
    }
    if (!StringUtil.isNullOrEmpty(ip)) {
        whereClauses.add(" exe.IP like ? ");
    }
    if (!StringUtil.isNullOrEmpty(port)) {
        whereClauses.add(" exe.port like ? ");
    }
    if (!StringUtil.isNullOrEmpty(tag)) {
        whereClauses.add(" exe.tag like ? ");
    }
    if (!StringUtil.isNullOrEmpty(browserversion)) {
        whereClauses.add(" exe.browserfullversion like ? ");
    }
    if (!StringUtil.isNullOrEmpty(comment)) {
        whereClauses.add(" exe.comment like ? ");
    }
    if (!StringUtil.isNullOrEmpty(bugid)) {
        whereClauses.add(" tec.BugID like ? ");
    }
    if (!StringUtil.isNullOrEmpty(ticket)) {
        whereClauses.add(" tec.Ticket like ? ");
    }
    if (whereClauses.size() > 0) {
        query.append("where ");
        String joined = StringUtils.join(whereClauses, " and ");
        query.append(joined);
    }
    query.append(" order by exe.ID desc ");
    query.append(" ) as t group by t.test, t.testcase, t.environment, t.browser, t.country");
    Connection connection = this.databaseSpring.connect();
    try {
        PreparedStatement preStat = connection.prepareStatement(query.toString());
        if (testList != null) {
            for (String param : testList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (applicationList != null) {
            for (String param : applicationList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (projectList != null) {
            for (String param : projectList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (tcstatusList != null) {
            for (String param : tcstatusList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (groupList != null) {
            for (String param : groupList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (tcactiveList != null) {
            for (String param : tcactiveList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (priorityList != null) {
            for (String param : priorityList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (targetsprintList != null) {
            for (String param : targetsprintList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (targetrevisionList != null) {
            for (String param : targetrevisionList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (creatorList != null) {
            for (String param : creatorList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (implementerList != null) {
            for (String param : implementerList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (buildList != null) {
            for (String param : buildList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (revisionList != null) {
            for (String param : revisionList) {
                preStat.setString(++paramNumber, param);
            }
        }
        // environment
        if (environmentList != null) {
            for (String param : environmentList) {
                preStat.setString(++paramNumber, param);
            }
        }
        // country
        if (countryList != null) {
            for (String param : countryList) {
                preStat.setString(++paramNumber, param);
            }
        }
        // browser
        if (browserList != null) {
            for (String param : browserList) {
                preStat.setString(++paramNumber, param);
            }
        }
        // controlstatus
        if (tcestatusList != null) {
            for (String param : tcestatusList) {
                preStat.setString(++paramNumber, param);
            }
        }
        if (!StringUtil.isNullOrEmpty(system)) {
            preStat.setString(++paramNumber, system);
        }
        if (!StringUtil.isNullOrEmpty(ip)) {
            preStat.setString(++paramNumber, "%" + ip + "%");
        }
        if (!StringUtil.isNullOrEmpty(port)) {
            preStat.setString(++paramNumber, "%" + port + "%");
        }
        if (!StringUtil.isNullOrEmpty(tag)) {
            preStat.setString(++paramNumber, "%" + tag + "%");
        }
        if (!StringUtil.isNullOrEmpty(browserversion)) {
            preStat.setString(++paramNumber, "%" + browserversion + "%");
        }
        if (!StringUtil.isNullOrEmpty(comment)) {
            preStat.setString(++paramNumber, "%" + comment + "%");
        }
        if (!StringUtil.isNullOrEmpty(bugid)) {
            preStat.setString(++paramNumber, "%" + bugid + "%");
        }
        if (!StringUtil.isNullOrEmpty(ticket)) {
            preStat.setString(++paramNumber, "%" + ticket + "%");
        }
        try {
            ResultSet resultSet = preStat.executeQuery();
            try {
                while (resultSet.next()) {
                    tceList.add(loadWithDependenciesFromResultSet(resultSet));
                }
                if (tceList.isEmpty()) {
                    msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_NO_DATA_FOUND);
                } else {
                    msg.setDescription(msg.getDescription().replace("%ITEM%", "TestCaseExecution").replace("%OPERATION%", "SELECT"));
                }
            } catch (SQLException exception) {
                LOG.warn("Unable to execute query : " + exception.toString());
                msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
                msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));
                tceList.clear();
            } finally {
                if (resultSet != null) {
                    resultSet.close();
                }
            }
        } catch (SQLException ex) {
            LOG.warn("Unable to execute query : " + ex.toString());
            msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
            msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));
        } finally {
            if (preStat != null) {
                preStat.close();
            }
        }
    } catch (SQLException ex) {
        LOG.warn(ex.toString());
        msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
        msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));
    } finally {
        try {
            if (connection != null) {
                connection.close();
            }
        } catch (SQLException ex) {
            LOG.warn("Unable to execute query : " + ex.toString());
        }
    }
    answer.setTotalRows(tceList.size());
    answer.setDataList(tceList);
    answer.setResultMessage(msg);
    return answer;
}
Also used : AnswerList(org.cerberus.util.answer.AnswerList) IFactoryTestCaseExecution(org.cerberus.crud.factory.IFactoryTestCaseExecution) TestCaseExecution(org.cerberus.crud.entity.TestCaseExecution) SQLException(java.sql.SQLException) MessageEvent(org.cerberus.engine.entity.MessageEvent) ArrayList(java.util.ArrayList) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) LinkedList(java.util.LinkedList) ResultSet(java.sql.ResultSet)

Example 7 with TestCaseExecution

use of org.cerberus.crud.entity.TestCaseExecution in project cerberus-source by cerberustesting.

the class TestCaseExecutionDAO method findLastTCExecutionInGroup.

@Override
public TestCaseExecution findLastTCExecutionInGroup(String test, String testCase, String environment, String country, String build, String revision, String browser, String browserVersion, String ip, String port, String tag) {
    TestCaseExecution result = null;
    StringBuilder query = new StringBuilder();
    query.append("SELECT exe.* FROM testcaseexecution exe ").append("WHERE exe.test = ? AND exe.testcase = ? AND exe.country = ? AND exe.browser = ? ");
    if (!StringUtil.isNull(environment)) {
        query.append("AND exe.environment IN (");
        query.append(environment);
        query.append(") ");
    }
    if (!StringUtil.isNull(build)) {
        query.append("AND exe.build IN (");
        query.append(build);
        query.append(") ");
    }
    if (!StringUtil.isNull(revision)) {
        query.append("AND exe.revision IN (");
        query.append(revision);
        query.append(") ");
    }
    if (!StringUtil.isNull(browserVersion)) {
        query.append("AND exe.browserfullversion LIKE ? ");
    }
    if (!StringUtil.isNull(ip)) {
        query.append("AND exe.ip LIKE ? ");
    }
    if (!StringUtil.isNull(port)) {
        query.append("AND exe.port LIKE ? ");
    }
    if (!StringUtil.isNull(tag)) {
        query.append("AND exe.tag LIKE ? ");
    }
    query.append("ORDER BY exe.id DESC");
    try (Connection connection = this.databaseSpring.connect();
        PreparedStatement preStat = connection.prepareStatement(query.toString())) {
        preStat.setString(1, test);
        preStat.setString(2, testCase);
        preStat.setString(3, country);
        preStat.setString(4, browser);
        int i = 5;
        if (!StringUtil.isNull(browserVersion)) {
            preStat.setString(i, browserVersion);
            i++;
        }
        if (!StringUtil.isNull(ip)) {
            preStat.setString(i, ip);
            i++;
        }
        if (!StringUtil.isNull(port)) {
            preStat.setString(i, port);
            i++;
        }
        if (!StringUtil.isNull(tag)) {
            preStat.setString(i, tag);
        }
        try (ResultSet resultSet = preStat.executeQuery()) {
            if (resultSet.first()) {
                result = this.loadFromResultSet(resultSet);
            }
        } catch (SQLException exception) {
            LOG.error("Unable to execute query : " + exception.toString());
        }
    } catch (SQLException exception) {
        LOG.error("Unable to execute query : " + exception.toString());
    }
    return result;
}
Also used : IFactoryTestCaseExecution(org.cerberus.crud.factory.IFactoryTestCaseExecution) TestCaseExecution(org.cerberus.crud.entity.TestCaseExecution) SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 8 with TestCaseExecution

use of org.cerberus.crud.entity.TestCaseExecution in project cerberus-source by cerberustesting.

the class TestCaseExecutionDAO method loadWithTestCaseFromResultSet.

private TestCaseExecution loadWithTestCaseFromResultSet(ResultSet resultSet) throws SQLException {
    TestCaseExecution testCaseExecution = new TestCaseExecution();
    testCaseExecution = this.loadFromResultSet(resultSet);
    testCaseExecution.setTestCaseObj(testCaseDAO.loadFromResultSet(resultSet));
    return testCaseExecution;
}
Also used : IFactoryTestCaseExecution(org.cerberus.crud.factory.IFactoryTestCaseExecution) TestCaseExecution(org.cerberus.crud.entity.TestCaseExecution)

Example 9 with TestCaseExecution

use of org.cerberus.crud.entity.TestCaseExecution in project cerberus-source by cerberustesting.

the class TestCaseExecutionDAO method findLastTCExecutionByCriteria.

@Override
public TestCaseExecution findLastTCExecutionByCriteria(String test, String testCase, String environment, String country, String build, String revision, String browser, String browserVersion, String ip, String port, String tag) {
    TestCaseExecution result = null;
    final String query = new StringBuffer("SELECT exe.* FROM testcaseexecution exe ").append("WHERE exe.test = ? AND exe.testcase = ? ").append("AND exe.environment LIKE ? AND exe.country = ? AND exe.build LIKE ? ").append("AND exe.revision LIKE ? AND exe.browser = ? AND exe.browserfullversion LIKE ? ").append("AND exe.ip LIKE ? AND exe.port LIKE ? AND exe.tag LIKE ? ").append("ORDER BY exe.id DESC").toString();
    try (Connection connection = this.databaseSpring.connect();
        PreparedStatement preStat = connection.prepareStatement(query)) {
        preStat.setString(1, test);
        preStat.setString(2, testCase);
        preStat.setString(3, ParameterParserUtil.wildcardIfEmpty(environment));
        preStat.setString(4, country);
        preStat.setString(5, ParameterParserUtil.wildcardIfEmpty(build));
        preStat.setString(6, ParameterParserUtil.wildcardIfEmpty(revision));
        preStat.setString(7, browser);
        preStat.setString(8, ParameterParserUtil.wildcardIfEmpty(browserVersion));
        preStat.setString(9, ParameterParserUtil.wildcardIfEmpty(ip));
        preStat.setString(10, ParameterParserUtil.wildcardIfEmpty(port));
        preStat.setString(11, ParameterParserUtil.wildcardIfEmpty(tag));
        try (ResultSet resultSet = preStat.executeQuery()) {
            if (resultSet.first()) {
                result = this.loadFromResultSet(resultSet);
            }
        } catch (SQLException exception) {
            LOG.error("Unable to execute query : " + exception.toString());
        }
    } catch (SQLException exception) {
        LOG.error("Unable to execute query : " + exception.toString());
    }
    return result;
}
Also used : IFactoryTestCaseExecution(org.cerberus.crud.factory.IFactoryTestCaseExecution) TestCaseExecution(org.cerberus.crud.entity.TestCaseExecution) SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 10 with TestCaseExecution

use of org.cerberus.crud.entity.TestCaseExecution in project cerberus-source by cerberustesting.

the class TestCaseExecutionDAO method readByCriteria.

@Override
public AnswerList readByCriteria(int start, int amount, String sort, String searchTerm, Map<String, List<String>> individualSearch, List<String> individualLike) throws CerberusException {
    MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_OK);
    AnswerList answer = new AnswerList();
    List<String> individalColumnSearchValues = new ArrayList<String>();
    final StringBuffer query = new StringBuffer();
    query.append("SELECT * FROM testcaseexecution exe ");
    query.append("where exe.`start`> '").append(DateUtil.getMySQLTimestampTodayDeltaMinutes(-360000)).append("' ");
    if (!StringUtil.isNullOrEmpty(searchTerm)) {
        query.append("and (exe.`id` like ? ");
        query.append(" or exe.`test` like ? ");
        query.append(" or exe.`testCase` like ? ");
        query.append(" or exe.`build` like ? ");
        query.append(" or exe.`revision` like ? ");
        query.append(" or exe.`environment` like ? ");
        query.append(" or exe.`country` like ? ");
        query.append(" or exe.`browser` like ? ");
        query.append(" or exe.`version` like ? ");
        query.append(" or exe.`platform` like ? ");
        query.append(" or exe.`browserfullversion` like ? ");
        query.append(" or exe.`start` like ? ");
        query.append(" or exe.`end` like ? ");
        query.append(" or exe.`controlstatus` like ? ");
        query.append(" or exe.`controlmessage` like ? ");
        query.append(" or exe.`application` like ? ");
        query.append(" or exe.`ip` like ? ");
        query.append(" or exe.`url` like ? ");
        query.append(" or exe.`port` like ? ");
        query.append(" or exe.`tag` like ? ");
        query.append(" or exe.`end` like ? ");
        query.append(" or exe.`status` like ? ");
        query.append(" or exe.`crbversion` like ? ");
        query.append(" or exe.`executor` like ? ");
        query.append(" or exe.`screensize` like ? ");
        query.append(" or exe.`userAgent` like ? )");
    }
    if (individualSearch != null && !individualSearch.isEmpty()) {
        query.append(" and ( 1=1 ");
        for (Map.Entry<String, List<String>> entry : individualSearch.entrySet()) {
            query.append(" and ");
            query.append(SqlUtil.getInSQLClauseForPreparedStatement(entry.getKey(), entry.getValue()));
            individalColumnSearchValues.addAll(entry.getValue());
        }
        query.append(" ) ");
    }
    if (!StringUtil.isNullOrEmpty(sort)) {
        query.append(" order by ").append(sort);
    }
    if ((amount <= 0) || (amount >= MAX_ROW_SELECTED)) {
        query.append(" limit ").append(start).append(" , ").append(MAX_ROW_SELECTED);
    } else {
        query.append(" limit ").append(start).append(" , ").append(amount);
    }
    // Debug message on SQL.
    if (LOG.isDebugEnabled()) {
        LOG.debug("SQL : " + query.toString());
    }
    List<TestCaseExecution> testCaseExecutionList = new ArrayList<TestCaseExecution>();
    Connection connection = this.databaseSpring.connect();
    try {
        PreparedStatement preStat = connection.prepareStatement(query.toString());
        int i = 1;
        if (!Strings.isNullOrEmpty(searchTerm)) {
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
            preStat.setString(i++, "%" + searchTerm + "%");
        }
        for (String individualColumnSearchValue : individalColumnSearchValues) {
            preStat.setString(i++, individualColumnSearchValue);
        }
        try {
            ResultSet resultSet = preStat.executeQuery();
            try {
                while (resultSet.next()) {
                    testCaseExecutionList.add(this.loadFromResultSet(resultSet));
                }
                msg.setDescription(msg.getDescription().replace("%ITEM%", "TestCaseExecution").replace("%OPERATION%", "SELECT"));
                // answer = new AnswerList(testCaseExecutionList, testCaseExecutionList.size());
                answer.setTotalRows(testCaseExecutionList.size());
            } catch (SQLException exception) {
                LOG.warn("Unable to execute query : " + exception.toString());
                msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
                msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));
                testCaseExecutionList = null;
            } finally {
                resultSet.close();
            }
        } catch (SQLException exception) {
            LOG.warn("Unable to execute query : " + exception.toString());
            msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
            msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));
            testCaseExecutionList = null;
        } finally {
            preStat.close();
        }
    } catch (SQLException exception) {
        LOG.warn("Unable to execute query : " + exception.toString());
        msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
        msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));
        testCaseExecutionList = null;
    } finally {
        try {
            if (connection != null) {
                connection.close();
            }
        } catch (SQLException e) {
            LOG.warn(e.toString());
            msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
            msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", "Unable to retrieve the list of entries!"));
        }
    }
    answer.setResultMessage(msg);
    answer.setDataList(testCaseExecutionList);
    return answer;
}
Also used : AnswerList(org.cerberus.util.answer.AnswerList) IFactoryTestCaseExecution(org.cerberus.crud.factory.IFactoryTestCaseExecution) TestCaseExecution(org.cerberus.crud.entity.TestCaseExecution) SQLException(java.sql.SQLException) MessageEvent(org.cerberus.engine.entity.MessageEvent) ArrayList(java.util.ArrayList) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) ResultSet(java.sql.ResultSet) AnswerList(org.cerberus.util.answer.AnswerList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) Map(java.util.Map)

Aggregations

TestCaseExecution (org.cerberus.crud.entity.TestCaseExecution)55 ArrayList (java.util.ArrayList)24 IFactoryTestCaseExecution (org.cerberus.crud.factory.IFactoryTestCaseExecution)20 MessageEvent (org.cerberus.engine.entity.MessageEvent)19 JSONObject (org.json.JSONObject)17 AnswerItem (org.cerberus.util.answer.AnswerItem)15 AnswerList (org.cerberus.util.answer.AnswerList)14 Connection (java.sql.Connection)13 PreparedStatement (java.sql.PreparedStatement)13 ResultSet (java.sql.ResultSet)13 SQLException (java.sql.SQLException)13 LinkedHashMap (java.util.LinkedHashMap)13 ITestCaseExecutionService (org.cerberus.crud.service.ITestCaseExecutionService)12 CerberusException (org.cerberus.exception.CerberusException)11 List (java.util.List)10 HashMap (java.util.HashMap)9 TestCaseExecutionQueue (org.cerberus.crud.entity.TestCaseExecutionQueue)9 JSONArray (org.json.JSONArray)9 JSONException (org.json.JSONException)9 ApplicationContext (org.springframework.context.ApplicationContext)9