Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/07/10 11:19:33 (14 years ago)
Author:
cneumuel
Message:

#1233

  • added test project
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
Files:
1 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj

    r5043 r5055  
    8484    <Compile Include="Exceptions\OptimizerNotFoundException.cs" />
    8585    <Compile Include="HiveExperiment\PluginClient.cs" />
     86    <Compile Include="IServiceLocator.cs" />
    8687    <Compile Include="Jobs\OptimizerJob.cs" />
    8788    <Compile Include="HeuristicLabClientsHivePlugin.cs" />
     
    9697    <Compile Include="PersistenceUtil.cs" />
    9798    <None Include="Properties\AssemblyInfo.cs.frame" />
    98     <Compile Include="ServiceClients\ServiceClientFactory.cs" />
    9999    <Compile Include="Exceptions\ServiceClientFactoryException.cs" />
    100100    <Compile Include="ServiceLocator.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/HiveExperimentClient.cs

    r5053 r5055  
    3434  using HeuristicLab.Services.Hive.Common.DataTransfer;
    3535  using HeuristicLab.Clients.Hive.Jobs;
     36  using HeuristicLab.Clients.Common;
    3637
    3738  /// <summary>
     
    223224        this.progress = new Progress("Connecting to server...");
    224225        IsProgressing = true;
    225         using (Disposable<IHiveService> service = ServiceLocator.Instance.ServicePool.GetService()) {
     226        using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) {
    226227          IEnumerable<string> groups = ToResourceIdList(this.ResourceIds);
    227228          this.HiveJob.SetIndexInParentOptimizerList(null);
     
    303304
    304305    public void Stop() {
    305       using (Disposable<IHiveService> service = ServiceLocator.Instance.ServicePool.GetService()) {
     306      using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) {
    306307        foreach (HiveJob hj in HiveJob.GetAllHiveJobs()) {
    307308          service.Obj.StopJob(hj.Job.Id);
     
    531532        int jobCount = 0;
    532533        progress.Status = "Connecting to Server...";
    533         using (var service = ServiceLocator.Instance.ServicePool.GetService()) {
     534        using (var service = ServiceLocator.Instance.GetService()) {
    534535          // fetch all Job objects to create the full tree of tree of HiveJob objects
    535536          progress.Status = "Downloading list of jobs...";
     
    607608
    608609    private OptimizerJob LoadOptimizerJob(Guid jobId) {
    609       using (var service = ServiceLocator.Instance.ServicePool.GetService()) {
     610      using (var service = ServiceLocator.Instance.GetService()) {
    610611        JobData jobData = service.Obj.GetJobData(jobId);
    611612        try {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/HiveExperimentManagerClient.cs

    r4905 r5055  
    3232  using HeuristicLab.Common;
    3333  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     34  using HeuristicLab.Clients.Common;
    3435
    3536  [Item("Hive Client", "Connects to Hive and lists all submitted experiments by the current user.")]
     
    9697          this.HiveExperiments = new ItemList<HiveExperimentClient>();
    9798        }
    98         using (var service = ServiceLocator.Instance.ServicePool.GetService()) {
     99        using (var service = ServiceLocator.Instance.GetService()) {
    99100          currentlyUpdating = true;
    100101          IEnumerable<DT.HiveExperiment> response = service.Obj.GetHiveExperiments();
     
    138139    void hiveExperiments_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<HiveExperimentClient>> e) {
    139140      if (!currentlyUpdating) {
    140         using (Disposable<IHiveService> service = ServiceLocator.Instance.ServicePool.GetService()) {
     141        using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) {
    141142          foreach (IndexedItem<HiveExperimentClient> item in e.Items) {
    142143            if (item.Value.HiveExperimentId != Guid.Empty) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/HiveJobClient.cs

    r5053 r5055  
    464464     
    465465      IEnumerable<IPluginDescription> neededPlugins = ApplicationManager.Manager.Plugins; //HivePluginInfoDto.FindPluginsNeeded(optimizerJob.GetType());
    466       using (var service = ServiceLocator.Instance.ServicePool.GetService()) {
     466      using (var service = ServiceLocator.Instance.GetService()) {
    467467        IEnumerable<Plugin> availablePlugins = service.Obj.GetPlugins();
    468468        foreach (IPluginDescription neededPlugin in neededPlugins) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/JobResultPoller.cs

    r4629 r5055  
    2727using HeuristicLab.Services.Hive.Common.DataTransfer;
    2828using System.Collections.Generic;
     29using HeuristicLab.Clients.Common;
    2930
    3031namespace HeuristicLab.Clients.Hive {
     
    9596
    9697    private void FetchJobResults() {
    97       using (Disposable<IHiveService> service = ServiceLocator.Instance.ServicePool.GetService()) {
     98      using (Disposable<IHiveService> service = ServiceLocator.Instance.GetService()) {
    9899        IEnumerable<LightweightJob> response = service.Obj.GetLightweightChildJobs(hiveJob.Job.Id, true, true);
    99100        OnJobResultsReceived(response);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveExperiment/PluginClient.cs

    r4905 r5055  
    1616
    1717    public void Load() {
    18       using (var service = ServiceLocator.Instance.ServicePool.GetService()) {
     18      using (var service = ServiceLocator.Instance.GetService()) {
    1919       
    2020      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceLocator.cs

    r4905 r5055  
    2222using HeuristicLab.Services.Hive.Common.ServiceContracts;
    2323using HeuristicLab.Clients.Hive.Properties;
     24using HeuristicLab.Clients.Common;
    2425
    2526namespace HeuristicLab.Clients.Hive {
    26   public class ServiceLocator {
    27     private static ServiceLocator instance = null;
    28     private ServiceClientFactory<IHiveService> serviceFactory = null;
    29 
    30     public static ServiceLocator Instance {
     27  public class ServiceLocator : IServiceLocator {
     28    private static IServiceLocator instance = null;
     29    public static IServiceLocator Instance {
    3130      get {
    3231        if (instance == null) {
     
    3534        return instance;
    3635      }
    37     }
    38 
    39     public ServiceLocator() {
    40       Settings.Default.SettingChanging += new System.Configuration.SettingChangingEventHandler(Default_SettingChanging);
    41     }
    42 
    43     private void Default_SettingChanging(object sender, System.Configuration.SettingChangingEventArgs e) {
    44       if (serviceFactory != null) {
    45         serviceFactory.Username = Settings.Default.HiveUsername;
    46         serviceFactory.Password = Settings.Default.HivePassword;
     36      set {
     37        instance = value;
    4738      }
    4839    }
    4940
    50     public ServiceClientFactory<IHiveService> ServicePool {
    51       get {
    52         if (serviceFactory == null) {
    53           serviceFactory = new ServiceClientFactory<IHiveService>(Settings.Default.HiveUsername, Settings.Default.HivePassword, "wsHttpBinding_IHiveService");
    54         }
    55         return serviceFactory;
    56       }
     41    public Disposable<IHiveService> GetService() {
     42        return ClientFactory.CreateClient<IHiveService>("wsHttpBinding_IHiveService");
    5743    }
    5844  }
Note: See TracChangeset for help on using the changeset viewer.