Changeset 5599 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks
- Timestamp:
- 03/03/11 14:18:29 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs
r5593 r5599 26 26 using HeuristicLab.PluginInfrastructure; 27 27 using HeuristicLab.PluginInfrastructure.Manager; 28 using HeuristicLab.Services.Hive.Common; 29 using HeuristicLab.Services.Hive.Common.DataTransfer; 30 using HeuristicLab.Services.Hive.Common.ServiceContracts; 31 32 namespace HeuristicLab.Clients.Hive.Slave.Tests { 28 29 namespace HeuristicLab.Clients.Hive.SlaveCore.Tests { 33 30 internal class MockHiveService : IHiveService { 34 31 private static List<Job> jobs; 35 32 private static List<JobData> jobDatas; 36 private static List<H euristicLab.Services.Hive.Common.DataTransfer.HiveExperiment> hiveExperiments;33 private static List<HiveExperiment> hiveExperiments; 37 34 private static List<Plugin> plugins = null; 38 35 public List<Job> ResultJobs { get; set; } 39 36 public List<JobData> ResultJobDatas { get; set; } 40 private static IEnumerable<PluginDescription> pDescs = null;37 private static List<PluginDescription> pDescs = null; 41 38 private static int cnt = 0; 42 39 … … 82 79 } 83 80 84 hiveExperiments = new List<H euristicLab.Services.Hive.Common.DataTransfer.HiveExperiment>();85 hiveExperiments.Add(new H euristicLab.Services.Hive.Common.DataTransfer.HiveExperiment() { Id = Guid.NewGuid(), Name = "Hive Exp 1", Description = "", RootJobId = jobs[0].Id });81 hiveExperiments = new List<HiveExperiment>(); 82 hiveExperiments.Add(new HiveExperiment() { Id = Guid.NewGuid(), Name = "Hive Exp 1", Description = "", RootJobId = jobs[0].Id }); 86 83 87 84 ResultJobDatas = new List<JobData>(); … … 92 89 PluginManager pm = new PluginManager(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PluginCacheServer")); 93 90 pm.DiscoverAndCheckPlugins(); 94 pDescs = pm.Plugins ;91 pDescs = pm.Plugins.ToList(); 95 92 plugins = new List<Plugin>(); 96 93 foreach (PluginDescription d in pDescs) { … … 106 103 107 104 #region Job Methods 108 public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> slaveGroupIds) {105 public Guid AddJob(Job job, JobData jobData, List<Guid> slaveGroupIds) { 109 106 job.Id = Guid.NewGuid(); 110 107 jobData.JobId = job.Id; … … 136 133 } 137 134 138 public IEnumerable<Job> GetJobs() {135 public List<Job> GetJobs() { 139 136 return jobs; 140 137 } 141 138 142 public IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds) {143 return jobs.Select(j => new LightweightJob(j)) ; // not real144 } 145 146 public IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {147 return jobs.Where(j => j.ParentJobId.HasValue).Select(j => new LightweightJob(j)) ;139 public List<LightweightJob> GetLightweightJobs(List<Guid> jobIds) { 140 return jobs.Select(j => new LightweightJob(j)).ToList(); // not real 141 } 142 143 public List<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { 144 return jobs.Where(j => j.ParentJobId.HasValue).Select(j => new LightweightJob(j)).ToList(); 148 145 } 149 146 … … 196 193 197 194 #region HiveExperiment Methods 198 public H euristicLab.Services.Hive.Common.DataTransfer.HiveExperiment GetHiveExperiment(Guid id) {195 public HiveExperiment GetHiveExperiment(Guid id) { 199 196 return hiveExperiments.Where(he => he.Id == id).SingleOrDefault(); 200 197 } 201 198 202 public IEnumerable<HeuristicLab.Services.Hive.Common.DataTransfer.HiveExperiment> GetHiveExperiments() {199 public List<HiveExperiment> GetHiveExperiments() { 203 200 return hiveExperiments; 204 201 } 205 202 206 public Guid AddHiveExperiment(H euristicLab.Services.Hive.Common.DataTransfer.HiveExperiment hiveExperimentDto) {203 public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) { 207 204 hiveExperimentDto.Id = Guid.NewGuid(); 208 205 hiveExperiments.Add(hiveExperimentDto); … … 210 207 } 211 208 212 public void UpdateHiveExperiment(H euristicLab.Services.Hive.Common.DataTransfer.HiveExperiment hiveExperimentDto) {209 public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) { 213 210 // do nothing 214 211 } … … 220 217 221 218 #region Login Methods 222 public void Hello( HeuristicLab.Services.Hive.Common.DataTransfer.Slave slaveInfo) {219 public void Hello(Slave slaveInfo) { 223 220 // do nothing 224 221 } … … 257 254 } 258 255 259 public IEnumerable<Plugin> GetPlugins() {256 public List<Plugin> GetPlugins() { 260 257 if (plugins == null) 261 258 plugins = ReadPluginsFromServerCache(); … … 263 260 } 264 261 265 public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) {262 public List<PluginData> GetPluginDatas(List<Guid> pluginIds) { 266 263 List<PluginData> pluginDatas = new List<PluginData>(); 267 264 … … 286 283 287 284 #region Slave Methods 288 public Guid AddSlave(S ervices.Hive.Common.DataTransfer.Slave slave) {285 public Guid AddSlave(Slave slave) { 289 286 throw new NotImplementedException(); 290 287 } … … 294 291 } 295 292 296 public S ervices.Hive.Common.DataTransfer.Slave GetSlave(Guid slaveId) {293 public Slave GetSlave(Guid slaveId) { 297 294 throw new NotImplementedException(); 298 295 } … … 302 299 } 303 300 304 public IEnumerable<Services.Hive.Common.DataTransfer.Slave> GetSlaves() {305 throw new NotImplementedException(); 306 } 307 308 public IEnumerable<SlaveGroup> GetSlaveGroups() {309 throw new NotImplementedException(); 310 } 311 312 public void UpdateSlave(S ervices.Hive.Common.DataTransfer.Slave slave) {301 public List<Slave> GetSlaves() { 302 throw new NotImplementedException(); 303 } 304 305 public List<SlaveGroup> GetSlaveGroups() { 306 throw new NotImplementedException(); 307 } 308 309 public void UpdateSlave(Slave slave) { 313 310 throw new NotImplementedException(); 314 311 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockJob.cs
r5450 r5599 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 30 31 namespace HeuristicLab.Clients.Hive.Slave .Tests {31 namespace HeuristicLab.Clients.Hive.SlaveCore.Tests { 32 32 [Item("Mock Job", "Represents mocked Job which just SpinWaits.")] 33 33 [StorableClass] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockServiceLocator.cs
r5526 r5599 21 21 22 22 using System; 23 using HeuristicLab.Services.Hive.Common.ServiceContracts;24 23 25 namespace HeuristicLab.Clients.Hive.Slave .Tests {24 namespace HeuristicLab.Clients.Hive.SlaveCore.Tests { 26 25 public class MockServiceLocator : IServiceLocator { 27 26 private MockHiveService service; … … 38 37 set { password = value; } 39 38 } 40 39 41 40 public IHiveService GetService() { 42 41 if (service == null)
Note: See TracChangeset
for help on using the changeset viewer.