Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/HeuristicLab.Clients.Hive.Slave-3.4.ConsoleTests.csproj
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/HeuristicLab.Clients.Hive.Slave-3.4.ConsoleTests.csproj	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/HeuristicLab.Clients.Hive.Slave-3.4.ConsoleTests.csproj	(revision 6360)
@@ -0,0 +1,185 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{B09E8C65-8D4D-48B3-8E9A-F6FC52107261}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Clients.Hive.Slave.Tests</RootNamespace>
+    <AssemblyName>HeuristicLab.Clients.Hive.Slave-3.4.Tests</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Clients.Hive.Slave-3.4.Tests.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Release\HeuristicLab.Clients.Hive.Slave-3.4.Tests.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimizer-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Optimizer-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.TestFunctions-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.SequentialEngine-3.3">
+      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.SequentialEngine-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MockJob.cs" />
+    <Compile Include="MockPluginService.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\HeuristicLab.Clients.Hive.Slave-3.4.csproj">
+      <Project>{989FE92B-484E-41EE-87E2-6A24AF0381D8}</Project>
+      <Name>HeuristicLab.Clients.Hive.Slave-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\HeuristicLab.Clients.Hive\3.4\HeuristicLab.Clients.Hive-3.4.csproj">
+      <Project>{B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}</Project>
+      <Name>HeuristicLab.Clients.Hive-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\HeuristicLab.Hive\3.4\HeuristicLab.Hive-3.4.csproj">
+      <Project>{F98A1740-9AC9-4D36-A582-6A2D0D06978D}</Project>
+      <Name>HeuristicLab.Hive-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\HeuristicLab.Services.Hive.Common\3.4\HeuristicLab.Services.Hive.Common-3.4.csproj">
+      <Project>{14424A16-48D4-445E-80BF-DDF617548BBB}</Project>
+      <Name>HeuristicLab.Services.Hive.Common-3.4</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: anches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/PluginCache.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/PluginCache.cs	(revision 6359)
+++ 	(revision )
@@ -1,309 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Threading;
-
-namespace HeuristicLab.Clients.Hive.SlaveCore {
-  public class PluginCache {
-    private static object locker = new object();
-    private const string lastUsedFileName = "lastUsed.dat";
-
-    //maximum number of days after which a plugin gets deleted if not used
-    private const int maxAge = 5;
-
-    private static PluginCache instance = null;
-
-    public string PluginCacheDir { get; set; }
-    public string PluginTempBaseDir { get; set; }
-
-    private List<Guid> cachedPluginsGuids = new List<Guid>();
-
-    public static PluginCache Instance {
-      get {
-        if (instance == null)
-          instance = new PluginCache();
-        return instance;
-      }
-    }
-
-    public PluginCache() {
-      PluginCacheDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PluginCache");
-      PluginTempBaseDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PluginTemp");
-
-      DoUpdateRun();
-    }
-
-    /// <summary>
-    /// Returns the last directory of a path
-    /// </summary>    
-    private string GetFilenameFromPath(string path) {
-      string[] dirParts = path.Split(Path.DirectorySeparatorChar);
-      if (dirParts.Length > 0) {
-        string fileGuid = dirParts[dirParts.Length - 1];
-        return fileGuid;
-      } else
-        return "";
-    }
-
-    private void DoUpdateRun() {
-      SafelyCreateDirectory(PluginCacheDir);
-      lock (cachedPluginsGuids) {
-        cachedPluginsGuids.Clear();
-        foreach (string dir in Directory.EnumerateDirectories(PluginCacheDir)) {
-          cachedPluginsGuids.Add(Guid.Parse(GetFilenameFromPath(dir)));
-        }
-      }
-    }
-
-    public void CopyPluginsForJob(List<Plugin> requests, Guid jobId, out string configFileName) {
-      configFileName = string.Empty;
-      String targetDir = Path.Combine(PluginTempBaseDir, jobId.ToString());
-
-      RecreateDirectory(targetDir);
-
-      foreach (Plugin requestedPlugin in requests) {
-        var filePaths = GetPluginFilePaths(requestedPlugin.Id);
-        foreach (string filePath in filePaths) {
-          File.Copy(filePath, Path.Combine(targetDir, Path.GetFileName(filePath)));
-        }
-
-        if (requestedPlugin.Name == "Configuration") {
-          configFileName = Path.Combine(targetDir, Path.GetFileName(filePaths.SingleOrDefault())); // configuration plugin consists only of 1 file (usually the "HeuristicLab X.X.exe.config")
-        }
-      }
-
-      // copy files from PluginInfrastructure (which are not declared in any plugins)
-      string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
-      CopyFile(baseDir, targetDir, "HeuristicLab.PluginInfrastructure-3.3.dll");
-      CopyFile(baseDir, targetDir, "ICSharpCode.SharpZipLib.dll");
-      CopyFile(baseDir, targetDir, "ICSharpCode.SharpZipLib License.txt");
-
-      // copy slave plugins, otherwise its not possible to register the UnhandledException handler to the appdomain        
-      CopyFile(baseDir, targetDir, "HeuristicLab.Clients.Hive.SlaveCore-3.4.dll");
-      CopyFile(baseDir, targetDir, "HeuristicLab.Clients.Hive-3.4.dll");
-      //CopyFile(baseDir, targetDir, "HeuristicLab.Services.Hive.Common-3.4.dll");
-      CopyFile(baseDir, targetDir, "HeuristicLab.Hive-3.4.dll");
-      CopyFile(baseDir, targetDir, "HeuristicLab.Clients.Common-3.3.dll");
-
-    }
-
-    private static DirectoryInfo RecreateDirectory(String targetDir) {
-      var di = new DirectoryInfo(targetDir);
-      if (di.Exists) Directory.Delete(targetDir, true);
-      di.Refresh();
-      while (di.Exists) {
-        Thread.Sleep(50);
-        di.Refresh();
-      }
-      return SafelyCreateDirectory(targetDir);
-    }
-
-    private static DirectoryInfo SafelyCreateDirectory(String targetDir) {
-      var di = new DirectoryInfo(targetDir);
-      if (!di.Exists) {
-        di = Directory.CreateDirectory(targetDir);
-        while (!di.Exists) {
-          Thread.Sleep(50);
-          di.Refresh();
-        }
-      }
-      return di;
-    }
-
-    private void CopyFile(string baseDir, string targetDir, string fileName) {
-      if (!File.Exists(Path.Combine(targetDir, fileName))) File.Copy(Path.Combine(baseDir, fileName), Path.Combine(targetDir, fileName));
-    }
-
-    /// <summary>
-    /// Updates the plugin cache with missing plugins and 
-    /// then copies the required plugins for the job.
-    /// </summary>        
-    internal void PreparePlugins(Job myJob, out string configFileName) {
-      lock (locker) {
-        SlaveClientCom.Instance.ClientCom.LogMessage("Fetching plugins for job " + myJob.Id);
-
-        List<Guid> missingGuids = new List<Guid>();
-        List<Plugin> neededPlugins = new List<Plugin>();
-        lock (cachedPluginsGuids) {
-          foreach (Guid pluginId in myJob.PluginsNeededIds) {
-            Plugin plugin = WcfService.Instance.GetPlugin(pluginId);
-            if (plugin != null) {
-              neededPlugins.Add(plugin);
-            }
-
-            if (!cachedPluginsGuids.Contains(pluginId)) {
-              missingGuids.Add(pluginId);
-            }
-          }
-        }
-
-        IEnumerable<PluginData> pluginDatas = WcfService.Instance.GetPluginDatas(missingGuids);
-
-        if (pluginDatas != null) {
-          foreach (PluginData pluginData in pluginDatas) {
-            string pluginDir = Path.Combine(PluginCacheDir, pluginData.PluginId.ToString());
-
-            //put all files belonging to a plugin in the same directory
-            SafelyCreateDirectory(pluginDir);
-            File.WriteAllBytes(Path.Combine(pluginDir, Path.GetFileName(pluginData.FileName)), pluginData.Data);
-          }
-
-          if (missingGuids.Count > 0) {
-            DoUpdateRun();
-          }
-          CopyPluginsForJob(neededPlugins, myJob.Id, out configFileName);
-        } else {
-          configFileName = "";
-        }
-        SlaveClientCom.Instance.ClientCom.LogMessage("Fetched " + missingGuids.Count + " plugins for job " + myJob.Id);
-      }
-    }
-
-    /// <summary>
-    /// Returns a list of files which belong to a plugin from the plugincache
-    /// </summary>
-    private IEnumerable<string> GetPluginFilePaths(Guid pluginId) {
-      string pluginPath = Path.Combine(PluginCacheDir, pluginId.ToString());
-
-      if (Directory.Exists(pluginPath)) {
-        WriteDateLastUsed(pluginPath);
-        foreach (string filePath in Directory.GetFiles(pluginPath)) {
-          string fn = Path.GetFileName(filePath);
-          if (fn != lastUsedFileName)
-            yield return filePath;
-        }
-      }
-    }
-
-    /// <summary>
-    /// creates a file in path with the current date;
-    /// this can later be used to find plugins which are outdated
-    /// </summary>    
-    private void WriteDateLastUsed(string path) {
-      FileStream fs = null;
-      try {
-        fs = new FileStream(Path.Combine(path, lastUsedFileName), FileMode.Create);
-        BinaryFormatter formatter = new BinaryFormatter();
-        formatter.Serialize(fs, DateTime.Now);
-      }
-      catch (IOException) {
-        SlaveClientCom.Instance.ClientCom.LogMessage(string.Format("No used date written in path {0}.", path));
-      }
-      catch (SerializationException) {
-        //rethrow...
-        throw;
-      }
-      finally {
-        if (fs != null) {
-          fs.Close();
-        }
-      }
-    }
-
-    /// <summary>
-    /// Checks the PluginTemp directory for orphaned directories and deletes them.
-    /// This should be only called if no jobs are currently running.
-    /// </summary>    
-    public void CleanPluginTemp() {
-      if (Directory.Exists(PluginTempBaseDir)) {
-        foreach (string dir in Directory.EnumerateDirectories(PluginTempBaseDir)) {
-          try {
-            SlaveClientCom.Instance.ClientCom.LogMessage("Deleting orphaned directory " + dir);
-            Directory.Delete(dir, true);
-          }
-          catch (Exception ex) {
-            SlaveClientCom.Instance.ClientCom.LogMessage("Error cleaning up PluginTemp directory " + dir + ": " + ex.ToString());
-          }
-        }
-      }
-    }
-
-    /// <summary>
-    /// checks the pluginCacheDirectory and deletes plugin folders which are not used anymore
-    /// </summary>    
-    private void CleanPluginCache() {
-      FileStream fs = null;
-      DateTime luDate;
-      bool changed = false;
-
-      if (Directory.Exists(PluginCacheDir)) {
-        lock (locker) {
-          foreach (string dir in Directory.EnumerateDirectories(PluginCacheDir)) {
-            try {
-              fs = new FileStream(Path.Combine(dir, lastUsedFileName), FileMode.Open);
-              BinaryFormatter formatter = new BinaryFormatter();
-              luDate = (DateTime)formatter.Deserialize(fs);
-              fs.Close();
-
-              if (luDate.AddDays(maxAge) < DateTime.Now) {
-                Directory.Delete(dir, true);
-                changed = true;
-              }
-            }
-            catch (FileNotFoundException) {
-              //nerver used
-              Directory.Delete(dir, true);
-              changed = true;
-            }
-            catch (Exception ex) {
-              if (fs != null) {
-                fs.Close();
-              }
-              SlaveClientCom.Instance.ClientCom.LogMessage(string.Format("CleanPluginCache threw exception: {0}", ex.ToString()));
-            }
-          }
-
-          if (changed)
-            DoUpdateRun();
-        }
-      }
-    }
-
-    internal void DeletePluginsForJob(Guid id) {
-      try {
-        SlaveClientCom.Instance.ClientCom.LogMessage("Deleting plugins...");
-        int tries = 5;
-        while (tries > 0) {
-          try {
-            Directory.Delete(Path.Combine(PluginTempBaseDir, id.ToString()), true);
-            tries = 0;
-          }
-          catch (Exception e) {
-            Thread.Sleep(1000);
-            tries--;
-            if (tries == 0) throw;// TODO: don't know what to do
-          }
-        }
-      }
-      catch (Exception ex) {
-        SlaveClientCom.Instance.ClientCom.LogMessage("failed while unloading " + id + " with exception " + ex);
-      }
-      CleanPluginCache();
-    }
-  }
-}
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/HeuristicLab.Clients.Hive.Slave-3.4.Tests.csproj
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/HeuristicLab.Clients.Hive.Slave-3.4.Tests.csproj	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/HeuristicLab.Clients.Hive.Slave-3.4.Tests.csproj	(revision 6360)
@@ -0,0 +1,417 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>
+    </ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{C4CBD11E-1B83-464A-B0AD-0DC0FF7E57AA}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.Clients.Hive.SlaveCore.Tests</RootNamespace>
+    <AssemblyName>HeuristicLab.Clients.Hive.Slave.Tests-3.4</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Clients.Hive.Slave.Tests-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Release\HeuristicLab.Clients.Hive.Slave.Tests-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <PropertyGroup>
+    <StartupObject />
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ALGLIB-3.1.0">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\ALGLIB-3.1.0.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.ProtocolBuffers-0.9.1">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\Google.ProtocolBuffers-0.9.1.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.ALGLIB-3.1.0">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.ALGLIB-3.1.0.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.DataAnalysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.DataAnalysis.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.DataAnalysis.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.EvolutionStrategy-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.EvolutionStrategy-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.LocalSearch-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.LocalSearch-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.SimulatedAnnealing-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.SimulatedAnnealing-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Algorithms.TabuSearch-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Algorithms.TabuSearch-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Analysis.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Clients.Common-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Clients.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.CodeEditor-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.CodeEditor-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Collections-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Common.Resources-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Common.Resources-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Core.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Core.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Data.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Data.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.PermutationEncoding.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.PermutationEncoding.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.RealVectorEncoding-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.RealVectorEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.LibSVM-1.6.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.LibSVM-1.6.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.log4net-1.2.10.0">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.log4net-1.2.10.0.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.MainForm-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Netron-3.0.2672.12446">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Netron-3.0.2672.12446.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators.Programmable-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators.Programmable-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Operators.Views.GraphVisualization-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators.Views.GraphVisualization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Operators-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimization.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Optimizer-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimizer-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Parameters.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Persistence.GUI-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence.GUI-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.ArtificialAnt-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ArtificialAnt-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.ArtificialAnt.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ArtificialAnt.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Classification-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Classification-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Classification.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Classification.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Regression-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Regression-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.ExternalEvaluation-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ExternalEvaluation-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.ExternalEvaluation.GP-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ExternalEvaluation.GP-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.ExternalEvaluation.GP.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ExternalEvaluation.GP.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.ExternalEvaluation.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.ExternalEvaluation.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Knapsack-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.Knapsack-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Knapsack.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.Knapsack.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.OneMax-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.OneMax-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.OneMax.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.OneMax.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.TestFunctions-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.TestFunctions.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TestFunctions.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.TravelingSalesman-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TravelingSalesman-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.TravelingSalesman.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.TravelingSalesman.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.VehicleRouting-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.VehicleRouting-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.VehicleRouting.Views-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.VehicleRouting.Views-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.ProtobufCS-0.9.1">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.ProtobufCS-0.9.1.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Random-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Selection-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Selection-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.SequentialEngine-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.SequentialEngine-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.SharpDevelop-3.1.1.5327">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.SharpDevelop-3.1.1.5327.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Tracing-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Tracing-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
+    </Reference>
+    <Reference Include="HeuristicLab.WinFormsUI-2.3.1">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.WinFormsUI-2.3.1.dll</HintPath>
+    </Reference>
+    <Reference Include="ICSharpCode.NRefactory">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\ICSharpCode.NRefactory.dll</HintPath>
+    </Reference>
+    <Reference Include="ICSharpCode.SharpDevelop.Dom">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\ICSharpCode.SharpDevelop.Dom.dll</HintPath>
+    </Reference>
+    <Reference Include="ICSharpCode.SharpZipLib">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\ICSharpCode.SharpZipLib.dll</HintPath>
+    </Reference>
+    <Reference Include="ICSharpCode.TextEditor">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\ICSharpCode.TextEditor.dll</HintPath>
+    </Reference>
+    <Reference Include="LibSVM-1.6.3">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\LibSVM-1.6.3.dll</HintPath>
+    </Reference>
+    <Reference Include="log4net">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+    <Reference Include="Mono.Cecil">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\Mono.Cecil.dll</HintPath>
+    </Reference>
+    <Reference Include="Netron.Diagramming.Core-3.0.2672.12446">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\Netron.Diagramming.Core-3.0.2672.12446.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.ServiceModel" />
+    <Reference Include="WeifenLuo.WinFormsUI.Docking-2.3.1">
+      <HintPath>C:\Program Files\HeuristicLab 3.3\WeifenLuo.WinFormsUI.Docking-2.3.1.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Mocks\MockHiveService.cs" />
+    <Compile Include="Mocks\MockJob.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Mocks\MockServiceLocator.cs" />
+    <Compile Include="SlaveTest.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4\HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4.csproj">
+      <Project>{464D70B8-2D91-485C-B622-22E4A4891C68}</Project>
+      <Name>HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Clients.Hive.Slave\3.4\HeuristicLab.Clients.Hive.Slave-3.4.csproj">
+      <Project>{989FE92B-484E-41EE-87E2-6A24AF0381D8}</Project>
+      <Name>HeuristicLab.Clients.Hive.Slave-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Clients.Hive\3.4\HeuristicLab.Clients.Hive-3.4.csproj">
+      <Project>{B5EF1E5A-9F3D-40B9-B4B0-30AADF2E2CEB}</Project>
+      <Name>HeuristicLab.Clients.Hive-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Hive\3.4\HeuristicLab.Hive-3.4.csproj">
+      <Project>{F98A1740-9AC9-4D36-A582-6A2D0D06978D}</Project>
+      <Name>HeuristicLab.Hive-3.4</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Services.Hive\3.4\HeuristicLab.Services.Hive-3.4.csproj">
+      <Project>{CF9DA321-AC1B-4FD3-9EC3-67BC6B861BDE}</Project>
+      <Name>HeuristicLab.Services.Hive-3.4</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockHiveService.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockHiveService.cs	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockHiveService.cs	(revision 6360)
@@ -0,0 +1,384 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.PluginInfrastructure.Manager;
+
+namespace HeuristicLab.Clients.Hive.SlaveCore.Tests {
+  internal class MockHiveService : IHiveService {
+    private static List<Job> jobs;
+    private static List<JobData> jobDatas;
+    private static List<HiveExperiment> hiveExperiments;
+    private static List<Plugin> plugins = null;
+    public List<Job> ResultJobs { get; set; }
+    public List<JobData> ResultJobDatas { get; set; }
+    private static List<PluginDescription> pDescs = null;
+    private static int cnt = 0;
+
+    public List<List<MessageContainer>> Messages { get; set; }
+    public static string ServerPluginCachePath { get; set; }
+    public static string ServerConfigFilePath { get; set; }
+
+    static MockHiveService() {
+      ServerPluginCachePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PluginCacheServer");
+      ServerConfigFilePath = Path.Combine(ServerPluginCachePath, "HeuristicLab 3.3.exe.config");
+
+      if (plugins == null)
+        plugins = ReadPluginsFromServerCache();
+
+
+      //TODO: reuse as fallback?
+      /*jobs = new List<Job>();
+      jobs.Add(new Job { Id = Guid.NewGuid(), JobState = JobState.Waiting, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 0 });
+      jobs.Add(new Job { Id = Guid.NewGuid(), JobState = JobState.Offline, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 100, ParentJobId = jobs.First().Id });
+      jobs.Add(new Job { Id = Guid.NewGuid(), JobState = JobState.Offline, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 1024, ParentJobId = jobs.First().Id });
+      jobs.Add(new Job { Id = Guid.NewGuid(), JobState = JobState.Offline, DateCreated = DateTime.Now, CoresNeeded = 1, MemoryNeeded = 4096, ParentJobId = jobs.First().Id });
+      byte[] data = PersistenceUtil.Serialize(new MockJob(400, false));
+      jobDatas = new List<JobData>();
+      foreach (var job in jobs) {
+        job.PluginsNeededIds = new List<Guid>();
+        job.PluginsNeededIds.AddRange(plugins.Select(a => a.Id));
+        jobDatas.Add(new JobData() { JobId = job.Id, Data = data });
+      }
+
+      hiveExperiments = new List<HeuristicLab.Services.Hive.Common.DataTransfer.HiveExperiment>();
+      hiveExperiments.Add(new HeuristicLab.Services.Hive.Common.DataTransfer.HiveExperiment() { Id = Guid.NewGuid(), Name = "Hive Exp 1", Description = "", RootJobId = jobs[0].Id });*/
+    }
+
+    public void UpdateJobs(List<Job> js, MockJob m) {
+      jobs = js;
+      byte[] data = PersistenceUtil.Serialize(m);
+
+      jobDatas = new List<JobData>();
+      foreach (var job in jobs) {
+        job.PluginsNeededIds = new List<Guid>();
+        job.PluginsNeededIds.AddRange(plugins.Select(a => a.Id));
+        jobDatas.Add(new JobData() { JobId = job.Id, Data = data });
+      }
+
+      hiveExperiments = new List<HiveExperiment>();
+      hiveExperiments.Add(new HiveExperiment() { Id = Guid.NewGuid(), Name = "Hive Exp 1", Description = "" });
+
+      ResultJobDatas = new List<JobData>();
+      ResultJobs = new List<Job>();
+    }
+
+    private static List<Plugin> ReadPluginsFromServerCache() {
+      var pm = new HeuristicLab.PluginInfrastructure.Manager.PluginManager(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PluginCacheServer"));
+      pm.DiscoverAndCheckPlugins();
+      pDescs = pm.Plugins.ToList();
+      plugins = new List<Plugin>();
+      foreach (PluginDescription d in pDescs) {
+        Plugin p = new Plugin();
+        p.Name = d.Name;
+        p.Version = d.Version;
+        p.Id = Guid.NewGuid();
+        plugins.Add(p);
+
+      }
+      return plugins;
+    }
+
+    #region Job Methods
+    public Guid AddJob(Job job, JobData jobData, List<Guid> slaveGroupIds) {
+      job.Id = Guid.NewGuid();
+      jobData.JobId = job.Id;
+      jobs.Add(job);
+      jobDatas.Add(jobData);
+      return job.Id;
+    }
+
+    public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) {
+      job.Id = Guid.NewGuid();
+      job.ParentJobId = parentJobId;
+      jobData.JobId = job.Id;
+      jobs.Add(job);
+      jobDatas.Add(jobData);
+      return job.Id;
+    }
+
+    public PluginData GetConfigurationFile() {
+      byte[] cf = File.ReadAllBytes(ServerConfigFilePath);
+      PluginData pd = new PluginData();
+      pd.Data = cf;
+      return pd;
+
+    }
+
+    public Job GetJob(Guid jobId) {
+      //MockHBM.SendHeartbeat();
+      return jobs.Where(j => j.Id == jobId).SingleOrDefault();
+    }
+
+    public List<Job> GetJobs() {
+      return jobs;
+    }
+
+    public List<LightweightJob> GetLightweightJobs(List<Guid> jobIds) {
+      return jobs.Select(j => new LightweightJob(j)).ToList(); // not real
+    }
+
+    public List<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {
+      return jobs.Where(j => j.ParentJobId.HasValue).Select(j => new LightweightJob(j)).ToList();
+    }
+
+    public List<LightweightJob> GetLightweightExperimentJobs(Guid experimentId) {
+      throw new NotImplementedException();
+    }
+
+    public JobData GetJobData(Guid jobId) {
+      JobData ret = jobDatas.Where(jd => jd.JobId == jobId).SingleOrDefault();
+      //MockHBM.SendHeartbeat();
+      return ret;
+    }
+
+    public void UpdateJob(Job jobDto) {
+      Console.WriteLine("Update Job called!");
+      ResultJobs.Add(jobDto);
+    }
+
+    public void UpdateJobData(Job jobDto, JobData jobDataDto) {
+      Console.WriteLine("Update JobData called!");
+      ResultJobDatas.Add(jobDataDto);
+      ResultJobs.Add(jobDto);
+    }
+
+    public void DeleteJob(Guid jobId) {
+      // do nothing
+    }
+
+    public void DeleteChildJobs(Guid parentJobId) {
+      // do nothing
+    }
+
+    public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) {
+      throw new NotImplementedException();
+    }
+    #endregion
+
+    #region JobControl Methods
+    int curJobIdx = 0;
+    public Job AquireJob(Guid slaveId) {
+      if (curJobIdx < jobs.Count) {
+        var job = jobs[curJobIdx];
+        // job.SlaveId = slaveId; // commented out because of change to StateLog
+        curJobIdx++;
+        return job;
+      }
+      throw new Exception("No Jobs left on MockHiveService!");
+    }
+
+    public void StopJob(Guid jobId) {
+      // do nothing
+    }
+
+    public void PauseJob(Guid jobId) {
+      // do nothing
+    }
+
+    public void RestartJob(Guid jobId) {
+      // do nothing
+    }
+    #endregion
+
+    #region HiveExperiment Methods
+    public HiveExperiment GetHiveExperiment(Guid id) {
+      return hiveExperiments.Where(he => he.Id == id).SingleOrDefault();
+    }
+
+    public List<HiveExperiment> GetHiveExperiments() {
+      return hiveExperiments;
+    }
+
+    public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) {
+      hiveExperimentDto.Id = Guid.NewGuid();
+      hiveExperiments.Add(hiveExperimentDto);
+      return hiveExperimentDto.Id;
+    }
+
+    public List<HiveExperiment> GetAllHiveExperiments() {
+      return hiveExperiments;
+    }
+
+    public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) {
+      // do nothing
+    }
+
+    public void DeleteHiveExperiment(Guid hiveExperimentId) {
+      // do nothing
+    }
+    #endregion
+
+    #region Login Methods
+    public void Hello(Slave slaveInfo) {
+      // do nothing
+    }
+
+    public void GoodBye(Guid id) {
+      // do nothing      
+    }
+
+    public List<MessageContainer> Heartbeat(Heartbeat heartbeat) {
+      if (Messages != null && cnt < Messages.Count) {
+        return Messages[cnt++];
+      } else {
+        return new List<MessageContainer>();
+      }
+    }
+
+    public Guid GetResourceId(string resourceName) {
+      // todo
+      return Guid.Empty;
+    }
+
+    #endregion
+
+    #region Plugin Methods
+    public Guid AddPlugin(Plugin p, List<PluginData> pds) {
+      /*p.Id = Guid.NewGuid();
+      plugins.Add(p);
+      foreach (var pluginData in pds) {
+        pluginData.PluginId = p.Id;
+        pluginDatas.Add(pluginData);
+
+      }
+      return p.Id;*/
+      throw new NotImplementedException();
+
+    }
+
+    public Plugin GetPlugin(Guid pluginId) {
+      if (plugins == null)
+        plugins = ReadPluginsFromServerCache();
+      return plugins.SingleOrDefault(x => x.Id == pluginId);
+    }
+
+    public List<Plugin> GetPlugins() {
+      if (plugins == null)
+        plugins = ReadPluginsFromServerCache();
+      return plugins;
+    }
+
+    public List<PluginData> GetPluginDatas(List<Guid> pluginIds) {
+      List<PluginData> pluginDatas = new List<PluginData>();
+
+      foreach (Guid guid in pluginIds) {
+        Plugin plugin = plugins.Find(p => p.Id == guid);
+        if (plugin != null) {
+          PluginDescription desc = pDescs.First(p => p.Name == plugin.Name && p.Version == plugin.Version);
+          if (desc != null) {
+            foreach (IPluginFile file in desc.Files) {
+              PluginData data = new PluginData();
+              data.PluginId = guid;
+              data.Data = File.ReadAllBytes(file.Name);
+              data.FileName = file.Name;
+              pluginDatas.Add(data);
+            }
+          }
+        }
+      }
+      return pluginDatas;
+    }
+    #endregion
+
+    #region Slave Methods
+    public Guid AddSlave(Slave slave) {
+      throw new NotImplementedException();
+    }
+
+    public Guid AddSlaveGroup(SlaveGroup slaveGroup) {
+      throw new NotImplementedException();
+    }
+
+    public Slave GetSlave(Guid slaveId) {
+      throw new NotImplementedException();
+    }
+
+    public SlaveGroup GetSlaveGroup(Guid slaveGroupId) {
+      throw new NotImplementedException();
+    }
+
+    public List<Slave> GetSlaves() {
+      throw new NotImplementedException();
+    }
+
+    public List<SlaveGroup> GetSlaveGroups() {
+      throw new NotImplementedException();
+    }
+
+    public void UpdateSlave(Slave slave) {
+      throw new NotImplementedException();
+    }
+
+    public void UpdateSlaveGroup(SlaveGroup slaveGroup) {
+      throw new NotImplementedException();
+    }
+
+    public void DeleteSlave(Guid slaveId) {
+      throw new NotImplementedException();
+    }
+
+    public void DeleteSlaveGroup(Guid slaveGroupId) {
+      throw new NotImplementedException();
+    }
+
+    public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) {
+      throw new NotImplementedException();
+    }
+
+    public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) {
+      throw new NotImplementedException();
+    }
+    #endregion
+
+    #region Lifecycle Methods
+    public void TriggerLifecycle(bool force) {
+      throw new NotImplementedException();
+    }
+    #endregion
+    #region Appointment Methods
+    public Guid AddAppointment(Appointment appointment) {
+      throw new NotImplementedException();
+    }
+
+    public void DeleteAppointment(Guid appointmentId) {
+      throw new NotImplementedException();
+    }
+
+    public void UpdateAppointment(Appointment appointment) {
+      throw new NotImplementedException();
+    }
+
+    public List<Appointment> GetScheduleForResource(Guid resourceId) {
+      throw new NotImplementedException();
+    }
+    #endregion
+
+
+    public List<Job> GetJobsByResourceId(Guid resourceId) {
+      throw new NotImplementedException();
+    }
+  }
+}
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockJob.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockJob.cs	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockJob.cs	(revision 6360)
@@ -0,0 +1,221 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Threading;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Hive;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Clients.Hive.SlaveCore.Tests {
+  [Item("Mock Job", "Represents mocked Job which just SpinWaits.")]
+  [StorableClass]
+  public class MockJob : NamedItem, IJob {
+    public virtual bool IsParallelizable {
+      get { return false; }
+    }
+
+    [Storable]
+    protected bool computeInParallel;
+    public bool ComputeInParallel {
+      get { return computeInParallel; }
+      set {
+        if (computeInParallel != value) {
+          computeInParallel = value;
+          OnComputeInParallelChanged();
+        }
+      }
+    }
+
+    [Storable]
+    private int indexInParentOptimizerList = -1;
+    public int IndexInParentOptimizerList {
+      get { return indexInParentOptimizerList; }
+      set { this.indexInParentOptimizerList = value; }
+    }
+
+    [Storable]
+    private bool collectChildJobs;
+    public bool CollectChildJobs {
+      get { return collectChildJobs; }
+      set { collectChildJobs = value; }
+    }
+
+    private int ms = 1000; //ms
+    private bool spinWait;
+    public MockJob(int ms, bool spinWait) {
+      this.ms = ms;
+      this.spinWait = spinWait;
+    }
+    public MockJob() { }
+    [StorableConstructor]
+    protected MockJob(bool deserializing) { }
+    protected MockJob(MockJob original, Cloner cloner)
+      : base(original, cloner) {
+      this.ComputeInParallel = original.ComputeInParallel;
+      this.IndexInParentOptimizerList = original.IndexInParentOptimizerList;
+      this.CollectChildJobs = original.CollectChildJobs;
+      this.ExecutionTime = original.executionTime;
+      this.ExecutionState = original.executionState;
+      this.ms = original.ms;
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MockJob(this, cloner);
+    }
+
+    [Storable]
+    private ExecutionState executionState;
+    public virtual ExecutionState ExecutionState {
+      get { return executionState; }
+      set {
+        if (executionState != value) {
+          this.executionState = value;
+          OnExecutionStateChanged();
+        }
+      }
+    }
+
+    [Storable]
+    private TimeSpan executionTime;
+    public TimeSpan ExecutionTime {
+      get { return executionTime; }
+      set {
+        if (executionTime != value) {
+          executionTime = value;
+          OnExecutionTimeChanged();
+        }
+      }
+    }
+
+    public virtual void Prepare() {
+      this.ExecutionState = HeuristicLab.Core.ExecutionState.Prepared;
+    }
+
+    public virtual void Start() {
+      new Thread(Run).Start();
+    }
+
+    private void Run() {
+      try {
+        if (spinWait) {
+          Stopwatch watch = new Stopwatch();
+          watch.Start();
+          OnJobStarted();
+          do {
+            Thread.SpinWait(1000);
+          } while (watch.ElapsedMilliseconds < ms);
+          watch.Stop();
+        } else {
+          Thread.Sleep(ms);
+        }
+        Stop();
+        OnJobStopped();
+      }
+      catch (ThreadAbortException) {
+        //this happens when the appdomain is killed (e.g. abort from server)
+        Stop();
+      }
+      catch (Exception e) {
+        this.ExecutionState = HeuristicLab.Core.ExecutionState.Stopped;
+        OnJobFailed(e);
+      }
+    }
+
+    public virtual void Pause() {
+      this.ExecutionState = HeuristicLab.Core.ExecutionState.Paused;
+    }
+
+    public virtual void Stop() {
+      ExecutionState = HeuristicLab.Core.ExecutionState.Stopped;
+    }
+
+    public virtual void Resume(IEnumerable<IJob> childJobs) {
+      ExecutionState = HeuristicLab.Core.ExecutionState.Stopped;
+    }
+
+    #region Events
+    public event EventHandler<EventArgs<IJob>> NewChildJob;
+    protected virtual void OnNewChildJob(IJob job) {
+      EventHandler<EventArgs<IJob>> handler = NewChildJob;
+      if (handler != null) handler(this, new EventArgs<IJob>(job));
+    }
+
+    public event EventHandler WaitForChildJobs;
+    protected virtual void OnWaitForChildJobs() {
+      EventHandler handler = WaitForChildJobs;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+
+    public event EventHandler DeleteChildJobs;
+    protected virtual void OnDeleteChildJobs() {
+      EventHandler handler = DeleteChildJobs;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+
+    public event EventHandler ComputeInParallelChanged;
+    protected virtual void OnComputeInParallelChanged() {
+      EventHandler handler = ComputeInParallelChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+
+    public event EventHandler ExecutionTimeChanged;
+    protected virtual void OnExecutionTimeChanged() {
+      EventHandler handler = ExecutionTimeChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+
+    public event EventHandler ExecutionStateChanged;
+    protected virtual void OnExecutionStateChanged() {
+      EventHandler handler = ExecutionStateChanged;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+
+    public event EventHandler JobStarted;
+    protected virtual void OnJobStarted() {
+      EventHandler handler = JobStarted;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+
+    public event EventHandler JobFailed;
+    protected virtual void OnJobFailed(Exception e) {
+      EventHandler handler = JobFailed;
+      EventArgs<Exception> ev = new EventArgs<Exception>(e);
+      if (handler != null) handler(this, ev);
+    }
+
+    public event EventHandler JobStopped;
+    protected virtual void OnJobStopped() {
+      EventHandler handler = JobStopped;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+
+    public event EventHandler JobPaused;
+    protected virtual void OnJobPaused() {
+      EventHandler handler = JobPaused;
+      if (handler != null) handler(this, EventArgs.Empty);
+    }
+    #endregion
+
+  }
+}
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockServiceLocator.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockServiceLocator.cs	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Mocks/MockServiceLocator.cs	(revision 6360)
@@ -0,0 +1,54 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+
+namespace HeuristicLab.Clients.Hive.SlaveCore.Tests {
+  public class MockServiceLocator : IServiceLocator {
+    private MockHiveService service;
+
+    private string username;
+    public string Username {
+      get { return username; }
+      set { username = value; }
+    }
+
+    private string password;
+    public string Password {
+      get { return password; }
+      set { password = value; }
+    }
+
+    public IHiveService GetService() {
+      if (service == null)
+        service = new MockHiveService();
+      return service;
+    }
+
+    public void CallHiveService(Action<IHiveService> call) {
+      call(GetService());
+    }
+
+    public T CallHiveService<T>(Func<IHiveService, T> call) {
+      return call(GetService());
+    }
+  }
+}
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Properties/AssemblyInfo.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Properties/AssemblyInfo.cs	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/Properties/AssemblyInfo.cs	(revision 6360)
@@ -0,0 +1,35 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Clients.Hive.Slave.Tests-3.4")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("HeuristicLab.Clients.Hive.Slave.Tests-3.4")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("04d855b9-91ac-4519-bb88-2915c983aef9")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/SlaveTest.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/SlaveTest.cs	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/SlaveTest.cs	(revision 6360)
@@ -0,0 +1,195 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Clients.Hive.SlaveCore.ConsoleClient;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace HeuristicLab.Clients.Hive.SlaveCore.Tests {
+  [TestClass]
+  public class SlaveTest {
+    private static SlaveCommListener listener;
+
+    // Use ClassInitialize to run code before running the first test in the class
+    [ClassInitialize]
+    public static void MyClassInitialize(TestContext testContext) {
+      ServiceLocator.Instance = new MockServiceLocator();
+      /* listener = new SlaveCommListener();
+       listener.Open();*/
+    }
+
+    [ClassCleanup]
+    public static void MyClassCleanup() {
+      //listener.Close();
+    }
+
+
+    private List<List<MessageContainer>> CreateMsgsForSingleJob() {
+      List<List<MessageContainer>> allMsgs = new List<List<MessageContainer>>();
+      //get slave to fetch job
+      List<MessageContainer> msg = new List<MessageContainer>();
+      msg.Add(new MessageContainer(MessageContainer.MessageType.CalculateJob));
+      allMsgs.Add(msg);
+
+      //do nothing
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+
+      msg = new List<MessageContainer>();
+      msg.Add(new MessageContainer(MessageContainer.MessageType.ShutdownSlave));
+      allMsgs.Add(msg);
+      return allMsgs;
+    }
+
+    [TestMethod]
+    public void TestSingleJob() {
+      Job testJob = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 };
+      testJob.State = JobState.Waiting;
+      List<Job> jobList = new List<Job>();
+      jobList.Add(testJob);
+      MockJob job = new MockJob(300, false);
+
+      ServiceLocator.Instance.CallHiveService(service => {
+        MockHiveService ms = (MockHiveService)service;
+        ((MockHiveService)service).Messages = CreateMsgsForSingleJob();
+        ((MockHiveService)service).UpdateJobs(jobList, job);
+
+        HeuristicLab.Clients.Hive.SlaveCore.Core core = new SlaveCore.Core();
+        core.Start();
+
+        Assert.AreEqual<int>(1, ms.ResultJobs.Count);
+        Assert.AreEqual<Guid>(testJob.Id, ms.ResultJobs[0].Id);
+        core.Shutdown();
+      });
+    }
+
+    private List<List<MessageContainer>> CreateMsgsForShutdownSlaveWhileJobRunning() {
+      List<List<MessageContainer>> allMsgs = new List<List<MessageContainer>>();
+      //get slave to fetch job
+      List<MessageContainer> msg = new List<MessageContainer>();
+      msg.Add(new MessageContainer(MessageContainer.MessageType.CalculateJob));
+      allMsgs.Add(msg);
+
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+
+      msg = new List<MessageContainer>();
+      msg.Add(new MessageContainer(MessageContainer.MessageType.ShutdownSlave));
+      allMsgs.Add(msg);
+      return allMsgs;
+    }
+
+    [TestMethod]
+    public void TestShutdownSlaveWhileJobRunning() {
+      Job testJob = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 };
+      testJob.State = JobState.Waiting;
+      List<Job> jobList = new List<Job>();
+      jobList.Add(testJob);
+      MockJob job = new MockJob(10000, false);
+
+      ServiceLocator.Instance.CallHiveService(service => {
+        MockHiveService ms = (MockHiveService)service;
+        ((MockHiveService)service).Messages = CreateMsgsForShutdownSlaveWhileJobRunning();
+        ((MockHiveService)service).UpdateJobs(jobList, job);
+
+
+        HeuristicLab.Clients.Hive.SlaveCore.Core core = new SlaveCore.Core();
+        core.Start();
+      });
+    }
+
+
+    private List<List<MessageContainer>> CreateMsgsForTwoJobs() {
+      List<List<MessageContainer>> allMsgs = new List<List<MessageContainer>>();
+
+      //get slave to fetch jobs
+      List<MessageContainer> msg = new List<MessageContainer>();
+      msg.Add(new MessageContainer(MessageContainer.MessageType.CalculateJob));
+      allMsgs.Add(msg);
+
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+
+      msg = new List<MessageContainer>();
+      msg.Add(new MessageContainer(MessageContainer.MessageType.CalculateJob));
+      allMsgs.Add(msg);
+
+
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+      msg = new List<MessageContainer>();
+      allMsgs.Add(msg);
+
+      msg = new List<MessageContainer>();
+      msg.Add(new MessageContainer(MessageContainer.MessageType.ShutdownSlave));
+      allMsgs.Add(msg);
+      return allMsgs;
+    }
+
+    [TestMethod]
+    public void TestTwoJobs() {
+      Job testJob1 = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 };
+      testJob1.State = JobState.Waiting;
+      Job testJob2 = new Job { Id = Guid.NewGuid(), CoresNeeded = 1, MemoryNeeded = 0 };
+      testJob2.State = JobState.Waiting;
+      List<Job> jobList = new List<Job>();
+      jobList.Add(testJob1);
+      jobList.Add(testJob2);
+      MockJob job = new MockJob(2000, false);
+
+      ServiceLocator.Instance.CallHiveService(service => {
+        MockHiveService ms = (MockHiveService)service;
+        ((MockHiveService)service).Messages = CreateMsgsForTwoJobs();
+        ((MockHiveService)service).UpdateJobs(jobList, job);
+
+
+        HeuristicLab.Clients.Hive.SlaveCore.Core core = new SlaveCore.Core();
+        core.Start();
+        Assert.AreEqual<int>(2, ms.ResultJobs.Count);
+        core.Shutdown();
+      });
+    }
+  }
+}
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/app.config
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/app.config	(revision 6360)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/app.config	(revision 6360)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<configuration>
+   
+  <system.serviceModel>
+    <services>
+      <service name="HeuristicLab.Clients.Hive.SlaveCore.SlaveCommunicationService">
+        <endpoint address="net.pipe://localhost/HeuristicLabSlaveCom"
+          binding="netNamedPipeBinding" contract="HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts.ISlaveCommunication" />
+      </service>
+    </services>
+  </system.serviceModel>
+
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
