コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceProfile" /> class.
 /// </summary>
 /// <param name="detail">The detail.</param>
 /// <param name="resourceName">Name of the resource.</param>
 public ResourceMetadata(string resourceName, ResourceMetadataDetail detail)
 {
     ResourceName = resourceName;
     Detail       = detail;
     //MapElement = new SessionMapElement("{0}:{1}".FormatWith(resourceName, detail.Name), ElementType.ResourceMetadata, detail.MetadataType);
     MapElement = new SessionMapElement(detail.Name, ElementType.Activity, detail.MetadataType);
 }
コード例 #2
0
        private void CreateMetadataDetail(VirtualResource resource, ResourceDetailBase detail)
        {
            foreach (var data in resource.VirtualResourceMetadataSet.Where(m => m.Enabled))
            {
                ResourceMetadataDetail metadata = new ResourceMetadataDetail()
                {
                    MetadataType    = data.MetadataType,
                    Data            = data.Metadata,
                    Id              = data.VirtualResourceMetadataId,
                    Name            = data.Name,
                    MetadataVersion = data.MetadataVersion
                };

                detail.MetadataDetails.Add(metadata);
            }
        }
コード例 #3
0
 protected override string GetExecutionPlan(ResourceMetadataDetail detail)
 {
     return(string.Empty);
 }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Activity" /> class.
        /// </summary>
        /// <param name="activityDetail">The activity detail.</param>
        /// <param name="officeWorker">The office worker.</param>
        /// <exception cref="System.ArgumentNullException">activityDetail</exception>
        public Activity(ResourceMetadataDetail activityDetail, OfficeWorkerDetail officeWorker)
        {
            if (activityDetail == null)
            {
                throw new ArgumentNullException("activityDetail");
            }

            Id             = activityDetail.Id;
            Name           = activityDetail.Name;
            ActivityType   = activityDetail.MetadataType;
            ExecutionOrder = activityDetail.Plan.Order;
            ExecutionValue = activityDetail.Plan.Value;
            ExecutionPhase = activityDetail.Plan.Phase;
            ExecutionMode  = activityDetail.Plan.Mode;
            Pacing         = activityDetail.Plan.ActivityPacing;

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(activityDetail.Data);
            _metadata = doc;

            // Populate assets for this activity
            if (GlobalDataStore.Manifest.ActivityAssets.ContainsKey(activityDetail.Id))
            {
                var assetIds = GlobalDataStore.Manifest.ActivityAssets[activityDetail.Id];
                _requestedAssets.AddRange(GlobalDataStore.Manifest.AllAssets.Where(n => assetIds.Contains(n.AssetId)));
            }

            // Populate documents for this activity
            if (GlobalDataStore.Manifest.ActivityDocuments.ContainsKey(activityDetail.Id))
            {
                var documentIds = GlobalDataStore.Manifest.ActivityDocuments[activityDetail.Id];
                _documents.AddRange(GlobalDataStore.Manifest.Documents.Where(n => documentIds.Contains(n.DocumentId)));
            }

            // Populate servers for this activity
            if (GlobalDataStore.Manifest.ActivityServers.ContainsKey(activityDetail.Id))
            {
                var serverIds = GlobalDataStore.Manifest.ActivityServers[activityDetail.Id];
                _servers.AddRange(GlobalDataStore.Manifest.Servers.Where(n => serverIds.Contains(n.ServerId)));
            }

            // Populate print queues for this activity
            if (GlobalDataStore.Manifest.ActivityPrintQueues.ContainsKey(activityDetail.Id))
            {
                _requestedPrintQueues.AddRange(GlobalDataStore.Manifest.ActivityPrintQueues[activityDetail.Id]);
            }

            // Populate retry settings for this activity (or set them to a default instance if none are configured)
            if (GlobalDataStore.Manifest.ActivityRetrySettings.ContainsKey(activityDetail.Id))
            {
                _retrySettings = GlobalDataStore.Manifest.ActivityRetrySettings[activityDetail.Id];
            }
            else
            {
                _retrySettings = new PluginRetrySettingDictionary(new List <PluginRetrySetting>());
            }

            // Populate the list of external credentials that may be needed for activity execution.
            if (GlobalDataStore.Manifest.Resources.ExternalCredentials.Count() > 0)
            {
                _externalCredentials = GlobalDataStore.Manifest.GetExternalCredentials(GlobalDataStore.Credential);
            }

            // Populate environment info
            _environment = new PluginEnvironment(
                GlobalDataStore.Manifest.PluginDefinitions.First(n => n.Name == ActivityType).PluginSettings,
                GlobalSettings.Items[Setting.Domain],
                GlobalSettings.Items[Setting.DnsDomain]
                );

            // Populate execution context
            _executionContext.SessionId    = GlobalDataStore.Manifest.SessionId;
            _executionContext.UserName     = GlobalDataStore.Credential.UserName;
            _executionContext.UserPassword = GlobalDataStore.Credential.Password;
            _executionContext.UserDomain   = GlobalDataStore.Credential.Domain;

            // Refresh asset availability
            RefreshAssetAvailability();

            // Create execution data
            _executionData = new PluginExecutionData(
                XElement.Parse(activityDetail.Data),
                activityDetail.MetadataVersion,
                new AssetInfoCollection(_availableAssets),
                new DocumentCollection(_documents),
                new ServerInfoCollection(_servers),
                new PrintQueueInfoCollection(_availablePrintQueues),
                _environment,
                _executionContext,
                _retrySettings,
                new ExternalCredentialInfoCollection(_externalCredentials)
                );

            CreatePlugin();
        }
コード例 #5
0
 protected virtual string GetExecutionPlan(ResourceMetadataDetail detail)
 {
     return(LegacySerializer.SerializeDataContract((WorkerExecutionPlan)detail.Plan).ToString());
 }
コード例 #6
0
ファイル: LoadTester.cs プロジェクト: ProjectAgri20/newrepo
 protected override string GetExecutionPlan(ResourceMetadataDetail detail)
 {
     return(LegacySerializer.SerializeDataContract((LoadTesterExecutionPlan)detail.Plan).ToString());
 }