Esempio n. 1
0
        void PrepareDataObject(WebRequestTO webRequest, string serviceName, NameValueCollection headers, IPrincipal user, Guid workspaceGuid, out IWarewolfResource resource)
        {
            var uri = string.IsNullOrWhiteSpace(webRequest.WebServerUrl) ? new Uri("https://test/") : new Uri(webRequest.WebServerUrl);

            _dataObject = _dataObjectFactory.New(workspaceGuid, user, serviceName, webRequest);
            _dataObject.OriginalServiceName = serviceName;
            _dataObject.SetHeaders(headers);
            _dataObject.SetupForWebDebug(webRequest);
            webRequest.BindRequestVariablesToDataObject(ref _dataObject);
            _dataObject.SetupForRemoteInvoke(headers);
            _dataObject.SetEmissionType(uri, serviceName, headers);
            _dataObject.SetupForTestExecution(serviceName, headers);
            if (_dataObject.ServiceName == null)
            {
                _dataObject.ServiceName = serviceName;
            }

            _dataObject.SetResourceNameAndId(_resourceCatalog, serviceName, out resource);
            _dataObject.SetTestResourceIds(_resourceCatalog.NewContextualResourceCatalog(_authorizationService, workspaceGuid), webRequest, serviceName, resource);
            _dataObject.WebUrl     = webRequest.WebServerUrl;
            _dataObject.EsbChannel = _esbChannelFactory.New();

            if (_dataObject.Settings is null)
            {
                _dataObject.Settings = new Dev2WorkflowSettingsTO
                {
                    ExecutionLogLevel     = Config.Server.ExecutionLogLevel,
                    EnableDetailedLogging = Config.Server.EnableDetailedLogging,
                    LoggerType            = LoggerType.JSON,
                    KeepLogsForDays       = 2,
                    CompressOldLogFiles   = true
                };
            }

            var stateNotifier = CustomContainer.Get <IStateNotifierFactory>()?.New(_dataObject);

            _dataObject.StateNotifier = stateNotifier;
        }