Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/24/10 21:25:52 (14 years ago)
Author:
mkommend
Message:

Created PluginDependenciesTest and corrected all projects (ticket #1202).

Location:
trunk/sources/HeuristicLab/3.3/Tests
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab/3.3/Tests/ContentViewTests.cs

    r4488 r4490  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Linq;
    324using HeuristicLab.Common;
     
    3152    [ClassInitialize]
    3253    public static void MyClassInitialize(TestContext testContext) {
    33       PluginLoader.LoadPluginsIntoAppDomain();
     54      PluginLoader.pluginAssemblies.Any();
    3455    }
    3556
  • trunk/sources/HeuristicLab/3.3/Tests/HeuristicLab-3.3.Tests.csproj

    r4488 r4490  
    9999      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    100100    </Reference>
     101    <Reference Include="System.Windows.Forms" />
    101102  </ItemGroup>
    102103  <ItemGroup>
     
    107108  <ItemGroup>
    108109    <Compile Include="ContentViewTests.cs" />
     110    <Compile Include="PluginDependenciesTest.cs" />
    109111    <Compile Include="PluginLoader.cs" />
    110112    <Compile Include="Properties\AssemblyInfo.cs" />
  • trunk/sources/HeuristicLab/3.3/Tests/PluginLoader.cs

    r4487 r4490  
    11
     2using System;
     3using System.Collections.Generic;
     4using System.IO;
     5using System.Linq;
     6using System.Reflection;
     7using HeuristicLab.PluginInfrastructure;
     8
    29namespace HeuristicLab_3._3.Tests {
    310  internal static class PluginLoader {
    4     public static void LoadPluginsIntoAppDomain() {
    5       new HeuristicLab.ALGLIB.HeuristicLabAlgLibPlugin();
     11    public const string AssemblyExtension = ".dll";
     12    public static List<Assembly> pluginAssemblies;
    613
    7       new HeuristicLab.Algorithms.DataAnalysis.HeuristicLabAlgorithmsDataAnalysisPlugin();
    8       new HeuristicLab.Algorithms.EvolutionStrategy.HeuristicLabAlgorithmsEvolutionStrategyPlugin();
    9       new HeuristicLab.Algorithms.GeneticAlgorithm.HeuristicLabAlgorithmsGeneticAlgorithmPlugin();
    10       new HeuristicLab.Algorithms.LocalSearch.HeuristicLabAlgorithmsLocalSearchPlugin();
    11       new HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm.HeuristicLabAlgorithmsOffspringSelectionGeneticAlgorithmPlugin();
    12       new HeuristicLab.Algorithms.SimulatedAnnealing.HeuristicLabAlgorithmsSimulatedAnnealingPlugin();
    13       new HeuristicLab.Algorithms.TabuSearch.HeuristicLabAlgorithmsTabuSearchPlugin();
     14    static PluginLoader() {
     15      foreach (string path in Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory)
     16        .Where(s => s.EndsWith(AssemblyExtension)))
     17        Assembly.LoadFrom(path);
    1418
    15       new HeuristicLab.Analysis.HeuristicLabAnalysisPlugin();
    16       new HeuristicLab.Analysis.Views.HeuristicLabAnalysisViewsPlugin();
     19      pluginAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(IsPluginAssembly).ToList();
     20    }
    1721
    18       new HeuristicLab.Clients.Common.HeuristicLabClientsCommonPlugin();
    19       new HeuristicLab.CodeEditor.HeuristicLabCodeEditorPlugin();
    20       new HeuristicLab.Collections.HeuristicLabCollectionsPlugin();
     22    private static bool IsPluginAssembly(Assembly assembly) {
     23      return assembly.GetExportedTypes()
     24        .Where(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface).Any();
     25    }
    2126
    22       new HeuristicLab.Common.HeuristicLabCommonPlugin();
    23       new HeuristicLab.Common.Resources.HeuristicLabCommonResourcesPlugin();
    2427
    25       new HeuristicLab.Core.HeuristicLabCorePlugin();
    26       new HeuristicLab.Core.Views.HeuristicLabCoreViewsPlugin();
     28    //public static void LoadPluginsIntoAppDomain() {
     29    //  new HeuristicLab.Algorithms.DataAnalysis.HeuristicLabAlgorithmsDataAnalysisPlugin();
     30    //  new HeuristicLab.Algorithms.EvolutionStrategy.HeuristicLabAlgorithmsEvolutionStrategyPlugin();
     31    //  new HeuristicLab.Algorithms.GeneticAlgorithm.HeuristicLabAlgorithmsGeneticAlgorithmPlugin();
     32    //  new HeuristicLab.Algorithms.LocalSearch.HeuristicLabAlgorithmsLocalSearchPlugin();
     33    //  new HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm.HeuristicLabAlgorithmsOffspringSelectionGeneticAlgorithmPlugin();
     34    //  new HeuristicLab.Algorithms.SimulatedAnnealing.HeuristicLabAlgorithmsSimulatedAnnealingPlugin();
     35    //  new HeuristicLab.Algorithms.TabuSearch.HeuristicLabAlgorithmsTabuSearchPlugin();
    2736
    28       new HeuristicLab.Data.HeuristicLabDataPlugin();
    29       new HeuristicLab.Data.Views.HeuristicLabDataViewsPlugin();
     37    //  new HeuristicLab.Analysis.HeuristicLabAnalysisPlugin();
     38    //  new HeuristicLab.Analysis.Views.HeuristicLabAnalysisViewsPlugin();
    3039
    31       new HeuristicLab.Encodings.BinaryVectorEncoding.HeuristicLabEncodingsBinaryVectorEncodingPlugin();
    32       new HeuristicLab.Encodings.IntegerVectorEncoding.HeuristicLabEncodingsIntegerVectorEncodingPlugin();
    33       new HeuristicLab.Encodings.PermutationEncoding.HeuristicLabEncodingsPermutationEncodingPlugin();
    34       new HeuristicLab.Encodings.PermutationEncoding.Views.HeuristicLabEncodingsPermutationEncodingViewsPlugin();
    35       new HeuristicLab.Encodings.RealVectorEncoding.HeuristicLabEncodingsRealVectorEncodingPlugin();
    36       new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin();
    37       new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin();
     40    //  new HeuristicLab.Clients.Common.HeuristicLabClientsCommonPlugin();
     41    //  new HeuristicLab.CodeEditor.HeuristicLabCodeEditorPlugin();
     42    //  new HeuristicLab.Collections.HeuristicLabCollectionsPlugin();
    3843
    39       new HeuristicLab.MainForm.HeuristicLabMainFormPlugin();
    40       new HeuristicLab.MainForm.WindowsForms.HeuristicLabMainFormPlugin();
     44    //  new HeuristicLab.Common.HeuristicLabCommonPlugin();
     45    //  new HeuristicLab.Common.Resources.HeuristicLabCommonResourcesPlugin();
    4146
    42       new HeuristicLab.Operators.HeuristicLabOperatorsPlugin();
    43       new HeuristicLab.Operators.Programmable.HeuristicLabOperatorsProgrammablePlugin();
    44       new HeuristicLab.Operators.Views.HeuristicLabOperatorsViewsPlugin();
    45       new HeuristicLab.Operators.Views.GraphVisualization.HeuristicLabOperatorsViewsGraphVisualizationPlugin();
     47    //  new HeuristicLab.Core.HeuristicLabCorePlugin();
     48    //  new HeuristicLab.Core.Views.HeuristicLabCoreViewsPlugin();
    4649
    47       new HeuristicLab.Parameters.HeuristicLabParametersPlugin();
    48       new HeuristicLab.Parameters.Views.HeuristicLabParametersViewsPlugin();
     50    //  new HeuristicLab.Data.HeuristicLabDataPlugin();
     51    //  new HeuristicLab.Data.Views.HeuristicLabDataViewsPlugin();
    4952
    50       new HeuristicLab.Persistence.HeuristicLabPersistencePlugin();
    51       new HeuristicLab.Persistence.GUI.HeuristicLabPersistenceGUIPlugin();
     53    //  new HeuristicLab.Encodings.BinaryVectorEncoding.HeuristicLabEncodingsBinaryVectorEncodingPlugin();
     54    //  new HeuristicLab.Encodings.IntegerVectorEncoding.HeuristicLabEncodingsIntegerVectorEncodingPlugin();
     55    //  new HeuristicLab.Encodings.PermutationEncoding.HeuristicLabEncodingsPermutationEncodingPlugin();
     56    //  new HeuristicLab.Encodings.PermutationEncoding.Views.HeuristicLabEncodingsPermutationEncodingViewsPlugin();
     57    //  new HeuristicLab.Encodings.RealVectorEncoding.HeuristicLabEncodingsRealVectorEncodingPlugin();
     58    //  new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin();
     59    //  new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin();
    5260
    53       new HeuristicLab.Problems.ArtificialAnt.HeuristicLabProblemsArtificialAntPlugin();
    54       new HeuristicLab.Problems.ArtificialAnt.Views.HeuristicLabProblemsArtificialAntViewsPlugin();
    55       new HeuristicLab.Problems.DataAnalysis.HeuristicLabProblemsDataAnalysisPlugin();
    56       new HeuristicLab.Problems.DataAnalysis.Regression.HeuristicLabProblemsDataAnalysisRegressionPlugin();
    57       new HeuristicLab.Problems.DataAnalysis.Views.HeuristicLabProblemsDataAnalysisViewsPlugin();
    58       new HeuristicLab.Problems.ExternalEvaluation.HeuristicLabProblemsExternalEvaluationPlugin();
    59       new HeuristicLab.Problems.ExternalEvaluation.GP.HeuristicLabProblemsExternalEvaluationGPPlugin();
    60       new HeuristicLab.Problems.ExternalEvaluation.GP.Views.HeuristicLabProblemsExternalEvaluationGPViewsPlugin();
    61       new HeuristicLab.Problems.ExternalEvaluation.Views.HeuristicLabProblemsExternalEvaluationViewsPlugin();
    62       new HeuristicLab.Problems.Knapsack.HeuristicLabProblemsKnapsackPlugin();
    63       new HeuristicLab.Problems.Knapsack.Views.HeuristicLabProblemsKnapsackViewsPlugin();
    64       new HeuristicLab.Problems.OneMax.HeuristicLabProblemsOneMaxPlugin();
    65       new HeuristicLab.Problems.OneMax.Views.HeuristicLabProblemsKnapsackViewsPlugin();
    66       new HeuristicLab.Problems.TestFunctions.HeuristicLabProblemsTestFunctionsPlugin();
    67       new HeuristicLab.Problems.TestFunctions.Views.HeuristicLabProblemsTestFunctionsViewsPlugin();
    68       new HeuristicLab.Problems.TravelingSalesman.HeuristicLabProblemsTravelingSalesmanPlugin();
    69       new HeuristicLab.Problems.TravelingSalesman.Views.HeuristicLabProblemsTravelingSalesmanViewsPlugin();
    70       new HeuristicLab.Problems.VehicleRouting.HeuristicLabProblemsVehicleRoutingPlugin();
    71       new HeuristicLab.Problems.VehicleRouting.Views.HeuristicLabProblemsVehicleRoutingViewsPlugin();
     61    //  new HeuristicLab.MainForm.HeuristicLabMainFormPlugin();
     62    //  new HeuristicLab.MainForm.WindowsForms.HeuristicLabMainFormPlugin();
    7263
    73       new HeuristicLab.Random.HeuristicLabRandomPlugin();
    74       new HeuristicLab.Selection.HeuristicLabSelectionPlugin();
    75       new HeuristicLab.SequentialEngine.HeuristicLabSequentialEnginePlugin();
    76       new HeuristicLab.Tracing.HeuristicLabPersistencePlugin();
    77     }
     64    //  new HeuristicLab.Operators.HeuristicLabOperatorsPlugin();
     65    //  new HeuristicLab.Operators.Programmable.HeuristicLabOperatorsProgrammablePlugin();
     66    //  new HeuristicLab.Operators.Views.HeuristicLabOperatorsViewsPlugin();
     67    //  new HeuristicLab.Operators.Views.GraphVisualization.HeuristicLabOperatorsViewsGraphVisualizationPlugin();
     68
     69    //  new HeuristicLab.Parameters.HeuristicLabParametersPlugin();
     70    //  new HeuristicLab.Parameters.Views.HeuristicLabParametersViewsPlugin();
     71
     72    //  new HeuristicLab.Persistence.HeuristicLabPersistencePlugin();
     73    //  new HeuristicLab.Persistence.GUI.HeuristicLabPersistenceGUIPlugin();
     74
     75    //  new HeuristicLab.Problems.ArtificialAnt.HeuristicLabProblemsArtificialAntPlugin();
     76    //  new HeuristicLab.Problems.ArtificialAnt.Views.HeuristicLabProblemsArtificialAntViewsPlugin();
     77    //  new HeuristicLab.Problems.DataAnalysis.HeuristicLabProblemsDataAnalysisPlugin();
     78    //  new HeuristicLab.Problems.DataAnalysis.Regression.HeuristicLabProblemsDataAnalysisRegressionPlugin();
     79    //  new HeuristicLab.Problems.DataAnalysis.Views.HeuristicLabProblemsDataAnalysisViewsPlugin();
     80    //  new HeuristicLab.Problems.ExternalEvaluation.HeuristicLabProblemsExternalEvaluationPlugin();
     81    //  new HeuristicLab.Problems.ExternalEvaluation.GP.HeuristicLabProblemsExternalEvaluationGPPlugin();
     82    //  new HeuristicLab.Problems.ExternalEvaluation.GP.Views.HeuristicLabProblemsExternalEvaluationGPViewsPlugin();
     83    //  new HeuristicLab.Problems.ExternalEvaluation.Views.HeuristicLabProblemsExternalEvaluationViewsPlugin();
     84    //  new HeuristicLab.Problems.Knapsack.HeuristicLabProblemsKnapsackPlugin();
     85    //  new HeuristicLab.Problems.Knapsack.Views.HeuristicLabProblemsKnapsackViewsPlugin();
     86    //  new HeuristicLab.Problems.OneMax.HeuristicLabProblemsOneMaxPlugin();
     87    //  new HeuristicLab.Problems.OneMax.Views.HeuristicLabProblemsKnapsackViewsPlugin();
     88    //  new HeuristicLab.Problems.TestFunctions.HeuristicLabProblemsTestFunctionsPlugin();
     89    //  new HeuristicLab.Problems.TestFunctions.Views.HeuristicLabProblemsTestFunctionsViewsPlugin();
     90    //  new HeuristicLab.Problems.TravelingSalesman.HeuristicLabProblemsTravelingSalesmanPlugin();
     91    //  new HeuristicLab.Problems.TravelingSalesman.Views.HeuristicLabProblemsTravelingSalesmanViewsPlugin();
     92    //  new HeuristicLab.Problems.VehicleRouting.HeuristicLabProblemsVehicleRoutingPlugin();
     93    //  new HeuristicLab.Problems.VehicleRouting.Views.HeuristicLabProblemsVehicleRoutingViewsPlugin();
     94
     95    //  new HeuristicLab.Random.HeuristicLabRandomPlugin();
     96    //  new HeuristicLab.Selection.HeuristicLabSelectionPlugin();
     97    //  new HeuristicLab.SequentialEngine.HeuristicLabSequentialEnginePlugin();
     98    //  new HeuristicLab.Tracing.HeuristicLabPersistencePlugin();
     99    //}
    78100  }
    79101}
Note: See TracChangeset for help on using the changeset viewer.