Ejemplo n.º 1
0
 /// <summary>
 /// Syncs the collections on a PSMultiInstanceSettings with its wrapped OM object
 /// </summary>
 internal static void MultiInstanceSettingsSyncCollections(PSMultiInstanceSettings multiInstanceSettings)
 {
     if (multiInstanceSettings != null)
     {
         multiInstanceSettings.omObject.CommonResourceFiles = CreateSyncedList(multiInstanceSettings.CommonResourceFiles, ConvertResourceFile);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Syncs the collections on a PSMultiInstanceSettings with its wrapped OM object
 /// </summary>
 internal static void MultiInstanceSettingsSyncCollections(PSMultiInstanceSettings multiInstanceSettings)
 {
     if (multiInstanceSettings != null)
     {
         multiInstanceSettings.omObject.CommonResourceFiles = CreateSyncedList(multiInstanceSettings.CommonResourceFiles,
                                                                               (r) =>
         {
             ResourceFile resourceFile = new ResourceFile(r.BlobSource, r.FilePath);
             return(resourceFile);
         });
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a test task for use in Scenario tests.
        /// </summary>
        public static void CreateTestTask(BatchController controller, BatchAccountContext context, string jobId, string taskId, string cmdLine = "cmd /c dir /s", int numInstances = 0)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            PSMultiInstanceSettings multiInstanceSettings = null;

            if (numInstances > 1)
            {
                multiInstanceSettings = new PSMultiInstanceSettings("cmd /c echo coordinating", numInstances);
            }

            NewTaskParameters parameters = new NewTaskParameters(context, jobId, null, taskId)
            {
                CommandLine           = cmdLine,
                MultiInstanceSettings = multiInstanceSettings,
                UserIdentity          = new PSUserIdentity(new PSAutoUserSpecification(AutoUserScope.Task, numInstances <= 1 ? ElevationLevel.Admin : ElevationLevel.NonAdmin))
            };

            client.CreateTask(parameters);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a test task for use in Scenario tests.
        /// </summary>
        public static void CreateTestTask(BatchController controller, BatchAccountContext context, string jobId, string taskId, string cmdLine = "cmd /c dir /s", int numInstances = 0)
        {
            BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);

            PSMultiInstanceSettings multiInstanceSettings = null;

            if (numInstances > 1)
            {
                multiInstanceSettings = new PSMultiInstanceSettings(numInstances);
                multiInstanceSettings.CoordinationCommandLine = "cmd /c echo coordinating";
            }

            NewTaskParameters parameters = new NewTaskParameters(context, jobId, null, taskId)
            {
                CommandLine           = cmdLine,
                MultiInstanceSettings = multiInstanceSettings,
                RunElevated           = numInstances <= 1
            };

            client.CreateTask(parameters);
        }