コード例 #1
0
ファイル: OfficeWorker.cs プロジェクト: ProjectAgri20/newrepo
        /// <summary>
        /// Copies all relevant metadata from the target VirtualResource to this instance.
        /// </summary>
        /// <param name="resource">The resource to copy from.</param>
        public override void CopyResourceProperties(VirtualResource resource)
        {
            base.CopyResourceProperties(resource);
            OfficeWorker officeWorker = resource as OfficeWorker;

            if (officeWorker != null)
            {
                this.RepeatCount            = officeWorker.RepeatCount;
                this.RandomizeStartupDelay  = officeWorker.RandomizeStartupDelay;
                this.MinStartupDelay        = officeWorker.MinStartupDelay;
                this.MaxStartupDelay        = officeWorker.MaxStartupDelay;
                this.RandomizeActivities    = officeWorker.RandomizeActivities;
                this.RandomizeActivityDelay = officeWorker.RandomizeActivityDelay;
                this.MinActivityDelay       = officeWorker.MinActivityDelay;
                this.MaxActivityDelay       = officeWorker.MaxActivityDelay;
                this.ExecutionMode          = officeWorker.ExecutionMode;
                this.DurationTime           = officeWorker.DurationTime;
                this.SecurityGroups         = officeWorker.SecurityGroups;
                this.ResourcesPerVM         = officeWorker.ResourcesPerVM;
                this.ExecutionSchedule      = officeWorker.ExecutionSchedule;
                this.UserPool = officeWorker.UserPool;
            }
            else
            {
                throw new ArgumentException("Resource must be of type OfficeWorker.", "resource");
            }
        }
コード例 #2
0
ファイル: LoadTester.cs プロジェクト: ProjectAgri20/newrepo
        private VirtualResource CreateExpandedResource(Collection <ExpandedResourceMetadata> expandedData, int index)
        {
            // First clone this Load Tester resource, then clear it's metadata set.
            VirtualResource resource = this.Clone <LoadTester>();

            resource.VirtualResourceMetadataSet.Clear();

            resource.Name = "{0} [{1}]".FormatWith(resource.Name, index);

            // For each entry in the expanded set, get the metadata item from "this" by the id
            // in the expanded set item, clone it, then update the thread count to the value
            // in the expanded set item, then add the new metadata item to the resource.  Do
            // this for all items in the expanded data.  Then return the resource.
            foreach (var item in expandedData)
            {
                var metadata = VirtualResourceMetadataSet.First(x => x.VirtualResourceMetadataId == item.Id).Clone();

                // Update the execution plan with the correct number of threads and update it with
                // the property thread ramp up information.
                var plan = LegacySerializer.DeserializeDataContract <LoadTesterExecutionPlan>(metadata.ExecutionPlan);
                plan.ThreadCount = item.ThreadCount;

                plan.RampUpSettings = new Collection <RampUpSetting>();
                foreach (var setting in item.RampUpSettings)
                {
                    plan.RampUpSettings.Add(setting);
                }
                metadata.ExecutionPlan = LegacySerializer.SerializeDataContract(plan).ToString();
                resource.VirtualResourceMetadataSet.Add(metadata);
            }

            return(resource);
        }
コード例 #3
0
        /// <summary>
        /// Copies a Virtual Resource and all of its 'configuration data' - but does NOT
        /// copy the Metadata items.
        /// </summary>
        /// <returns>The Copy of the Virtual Resource</returns>
        public VirtualResource ShallowCopy()
        {
            // Create a new resource of the same type as this one using reflection
            VirtualResource newResource = (VirtualResource)Activator.CreateInstance(this.GetType());

            newResource.CopyResourceProperties(this);
            return(newResource);
        }
コード例 #4
0
        public override void CopyResourceProperties(VirtualResource resource)
        {
            base.CopyResourceProperties(resource);
            PerfMonCollector collector = resource as PerfMonCollector;

            if (collector != null)
            {
                HostName = collector.HostName;
            }
            else
            {
                throw new ArgumentException("Resource must be of type PerfMonCollector.", "resource");
            }
        }
コード例 #5
0
        /// <summary>
        /// Copies all resource-specific properties from the target VirtualResource to this instance.
        /// </summary>
        /// <param name="resource">The resource.</param>
        /// <remarks>
        /// This method is used when committing changes to an existing resource or creating
        /// a copy of a resource.  It should copy any properties that are specific to the
        /// child resource type from the target resource to this instance.
        /// Properties defined by the VirtualResource base class do not need to be copied.
        /// </remarks>
        public virtual void CopyResourceProperties(VirtualResource resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }

            Name          = resource.Name;
            Description   = resource.Description;
            ResourceType  = resource.ResourceType;
            InstanceCount = resource.InstanceCount;
            Platform      = resource.Platform;
            Enabled       = resource.Enabled;
        }
コード例 #6
0
ファイル: LoadTester.cs プロジェクト: ProjectAgri20/newrepo
        public override void CopyResourceProperties(VirtualResource resource)
        {
            base.CopyResourceProperties(resource);
            LoadTester loadTester = resource as LoadTester;

            if (loadTester != null)
            {
                this.ThreadsPerVM = loadTester.ThreadsPerVM;
            }
            else
            {
                throw new ArgumentException("Resource must be of type LoadTester.", "resource");
            }
        }
コード例 #7
0
        /// <summary>
        /// Copies all relevant metadata from the target VirtualResource to this instance.
        /// </summary>
        /// <param name="resource">The resource to copy from.</param>
        public override void CopyResourceProperties(VirtualResource resource)
        {
            base.CopyResourceProperties(resource);
            AdminWorker adminWorker = resource as AdminWorker;

            if (adminWorker != null)
            {
                DBExecutionMode = adminWorker.DBExecutionMode;
            }
            else
            {
                throw new ArgumentException("Resource must be of type AdminWorker.", "resource");
            }
        }
コード例 #8
0
        /// <summary>
        /// Creates a copy of this <see cref="VirtualResource"/>.
        /// </summary>
        /// <returns></returns>
        public VirtualResource Copy()
        {
            // Create a new resource of the same type as this one using reflection
            VirtualResource newResource = (VirtualResource)Activator.CreateInstance(this.GetType());

            newResource.CopyResourceProperties(this);

            // Copy over all metadata items
            foreach (VirtualResourceMetadata metadata in this.VirtualResourceMetadataSet)
            {
                VirtualResourceMetadata copiedMetadata = metadata.Copy(true);
                copiedMetadata.VirtualResourceId = newResource.VirtualResourceId;
                newResource.VirtualResourceMetadataSet.Add(copiedMetadata);
            }

            return(newResource);
        }
コード例 #9
0
        /// <summary>
        /// Copies all relevant metadata from the target VirtualResource to this instance.
        /// </summary>
        /// <param name="resource">The resource to copy from.</param>
        public override void CopyResourceProperties(VirtualResource resource)
        {
            base.CopyResourceProperties(resource);
            EventLogCollector collector = resource as EventLogCollector;

            if (collector != null)
            {
                HostName        = collector.HostName;
                ComponentsData  = collector.ComponentsData;
                EntryTypesData  = collector.EntryTypesData;
                PollingInterval = collector.PollingInterval;
            }
            else
            {
                throw new ArgumentException("Resource must be of type EventLogCollector.", "resource");
            }
        }
コード例 #10
0
ファイル: CitrixWorker.cs プロジェクト: ProjectAgri20/newrepo
        public override void CopyResourceProperties(VirtualResource resource)
        {
            base.CopyResourceProperties(resource);

            CitrixWorker worker = resource as CitrixWorker;

            if (worker != null)
            {
                this.ServerHostname  = worker.ServerHostname;
                this.DBWorkerRunMode = worker.DBWorkerRunMode;
                this.PublishedApp    = worker.PublishedApp;
            }
            else
            {
                throw new ArgumentException("Resource must be of type CitrixWorker.", "resource");
            }
        }
コード例 #11
0
        public override void CopyResourceProperties(VirtualResource resource)
        {
            base.CopyResourceProperties(resource);

            SetDefaults();

            SolutionTester tester = resource as SolutionTester;

            if (tester != null)
            {
                UseCredential    = tester.UseCredential;
                CredentialType   = tester.CredentialType;
                CredentialName   = tester.UserName;
                CredentialDomain = tester.Domain;
                Password         = tester.Password;
            }
            else
            {
                throw new ArgumentException("Resource must be of type SolutionTester.", "resource");
            }
        }