/// <summary> /// Creates resource detail and inserts it into the manifest. /// </summary> /// <param name="resources">The resources.</param> /// <param name="manifest">The manifest.</param> internal override void AddToManifest(Collection <VirtualResource> resources, SystemManifest manifest) { var resource = resources.First(); MachineReservationDetail detail = manifest.Resources.GetResource <MachineReservationDetail>(resource.VirtualResourceId); if (detail == null) { detail = CreateDetail(resource); manifest.Resources.Add(detail); } // Add installers to the manifest that are specific to this instance of the Machine Reservation MachineReservationMetadata metadata = LegacySerializer.DeserializeXml <MachineReservationMetadata>(resource.VirtualResourceMetadataSet.First().Metadata); if (metadata.PackageId != Guid.Empty) { using (EnterpriseTestContext context = new EnterpriseTestContext()) { int i = 1; foreach (var installer in SelectSoftwareInstallers(context, metadata.PackageId)) { TraceFactory.Logger.Debug("Adding {0}".FormatWith(installer.Description)); manifest.SoftwareInstallers.Add(CreateSoftwareInstallerDetail(installer, i++)); } } } }
/// <summary> /// Initializes a new instance of the <see cref="MachineReservationHandler"/> class. /// </summary> /// <param name="manifest">The manifest.</param> public MachineReservationHandler(SystemManifest manifest) : base(manifest) { _reservation = GlobalDataStore.Manifest.Resources.OfType <MachineReservationDetail>().First(); VirtualResourceEventBus.OnStartMainRun += VirtualResourceEventBus_OnStartMainRun; VirtualResourceEventBus.OnShutdownResource += VirtualResourceEventBus_OnShutdownResource; VirtualResourceEventBus.OnPauseResource += VirtualResourceEventBus_OnPauseResource; VirtualResourceEventBus.OnResumeResource += VirtualResourceEventBus_OnResumeResource; }