Class LogRecordService

java.lang.Object
org.qubership.atp.ram.services.CrudService<LogRecord>
org.qubership.atp.ram.services.LogRecordService

@Service public class LogRecordService extends CrudService<LogRecord>
  • Constructor Details

    • LogRecordService

      public LogRecordService()
  • Method Details

    • init

      @PostConstruct public void init()
      Init invertStatusMap.
    • repository

      protected org.springframework.data.mongodb.repository.MongoRepository<LogRecord,UUID> repository()
      Specified by:
      repository in class CrudService<LogRecord>
    • getAll

      public List<LogRecord> getAll()
      Overrides:
      getAll in class CrudService<LogRecord>
    • getByIds

      public List<LogRecord> getByIds(List<UUID> logRecordIds)
    • getLogRecordChildren

      public Stream<LogRecord> getLogRecordChildren(UUID id)
      Gets log record children.
      Parameters:
      id - the id
      Returns:
      the log record children
    • getStepContextVariablesOfLogRecord

      public List<ContextVariable> getStepContextVariablesOfLogRecord(UUID id)
      Get step context variables of logrecord.
      Parameters:
      id - if of logrecord.
      Returns:
      List of step context variables.
    • getContextVariablesByIds

      public List<ContextVariable> getContextVariablesByIds(List<UUID> logRecordIds)
      Get context variables by logRecordIds.
      Parameters:
      logRecordIds - logRecordIds
      Returns:
      list of context variables collected from logRecords
    • getContextVariables

      public Object getContextVariables(UUID id, Integer page, Integer size, List<ContextVariablesActiveTab> activeTabs)
      Get context variables of logrecord.
      Parameters:
      id - if of logrecord
      page - number of page for pagination
      size - size of 1 page for pagination
      Returns:
      List of paginated context variables and total caount of context variables.
    • getAllContextVariables

      public List<ContextVariable> getAllContextVariables(UUID id)
      Get All context variables of logrecord.
      Parameters:
      id - if of logrecord
      Returns:
      List of paginated context variables and total caount of context variables.
    • getStepContextVariables

      public Object getStepContextVariables(UUID id, Integer page, Integer size, List<ContextVariablesActiveTab> activeTabs)
      Gets step context variables.
      Parameters:
      id - the id
      page - the page
      size - the size
      activeTabs - the active tabs
      Returns:
      the step context variables
    • filterContextVariables

      public ContextVariablesResponse filterContextVariables(UUID id, List<String> parameters, String beforeValue, String afterValue)
      Filter context variable of logrecord by specified parameters.
      Parameters:
      id - if of logrecord
      parameters - list of context variables names to filter by
      beforeValue - beforeValue to filter by using "contains" strategy
      afterValue - afterValue to filter by using "contains" strategy
      Returns:
      list of context variables that have passed all predicates.
    • filterStepContextVariables

      public ContextVariablesResponse filterStepContextVariables(UUID id, List<String> parameters, String beforeValue, String afterValue)
      Filter step context variables context variables response.
      Parameters:
      id - the id
      parameters - the parameters
      beforeValue - the before value
      afterValue - the after value
      Returns:
      the context variables response
    • delete

      public void delete(UUID uuid)
    • getOrderedChildrenLogRecordsForParentLogRecord

      public List<LogRecord> getOrderedChildrenLogRecordsForParentLogRecord(UUID uuid)
    • create

      public LogRecord create()
    • save

      public LogRecord save(LogRecord logRecord)
      Overrides:
      save in class CrudService<LogRecord>
    • findById

      public LogRecord findById(UUID logRecordId)
      Find LogRecord by uuid or throw NPE if LR doesn't exist.
      Parameters:
      logRecordId - for find LogRecord
      Returns:
      return log record by uuid or throw NPE
    • findLastInProgressLogRecordByTestRunId

      public LogRecord findLastInProgressLogRecordByTestRunId(UUID testRunId)
    • findLastInProgressOrcLogRecordByTestRunId

      public LogRecord findLastInProgressOrcLogRecordByTestRunId(UUID testRunId)
    • getBrowserConsoleLogsTable

      public PaginationResponse<BrowserConsoleLogsTable> getBrowserConsoleLogsTable(UUID logRecordUuid, org.springframework.data.domain.Pageable pageable)
      Find BrowserConsoleLogs by LogRecordUUID with pagination.
    • createBrowserConsoleLog

      public void createBrowserConsoleLog(UUID logRecordUuid, List<BrowserConsoleLogsTable> logs)
      Create BrowserConsoleLog for LogRecord.
      Parameters:
      logRecordUuid - LogRecordId
      logs - logs to save
    • addLogRecordAkb

      public String addLogRecordAkb(UUID logRecordId, UUID akbRecordId)
      Add existing AkbRecord to LogRecord.
    • saveCountScreenshots

      public void saveCountScreenshots(UUID executionRequestUuid, List<TestRun> testRuns)
      Deprecated.
      use LogRecordLoggingController instead of this.
      Save number of screenshots fot TestRuns from current ER.
      Parameters:
      executionRequestUuid - Execution Request UUID
    • analyze

      public void analyze(TestRun testRun)
      Analyzes all LogRecords in TestRun.
    • createLogRecordByRequest

      @Deprecated public LogRecord createLogRecordByRequest(LogRecord request)
      Deprecated.
      Create LogRecord by request from adapter.
      Parameters:
      request - with data for LogRecord
      Returns:
      LogRecord object
    • getErrorMapping

      public List<ErrorMappingItem> getErrorMapping(ExecutionRequestService executionRequestService, String source, UUID parentUuid)
      Loads list of ErrorMappingItem from specified sources.
      Parameters:
      executionRequestService - ExecutionRequestService
      source - TestRun or ExecutionRequest.
      parentUuid - UUID of TestRun or ExecutionRequest
      Returns:
      list of ErrorMappingItem
    • getProjectIdByParentId

      public UUID getProjectIdByParentId(UUID parentId, String source)
      Gets project id by parent id.
      Parameters:
      parentId - parent id
      source - source type
      Returns:
      project id
    • getLogRecordPath

      public StepPath getLogRecordPath(UUID uuid)
    • addLogRecordAkbRecords

      public LogRecord addLogRecordAkbRecords(UUID logRecordUuid, List<UUID> akbRecordsUuid)
      Add existing AkbRecord to LogRecord.
    • findByTestRunIdAndParentUuid

      public List<LogRecord> findByTestRunIdAndParentUuid(UUID testRunId, UUID parentId, LogRecordFilteringRequest filteringRequest)
      Returns List of LogRecord for TestRun and ParentLogRecord.
    • findTopLogRecordsOnTestRun

      public List<LogRecord> findTopLogRecordsOnTestRun(UUID testRunId)
    • findAllByTestRunIdOrderByStartDateAsc

      public List<LogRecord> findAllByTestRunIdOrderByStartDateAsc(UUID testRunUuid, LogRecordFilteringRequest filteringRequest)
      Returns List of full LogRecords for TestRun.
    • findLogRecordsWithPreviewByTestRunIdOrderByStartDateAsc

      public List<LogRecord> findLogRecordsWithPreviewByTestRunIdOrderByStartDateAsc(UUID testRunUuid, LogRecordFilteringRequest filteringRequest)
      Returns List of LogRecords with id, status, type and preview for TestRun.
    • findLogRecordsWithSpecificFieldsByTestRunIdOrderByStartDateAsc

      public List<LogRecord> findLogRecordsWithSpecificFieldsByTestRunIdOrderByStartDateAsc(UUID testRunId)
      Returns List of LogRecords with id, status, type, name, message, parent id, is section, is compound, testRun id and duration for TestRun.
    • findLogRecordNamesByTestRunId

      public List<LogRecord> findLogRecordNamesByTestRunId(UUID testRunUuid)
      Returns names of LogRecords (@Link LogRecord) for TestRun.
    • getChildrenCount

      public long getChildrenCount(LogRecord lr)
      Returns number of children for LogRecord.
    • getProjectIdByLogRecordId

      public UUID getProjectIdByLogRecordId(UUID id)
    • findOrCreate

      @Deprecated public LogRecord findOrCreate(LogRecord request)
      Deprecated.
      use LogRecordLoggingController instead of this.
      Find or create log record.
      Parameters:
      request - creation request
      Returns:
      result
    • findByRequest

      @Nonnull @Deprecated public TestRun findByRequest(LogRecord request)
      Deprecated.
      Find by testRunId from logrecord or find by testRunId from request.
    • getAllLogRecordsUuidByTestRunId

      public List<LogRecord> getAllLogRecordsUuidByTestRunId(UUID testRunId)
    • getAllSectionNotCompoundLogRecordsByTestRunId

      public List<LogRecord> getAllSectionNotCompoundLogRecordsByTestRunId(UUID testRunId)
    • getAllNotSectionLogRecordsByTestRunId

      public List<LogRecord> getAllNotSectionLogRecordsByTestRunId(UUID testRunId)
    • getAllFailedLogRecordsByTestRunId

      public List<LogRecord> getAllFailedLogRecordsByTestRunId(UUID testRunId)
    • getUuidAndMessageFailedLogRecordsByTestRunId

      public List<LogRecord> getUuidAndMessageFailedLogRecordsByTestRunId(UUID testRunId)
    • getAllTestingStatusLogRecordsByTestRunId

      public List<LogRecord> getAllTestingStatusLogRecordsByTestRunId(UUID testRunId)
    • getAllFailedLogRecordsByTestRunIds

      public List<LogRecord> getAllFailedLogRecordsByTestRunIds(Collection<UUID> testRunsIds)
    • getAllNotStartedLogRecordsByTestRunId

      public List<LogRecord> getAllNotStartedLogRecordsByTestRunId(UUID testRunId)
    • geChildLogRecordsOrParent

      public List<LogRecord> geChildLogRecordsOrParent(UUID id)
      Get list of child LR or current LR.
      Parameters:
      id - of current LR
      Returns:
      list of LR-s
    • getAllMatchesLogRecordsByTestRunId

      public List<LogRecord> getAllMatchesLogRecordsByTestRunId(UUID testRunId, String searchValue)
    • getAllMatchesLogRecordsByTestRunIdCaseInsensitive

      public Stream<LogRecord> getAllMatchesLogRecordsByTestRunIdCaseInsensitive(UUID testRunId, String searchValue)
    • getLogRecordByIdWithChildren

      public LogRecordResponse getLogRecordByIdWithChildren(UUID uuid)
      Find parent LR by UUID and his children, if exists.
      Parameters:
      uuid - for find LR
      Returns:
      parent LR and his children if exists
    • getLocationInEditor

      public LocationInEditorResponse getLocationInEditor(UUID id)
      Gets location in editor by id of log record.
      Parameters:
      id - the id
      Returns:
      the location in editor
    • getLogRecordContent

      public LogRecordContentResponse getLogRecordContent(UUID id)
      Get general info for logrecord.
    • getAllTestRunBvLogRecordsWithValidationSteps

      public List<BvLogRecord> getAllTestRunBvLogRecordsWithValidationSteps(UUID testRunId)
      Get all test run BV log records.
      Parameters:
      testRunId - test rin identifier
      Returns:
      log records
    • getAllByTestingStatusAndTestRunId

      public List<LogRecord> getAllByTestingStatusAndTestRunId(TestingStatuses testingStatuses, UUID testRunId)
      Find LR-s with fields 'uuid' and 'name' by testing status and test run id.
      Parameters:
      testingStatuses - status of found LR-s
      testRunId - uuid TR for found LR-s
      Returns:
      list of LR-s with fields 'uuid' and 'name'
    • findLogRecordsWithValidationParamsByTestRunIds

      public List<LogRecord> findLogRecordsWithValidationParamsByTestRunIds(Collection<UUID> testRunIds)
    • findFailedLogRecordsWithMetaInfoByTestRunIds

      public List<LogRecord> findFailedLogRecordsWithMetaInfoByTestRunIds(Collection<UUID> testRunIds)
    • findLogRecordsWithValidationParamsAndFailureByTestRunIds

      public Stream<LogRecord> findLogRecordsWithValidationParamsAndFailureByTestRunIds(Collection<UUID> testRunIds)
    • getLogRecordChildrenByName

      public List<LogRecord> getLogRecordChildrenByName(UUID id, String searchValue)
      Finds child Log Records by name.
      Parameters:
      id - of parent Log Record
      searchValue - part of the child Log Record name to search
      Returns:
      list of child Log Record
    • getAllLogRecordScreenshotPreviews

      public LogRecordScreenshotResponse getAllLogRecordScreenshotPreviews(UUID logRecordId)
      Get all log record children previews.
      Parameters:
      logRecordId - log record id
      Returns:
      list of previews
    • updateExecutionStatus

      public void updateExecutionStatus(UUID logRecordId, UpdateLogRecordExecutionStatusRequest request)
      Update log record execution status.
      Parameters:
      logRecordId - log record id
      request - update request
    • updateContextVariables

      public void updateContextVariables(UUID logRecordId, UpdateLogRecordContextVariablesRequest request)
      Update log record context variables.
      Parameters:
      logRecordId - log record id
      request - update request
    • updateStepContextVariables

      public void updateStepContextVariables(UUID logRecordId, UpdateLogRecordContextVariablesRequest request)
      Update log record step context variables.
      Parameters:
      logRecordId - log record id
      request - update request
    • updateMessageParameters

      public void updateMessageParameters(UUID logRecordId, UpdateLogRecordMessageParametersRequest request)
      Update log record message parameters.
      Parameters:
      logRecordId - log record id
      request - update request
    • getAllHierarchicalChildrenLogRecords

      public List<LogRecord> getAllHierarchicalChildrenLogRecords(UUID parentLogRecordId)
      Get all hierarchical children log records for parent log record.
      Parameters:
      parentLogRecordId - paren log record id
      Returns:
      children log records
    • getAllHierarchicalUILogRecords

      public void getAllHierarchicalUILogRecords(List<LogRecord> list, LogRecord logRecord)
      Get hierarchical UI log records.
      Parameters:
      list - list container
      logRecord - parent log record
    • revertTestingStatusForLogRecord

      public LogRecord revertTestingStatusForLogRecord(UUID logRecordId)
      Revert testing status for log record. Note if you need correct test run status as well you have to call method testRunService.revertTestingStatusForLogRecord instead of this
      Parameters:
      logRecordId - the log record id
      Returns:
      the log record
    • findLogRecordForTreeByUuid

      public LogRecord findLogRecordForTreeByUuid(UUID logRecordId)
    • getQuantityLogRecordsWhichMatchToPatterns

      public LogRecordQuantityResponse getQuantityLogRecordsWhichMatchToPatterns(LogRecordQuantityMatchPatternRequest request)
      Method returns quantity of all Log Records which match to current and new patterns. Returning value contains quantity of all Log Records which match to current and new patterns.
      Parameters:
      request - contains parameters for calculation
      Returns:
      object of type LogRecordQuantityResponse
    • findLogRecordsWithValidationParamsAndStatusByTrId

      public List<LogRecord> findLogRecordsWithValidationParamsAndStatusByTrId(UUID testRunId)
      Return list of LR with fields: validationLabels, validationTable, testingStatus.
      Parameters:
      testRunId - for search of log records
      Returns:
      list of log records for current test run
    • getLogRecordMessageParameters

      public List<MessageParameter> getLogRecordMessageParameters(UUID id)
      Get log record message parameters.
      Parameters:
      id - log record identifier
      Returns:
      message parameters
    • searchContextVariableParameters

      public List<String> searchContextVariableParameters(UUID logRecordId, String name)
      Search context variable parameters.
      Parameters:
      logRecordId - log record identifier
      name - search name
      Returns:
      result parameter names list
    • searchStepContextVariableParameters

      public List<String> searchStepContextVariableParameters(UUID logRecordId, String name)
      Search step context variable parameters list.
      Parameters:
      logRecordId - the log record id
      name - the name
      Returns:
      the list
    • getLogRecordWithChildrenByTrIdAndStatus

      public LogRecordWithChildrenResponse getLogRecordWithChildrenByTrIdAndStatus(UUID testRunId, TestingStatuses testingStatuses)
      Get first parent and children LR.
      Parameters:
      testRunId - TR id
      testingStatuses - status
      Returns:
      parent and children LR
    • countLrsByTestRunsId

      public Long countLrsByTestRunsId(Set<UUID> testRunsId)
      Get count LR-s for TR.
      Parameters:
      testRunsId - for count LR-s
      Returns:
      count LR-s
    • getSubstepScreenshots

      public List<SubstepScreenshotResponse> getSubstepScreenshots(List<UUID> logRecordIds)
      Get list of substeps response.
      Parameters:
      logRecordIds - for get screenshot
      Returns:
      list of SubstepScreenshotResponse
    • findLogRecordsWithParentsByPreviewExists

      public List<LogRecordWithParentListResponse> findLogRecordsWithParentsByPreviewExists(UUID testRunId)
    • getAllLogRecordsByTestRunIds

      public List<LogRecord> getAllLogRecordsByTestRunIds(List<UUID> testRunIds)
    • updateSsmMetricReportsData

      public void updateSsmMetricReportsData(UUID logRecordId, SsmMetricReports data)
      Update SSM metric reports data.
      Parameters:
      logRecordId - log record identifier
      data - SSM metric reports data
    • countAllFailedLrByTestRunIds

      public Long countAllFailedLrByTestRunIds(Collection<UUID> testRunsIds)
    • countAllPassedLrByTestRunIds

      public Long countAllPassedLrByTestRunIds(Collection<UUID> testRunsIds)
    • getAllFailedLogRecordsByTestRunIdsStream

      public Stream<LogRecord> getAllFailedLogRecordsByTestRunIdsStream(Collection<UUID> testRunsIds, Collection<UUID> logRecordsIdForExclude)
      Get failed LR-s by TR-s id and exclude some LR-s by ID-s.
      Parameters:
      testRunsIds - for find LR-s
      logRecordsIdForExclude - for exclude LR-s by id
      Returns:
      stream of LogRecord