Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16571


Ignore:
Timestamp:
01/28/19 17:39:41 (6 years ago)
Author:
gkronber
Message:

#2520: several fixes based on failing unit tests

  • adapted unit tests that check StorableConstructors
  • missing translations of StorableClass -> StorableType
  • missing StorableConstructors
  • missing or unecessary PluginDependencies / ProjectReferences
Location:
trunk
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj

    r16568 r16571  
    143143    <Compile Include="ArrayExtensions.cs" />
    144144    <Compile Include="ExceptionExtensions.cs" />
     145    <Compile Include="Plugin.cs" />
    145146    <Compile Include="Statistics\EmpiricalCumulativeDistributionFunction.cs" />
    146147    <Compile Include="ListExtensions.cs" />
     
    154155    <Compile Include="Statistics\EnumerableStatisticExtensions.cs" />
    155156    <Compile Include="IDeepCloneable.cs" />
    156     <Compile Include="Plugin.cs" />
    157157    <Compile Include="ReferenceEqualityComparer.cs" />
    158158    <Compile Include="SequenceGenerator.cs" />
  • trunk/HeuristicLab.Common/3.3/Plugin.cs.frame

    r16565 r16571  
    3131  [Plugin("HeuristicLab.Common", "3.3.15.$WCREV$")]
    3232  [PluginFile("HeuristicLab.Common-3.3.dll", PluginFileType.Assembly)]
     33  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3334  public class HeuristicLabCommonPlugin : PluginBase {
    3435  }
  • trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Formatters/SymbolicExpressionTreeHierarchicalFormatter.cs

    r16565 r16571  
    3131  [StorableType("0a9ad135-ced1-4c3b-94ff-b1fb41193515")]
    3232  public sealed class SymbolicExpressionTreeHierarchicalFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
    33     private SymbolicExpressionTreeHierarchicalFormatter(SymbolicExpressionTreeHierarchicalFormatter original, Cloner cloner)
    34       : base(original, cloner) {
    35     }
     33    [StorableConstructor]
     34    private SymbolicExpressionTreeHierarchicalFormatter(StorableConstructorFlag _) : base(_) { }
     35
     36    private SymbolicExpressionTreeHierarchicalFormatter(SymbolicExpressionTreeHierarchicalFormatter original, Cloner cloner) : base(original, cloner) { }
    3637    public override IDeepCloneable Clone(Cloner cloner) {
    3738      return new SymbolicExpressionTreeHierarchicalFormatter(this, cloner);
  • trunk/HeuristicLab.Hive/3.3/Plugin.cs.frame

    r16565 r16571  
    3030  [PluginFile("HeuristicLab.Hive-3.3.dll", PluginFileType.Assembly)]
    3131  [PluginDependency("HeuristicLab.Common", "3.3")]
    32   [PluginDependency("HeuristicLab.Core", "3.3")] 
     32  [PluginDependency("HeuristicLab.Core", "3.3")]
     33  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3334  public class HeuristicLabHivePlugin : PluginBase {
    3435  }
  • trunk/HeuristicLab.Persistence/3.3/Auxiliary/TypeName.cs

    r16565 r16571  
    3333  /// attributes.
    3434  /// </summary>
    35   [StorableClass]
     35  [StorableType("843C9419-B662-4902-BE18-2ABEB1BF61F0")]
    3636  public class TypeName {
    3737
  • trunk/HeuristicLab.Persistence/3.3/Core/Configuration.cs

    r16565 r16571  
    3232  /// <c>ConfigurationService</c>.
    3333  /// </summary>
    34   [StorableClass]
     34  [StorableType("72F8B3EA-0BC3-43A8-9B58-EF798C154CF3")]
    3535  public class Configuration {
    3636
  • trunk/HeuristicLab.Persistence/3.3/Core/FormatBase.cs

    r16565 r16571  
    2929  /// </summary>
    3030  /// <typeparam name="SerialDataFormat">The type of the serial data format.</typeparam>
    31   [StorableClass]
     31  [StorableType("4EC2B779-0778-4B95-BF4F-5F88C1C1FF1F")]
    3232  public abstract class FormatBase<SerialDataFormat> : IFormat<SerialDataFormat> where SerialDataFormat : ISerialData {
    3333
  • trunk/HeuristicLab.Persistence/3.3/Core/PrimitiveSerializerBase.cs

    r16565 r16571  
    3232  /// <typeparam name="Source">The source type.</typeparam>
    3333  /// <typeparam name="SerialData">The serialized type.</typeparam>
    34   [StorableClass]
     34  [StorableType("A43393DF-4A1F-42A0-BA2D-1DFEA04EBD97")]
    3535  public abstract class PrimitiveSerializerBase<Source, SerialData> :
    3636      IPrimitiveSerializer<Source, SerialData>
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/ArraySerializer.cs

    r16565 r16571  
    2828namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    2929
    30   [StorableClass]
     30  [StorableType("EBEA3A72-AF1D-44BF-8A09-1645402E0715")]
    3131  internal sealed class ArraySerializer : ICompositeSerializer {
    3232
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/CompactNumberArray2StringSerializer.cs

    r16565 r16571  
    3131namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3232
    33   [StorableClass]
     33  [StorableType("19E6CBD6-B977-4828-8121-5B5E9E856F2B")]
    3434  public sealed class CompactNumberArray2StringSerializer : ICompositeSerializer {
    3535
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/ConcreteDictionarySerializer.cs

    r16565 r16571  
    3030namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3131
    32   [StorableClass]
     32  [StorableType("5C0B5959-CFCA-4067-9D4D-540846D8F6EF")]
    3333  internal sealed class ConcreteDictionarySerializer : ICompositeSerializer {
    3434
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/DictionarySerializer.cs

    r16565 r16571  
    3030namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3131
    32   [StorableClass]
     32  [StorableType("D66B7E71-1399-41F0-A97B-E2A2A0C87D71")]
    3333  internal sealed class DictionarySerializer : ICompositeSerializer {
    3434
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumSerializer.cs

    r16565 r16571  
    2828namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    2929
    30   [StorableClass]
     30  [StorableType("1DBD47D9-312B-4572-8B66-C3BFFD004FD6")]
    3131  internal sealed class EnumSerializer : ICompositeSerializer {
    3232
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumerableSerializer.cs

    r16565 r16571  
    3131namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3232
    33   [StorableClass]
     33  [StorableType("0EC0CBC9-A9C3-49BB-B3AC-6991DE771F27")]
    3434  internal sealed class EnumerableSerializer : ICompositeSerializer {
    3535
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/HashSetSerializer.cs

    r16565 r16571  
    3131namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3232
    33   [StorableClass]
     33  [StorableType("3A6430F5-B40C-46D1-89F2-B8AAAD46F052")]
    3434  internal sealed class HashSetSerializer : ICompositeSerializer {
    3535
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/KeyValuePairSerializer.cs

    r16565 r16571  
    3030namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3131
    32   [StorableClass]
     32  [StorableType("7A42AEE3-A9C5-46B7-9968-F8EF3E146DF3")]
    3333  internal sealed class KeyValuePairSerializer : ICompositeSerializer {
    3434
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Number2StringSerializer.cs

    r16565 r16571  
    4040  /// but can be useful in generating custom serializers.
    4141  /// </summary>
    42   [StorableClass]
     42  [StorableType("CD4E3C0C-C766-42EA-B968-C6EBD0FAA637")]
    4343  public sealed class Number2StringSerializer : ICompositeSerializer {
    4444
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/NumberEnumerable2StringSerializer.cs

    r16565 r16571  
    3131namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3232
    33   [StorableClass]
     33  [StorableType("44392644-F6AE-48F3-B0D8-08D3ED7DA307")]
    3434  internal sealed class NumberEnumerable2StringSerializer : ICompositeSerializer {
    3535
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/QueueSerializer.cs

    r16565 r16571  
    3030namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3131
    32   [StorableClass]
     32  [StorableType("EAAB8D01-445B-4834-B318-2AD56B7B537E")]
    3333  internal sealed class QueueSerializer : ICompositeSerializer {
    3434
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StackSerializer.cs

    r16565 r16571  
    3030namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3131
    32   [StorableClass]
     32  [StorableType("0EFD0631-C3A9-4233-B5B2-06103C908D78")]
    3333  internal sealed class StackSerializer : ICompositeSerializer {
    3434
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs

    r16565 r16571  
    3939  /// or <c>AllFieldsAndAllProperties</c>.
    4040  /// </summary>
    41   [StorableClass]
     41  [StorableType("F60343E8-4337-4171-A50A-6A57D09267ED")]
    4242  public sealed class StorableSerializer : ICompositeSerializer {
    4343
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StructSerializer.cs

    r16565 r16571  
    2929namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3030
    31   [StorableClass]
     31  [StorableType("85C63E3B-C604-4267-8008-6B89521BA312")]
    3232  internal sealed class StructSerializer : ICompositeSerializer {
    3333
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/TupleSerializer.cs

    r16565 r16571  
    3030namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3131
    32   [StorableClass]
     32  [StorableType("463686AC-AA54-4D85-88DF-65F67AE0FA85")]
    3333  internal sealed class TupleSerializer : ICompositeSerializer {
    3434
  • trunk/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/TypeSerializer.cs

    r16565 r16571  
    2929namespace HeuristicLab.Persistence.Default.CompositeSerializers {
    3030
    31   [StorableClass]
     31  [StorableType("0CF9A082-629F-4554-8912-CC37228175E2")]
    3232  internal sealed class TypeSerializer : ICompositeSerializer {
    3333
  • trunk/HeuristicLab.Persistence/3.3/Default/DebugString/DebugString.cs

    r16565 r16571  
    2828  /// Simple write-only format for debugging purposes.
    2929  /// </summary>
    30   [StorableClass]
     30  [StorableType("11A7D76E-AB88-43E1-97E8-D195959C34A2")]
    3131  public class DebugString : ISerialData {
    3232
  • trunk/HeuristicLab.Persistence/3.3/Default/DebugString/DebugStringFormat.cs

    r16565 r16571  
    2828  /// Simple write-only format for debugging purposes.
    2929  /// </summary>
    30   [StorableClass]
     30  [StorableType("961AC268-6669-4B0E-A2B5-38C99BA63FD9")]
    3131  public class DebugStringFormat : FormatBase<DebugString> {
    3232    /// <summary>
  • trunk/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberArray2XmlSerializerBase.cs

    r16565 r16571  
    2929namespace HeuristicLab.Persistence.Default.Xml.Compact {
    3030
    31   [StorableClass]
     31  [StorableType("CE0A5AEB-FC09-4F66-9F92-C7B30BAB2713")]
    3232  internal abstract class NumberArray2XmlSerializerBase<T> : CompactXmlSerializerBase<T> where T : class {
    3333
  • trunk/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberEnumeration2XmlSerializerBase.cs

    r16565 r16571  
    2828namespace HeuristicLab.Persistence.Default.Xml.Compact {
    2929
    30   [StorableClass]
     30  [StorableType("B4D23353-9322-4005-BAF2-AB3034DEE34A")]
    3131  internal abstract class NumberEnumeration2XmlSerializerBase<T> : CompactXmlSerializerBase<T> where T : IEnumerable {
    3232
  • trunk/HeuristicLab.Persistence/3.3/Default/Xml/XmlFormat.cs

    r16565 r16571  
    2929  /// or save to a file.
    3030  /// </summary>
    31   [StorableClass]
     31  [StorableType("4E9895D9-BB30-43A6-AB35-4263FFDE3C0E")]
    3232  public class XmlFormat : FormatBase<XmlString> {
    3333    /// <summary>
  • trunk/HeuristicLab.Persistence/3.3/Default/Xml/XmlString.cs

    r16565 r16571  
    2929  /// XML friendly encapsulation of string data.
    3030  /// </summary>
    31   [StorableClass]
     31  [StorableType("C7207D30-79F0-47C7-B151-6E96A594F75C")]
    3232  public class XmlString : ISerialData {
    3333
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/SymbolicExpressionTreeEqualityComparer.cs

    r16565 r16571  
    1010    public SymbolicExpressionTreeNodeEqualityComparer SimilarityComparer { get; set; }
    1111
     12
     13    [StorableConstructor]
     14    protected SymbolicExpressionTreeEqualityComparer(StorableConstructorFlag _) { }
     15    public SymbolicExpressionTreeEqualityComparer() { }
     16
    1217    public bool Equals(ISymbolicExpressionTree a, ISymbolicExpressionTree b) {
    1318      if (SimilarityComparer == null) throw new Exception("SimilarityComparer needs to be initialized first.");
     
    1823      return (tree.Length << 8) % 12345;
    1924    }
     25
    2026  }
    2127}
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs

    r16565 r16571  
    3434    public double UpperBound { get; private set; }
    3535
     36    [StorableConstructor]
     37    protected Interval(StorableConstructorFlag _) { }
     38
    3639    public Interval(double lowerBound, double upperBound) {
    3740      if (lowerBound > upperBound)
  • trunk/HeuristicLab.Tests/HeuristicLab-3.3/StorableTest.cs

    r16565 r16571  
    4242
    4343      foreach (Type storableType in ApplicationManager.Manager.GetTypes(typeof(object))
    44         .Where(StorableClassAttribute.IsStorableClass)) {
     44        .Where(StorableTypeAttribute.IsStorableType)) {
    4545        //test only types contained in HL plugin assemblies
     46        if (!storableType.Namespace.StartsWith("HeuristicLab")) continue;
    4647        if (storableType.Namespace.Contains(".Tests")) continue;
    4748        if (!PluginLoader.Assemblies.Contains(storableType.Assembly)) continue;
    4849
     50        if (storableType.IsEnum || storableType.IsInterface) continue;
     51        var storableFields = storableType
     52          .GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
     53          .Where(fi => StorableAttribute.IsStorable(fi));
     54        var storableProps = storableType
     55          .GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
     56          .Where(fi => StorableAttribute.IsStorable(fi));
     57
     58        // a storable constructor should be given but is not absolutely required.
     59        // when there are no storable fields then a storable ctor has no real purpose.
     60        if (!storableFields.Any() && !storableProps.Any()) continue;
     61
    4962        IEnumerable<ConstructorInfo> ctors = storableType.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
    50         ConstructorInfo storableConstructor = ctors.Where(c => c.GetParameters().Count() == 1 && c.GetParameters().First().ParameterType == typeof(bool)).FirstOrDefault();
     63        ConstructorInfo storableConstructor = ctors.Where(c => c.GetParameters().Count() == 1 && c.GetParameters().First().ParameterType == typeof(HEAL.Attic.StorableConstructorFlag)).FirstOrDefault();
    5164        if (storableConstructor == null) errorMessage.Append(Environment.NewLine + storableType.ToString() + ": No storable constructor is defined.");
    5265        else {
     
    6982      foreach (var type in ApplicationManager.Manager.GetTypes(typeof(object), onlyInstantiable: false, includeGenericTypeDefinitions: true)
    7083        .Where(t => t.Namespace != null && !t.Namespace.Contains(".Tests"))
    71         .Where(t => !StorableClassAttribute.IsStorableClass(t))) {
     84        .Where(t => !StorableTypeAttribute.IsStorableType(t))) {
    7285        var members = type.GetMembers(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly);
    7386        var storableConstructor = members.SingleOrDefault(m => Attribute.IsDefined(m, typeof(StorableConstructorAttribute), inherit: false));
     
    7588
    7689        if (storableConstructor != null) {
    77           errorMessage.Append(Environment.NewLine + type.Namespace + "." + type.GetPrettyName() + ": Contains a storable constructor but is not a storable class.");
     90          errorMessage.Append(Environment.NewLine + type.Namespace + "." + type.GetPrettyName() + ": Contains a storable constructor but is not a storable type.");
    7891        } else if (storableMembers.Any()) {
    79           errorMessage.Append(Environment.NewLine + type.Namespace + "." + type.GetPrettyName() + ": Contains at least one storable member but is not a storable class.");
     92          errorMessage.Append(Environment.NewLine + type.Namespace + "." + type.GetPrettyName() + ": Contains at least one storable member but is not a storable type.");
    8093        }
    8194      }
Note: See TracChangeset for help on using the changeset viewer.