- Timestamp:
- 09/08/11 14:37:52 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs
r6721 r6723 44 44 IHiveDao dao = ServiceLocator.Instance.HiveDao; 45 45 46 DT. HiveExperiment he = new DT.HiveExperiment();46 DT.Job he = new DT.Job(); 47 47 he.DateCreated = DateTime.Now; 48 48 he.Name = "TestExperiment"; … … 55 55 job1.StateLog.Add(new DT.StateLog { State = DT.TaskState.Offline, DateTime = DateTime.Now }); 56 56 job1.Command = DT.Command.Pause; 57 job1. HiveExperimentId = he.Id;57 job1.JobId = he.Id; 58 58 job1.IsPrivileged = true; 59 59 … … 92 92 Assert.AreEqual(job1.StateLog.Count, job1loaded.StateLog.Count); 93 93 Assert.AreEqual(job1.Command, job1loaded.Command); 94 Assert.AreEqual(job1. HiveExperimentId, job1loaded.HiveExperimentId);94 Assert.AreEqual(job1.JobId, job1loaded.JobId); 95 95 Assert.AreEqual(job1.IsPrivileged, job1loaded.IsPrivileged); 96 96 Assert.IsTrue(Math.Abs((job1loaded.LastJobDataUpdate - jobData1.LastUpdate).TotalSeconds) < 1); … … 215 215 IHiveDao dao = ServiceLocator.Instance.HiveDao; 216 216 217 DT. HiveExperiment he = new DT.HiveExperiment();217 DT.Job he = new DT.Job(); 218 218 he.DateCreated = DateTime.Now; 219 219 he.Name = "TestExperiment"; … … 225 225 job.State = DT.TaskState.Offline; 226 226 job.StateLog.Add(new DT.StateLog { State = DT.TaskState.Offline, DateTime = DateTime.Now }); 227 job. HiveExperimentId = he.Id;227 job.JobId = he.Id; 228 228 job.Id = dao.AddJob(job); 229 229 230 DT. HiveExperimentPermission perm = new DT.HiveExperimentPermission();231 perm. HiveExperimentId = he.Id;230 DT.JobPermission perm = new DT.JobPermission(); 231 perm.JobId = he.Id; 232 232 perm.GrantedByUserId = he.OwnerUserId; 233 233 perm.GrantedUserId = Guid.NewGuid(); … … 235 235 dao.AddHiveExperimentPermission(perm); 236 236 237 DT. HiveExperimentheLoaded = dao.GetHiveExperiment(he.Id);237 DT.Job heLoaded = dao.GetHiveExperiment(he.Id); 238 238 Assert.AreEqual(he.Id, heLoaded.Id); 239 239 Assert.AreEqual(he.Name, heLoaded.Name); … … 245 245 Assert.AreEqual(job.Id, jobLoaded.Id); 246 246 Assert.AreEqual(job.State, jobLoaded.State); 247 Assert.AreEqual(job. HiveExperimentId, jobLoaded.HiveExperimentId);248 249 DT. HiveExperimentPermission permLoaded = dao.GetHiveExperimentPermission(he.Id, perm.GrantedUserId);250 Assert.AreEqual(perm. HiveExperimentId, permLoaded.HiveExperimentId);247 Assert.AreEqual(job.JobId, jobLoaded.JobId); 248 249 DT.JobPermission permLoaded = dao.GetHiveExperimentPermission(he.Id, perm.GrantedUserId); 250 Assert.AreEqual(perm.JobId, permLoaded.JobId); 251 251 Assert.AreEqual(perm.GrantedUserId, permLoaded.GrantedUserId); 252 252 Assert.AreEqual(perm.GrantedByUserId, permLoaded.GrantedByUserId); … … 256 256 Assert.AreEqual(null, dao.GetHiveExperiment(he.Id)); 257 257 Assert.AreEqual(null, dao.GetJob(job.Id)); 258 Assert.AreEqual(null, dao.GetHiveExperimentPermission(perm. HiveExperimentId, perm.GrantedUserId));258 Assert.AreEqual(null, dao.GetHiveExperimentPermission(perm.JobId, perm.GrantedUserId)); 259 259 260 260 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
r6721 r6723 49 49 50 50 // create hive experiment 51 DT. HiveExperiment experiment = new DT.HiveExperiment() { Name = "TestExperiment", Description = "" };51 DT.Job experiment = new DT.Job() { Name = "TestExperiment", Description = "" }; 52 52 53 53 // create job … … 101 101 102 102 // add job 103 job. HiveExperimentId = experiment.Id;103 job.JobId = experiment.Id; 104 104 job.Id = service.AddJob(job, jobData, new List<Guid> { slave.Id }); 105 105 … … 112 112 Assert.AreEqual(DT.TaskState.Waiting, jobLoaded.State); 113 113 Assert.IsTrue(job.PluginsNeededIds.SequenceEqual(jobLoaded.PluginsNeededIds)); 114 Assert.AreEqual(job. HiveExperimentId, jobLoaded.HiveExperimentId);114 Assert.AreEqual(job.JobId, jobLoaded.JobId); 115 115 116 116 DT.TaskData jobDataLoaded = service.GetJobData(job.Id); … … 119 119 120 120 // test hive experiment 121 DT. HiveExperimentexperimentLoaded = service.GetHiveExperiment(experiment.Id);121 DT.Job experimentLoaded = service.GetHiveExperiment(experiment.Id); 122 122 Assert.AreEqual(experiment.Id, experimentLoaded.Id); 123 123 Assert.AreEqual(experiment.Name, experimentLoaded.Name); … … 201 201 202 202 // create hive experiment 203 DT. HiveExperiment experiment = new DT.HiveExperiment() { Name = "TestExperiment", Description = "" };203 DT.Job experiment = new DT.Job() { Name = "TestExperiment", Description = "" }; 204 204 205 205 // create parent job … … 244 244 245 245 // add parent job 246 parentJob. HiveExperimentId = experiment.Id;246 parentJob.JobId = experiment.Id; 247 247 parentJob.Id = service.AddJob(parentJob, parentJobData, new List<Guid> { slave.Id }); 248 248 249 249 // add child job 250 childJob. HiveExperimentId = experiment.Id;250 childJob.JobId = experiment.Id; 251 251 childJob.Id = service.AddChildJob(parentJob.Id, childJob, childJobData); 252 252 childJob.ParentTaskId = parentJob.Id; … … 255 255 var childJobLoaded = service.GetJob(childJob.Id); 256 256 Assert.AreEqual(childJob.ParentTaskId, childJobLoaded.ParentTaskId); 257 Assert.AreEqual(childJob. HiveExperimentId, childJobLoaded.HiveExperimentId);257 Assert.AreEqual(childJob.JobId, childJobLoaded.JobId); 258 258 Assert.AreEqual(DT.TaskState.Waiting, childJobLoaded.State); 259 259 Assert.AreEqual(false, childJobLoaded.FinishWhenChildJobsFinished); … … 262 262 // test parent job 263 263 var parentJobLoaded = service.GetJob(parentJob.Id); 264 Assert.AreEqual(parentJob. HiveExperimentId, parentJobLoaded.HiveExperimentId);264 Assert.AreEqual(parentJob.JobId, parentJobLoaded.JobId); 265 265 Assert.AreEqual(TaskState.Waiting, parentJobLoaded.State); 266 266 Assert.AreEqual(true, parentJobLoaded.FinishWhenChildJobsFinished); … … 304 304 305 305 // create hive experiment 306 DT. HiveExperiment e1 = new DT.HiveExperiment() { Name = "TestExperiment", Description = "" };306 DT.Job e1 = new DT.Job() { Name = "TestExperiment", Description = "" }; 307 307 e1.Id = service.AddHiveExperiment(e1); 308 308
Note: See TracChangeset
for help on using the changeset viewer.