/// <summary>
        /// Converts the metadata from version 1.0 to 1.1.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public XElement Convert(XElement xml)
        {
            SerializerProxyMap proxyMap = new SerializerProxyMap(typeof(CollectDeviceSystemInfoActivityData),
                                                                 "Plugin.CollectDeviceSystemInfo",
                                                                 "Plugin.CollectDeviceSystemInfo",
                                                                 "CollectDeviceSystemInfoActivityData");

            CollectDeviceSystemInfoActivityData converted = Serializer.Deserialize <CollectDeviceSystemInfoActivityData>(xml, new[] { proxyMap });

            return(Serializer.Serialize(converted));
        }
        /// <summary>
        /// Validates the given metadata against the CollectDeviceSystemInfo Activity data.
        /// </summary>
        /// <param name="configurationData">The configuration data.</param>
        /// <returns>true if valid</returns>
        public bool ValidateMetadata(ref PluginConfigurationData configurationData)
        {
            bool validData = true;
            CollectDeviceSystemInfoActivityData activityData = null;

            try
            {
                activityData = configurationData.GetMetadata <CollectDeviceSystemInfoActivityData>(ConverterProvider.GetMetadataConverters());
            }
            catch
            {
                activityData = new CollectDeviceSystemInfoActivityData();
                validData    = false;
            }

            configurationData = new PluginConfigurationData(activityData, CollectDeviceSystemInfoConfigurationControl.Version);

            return(validData);
        }
Exemple #3
0
        /// <summary>
        /// Defines and executes the PluginCollectDeviceSystemInfo workflow.
        /// </summary>
        /// <param name="executionData">Information used in the execution of this workflow.</param>
        /// <returns>The result of executing the workflow.</returns>
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            _data = executionData.GetMetadata <CollectDeviceSystemInfoActivityData>(ConverterProvider.GetMetadataConverters());
            _collectDeviceInfoEngine = new CollectDeviceSystemInfoEngine(executionData);

            UpdateStatus("Starting execution");

            // iterate through each applicable asset, acquire the lock and take the memory snapshot, then proceed to next
            var devices = executionData.Assets.OfType <IDeviceInfo>();

            Parallel.ForEach(devices, device =>
            {
                UpdateStatus("Collecting Memory on Asset ID '" + device.AssetId + "'.");
                _collectDeviceInfoEngine.ProcessMemCollectionByDevice(device);
                if (_collectDeviceInfoEngine.IsError)
                {
                    UpdateStatus(_collectDeviceInfoEngine.ErrorMessage);
                    _collectDeviceInfoEngine.ErrorMessage = string.Empty;
                }
            });


            PluginExecutionResult result;

            if (_collectDeviceInfoEngine.ProblemDevices.Any())
            {
                var msg = $"Failed to collect on {string.Join(",", _collectDeviceInfoEngine.ProblemDevices.ToArray())}";
                result = new PluginExecutionResult(PluginResult.Failed, msg, "Memory collection error.");
                UpdateStatus(msg);
            }
            else
            {
                result = new PluginExecutionResult(PluginResult.Passed);
            }

            UpdateStatus("Completing execution");
            UpdateStatus($"Result = {result.Result}");
            return(result);
        }
 /// <summary>
 /// Initializes the configuration control with the supplied configuration settings.
 /// </summary>
 /// <param name="configuration">Pre-configured plugin settings.</param>
 /// <param name="environment">Domain and plugin specific environment data.</param>
 public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
 {
     // Deserialize the plugin specific configuration settings.
     _data = configuration.GetMetadata <CollectDeviceSystemInfoActivityData>(ConverterProvider.GetMetadataConverters());
     assetSelectionControl.Initialize(configuration.Assets, HP.ScalableTest.Framework.Assets.AssetAttributes.None);
 }
 /// <summary>
 /// Initializes the configuration control to default values.
 /// </summary>
 /// <param name="environment">Domain and plugin specific environment data.</param>
 public void Initialize(PluginEnvironment environment)
 {
     _data = new CollectDeviceSystemInfoActivityData();
     assetSelectionControl.Initialize(HP.ScalableTest.Framework.Assets.AssetAttributes.None);
 }