Example #1
0
 public AuditLog(IDSFDataObject dsfDataObject, string auditType, string detail, IDev2Activity previousActivity, IDev2Activity nextActivity)
 {
     WorkflowID                 = dsfDataObject.ResourceID.ToString();
     ExecutionID                = dsfDataObject.ExecutionID.ToString();
     ExecutionOrigin            = Convert.ToInt64(dsfDataObject.ExecutionOrigin);
     IsSubExecution             = Convert.ToInt64(dsfDataObject.IsSubExecution);
     IsRemoteWorkflow           = Convert.ToInt64(dsfDataObject.IsRemoteWorkflow());
     WorkflowName               = dsfDataObject.ServiceName;
     ServerID                   = dsfDataObject.ServerID.ToString();
     ParentID                   = dsfDataObject.ParentID.ToString();
     ExecutingUser              = dsfDataObject.ExecutingUser?.ToString();
     ExecutionOriginDescription = dsfDataObject.ExecutionOriginDescription;
     ExecutionToken             = dsfDataObject.ExecutionToken.ToJson();
     Environment                = dsfDataObject.Environment.ToJson();
     AuditDate                  = DateTime.Now.ToString();
     AuditType                  = auditType;
     AdditionalDetail           = detail;
     if (previousActivity != null)
     {
         PreviousActivity     = previousActivity.GetDisplayName();
         PreviousActivityType = previousActivity.GetType().ToString();
         PreviousActivityId   = previousActivity.ActivityId.ToString();
     }
     if (nextActivity != null)
     {
         NextActivity     = nextActivity.GetDisplayName();
         NextActivityType = nextActivity.GetType().ToString();
         NextActivityId   = nextActivity.ActivityId.ToString();
     }
 }
Example #2
0
 public TestMockStep(IDev2Activity originalActivity, List <IServiceTestOutput> outputs)
 {
     _originalActivity = originalActivity;
     Outputs           = outputs;
     Act = originalActivity as DsfNativeActivity <string>;
     if (Act != null)
     {
         DisplayName    = Act.DisplayName;
         UniqueID       = Act.UniqueID;
         ActualTypeName = originalActivity.GetType().Name;
     }
 }
        public void ThenADetailedLogEntryIsCreated(Table table)
        {
            var nodeTable = table.CreateSet <NodeLogTable>().ToList();

            var           dataObject = _scenarioContext.Get <IDSFDataObject>("dataObject");
            IDev2Activity resource   = GetWFsFirstNode(dataObject);

            var displayName = resource.GetDisplayName();
            var nodeType    = resource.GetType();

            _scenarioContext.Add(nameof(resource), resource);

            Assert.AreEqual(nodeTable[0].Key, nodeType.Name);
            Assert.AreEqual(nodeTable[0].Value, displayName.Trim());
        }
Example #4
0
        public Audit(IDSFDataObject dsfDataObject, string auditType, string detail, IDev2Activity previousActivity, IDev2Activity nextActivity, Exception exception)
        {
            var dev2Serializer = new Dev2JsonSerializer();

            WorkflowID                 = dsfDataObject.ResourceID.ToString();
            ExecutionID                = dsfDataObject.ExecutionID.ToString();
            ExecutionOrigin            = Convert.ToInt64(dsfDataObject.ExecutionOrigin);
            IsSubExecution             = Convert.ToBoolean(dsfDataObject.IsSubExecution);
            IsRemoteWorkflow           = Convert.ToBoolean(dsfDataObject.IsRemoteWorkflow());
            WorkflowName               = dsfDataObject.ServiceName;
            ServerID                   = dsfDataObject.ServerID.ToString();
            ParentID                   = dsfDataObject.ParentID.ToString();
            ExecutingUser              = dsfDataObject.ExecutingUser?.ToString();
            User                       = dsfDataObject.ExecutingUser?.ToString();
            ExecutionOriginDescription = dsfDataObject.ExecutionOriginDescription;
            ExecutionToken             = dev2Serializer.Serialize(ExecutionToken);
            Environment                = dsfDataObject.Environment.ToJson();
            VersionNumber              = dsfDataObject.VersionNumber.ToString();
            AuditDate                  = DateTime.Now;
            StartDateTime              = DateTime.Now;
            CompletedDateTime          = DateTime.Now;
            Url              = dsfDataObject.WebUrl;
            AuditType        = auditType;
            AdditionalDetail = detail;
            Exception        = exception;

            if (previousActivity != null)
            {
                PreviousActivity     = previousActivity.GetDisplayName();
                PreviousActivityType = previousActivity.GetType().ToString();
                PreviousActivityId   = previousActivity.UniqueID;
            }
            if (nextActivity != null)
            {
                NextActivity     = nextActivity.GetDisplayName();
                NextActivityType = nextActivity.GetType().ToString();
                NextActivityId   = nextActivity.UniqueID;
            }
        }
Example #5
0
        private void WriteHeader(IDev2Activity previousActivity, IDev2Activity nextActivity)
        {
            _jsonTextWriter.WriteStartObject();
            _jsonTextWriter.WritePropertyName("timestamp");
            _jsonTextWriter.WriteValue(DateTime.Now);
            if (!(previousActivity is null))
            {
                _jsonTextWriter.WritePropertyName("PreviousActivity");
                _jsonTextWriter.WriteValue(previousActivity.UniqueID);
            }
            if (!(nextActivity is null))
            {
                _jsonTextWriter.WritePropertyName("NextActivity");

                _jsonTextWriter.WriteStartObject();
                _jsonTextWriter.WritePropertyName("Id");
                _jsonTextWriter.WriteValue(nextActivity.UniqueID);
                _jsonTextWriter.WritePropertyName("Type");
                _jsonTextWriter.WriteValue(nextActivity.GetType().ToString());
                _jsonTextWriter.WritePropertyName("DisplayName");
                _jsonTextWriter.WriteValue(nextActivity.GetDisplayName());
                if (nextActivity is DsfActivity dsfActivity)
                {
                    _jsonTextWriter.WritePropertyName("Inputs");
                    var jsonSerializer = new Dev2JsonSerializer();
                    _jsonTextWriter.WriteRawValue(jsonSerializer.Serialize(dsfActivity.Inputs, Formatting.None));
                    _jsonTextWriter.WritePropertyName("Outputs");
                    _jsonTextWriter.WriteRawValue(jsonSerializer.Serialize(dsfActivity.Outputs, Formatting.None));
                }
                _jsonTextWriter.WriteEndObject();
            }
            _jsonTextWriter.WriteEndObject();
            _jsonTextWriter.Flush();
            _writer.WriteLine();
            _writer.Flush();
        }
Example #6
0
 private bool IsDsfComment(IDev2Activity activity)
 {
     return(activity.GetType().Name is "DsfCommentActivity");
 }