示例#1
0
        /// <summary>
        /// Creates a test pool for use in Scenario tests.
        /// </summary>
        public static void CreateTestPool(BatchController controller, BatchAccountContext context, string poolId, int targetDedicated,
                                          CertificateReference certReference = null, StartTask startTask = null)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            PSCertificateReference[] certReferences = null;
            if (certReference != null)
            {
                certReferences = new PSCertificateReference[] { new PSCertificateReference(certReference) };
            }
            PSStartTask psStartTask = null;

            if (startTask != null)
            {
                psStartTask = new PSStartTask(startTask);
            }

            PSCloudServiceConfiguration paasConfiguration = new PSCloudServiceConfiguration("4", "*");

            NewPoolParameters parameters = new NewPoolParameters(context, poolId)
            {
                VirtualMachineSize        = "small",
                CloudServiceConfiguration = paasConfiguration,
                TargetDedicated           = targetDedicated,
                CertificateReferences     = certReferences,
                StartTask = psStartTask,
                InterComputeNodeCommunicationEnabled = true
            };

            client.CreatePool(parameters);
        }
示例#2
0
        /// <summary>
        /// Syncs the collections on a PSStartTask with its wrapped OM object
        /// </summary>
        internal static void StartTaskSyncCollections(PSStartTask startTask)
        {
            if (startTask != null)
            {
                startTask.omObject.EnvironmentSettings = CreateSyncedDict(
                    startTask.EnvironmentSettings,
                    ConvertEnvironmentSetting);

                startTask.omObject.ResourceFiles = CreateSyncedList(startTask.ResourceFiles, ConvertResourceFile);
            }
        }
示例#3
0
        /// <summary>
        /// Syncs the collections on a PSStartTask with its wrapped OM object
        /// </summary>
        internal static void StartTaskSyncCollections(PSStartTask startTask)
        {
            if (startTask != null)
            {
                startTask.omObject.EnvironmentSettings = CreateSyncedList(startTask.EnvironmentSettings,
                                                                          (e) =>
                {
                    EnvironmentSetting envSetting = new EnvironmentSetting(e.Name, e.Value);
                    return(envSetting);
                });

                startTask.omObject.ResourceFiles = CreateSyncedList(startTask.ResourceFiles,
                                                                    (r) =>
                {
                    ResourceFile resourceFile = new ResourceFile(r.BlobSource, r.FilePath);
                    return(resourceFile);
                });
            }
        }
        /// <summary>
        /// Creates a test pool for use in Scenario tests.
        /// </summary>
        public static void CreateTestPool(
            BatchController controller,
            BatchAccountContext context,
            string poolId,
            int?targetDedicated,
            int?targetLowPriority,
            CertificateReference certReference = null,
            StartTask startTask = null)
        {
            PSCertificateReference[] certReferences = null;
            if (certReference != null)
            {
                certReferences = new PSCertificateReference[] { new PSCertificateReference(certReference) };
            }
            PSStartTask psStartTask = null;

            if (startTask != null)
            {
                psStartTask = new PSStartTask(startTask);
            }

            PSCloudServiceConfiguration paasConfiguration = new PSCloudServiceConfiguration("4", "*");

            NewPoolParameters parameters = new NewPoolParameters(context, poolId)
            {
                VirtualMachineSize            = "small",
                CloudServiceConfiguration     = paasConfiguration,
                TargetDedicatedComputeNodes   = targetDedicated,
                TargetLowPriorityComputeNodes = targetLowPriority,
                CertificateReferences         = certReferences,
                StartTask = psStartTask,
                InterComputeNodeCommunicationEnabled = true
            };

            CreatePoolIfNotExists(controller, parameters);
        }