Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Tests/ExperimentManagerTests.cs @ 5404

Last change on this file since 5404 was 5404, checked in by cneumuel, 13 years ago

#1233

  • changed the workflow of aquireing a new job from server.
    • if a job is available for calculation, the slave receives the jobId already with the heartbeats. The job is then exclusively assigned to this slave.
  • extended the metainfo for a slave by OperatingSystem and CpuArchitecture
  • enhanced the way plugin-dependencies are discovered by using the types used by XmlGenerator. Now only mimimum amount of plugins are transferred.
  • selection of waiting jobs now consideres assigned slave-group
  • more unit tests for service
  • added unit tests for experiment manager
File size: 2.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Linq;
24using HeuristicLab.Services.Hive.Common.ServiceContracts;
25using Microsoft.VisualStudio.TestTools.UnitTesting;
26using HeuristicLab.Clients.Hive.Slave.Tests;
27using HeuristicLab.Clients.Hive.Jobs;
28using HeuristicLab.Algorithms.GeneticAlgorithm;
29using HeuristicLab.Problems.TestFunctions;
30using HeuristicLab.Optimization;
31using HeuristicLab.Core;
32using System.Threading;
33using HeuristicLab.PluginInfrastructure.Manager;
34using System.IO;
35using System.Reflection;
36
37namespace HeuristicLab.Clients.Hive.Tests {
38  [TestClass]
39  public class ExperimentManagerTests {
40
41
42    [ClassInitialize]
43    public static void MyClassInitialize(TestContext testContext) {
44      //PluginLoader.pluginAssemblies.Any();
45      ServiceLocator.Instance = new MockServiceLocator();
46    }
47   
48    [TestMethod]
49    public void TestExperimentUpload() {
50      HiveExperimentClient hec = new HiveExperimentClient();
51      var optimizer = CreateOptimizer();
52      hec.HiveJob = new HiveJob(optimizer);
53
54      hec.Start();
55
56      while (hec.ExecutionState != ExecutionState.Stopped) {
57        Thread.Sleep(500);
58      }
59
60    }
61
62    private IOptimizer CreateOptimizer() {
63      var ga = new GeneticAlgorithm();
64      ga.Engine = new SequentialEngine.SequentialEngine();
65      ga.Problem = new SingleObjectiveTestFunctionProblem();
66      return ga;
67    }
68
69  }
70}
Note: See TracBrowser for help on using the repository browser.