コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testHistoricExceptionStacktraceBinary()
        public virtual void testHistoricExceptionStacktraceBinary()
        {
            // given
            BpmnModelInstance instance = createFailingProcess();

            testRule.deploy(instance);
            runtimeService.startProcessInstanceByKey("Process");
            string jobId = managementService.createJobQuery().singleResult().Id;

            // when
            try
            {
                managementService.executeJob(jobId);
                fail();
            }
            catch (Exception)
            {
                // expected
            }

            HistoricJobLogEventEntity entity = (HistoricJobLogEventEntity)historyService.createHistoricJobLogQuery().failureLog().singleResult();

            assertNotNull(entity);

            ByteArrayEntity byteArrayEntity = configuration.CommandExecutorTxRequired.execute(new GetByteArrayCommand(entity.ExceptionByteArrayId));

            checkBinary(byteArrayEntity);
        }
コード例 #2
0
 public virtual void checkReadHistoricJobLog(HistoricJobLogEventEntity historicJobLog)
 {
     if (!string.ReferenceEquals(historicJobLog.ProcessDefinitionKey, null))
     {
         AuthorizationManager.checkAuthorization(READ_HISTORY, PROCESS_DEFINITION, historicJobLog.ProcessDefinitionKey);
     }
 }
コード例 #3
0
        protected internal virtual HistoryEvent CreateHistoricJobLogEvt(IJob job, HistoryEventTypes eventType)
        {
            HistoricJobLogEventEntity @event = NewHistoricJobLogEntity(job);

            InitHistoricJobLogEvent(@event, job, eventType);
            return(@event);
        }
コード例 #4
0
 public virtual void CheckReadHistoricJobLog(HistoricJobLogEventEntity historicJobLog)
 {
     if (historicJobLog != null && !TenantManager.IsAuthenticatedTenant(historicJobLog.TenantId))
     {
         throw Log.ExceptionCommandWithUnauthorizedTenant("get the historic job log '" + historicJobLog.Id + "'");
     }
 }
コード例 #5
0
 public virtual void CheckReadHistoricJobLog(HistoricJobLogEventEntity historicJobLog)
 {
     if (!ReferenceEquals(historicJobLog.ProcessDefinitionKey, null))
     {
         AuthorizationManager.CheckAuthorization(Permissions.ReadHistory, Resources.ProcessDefinition,
                                                 historicJobLog.ProcessDefinitionKey);
     }
 }
コード例 #6
0
        protected internal virtual void InitHistoricJobLogEvent(HistoricJobLogEventEntity evt, IJob job, HistoryEventTypes eventType)
        {
            evt.TimeStamp = ClockUtil.CurrentTime;

            JobEntity jobEntity = (JobEntity)job;

            evt.JobId       = jobEntity.Id;
            evt.JobDueDate  = jobEntity.Duedate;
            evt.JobRetries  = jobEntity.Retries;
            evt.JobPriority = jobEntity.Priority;

            IJobDefinition jobDefinition = jobEntity.JobDefinition;

            if (jobDefinition != null)
            {
                evt.JobDefinitionId            = jobDefinition.Id;
                evt.JobDefinitionType          = jobDefinition.JobType;
                evt.JobDefinitionConfiguration = jobDefinition.JobConfiguration;
            }
            else
            {
                // in case of async signal there does not exist a job definition
                // but we use the jobHandlerType as jobDefinitionType
                evt.JobDefinitionType = jobEntity.JobHandlerType;
            }

            evt.ActivityId           = jobEntity.ActivityId;
            evt.ExecutionId          = jobEntity.ExecutionId;
            evt.ProcessInstanceId    = jobEntity.ProcessInstanceId;
            evt.ProcessDefinitionId  = jobEntity.ProcessDefinitionId;
            evt.ProcessDefinitionKey = jobEntity.ProcessDefinitionKey;
            evt.DeploymentId         = jobEntity.DeploymentId;
            evt.TenantId             = jobEntity.TenantId;

            // initialize sequence counter
            InitSequenceCounter(jobEntity, evt);

            IJobState state = null;

            if (HistoryEventTypes.JobCreate.Equals(eventType))
            {
                state = JobStateFields.Created;
            }
            else if (HistoryEventTypes.JobFail.Equals(eventType))
            {
                state = JobStateFields.Failed;
            }
            else if (HistoryEventTypes.JobSuccess.Equals(eventType))
            {
                state = JobStateFields.Successful;
            }
            else if (HistoryEventTypes.JobDelete.Equals(eventType))
            {
                state = JobStateFields.Deleted;
            }
            evt.State = state.StateCode;
        }
コード例 #7
0
        private IList <string> findExceptionByteArrayIds()
        {
            IList <string>         exceptionByteArrayIds = new List <string>();
            IList <HistoricJobLog> historicJobLogs       = historyService.createHistoricJobLogQuery().list();

            foreach (HistoricJobLog historicJobLog in historicJobLogs)
            {
                HistoricJobLogEventEntity historicJobLogEventEntity = (HistoricJobLogEventEntity)historicJobLog;
                if (!string.ReferenceEquals(historicJobLogEventEntity.ExceptionByteArrayId, null))
                {
                    exceptionByteArrayIds.Add(historicJobLogEventEntity.ExceptionByteArrayId);
                }
            }
            return(exceptionByteArrayIds);
        }
コード例 #8
0
        public virtual string Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("historicJobLogId", HistoricJobLogId);

            HistoricJobLogEventEntity job = commandContext.HistoricJobLogManager.FindHistoricJobLogById(HistoricJobLogId);

            EnsureUtil.EnsureNotNull("No historic job log found with id " + HistoricJobLogId, "historicJobLog", job);

            foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.CheckReadHistoricJobLog(job);
            }

            return(job.ExceptionStacktrace);
        }
コード例 #9
0
        public virtual HistoryEvent CreateHistoricJobLogFailedEvt(IJob job, System.Exception exception)
        {
            HistoricJobLogEventEntity @event = (HistoricJobLogEventEntity)CreateHistoricJobLogEvt(job, HistoryEventTypes.JobFail);

            if (exception != null)
            {
                // exception message
                @event.JobExceptionMessage = exception.Message;

                // stacktrace
                string         exceptionStacktrace = ExceptionUtil.GetExceptionStacktrace(exception);
                byte[]         exceptionBytes      = StringUtil.ToByteArray(exceptionStacktrace);
                ResourceEntity byteArray           = ExceptionUtil.CreateJobExceptionByteArray(exceptionBytes);
                @event.ExceptionByteArrayId = byteArray.Id;
            }

            return(@event);
        }