Changeset 16555


Ignore:
Timestamp:
01/24/19 19:47:53 (2 years ago)
Author:
gkronber
Message:

#2520 added a unit test to try to serialize samples which have been running for 20secs.

Location:
branches/2520_PersistenceReintegration/HeuristicLab.Tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2520_PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence.Fossil/UseCases.cs

    r16485 r16555  
    3131using HeuristicLab.Analysis;
    3232using HeuristicLab.Common;
     33using HeuristicLab.Core;
    3334using HeuristicLab.Data;
    3435using HeuristicLab.Persistence.Core;
     
    134135    [TestMethod]
    135136    [TestCategory("Persistence.Fossil")]
    136     [TestProperty("Time", "short")]
     137    [TestProperty("Time", "long")]
    137138    public void TestLoadingSamples() {
    138139      var path = @"C:\reps\hl-core\branches\2520_PersistenceReintegration\HeuristicLab.Optimizer\3.3\Documents";
     
    164165      }
    165166    }
     167    [TestMethod]
     168    [TestCategory("Persistence.Fossil")]
     169    [TestProperty("Time", "long")]
     170    public void TestLoadingRunAndStoreSamples() {
     171      var path = @"C:\reps\hl-core\branches\2520_PersistenceReintegration\HeuristicLab.Optimizer\3.3\Documents";
     172      var serializer = new ProtoBufSerializer();
     173      foreach (var fileName in Directory.EnumerateFiles(path, "*.hl")) {
     174        var original = XmlParser.Deserialize(fileName);
     175
     176        var exec = original as IExecutable;
     177        if (exec != null) {
     178          exec.Paused += (sender, e) => {
     179            serializer.Serialize(exec, fileName + "_paused.proto");
     180            Console.WriteLine("Paused File: " + fileName);
     181          };
     182          exec.Stopped += (sender, e) => {
     183            serializer.Serialize(exec, fileName + "_stopped.proto");
     184            Console.WriteLine("Stopped File: " + fileName);
     185          };
     186          var t = exec.StartAsync();
     187          System.Threading.Thread.Sleep(20000); // wait 20 secs
     188          if (exec.ExecutionState == ExecutionState.Started) { // only if not already stopped
     189            exec.Pause();
     190          }
     191        }
     192      }
     193    }
     194
    166195
    167196    [TestMethod]
  • branches/2520_PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r16539 r16555  
    116116      <HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
    117117    </Reference>
    118     <Reference Include="HEAL.Fossil, Version=1.0.1.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    119       <HintPath>..\packages\HEAL.Fossil.1.0.1\lib\netstandard2.0\HEAL.Fossil.dll</HintPath>
     118    <Reference Include="HEAL.Fossil, Version=1.0.2.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     119      <HintPath>..\packages\HEAL.Fossil.1.0.2-pre-02\lib\netstandard2.0\HEAL.Fossil.dll</HintPath>
    120120    </Reference>
    121121    <Reference Include="HeuristicLab.Algorithms.ALPS-3.3">
  • branches/2520_PersistenceReintegration/HeuristicLab.Tests/packages.config

    r16539 r16555  
    22<packages>
    33  <package id="Google.Protobuf" version="3.6.1" targetFramework="net461" />
    4   <package id="HEAL.Fossil" version="1.0.1" targetFramework="net461" />
     4  <package id="HEAL.Fossil" version="1.0.2-pre-02" targetFramework="net461" />
    55  <package id="System.Drawing.Common" version="4.5.1" targetFramework="net461" />
    66</packages>
Note: See TracChangeset for help on using the changeset viewer.