コード例 #1
0
        public void CannotModifyUsesTaskDependenciesOnAJobScheduleAfterItHasBeenCommitted()
        {
            const bool usesTaskDependencies = true;


            using BatchClient client = ClientUnitTestCommon.CreateDummyClient();
            Protocol.RequestInterceptor interceptor = new Protocol.RequestInterceptor(
                baseRequest =>
            {
                var request = (Protocol.BatchRequests.JobScheduleAddBatchRequest)baseRequest;

                request.ServiceRequestFunc = token =>
                {
                    var response = new AzureOperationHeaderResponse <Models.JobScheduleAddHeaders> {
                        Response = new HttpResponseMessage(HttpStatusCode.Created)
                    };

                    return(Task.FromResult(response));
                };
            });

            Microsoft.Azure.Batch.CloudJobSchedule cloudJobSchedule = client.JobScheduleOperations.CreateJobSchedule();
            Microsoft.Azure.Batch.JobSpecification jobSpec          = new Microsoft.Azure.Batch.JobSpecification(poolInformation: null)
            {
                UsesTaskDependencies = usesTaskDependencies
            };
            cloudJobSchedule.JobSpecification = jobSpec;
            cloudJobSchedule.Commit(new List <BatchClientBehavior> {
                interceptor
            });

            // writing isn't allowed for a CloudJobSchedule.JobSpecification.UsesTaskDependencies that is in an invalid state.
            Assert.Throws <InvalidOperationException>(() => cloudJobSchedule.JobSpecification.UsesTaskDependencies = false);
        }
コード例 #2
0
 internal PSJobSpecification(Microsoft.Azure.Batch.JobSpecification omObject)
 {
     if ((omObject == null))
     {
         throw new System.ArgumentNullException("omObject");
     }
     this.omObject = omObject;
 }
コード例 #3
0
 internal PSJobSpecification(Microsoft.Azure.Batch.JobSpecification omObject)
 {
     if ((omObject == null))
     {
         throw new System.ArgumentNullException("omObject");
     }
     this.omObject = omObject;
 }
コード例 #4
0
 public PSJobSpecification()
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification();
 }
コード例 #5
0
 public PSJobSpecification()
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification();
 }
コード例 #6
0
        /// <summary>
        /// Creates an instance of CloudJobSchedule that is unbound and does not have a consistency relationship to any job schedule in the Batch Service.
        /// </summary>
        /// <param name="jobScheduleId">The id of the job schedule.</param>
        /// <param name="schedule">The schedule that determines when jobs will be created.</param>
        /// <param name="jobSpecification">a <see cref="JobSpecification" /> containing details of the jobs to be created according to the <paramref name="schedule"/>.</param>
        /// <returns>A <see cref="CloudJobSchedule"/> representing a new job schedule that has not been submitted to the Batch service.</returns>
        public CloudJobSchedule CreateJobSchedule(string jobScheduleId, Schedule schedule, JobSpecification jobSpecification)
        {
            CloudJobSchedule newJobSchedule = new CloudJobSchedule(this.ParentBatchClient, this.CustomBehaviors)
            {
                Id               = jobScheduleId,
                Schedule         = schedule,
                JobSpecification = jobSpecification
            };

            return(newJobSchedule);
        }
コード例 #7
0
 public PSJobSpecification(PSPoolInformation poolInformation)
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification(poolInformation.omObject);
 }
コード例 #8
0
 public PSJobSpecification(PSPoolInformation poolInformation)
 {
     this.omObject = new Microsoft.Azure.Batch.JobSpecification(poolInformation.omObject);
 }