Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/20/11 14:16:53 (13 years ago)
Author:
cneumuel
Message:

#1233

  • renamed UptimeCalendar and Appointment to Downtime
  • added service methods to delete plugins and get plugin by hash
  • made reverted TransactionManager change, made it non-static and added interface
  • moved magic numbers to application settings
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs

    r6431 r6452  
    7070      plugin1.UserId = Guid.Empty;
    7171      plugin1.DateCreated = DateTime.Now;
     72      plugin1.Hash = new byte[] { 1, 2, 3 };
    7273
    7374      DT.PluginData pluginData1 = new DT.PluginData();
     
    135136      Assert.AreEqual(null, dao.GetJobData(job1.Id));
    136137      Assert.AreEqual(null, dao.GetHiveExperiment(he.Id));
     138
     139      dao.DeletePlugin(plugin1.Id);
     140      Assert.AreEqual(null, dao.GetPlugin(plugin1.Id));
    137141    }
    138142
     
    177181      plugin1.Version = new Version("1.0.0.0");
    178182      plugin1.UserId = Guid.Empty;
     183      plugin1.Hash = new byte[] { 1, 2, 3 };
    179184
    180185      plugin1.Id = dao.AddPlugin(plugin1);
     
    186191      Assert.AreEqual(plugin1.UserId, plugin1loaded.UserId);
    187192      Assert.AreEqual(plugin1.DateCreated.ToString(), plugin1loaded.DateCreated.ToString());
     193      Assert.IsTrue(plugin1.Hash.SequenceEqual(plugin1loaded.Hash));
    188194
    189195      DT.PluginData pluginData1 = new DT.PluginData();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockLifecycleManager.cs

    r6372 r6452  
    2020#endregion
    2121
    22 
    2322namespace HeuristicLab.Services.Hive.Tests.Mocks {
    2423  public class MockLifecycleManager : ILifecycleManager {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs

    r6431 r6452  
    4444
    4545    public ILifecycleManager LifecycleManager {
    46       get {
    47         return defaultServiceLocator.LifecycleManager;
    48       }
     46      get { return defaultServiceLocator.LifecycleManager; }
     47    }
     48    public ITransactionManager TransactionManager {
     49      get { return defaultServiceLocator.TransactionManager; }
    4950    }
    5051
    5152    public HeartbeatManager HeartbeatManager {
    52       get {
    53         return defaultServiceLocator.HeartbeatManager;
    54       }
     53      get { return defaultServiceLocator.HeartbeatManager; }
    5554    }
    56 
    5755  }
    5856}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs

    r6431 r6452  
    6666      };
    6767
     68      // delete plugin first (otherwise the system would not allow it because of the same hash code
     69      var hash = new byte[] { 1, 2, 3 };
     70      var p = service.GetPluginByHash(hash);
     71      if (p != null) service.DeletePlugin(p.Id);
     72
    6873      // create plugin
    6974      DT.Plugin plugin1 = new DT.Plugin();
     
    7277      plugin1.UserId = Guid.Empty;
    7378      plugin1.DateCreated = DateTime.Now;
    74 
     79      plugin1.Hash = hash;
     80     
    7581      DT.PluginData pluginData1 = new DT.PluginData();
    7682      pluginData1.FileName = "Tests.MyPlugin-1.0.dll";
     
    167173      Assert.AreEqual(job.Id, actions[0].JobId);
    168174
    169       // create appointment which should make slave unavailable for calculation
    170       Guid appointmentId = service.AddAppointment(new Appointment { ResourceId = slave.Id, StartDate = DateTime.Now - TimeSpan.FromMinutes(1), EndDate = DateTime.Now + TimeSpan.FromMinutes(1), Recurring = false });
     175      // create downtime which should make slave unavailable for calculation
     176      Guid downtimeId = service.AddDowntime(new Downtime { ResourceId = slave.Id, StartDate = DateTime.Now - TimeSpan.FromMinutes(1), EndDate = DateTime.Now + TimeSpan.FromMinutes(1), Recurring = false });
    171177
    172178      progress.Clear();
     
    177183      Assert.AreEqual(Guid.Empty, actions[0].JobId);
    178184
    179       service.DeleteAppointment(appointmentId);
     185      service.DeleteDowntime(downtimeId);
    180186
    181187      // delete
Note: See TracChangeset for help on using the changeset viewer.