Class EngineTestResult
- java.lang.Object
-
- mks.ci.server.engine.EngineTestResult
-
public class EngineTestResult extends java.lang.Object
EngineTestResult is used to interact with test result tables (insert, update, purge and obtain test result records).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EngineTestResult.Op
Test result operationstatic class
EngineTestResult.ScriptTestResultsArgsBean
A class that represents the arguments for test results.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACL_NAME
The ACL under which our permission livesstatic java.lang.String
AUDIT_CATEGORY
Audit category for the operations performed in this classstatic int
CREATE_MODE
static int
EDIT_MODE
Editing modesstatic java.lang.String
ISSUE_TYPE_SQL
static java.lang.String
PERMISSION_NAME
The permission that controls who is allowed to purge test resultsstatic java.lang.String
PURGE_TEST_RESULTS_OP
Audit the purging of test resultsstatic int
QUERY_BY_RELATED_ITEM
static int
QUERY_BY_SESSION
static int
QUERY_BY_TEST_CASE
Types of test result queries.static int
QUERY_BY_TEST_SUITE
static int
SET_MODE
static java.lang.String
UNSPECIFIED_STATE_NAME
The unspecified state name
-
Constructor Summary
Constructors Constructor Description EngineTestResult(mks.ci.server.engine.EngineSQL engineSQL)
Construct the TestResultEngine
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
checkModifyTestResultPolicy(java.sql.Connection c, int currentUserID, int sessionID)
Check that the user is allows to modify test results in this sessionvoid
checkPurgeTestResultPermission()
Check if the user has the permission to purge the test resultsvoid
checkTestSession(int currentUserId, mks.ci.server.engine.Issue session)
Make sure the specified item is a test sessionstatic void
checkTestSession(mks.ci.server.engine.EngineSQL engineSQL, int currentUserId, mks.ci.server.engine.Issue session)
Make sure the specified item is a test sessionvoid
checkTestSessionIssues(int currentUserId, java.util.Collection<mks.ci.server.engine.Issue> sessionIssues)
Make sure all issues are test sessionsint[]
convertCollectionToArray(java.util.Collection<java.lang.Integer> c)
Convert the collection of integers to int arrayvoid
deleteTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.List<mks.ci.api.TestResultID> resultIds)
Delete specified test resultsvoid
fetchResults(java.sql.Connection c, int sessionID, java.util.List<java.lang.Integer> testIds, java.util.Set<java.lang.Integer> foundTestIds, java.util.List<java.lang.Integer> resultIds, boolean forRemoveUnmodified)
static mks.ci.server.filter.CollectionFilter
getFilterForIssueIDs(java.util.Collection<java.lang.Integer> issueIDs)
Get a filter representing all issue ids in the given list.java.util.Set<java.lang.Integer>
getRelatedItemIdsInPage(java.util.Collection<mks.ci.server.engine.TestResult> page)
Get the set of all related items to be added to the results in the pagejava.util.List<java.lang.Integer>
getResultIds(int queryType, int sessionId, int itemId, java.util.Collection<java.lang.Integer> sessionIds, boolean showLastResultOnly, java.lang.String sortColumn, boolean sortAscending, mks.ci.api.TestResultVerdictFilter verdictFilter, boolean showSharedResults, int currentUserID, int clientVersion)
Deprecated.java.util.List<java.util.List<java.lang.Integer>>
getResultIds(java.util.Collection<mks.ci.api.TestResultID> trIDs, int currentUserID, int clientVersion)
Get the list of test result ids (as integers) from the list of test result id objectsmks.ci.common.GetResultIdsReturn
getResultIds(mks.ci.common.GetTestResultIdsArg args, int currentUserID, int clientVersion)
Get a list of test result ids that match specified criteria.java.util.List<java.lang.Integer>
getResultIDsForTestCasesInSession(int sessionID, java.util.List<java.lang.Integer> testIds, int currentUserID, int clientVersion)
Get the results for the specified test cases in the specified test session.int
getResultsCount(int queryType, int sessionId, int itemId, mks.ci.api.TestResultVerdictFilter verdictFilter, boolean showSharedResults, int currentUserID, int clientVersion)
Get the number of results that match specified criteria.int
getResultsCount(java.sql.Connection c, int queryType, int sessionId, int itemId, mks.ci.api.TestResultVerdictFilter verdictFilter, boolean showSharedResults, int currentUserID, int clientVersion)
Get the number of results that match specified criteria.mks.ci.server.engine.TestResult
getTestResult(int sessionId, int caseId, int currentUserID, int clientVersion)
Get test result for the specified test case in the specified test session.mks.ci.server.engine.TestResultAttachment
getTestResultAttachment(int id, int currentUserID, int clientVersion)
Get test result attachments by idjava.util.List<mks.ci.server.engine.TestResultAttachment>
getTestResultAttachments(java.util.List<java.lang.String> attachmentNames, int sessionID, int testID, int currentUserID, int clientVersion)
Get test result attachments by name.java.util.Set<java.lang.Integer>
getTestResultFields(int userId)
Get test result fields visible to the user.java.util.List<mks.ci.server.engine.TestResult>
getTestResults(boolean throwIfNotFound, int sessionId, java.util.List<java.lang.Integer> caseIds, int currentUserID, int clientVersion)
Get test results for test cases for the specified test sessionjava.util.List<mks.ci.server.engine.TestResult>
getTestResults(java.sql.Connection c, boolean throwIfNotFound, int sessionId, java.util.List<java.lang.Integer> caseIds, int currentUserID, int clientVersion)
Get test results for test cases for the specified test sessionmks.ci.common.GetTestResultsReturn
getTestResults(java.sql.Connection c, mks.ci.common.GetTestResultsArg arg, int currentUserID, int clientVersion)
Get test results objects for specified test result IDs.java.util.List<mks.ci.server.engine.TestResult>
getTestResults(java.util.List<java.lang.Integer> resultIds, int currentUserID, int clientVersion)
Get test results by their id.mks.ci.common.GetTestResultsReturn
getTestResults(mks.ci.common.GetTestResultsArg arg, int currentUserID, int clientVersion)
Get test results objects for specified test result IDs.java.util.Map<java.lang.Integer,java.util.List<mks.ci.server.engine.TestResult>>
getTestResultsForIssueIDs(java.sql.Connection c, java.util.List<java.lang.Integer> issueIDs, int currentUserId, int clientVersion)
Get the list of test results for each issue in the list, only if the issue in the list is a session, case, or can be related itemjava.util.Map<java.lang.Integer,java.util.List<mks.ci.server.engine.TestResult>>
getTestResultsForIssueIDs(java.util.List<java.lang.Integer> issueIDs, int currentUserId, int clientVersion)
Get the list of test results for each issue in the list, only if the issue in the list is a session, case, or can be related itemmks.ci.server.engine.Type
getTestResultType()
mks.ci.server.engine.Issue
getTestSessionIssue(java.sql.Connection c, int currentUserId, int issueId)
Get the specfied issuestatic mks.ci.server.engine.Issue
getTestSessionIssue(java.sql.Connection c, mks.ci.server.engine.EngineSQL engineSQL, int currentUserId, int issueId)
Get the specified issuejava.util.List<mks.ci.server.engine.Issue>
getTestSessionIssues(java.sql.Connection c, int currentUserId, java.util.Collection<java.lang.Integer> sessionIds)
Get test session issues all at oncejava.util.List<mks.ci.server.engine.Issue>
getTestSessionIssues(java.sql.Connection c, int currentUserId, java.util.Collection<java.lang.Integer> sessionIds, mks.ci.server.engine.IssueComponents ic)
Get test session issues all at once, and populate requested issue componentsjava.util.List<java.lang.Integer>
getTestSessionsForCase(int caseId, int currentUserId, int clientVersion)
Find all sessions in which the test case has been tested and return themjava.util.List<java.lang.Integer>
getTestSessionsForCase(java.sql.Connection c, int caseId, int currentUserId, int clientVersion)
Find all sessions in which the test case has been tested and return themjava.util.List<java.lang.Integer>
getTestSessionsForSuite(int suiteId, int currentUserId, int clientVersion)
/** Find all sessions in which the test cases in the suite have been tested and return themjava.util.List<java.lang.Integer>
getTestSessionsForSuite(java.sql.Connection c, int suiteId, int currentUserId, int clientVersion)
Find all sessions in which the test cases in the suite have been tested and return them NOTE: Here we are walking the document as of now.java.util.List<java.lang.Integer>
getTestStepIds(java.util.List<mks.ci.api.TestResultID> steps, int currentUserID, int clientVersion)
Get ids for the test steps passed injava.util.List<mks.ci.server.engine.TestStepResult>
getTestStepResults(java.util.List<java.lang.Integer> stepResultIDs, int currentUserID, int clientVersion)
Get test step result details for test steps identified by the result ids passed in.java.util.List<java.lang.Integer>
getUntestedCases(java.sql.Connection c, mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int itemId, java.util.Collection<java.lang.Integer> sessionIds, int currentUserId, int clientVersion)
java.util.List<java.lang.Integer>
getUntestedCases(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int itemId, java.util.Collection<java.lang.Integer> sessionIds, int currentUserID, int clientVersion)
boolean
isModifyRelatedItemsOnly(java.util.Collection<mks.ci.server.engine.TestResult> page)
Are we only modifying related items for all the test results in a pageboolean
isTestResultMetaDataField(int fieldId, int userId)
Is the specified field test result meta data field visible to the specified user.boolean
isValidSortColumn(java.lang.String sortColumn)
Is the sort column valid test result columnboolean
isValidVisibleTestResultField(int fieldId, int userId)
Is the field valid test result (possibly virtual) field visible to the user.boolean
isVirtualTestResultField(int fieldId)
Is the specified field test result built in fieldvoid
loadHistoricallyToValidateTestSteps(java.sql.Connection c, int currentUserID, java.util.Date asOfDate, java.util.Collection<java.lang.Integer> testCasesInPage, java.util.Set<java.lang.Integer> mustGetStepsFor, java.util.Map<java.lang.Integer,mks.ci.server.engine.TestResult> idToTestResult)
void
purgeTestResults(java.sql.Connection c, mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.Date before)
Purge all the test results in all the sessions that were created before the specified date.void
purgeTestResults(java.sql.Connection c, mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.List<java.lang.Integer> sessionIDs)
Purge all test results in all the sessions listed.void
purgeTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.Date before)
Purge all the test results in all the sessions that were created before the specified date.void
purgeTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.List<java.lang.Integer> sessionIDs)
Purge all test results in all the sessions listed.void
setTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int sessionID, java.util.List<mks.ci.server.engine.TestResult> testResults, int mode, int currentUserID, int clientVersion, boolean isImport)
Insert or update the test results into the test results tables.void
verifyTestResultPolicies(int sessionID, int caseID, int currentUserID)
Verify that the session and case ids are valid, i.e. that the session specified is a test session and that the test case specified is a valid test case in that session.void
verifyTestResultPolicies(java.sql.Connection c, int currentUserID, int sessionID, java.util.List<mks.ci.server.engine.TestResult> results)
Make sure the user is allowed to perform the operation.
-
-
-
Field Detail
-
QUERY_BY_TEST_CASE
public static final int QUERY_BY_TEST_CASE
Types of test result queries.- See Also:
- Constant Field Values
-
QUERY_BY_SESSION
public static final int QUERY_BY_SESSION
- See Also:
- Constant Field Values
-
QUERY_BY_RELATED_ITEM
public static final int QUERY_BY_RELATED_ITEM
- See Also:
- Constant Field Values
-
QUERY_BY_TEST_SUITE
public static final int QUERY_BY_TEST_SUITE
- See Also:
- Constant Field Values
-
EDIT_MODE
public static final int EDIT_MODE
Editing modes- See Also:
- Constant Field Values
-
CREATE_MODE
public static final int CREATE_MODE
- See Also:
- Constant Field Values
-
SET_MODE
public static final int SET_MODE
- See Also:
- Constant Field Values
-
ISSUE_TYPE_SQL
public static final java.lang.String ISSUE_TYPE_SQL
- See Also:
- Constant Field Values
-
AUDIT_CATEGORY
public static final java.lang.String AUDIT_CATEGORY
Audit category for the operations performed in this class- See Also:
- Constant Field Values
-
PURGE_TEST_RESULTS_OP
public static final java.lang.String PURGE_TEST_RESULTS_OP
Audit the purging of test results- See Also:
- Constant Field Values
-
ACL_NAME
public static final java.lang.String ACL_NAME
The ACL under which our permission lives- See Also:
- Constant Field Values
-
PERMISSION_NAME
public static final java.lang.String PERMISSION_NAME
The permission that controls who is allowed to purge test results- See Also:
- Constant Field Values
-
UNSPECIFIED_STATE_NAME
public static final java.lang.String UNSPECIFIED_STATE_NAME
The unspecified state name- See Also:
- Constant Field Values
-
-
Method Detail
-
checkPurgeTestResultPermission
public void checkPurgeTestResultPermission() throws mks.ci.exception.TestManagementException
Check if the user has the permission to purge the test results- Throws:
mks.ci.exception.TestManagementException
- in case any error occurs in the process of checking the permission or if the user has no permission to perform the operation.
-
setTestResults
public void setTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int sessionID, java.util.List<mks.ci.server.engine.TestResult> testResults, int mode, int currentUserID, int clientVersion, boolean isImport) throws mks.ci.exception.CIException, java.sql.SQLException
Insert or update the test results into the test results tables. Before any operations are executed, we will ensure that the test result attachments are downloaded locally (unless the content is stored inline in the bulk data). Once the test results are submitted, we remove the locally downloaded attachment files (unless the files are marked as not temporary). This method will first split the submitted test results into ones that already exist in the table and the ones that are new and need to be inserted. From there we have 3 cases depending on the value of the mode parameter: 1. If we are called by the create result command (mode == CREATE_MODE) In this case, if any of the submitted results already exists, an error will be thrown. Otherwise the results are created. 2. If we are called by the edit result command (mode == EDIT_MODE) In this case, if any of the submitted results does not exist an error is throw. Otherwise, the results are edited. 3. If we are called by the set results command (mode == SET_MODE) In this case, the results that already exist will be updated (edited), and results that do not exist will be created.- Parameters:
statusListener
- Reference to the client side listener for the operation.sessionID
- the id of the session in scope of which the test is performedtestResults
- the list of test results to insert or updatemode
- is the set results mode. This is one of EngineTestResults.EDIT_MODE in case the EditTestResultCommand calls us, EnginTestResult.CREATE_MODE in case EditTestResultCommand calls us, or EngineTestResult.SET_MODE in case SetTestResultCommand calls us.currentUserID
- The ID of the user performing the operation.clientVersion
- the version of the client asking us to perform the operation.isImport
- true if we are importing a test result. Used when installing a solution. Must have admin permissions to use this- Throws:
mks.ci.exception.CIException
- if we can not download attachments for whatever reasonjava.sql.SQLException
- any SQL exceptionmks.frame.app.ui.CancelledException
- if the user cancels the operation
-
getResultIDsForTestCasesInSession
public java.util.List<java.lang.Integer> getResultIDsForTestCasesInSession(int sessionID, java.util.List<java.lang.Integer> testIds, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get the results for the specified test cases in the specified test session.- Parameters:
sessionID
- the item ID of the test session.testIds
- the item IDs of the test cases for which to get the results forcurrentUserID
- the id of the user performing the operation.clientVersion
- the client API version.- Returns:
- the list of test result objects
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
fetchResults
public void fetchResults(java.sql.Connection c, int sessionID, java.util.List<java.lang.Integer> testIds, java.util.Set<java.lang.Integer> foundTestIds, java.util.List<java.lang.Integer> resultIds, boolean forRemoveUnmodified) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getTestResult
public mks.ci.server.engine.TestResult getTestResult(int sessionId, int caseId, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test result for the specified test case in the specified test session.- Parameters:
sessionId
- the item id of the test session in which the results were createdcaseId
- the item id of the test case for which we want the resultcurrentUserID
- id of the user performing the operationclientVersion
- client API version.- Returns:
- list of all test results populated with data from the database. Note that only list of attachment names for the results are returned, and not the attachment bulk data. Callers can ask for attachment data separately.
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestResults
public java.util.List<mks.ci.server.engine.TestResult> getTestResults(boolean throwIfNotFound, int sessionId, java.util.List<java.lang.Integer> caseIds, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test results for test cases for the specified test session- Parameters:
sessionId
- the item id of the test session in which the results were createdcaseIds
- the list of test case ids for which to get the resultscurrentUserID
- id of the user performing the operationclientVersion
- client API version.- Returns:
- list of all test results populated with data from the database. Note that only list of attachment names for the results are returned, and not the attachment bulk data. Callers can ask for attachment data separately.
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestResults
public java.util.List<mks.ci.server.engine.TestResult> getTestResults(java.sql.Connection c, boolean throwIfNotFound, int sessionId, java.util.List<java.lang.Integer> caseIds, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test results for test cases for the specified test session- Parameters:
c
- database connection to usethrowIfNotFound
- throw an exception if some of the requested results do not existsessionId
- the item id of the test session in which the results were createdcaseIds
- the list of test case Ids for which to get the resultscurrentUserID
- id of the user performing the operationclientVersion
- client API version.- Returns:
- list of all test results populated with data from the database. Note that only list of attachment names for the results are returned, and not the attachment bulk data. Callers can ask for attachment data separately.
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestResults
public java.util.List<mks.ci.server.engine.TestResult> getTestResults(java.util.List<java.lang.Integer> resultIds, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test results by their id.- Parameters:
resultIds
- the list of test result IDs to getcurrentUserID
- id of the user performing the operationclientVersion
- client API version.- Returns:
- list of all test results populated with data from the database. Note that only list of attachment names for the results are returned, and not the attachment bulk data. Callers can ask for attachment data separately.
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestResults
public mks.ci.common.GetTestResultsReturn getTestResults(mks.ci.common.GetTestResultsArg arg, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test results objects for specified test result IDs. Also populate requested session and case fields for each result returned. Test case fields are populated as of a test session (specified on test result) freeze date.- Parameters:
arg
- all the arguments wrapped in single object.currentUserID
- the ID of the user performing the operationclientVersion
- the version of the client talking to us- Returns:
- all the requested test results objects and all requested issues wrapped in single object.
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestResults
public mks.ci.common.GetTestResultsReturn getTestResults(java.sql.Connection c, mks.ci.common.GetTestResultsArg arg, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test results objects for specified test result IDs. Also populate requested session and case fields for each result returned. Test case fields are populated as of a test session (specified on test result) freeze date. Strategy here is to first get all results as before. Then we walk through the page of results, and build a list of all unique session IDs we encounter. We also partition all test case IDs in the page of results by the test session with which they are paired on the result. This gives us a map of test session to case IDs. Then we get all the unique test session issues (requesting all fields that the client wants and test session freeze date as well). We then walk through the list of test session issues and from our partition map we built we get all test case Ids for the session ID. We then fetch the test case issues as of that test session freeze date. We stick these issues into a map of caseID to Issue objects and in addition stick the session to this map into another map that is returned to the client (this prevents us sending same issue back to the client multiple times and it also allows the client to easily reconstruct the session issue and case issue for each test result returned here.- Parameters:
c
- our database connectionarg
- all the arguments wrapped in single object.currentUserID
- the ID of the user performing the operationclientVersion
- the version of the client talking to us- Returns:
- all the requested test results objects and all requested issues wrapped in single object.
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestSessionsForSuite
public java.util.List<java.lang.Integer> getTestSessionsForSuite(int suiteId, int currentUserId, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
/** Find all sessions in which the test cases in the suite have been tested and return them- Parameters:
suiteId
- the id of the test suite documentcurrentUserId
- the id of the user performing the operationclientVersion
- the version of the client calling us- Returns:
- list of session ids of all test sessions in which any of the test cases in the suite has been tested
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestSessionsForSuite
public java.util.List<java.lang.Integer> getTestSessionsForSuite(java.sql.Connection c, int suiteId, int currentUserId, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Find all sessions in which the test cases in the suite have been tested and return them NOTE: Here we are walking the document as of now. However, the test session may have used the document as of some historic time. Hence, there may be a discrepancy between the nodes document has now and what it had as of a test session freeze date. This means that document walk may give us more or less test cases than were really tested in some test session. But as long as at least one test case was present as of the test session freeze date and as of now, we will find the session. In the case the document has completely evolved from the session freeze date and now, so that it has not a single test case in common, we won't find the session.- Parameters:
c
- connection to usesuiteId
- the id of the test suite documentcurrentUserId
- the id of the user performing the operationclientVersion
- the version of the client calling us- Returns:
- list of session ids of all test sessions in which any of the test cases in the suite has been tested
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestSessionsForCase
public java.util.List<java.lang.Integer> getTestSessionsForCase(int caseId, int currentUserId, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Find all sessions in which the test case has been tested and return them- Parameters:
caseId
- the id of the test casecurrentUserId
- the id of the user performing the operationclientVersion
- the version of the client calling us- Returns:
- list of session ids of all test sessions in which any of the test cases in the suite has been tested
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestSessionsForCase
public java.util.List<java.lang.Integer> getTestSessionsForCase(java.sql.Connection c, int caseId, int currentUserId, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Find all sessions in which the test case has been tested and return them- Parameters:
c
- connection to usecaseId
- the id of the test casecurrentUserId
- the id of the user performing the operationclientVersion
- the version of the client calling us- Returns:
- list of session ids of all test sessions in which any of the test cases in the suite has been tested
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestResultsForIssueIDs
public java.util.Map<java.lang.Integer,java.util.List<mks.ci.server.engine.TestResult>> getTestResultsForIssueIDs(java.util.List<java.lang.Integer> issueIDs, int currentUserId, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get the list of test results for each issue in the list, only if the issue in the list is a session, case, or can be related item- Parameters:
issueIDs
- The list of issue idscurrentUserId
- the id of the user performing the operationclientVersion
- the version of the client calling us- Returns:
- A map of issue ids to a list of test results
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestResultsForIssueIDs
public java.util.Map<java.lang.Integer,java.util.List<mks.ci.server.engine.TestResult>> getTestResultsForIssueIDs(java.sql.Connection c, java.util.List<java.lang.Integer> issueIDs, int currentUserId, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get the list of test results for each issue in the list, only if the issue in the list is a session, case, or can be related item- Parameters:
c
- connection to useissueIDs
- The list of issue idscurrentUserId
- the id of the user performing the operationclientVersion
- the version of the client calling us- Returns:
- A map of issue ids to a list of test results
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getResultIds
@Deprecated public java.util.List<java.lang.Integer> getResultIds(int queryType, int sessionId, int itemId, java.util.Collection<java.lang.Integer> sessionIds, boolean showLastResultOnly, java.lang.String sortColumn, boolean sortAscending, mks.ci.api.TestResultVerdictFilter verdictFilter, boolean showSharedResults, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Deprecated.This method is deprecated and remains here for backward compatibility only. New code should use getResultIds with GetTestResultIdsArg param.Get a list of test result ids that match specified criteria. This is a generic method that can execute 3 types of queries depending on the queryType parameter passed in: 1. queryType = EngineTestResult.QUERY_BY_SESSION In this case all test results in the session specified by itemId are returned. Test results are additionally filtered by test result outcome (aka verdict), and only those results that have test outcome the same as verdictFiler are returned. Test ids are returned sorted by sortColumn specified in either ascending or descending order depending on the sortAscending flag value. 2. queryType = EngineTestResult.QUERY_BY_TEST_CASE In this case all test results for the test case specified by itemId are returned. Test results are filtered by outcome and sorted like above. 3. queryType = EngineTestResult.QUERY_BY_RELATED_ITEM In this case all test results that are related to item specified by itemId are returned, sorted on sortColumn and filtered by outcome. 4. queryType = EngineTestResult.QUERY_BY_TEST_SUITE In this case all test results for the test suite in all or the latest test session are returned.
- Parameters:
queryType
- specify what kind of query to run (must be one of EngineTestResult.QUERY_BY_SESSION, EngineTestResult.QUERY_BY_TEST_CASE, EngineTestResult.QUERY_BY_RELATED_ITEM EngineTestResult.QUERY_BY_TEST_SUITE).sessionId
- the id of the test session in which the test results should be obtained. This is only used if we are querying by test case, related item, or test suite.itemId
- the item Id of test case, session, or related item. The meaning of the item ID depends on the query type specified.sessionIds
- a list of session item ids for which we should get results. This is only used for query by session option. Can be null.showLastResultOnly
- show "last" result onlysortColumn
- the column to sort the test results by. This is one of the columns defined in TestResult.FIELD_XXX)sortAscending
- flag indicating sort order.verdictFilter
- return only test results that match the specified verdict filter. If the value is null, then test results are not filtered and all results are returned.currentUserID
- the ID of the user performing the operation.clientVersion
- client API version.- Returns:
- the list of test result IDs matching the criteria above.
- Throws:
mks.ci.exception.CIException
- any exceptionjava.sql.SQLException
- any SQL exception.
-
getResultIds
public mks.ci.common.GetResultIdsReturn getResultIds(mks.ci.common.GetTestResultIdsArg args, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get a list of test result ids that match specified criteria.- Parameters:
currentUserID
- the ID of the user performing the operation.clientVersion
- client API version.- Returns:
- TestResultIDFIeldPair that allows client to sort the test results based on sort column specified.
- Throws:
mks.ci.exception.CIException
- any exceptionjava.sql.SQLException
- any SQL exception.
-
getResultIds
public java.util.List<java.util.List<java.lang.Integer>> getResultIds(java.util.Collection<mks.ci.api.TestResultID> trIDs, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get the list of test result ids (as integers) from the list of test result id objects- Parameters:
trIDs
- The test result id objectscurrentUserID
- the ID of the user performing the operation.clientVersion
- client API version.- Returns:
- a list of two lists of integer result ids (the first list is test result ids and the second is test step result ids)
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
isValidSortColumn
public boolean isValidSortColumn(java.lang.String sortColumn)
Is the sort column valid test result column- Parameters:
sortColumn
- sort column as string (can be null)- Returns:
- true is the sort column specified by the client is valid, false otherwise
-
isVirtualTestResultField
public boolean isVirtualTestResultField(int fieldId)
Is the specified field test result built in field- Parameters:
fieldId
- the id of the field to check- Returns:
- true if the field is test result built in field
-
isTestResultMetaDataField
public boolean isTestResultMetaDataField(int fieldId, int userId)
Is the specified field test result meta data field visible to the specified user.- Parameters:
fieldId
- the id of the field to checkuserId
- the id of the user for which we are checking visibility- Returns:
- true if the field is a valid test result field and it is visible to the user.
-
isValidVisibleTestResultField
public boolean isValidVisibleTestResultField(int fieldId, int userId)
Is the field valid test result (possibly virtual) field visible to the user.- Parameters:
fieldId
- the id of the field to checkuserId
- the id of the user- Returns:
- true if this is either virtual test result field (always visible to the user) or if it is a test result meta data field visible to the user.
-
getUntestedCases
public java.util.List<java.lang.Integer> getUntestedCases(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int itemId, java.util.Collection<java.lang.Integer> sessionIds, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
- Parameters:
statusListener
-itemId
-sessionIds
-currentUserID
-clientVersion
-- Returns:
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getUntestedCases
public java.util.List<java.lang.Integer> getUntestedCases(java.sql.Connection c, mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int itemId, java.util.Collection<java.lang.Integer> sessionIds, int currentUserId, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
- Parameters:
statusListener
-itemId
-sessionIds
-currentUserId
-clientVersion
-- Returns:
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getResultsCount
public int getResultsCount(int queryType, int sessionId, int itemId, mks.ci.api.TestResultVerdictFilter verdictFilter, boolean showSharedResults, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get the number of results that match specified criteria. This is a generic method that can execute 3 types of queries depending on the queryType parameter passed in: 1. queryType = EngineTestResult.QUERY_BY_SESSION In this case all test results in the session specified by itemId are returned. Test results are additionally filtered by test result outcome (aka verdict), and only those results that have test outcome the same as verdictFiler are returned. Test ids are returned sorted by sortColumn specified in either ascending or descending order depending on the sortAscending flag value. 2. queryType = EngineTestResult.QUERY_BY_TEST_CASE In this case all test results for the test case specified by itemId are returned. Test results are filtered by outcome and sorted like above. 3. queryType = EngineTestResult.QUERY_BY_RELATED_ITEM In this case all test results that are related to item specified by itemId are returned, sorted on sortColumn and filtered by outcome 4. queryType = EngineTestResult.QUERY_BY_TEST_SUITE In this case all test results for the test suite in all or the latest test session are returned.- Parameters:
queryType
- specify what kind of query to run (must be one of EngineTestResult.QUERY_BY_SESSION, EngineTestResult.QUERY_BY_TEST_CASE, EngineTestResult.QUERY_BY_RELATED_ITEM EngineTestResult.QUERY_BY_TEST_SUITE).itemId
- the item Id of test case, session, or related item. The meaning of the item ID depends on the query type specified.verdictFilter
- return only test results that match the specified verdict filter. If the value is null, then test results are not filtered and all results are returned.showSharedResults
- in case the queryType is EngineTestResult.QUERY_BY_TEST_SUITE then return only the results from the most recent test session against the test suite, otherwise return results from all test sessionscurrentUserID
- the ID of the user performing the operation.clientVersion
- client API version.- Returns:
- the list of test result IDs matching the criteria above.
- Throws:
mks.ci.exception.CIException
- any exceptionjava.sql.SQLException
- any SQL exception.
-
getResultsCount
public int getResultsCount(java.sql.Connection c, int queryType, int sessionId, int itemId, mks.ci.api.TestResultVerdictFilter verdictFilter, boolean showSharedResults, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get the number of results that match specified criteria. This is a generic method that can execute 3 types of queries depending on the queryType parameter passed in: 1. queryType = EngineTestResult.QUERY_BY_SESSION In this case all test results in the session specified by itemId are returned. Test results are additionally filtered by test result outcome (aka verdict), and only those results that have test outcome the same as verdictFiler are returned. Test ids are returned sorted by sortColumn specified in either ascending or descending order depending on the sortAscending flag value. 2. queryType = EngineTestResult.QUERY_BY_TEST_CASE In this case all test results for the test case specified by itemId are returned. Test results are filtered by outcome and sorted like above. 3. queryType = EngineTestResult.QUERY_BY_RELATED_ITEM In this case all test results that are related to item specified by itemId are returned, sorted on sortColumn and filtered by outcome 4. queryType = EngineTestResult.QUERY_BY_TEST_SUITE In this case all test results for the test suite in all or the latest test session are returned.- Parameters:
c
- DB connection used to perform the query.queryType
- specify what kind of query to run (must be one of EngineTestResult.QUERY_BY_SESSION, EngineTestResult.QUERY_BY_TEST_CASE, EngineTestResult.QUERY_BY_RELATED_ITEM EngineTestResult.QUERY_BY_TEST_SUITE).itemId
- the item Id of test case, session, or related item. The meaning of the item ID depends on the query type specified.verdictFilter
- return only test results that match the specified verdict filter. If the value is null, then test results are not filtered and all results are returned.showSharedResults
- in case the queryType is EngineTestResult.QUERY_BY_TEST_SUITE then return only the results from the most recent test session against the test suite, otherwise return results from all test sessionscurrentUserID
- the ID of the user performing the operation.clientVersion
- client API version.- Returns:
- the list of test result IDs matching the criteria above.
- Throws:
mks.ci.exception.CIException
- any exceptionjava.sql.SQLException
- any SQL exception.
-
getTestStepIds
public java.util.List<java.lang.Integer> getTestStepIds(java.util.List<mks.ci.api.TestResultID> steps, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get ids for the test steps passed in- Parameters:
steps
- list of test result ids identifying test step results by a compound key consisting of session id, case id and step idcurrentUserID
- the id of the user performing the operationclientVersion
- client API version- Returns:
- list of test step row ids identifying step results in the table
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestStepResults
public java.util.List<mks.ci.server.engine.TestStepResult> getTestStepResults(java.util.List<java.lang.Integer> stepResultIDs, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test step result details for test steps identified by the result ids passed in.- Parameters:
stepResultIDs
- list of test step idscurrentUserID
- the id of the user performing the operationclientVersion
- client API version- Returns:
- list of test step result objects requested
- Throws:
mks.ci.exception.CIException
- if the test result requested does not existjava.sql.SQLException
-
getTestResultAttachments
public java.util.List<mks.ci.server.engine.TestResultAttachment> getTestResultAttachments(java.util.List<java.lang.String> attachmentNames, int sessionID, int testID, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test result attachments by name.- Parameters:
sessionID
- item id of the test sessiontestID
- test case id (item id of the test case)currentUserID
- the id of the user performing the operationclientVersion
- client api version- Returns:
- list of requested test result attachment objects
- Throws:
mks.ci.exception.CIException
- if attachment with the given name does not existjava.sql.SQLException
- any SQL exception
-
getTestResultAttachment
public mks.ci.server.engine.TestResultAttachment getTestResultAttachment(int id, int currentUserID, int clientVersion) throws mks.ci.exception.CIException, java.sql.SQLException
Get test result attachments by id- Parameters:
currentUserID
- the id of the user performing the operationclientVersion
- client api version- Throws:
mks.ci.exception.CIException
- if attachment with the given name does not existjava.sql.SQLException
- any SQL exception
-
purgeTestResults
public void purgeTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.List<java.lang.Integer> sessionIDs) throws mks.ci.exception.CIException, java.sql.SQLException
Purge all test results in all the sessions listed.- Parameters:
statusListener
- Reference to the client side listener for the operation.currentUserID
- The ID of the user performing the operation.clientVersion
- the version of the client asking us to perform the operation.sessionIDs
- list of session ids for which to purge all the test results for. in the given session.- Throws:
mks.ci.exception.CIException
- if the user does not have a permission to perform the operation.java.sql.SQLException
- any SQL exception.
-
purgeTestResults
public void purgeTestResults(java.sql.Connection c, mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.List<java.lang.Integer> sessionIDs) throws mks.ci.exception.CIException, java.sql.SQLException, mks.frame.app.ui.CancelledException
Purge all test results in all the sessions listed.- Parameters:
statusListener
- Reference to the client side listener for the operation.currentUserID
- The ID of the user performing the operation.clientVersion
- the version of the client asking us to perform the operation.sessionIDs
- list of session ids for which to purge all the test results for. in the given session.- Throws:
mks.ci.exception.CIException
- if the user does not have a permission to perform the operation.java.sql.SQLException
- any SQL exception.mks.frame.app.ui.CancelledException
-
purgeTestResults
public void purgeTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.Date before) throws mks.ci.exception.CIException, java.sql.SQLException
Purge all the test results in all the sessions that were created before the specified date. The user performing the operation must have the PurgeTestResults permission granted.- Parameters:
statusListener
- Reference to the client side listener for the operation.currentUserID
- The ID of the user performing the operation.clientVersion
- the version of the client asking us to perform the operation.before
- all test sessions created before this date will have all their test results purged.- Throws:
mks.ci.exception.CIException
- if the user does not have a permission to perform the operation.java.sql.SQLException
- any SQL exception.
-
purgeTestResults
public void purgeTestResults(java.sql.Connection c, mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.Date before) throws mks.ci.exception.CIException, java.sql.SQLException, mks.frame.app.ui.CancelledException
Purge all the test results in all the sessions that were created before the specified date. The user performing the operation must have the PurgeTestResults permission granted.- Parameters:
c
- connection to usestatusListener
- Reference to the client side listener for the operation.currentUserID
- The ID of the user performing the operation.clientVersion
- the version of the client asking us to perform the operation.before
- all test sessions created before this date will have all their test results purged.- Throws:
mks.ci.exception.CIException
- if the user does not have a permission to perform the operation.java.sql.SQLException
- any SQL exception.mks.frame.app.ui.CancelledException
- if the user cancels the operation
-
deleteTestResults
public void deleteTestResults(mks.frame.app.ui.IRemoteStatusListenerV3 statusListener, int currentUserID, int clientVersion, java.util.List<mks.ci.api.TestResultID> resultIds) throws mks.ci.exception.CIException, java.sql.SQLException
Delete specified test results- Parameters:
statusListener
-currentUserID
-clientVersion
-resultIds
-- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
verifyTestResultPolicies
public void verifyTestResultPolicies(int sessionID, int caseID, int currentUserID) throws mks.ci.exception.CIException, java.sql.SQLException
Verify that the session and case ids are valid, i.e. that the session specified is a test session and that the test case specified is a valid test case in that session.- Parameters:
sessionID
-caseID
-currentUserID
-- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
checkTestSession
public void checkTestSession(int currentUserId, mks.ci.server.engine.Issue session) throws mks.ci.exception.CIException, java.sql.SQLException
Make sure the specified item is a test session- Parameters:
currentUserId
-session
-- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
checkTestSession
public static void checkTestSession(mks.ci.server.engine.EngineSQL engineSQL, int currentUserId, mks.ci.server.engine.Issue session) throws mks.ci.exception.CIException, java.sql.SQLException
Make sure the specified item is a test session- Parameters:
engineSQL
-currentUserId
-session
-- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getFilterForIssueIDs
public static mks.ci.server.filter.CollectionFilter getFilterForIssueIDs(java.util.Collection<java.lang.Integer> issueIDs)
Get a filter representing all issue ids in the given list.- Parameters:
issueIDs
- a List of Integer issue ids- Returns:
- a filter that can be used to retrieve the issue ids
-
getTestSessionIssues
public java.util.List<mks.ci.server.engine.Issue> getTestSessionIssues(java.sql.Connection c, int currentUserId, java.util.Collection<java.lang.Integer> sessionIds) throws mks.ci.exception.CIException, java.sql.SQLException
Get test session issues all at once- Parameters:
currentUserId
-sessionIds
-- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestSessionIssues
public java.util.List<mks.ci.server.engine.Issue> getTestSessionIssues(java.sql.Connection c, int currentUserId, java.util.Collection<java.lang.Integer> sessionIds, mks.ci.server.engine.IssueComponents ic) throws mks.ci.exception.CIException, java.sql.SQLException
Get test session issues all at once, and populate requested issue components- Parameters:
c
-currentUserId
-sessionIds
-ic
-- Returns:
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
checkTestSessionIssues
public void checkTestSessionIssues(int currentUserId, java.util.Collection<mks.ci.server.engine.Issue> sessionIssues) throws mks.ci.exception.CIException, java.sql.SQLException
Make sure all issues are test sessions- Parameters:
currentUserId
-sessionIssues
-- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestSessionIssue
public static mks.ci.server.engine.Issue getTestSessionIssue(java.sql.Connection c, mks.ci.server.engine.EngineSQL engineSQL, int currentUserId, int issueId) throws mks.ci.exception.CIException, java.sql.SQLException
Get the specified issue- Parameters:
engineSQL
-currentUserId
-issueId
-- Returns:
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
getTestSessionIssue
public mks.ci.server.engine.Issue getTestSessionIssue(java.sql.Connection c, int currentUserId, int issueId) throws mks.ci.exception.CIException, java.sql.SQLException
Get the specfied issue- Parameters:
currentUserId
-issueId
-- Returns:
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
-
checkModifyTestResultPolicy
public void checkModifyTestResultPolicy(java.sql.Connection c, int currentUserID, int sessionID) throws mks.ci.exception.CIException, java.sql.SQLException
Check that the user is allows to modify test results in this session- Parameters:
c
- db connection to usecurrentUserID
- the id of the user performing the operationsessionID
- the id of the test session for which to check the policies for- Throws:
mks.ci.exception.CIException
- if any of the policies failjava.sql.SQLException
- any SQL exception
-
convertCollectionToArray
public int[] convertCollectionToArray(java.util.Collection<java.lang.Integer> c)
Convert the collection of integers to int array- Parameters:
c
-- Returns:
-
getRelatedItemIdsInPage
public java.util.Set<java.lang.Integer> getRelatedItemIdsInPage(java.util.Collection<mks.ci.server.engine.TestResult> page)
Get the set of all related items to be added to the results in the page- Parameters:
page
-- Returns:
-
isModifyRelatedItemsOnly
public boolean isModifyRelatedItemsOnly(java.util.Collection<mks.ci.server.engine.TestResult> page)
Are we only modifying related items for all the test results in a page- Parameters:
page
-- Returns:
-
getTestResultType
public mks.ci.server.engine.Type getTestResultType()
- Returns:
- the test result type instance (this is a singleton cached in this class). If there is no test result type, null will be returned.
-
getTestResultFields
public java.util.Set<java.lang.Integer> getTestResultFields(int userId)
Get test result fields visible to the user. If no test result type is defined empty collection is returned- Parameters:
userId
- the ID of the user asking for the fields- Returns:
- collection of integer IDs of the fields visible on the test result type to the user performing the operation.
-
verifyTestResultPolicies
public void verifyTestResultPolicies(java.sql.Connection c, int currentUserID, int sessionID, java.util.List<mks.ci.server.engine.TestResult> results) throws mks.ci.exception.CIException, java.sql.SQLException
Make sure the user is allowed to perform the operation. Here we will check that the test session id is an item of the type that has the test session role, that each test case for each result is a valid test case for the session, that each step for each test case is a valid step for that case. Also, we will make sure that the test result modification policy allows modification of test results for the user. Also verify that test result meta data fields are all test result fields also verify that all fields are of supported type, verify that field values are of correct type for the field data type, and make sure that meta data type is correct (i.e. type plays test result role).- Parameters:
c
- the DB connection to usecurrentUserID
- the id of the user performing the operation.sessionID
- the item id of the test session in which the operation is being performed.results
- a page of test results to verify- Throws:
mks.ci.exception.CIException
- if the user does not have the permission to perform the operationjava.sql.SQLException
- any SQL exception.
-
loadHistoricallyToValidateTestSteps
public void loadHistoricallyToValidateTestSteps(java.sql.Connection c, int currentUserID, java.util.Date asOfDate, java.util.Collection<java.lang.Integer> testCasesInPage, java.util.Set<java.lang.Integer> mustGetStepsFor, java.util.Map<java.lang.Integer,mks.ci.server.engine.TestResult> idToTestResult) throws mks.ci.exception.CIException, java.sql.SQLException, mks.ci.exception.TestManagementException
- Throws:
mks.ci.exception.CIException
java.sql.SQLException
mks.ci.exception.TestManagementException
-
-