public void TestOctopusTranscode()
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                db.Test_InsertDemoData(Regex.Replace(Environment.CurrentDirectory, @"src\\(?:demo|test)\\(?:plugins\\)?[\w.\-]+\\bin\\(?:Debug|Release)$", "bin\\plugins\\"));

                using (IControllerEngine controllerEngine = new ControllerEngine(true))
                {
                    var job = new Job();
                    var step = new Step();

                    step.Add(CreatePlugin());
                    job.Add(step);

                    db.Job_Insert( job.StatusID, job.JobXML.ToString());

                    Timing.WaitUntil(() => db.Job_GetUnfinishedJobs().ToList().Count == 1, 10 * 1000, "Wait til job has been added");
                    Timing.WaitUntil(() => db.Job_GetUnfinishedJobs().ToList().Count == 0, 120 * 1000, "Wait til job has completed");
                }
            }
        }
예제 #2
0
        public void Should_Sync_DB_With_InMemory_Collection()
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                // Load all assemblies
                foreach (AssemblyInfo info in db.AssemblyInfo_Get(null, null, null, null, null, null, null, true))
                {
                    PluginLoader.Add(info.Version + ", " + info.Name, info.ReadURL); // Add AssemblyIdentifier !!!!!!!!!!!!!!
                }
            }

            using( IJobManager mgr = new JobManager() )
            {
                bool isSynced = false;
                mgr.SynchronizeOnce();
                mgr.SyncCompleted += (sender, eventArgs) => isSynced = true;

                Timing.WaitUntil(() => isSynced, 10000, "Wait til JobManager is synced");

                // Change the Jobs
                foreach (IJob engineJob in mgr)
                {
                    engineJob.StatusID = 1000;
                }

                isSynced = false;
                mgr.SynchronizeOnce();  // Resync, to make sure changes in the InMemory collection is syncronised as well.
                mgr.SyncCompleted += (sender, eventArgs) => isSynced = true;

                Timing.WaitUntil(() => isSynced, 10000, "Wait til JobManager is synced");

                _DB.Dispose();
                _DB = new DatabaseDataContext();

                int count = _DB.Job_GetUnfinishedJobs().ToList().Count;

                Assert.AreEqual(1, mgr.ToList().Count);

                // Check if all the in memory objects are in the DB, and has the correct values
                foreach (IJob engineJob in mgr)
                {
                    int currentCount = 0;

                    foreach (Data.Job job in _DB.Job_GetUnfinishedJobs().ToList())
                    {
                        currentCount++;

                        if( Compare( engineJob, job ) )
                            break;

                        if( currentCount == count )
                            Assert.Fail(job.ID + " didn't compare correctly");
                    }
                }
            }
        }
예제 #3
0
		private IList<IJob> SyncInMemoryCollectionWithDB()
        {
            IList<IJob> addedJobs = new List<IJob>();

			using( DatabaseDataContext db = new DatabaseDataContext() )
            {
                foreach( Data.Job job in db.Job_GetUnfinishedJobs() )
                {
                    if( ContainsKey( job.ID ) ) 
                        continue;

					addedJobs.Add( new Job( job ) );
                }
            }

            return addedJobs;
        }
예제 #4
0
 public IEnumerable<IJobData> GetUnfinishedJobs()
 {
     using (DatabaseDataContext db = new DatabaseDataContext())
         return db.Job_GetUnfinishedJobs();
 }
예제 #5
0
 public IList<IComputedJobData> Job_GetUnfinished()
 {
     using (DatabaseDataContext db = new DatabaseDataContext())
         return (
             from job in db.Job_GetUnfinishedJobs()
             select (IComputedJobData)job
             ).ToList();
 }