예제 #1
0
        public void BasicCreate()
        {
            var newJobs = JsonConvert.DeserializeObject <NewJobs>(
                File.ReadAllText(
                    Path.Combine("..", "..", "..", "sample-newjobs", "fixtures-queues.json")),
                jsonSettings
                );

            _writeJobs.AddJobs(newJobs, null);

            ShouldMatchSnapshot(_writeMock.UpdateSchedules, "fixtures-queues-updatesch.json");
            ShouldMatchSnapshot(_writeMock.DeletePartsPals, "fixtures-queues-delparts.json");
            ShouldMatchSnapshot(_writeMock.Fixtures, "fixtures-queues-fixtures.json", AdjustProgramPath);
            ShouldMatchSnapshot(_writeMock.AddParts, "fixtures-queues-parts.json");
            ShouldMatchSnapshot(_writeMock.AddSchedules, "fixtures-queues-schedules.json");

            var start = newJobs.Jobs.First().RouteStartingTimeUTC;

            _jobDB.LoadJobsNotCopiedToSystem(start, start.AddMinutes(1)).Jobs.Should().BeEmpty();
        }
예제 #2
0
 public void AddJobs(NewJobs newJ, string expectedPreviousScheduleId)
 {
     if (!OpenDatabaseKitDB.MazakTransactionLock.WaitOne(TimeSpan.FromMinutes(2), true))
     {
         throw new Exception("Unable to obtain mazak database lock");
     }
     try
     {
         _writeJobs.AddJobs(newJ, expectedPreviousScheduleId);
     }
     finally
     {
         OpenDatabaseKitDB.MazakTransactionLock.ReleaseMutex();
     }
 }