Changeset 2771 for branches/DeploymentServer Prototype
- Timestamp:
- 02/09/10 17:24:13 (15 years ago)
- Location:
- branches/DeploymentServer Prototype/HeuristicLab.Services
- Files:
-
- 27 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment
- Property svn:ignore
-
old new 2 2 obj 3 3 *.user 4 *.svclog
-
- Property svn:ignore
-
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment.DataAccess/PluginDescription.cs
r2742 r2771 34 34 35 35 [DataMember(Name = "Dependencies")] 36 private IEnumerable<PluginDescription> dependencies;37 public IEnumerable<PluginDescription> Dependencies {36 private List<PluginDescription> dependencies; 37 public List<PluginDescription> Dependencies { 38 38 get { return dependencies; } 39 39 } … … 51 51 this.name = name; 52 52 this.version = version; 53 this.dependencies = new List<PluginDescription>(dependencies) .AsReadOnly();53 this.dependencies = new List<PluginDescription>(dependencies); //.AsReadOnly(); 54 54 //this.isDatabaseInstance = true; 55 55 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment.DataAccess/PluginStore.cs
r2766 r2771 10 10 public class PluginStore { 11 11 12 private PluginStoreClassesDataContext ctx;13 12 public PluginStore() { 14 ctx = new PluginStoreClassesDataContext();15 } 16 13 } 14 15 #region context creating members 17 16 public IEnumerable<ProductDescription> Products { 18 17 get { 19 return from p in ctx.Products 20 let plugins = from pair in ctx.ProductPlugins 21 from plugin in ctx.Plugins 22 where pair.ProductId == p.Id 23 where plugin.Id == pair.PluginId 24 select plugin 25 select MakeProductDescription(p, plugins); 26 } 27 } 28 29 private ProductDescription MakeProductDescription(Product p, IQueryable<Plugin> plugins) { 30 var desc = new ProductDescription(p.Id, p.Name, new Version(p.Version), from plugin in plugins 31 select MakePluginDescription(plugin)); 32 return desc; 33 } 34 35 private PluginDescription MakePluginDescription(Plugin plugin) { 36 var desc = new PluginDescription(plugin.Id, plugin.Name, new Version(plugin.Version), from dep in GetDependencies(plugin) 37 select MakePluginDescription(dep)); 38 return desc; 39 } 40 41 private IEnumerable<Plugin> GetDependencies(Plugin plugin) { 42 return from pair in ctx.Dependencies 43 from dependency in ctx.Plugins 44 where pair.PluginId == plugin.Id 45 where pair.DependencyId == dependency.Id 46 select dependency; 18 using (var ctx = new PluginStoreClassesDataContext()) { 19 return (from p in ctx.Products 20 let plugins = from pair in ctx.ProductPlugins 21 from plugin in ctx.Plugins 22 where pair.ProductId == p.Id 23 where plugin.Id == pair.PluginId 24 select plugin 25 select MakeProductDescription(ctx, p, plugins)).ToList(); 26 } 27 } 47 28 } 48 29 49 30 public IEnumerable<PluginDescription> Plugins { 50 31 get { 51 return from plugin in ctx.Plugins 52 select MakePluginDescription(plugin); 32 using (var ctx = new PluginStoreClassesDataContext()) { 33 return (from plugin in ctx.Plugins 34 select MakePluginDescription(ctx, plugin)).ToList(); 35 } 53 36 } 54 37 } 55 38 56 39 public byte[] PluginFile(PluginDescription pluginDescription) { 57 return GetExistingPlugin(pluginDescription.Name, pluginDescription.Version).PluginPackage.Data.ToArray(); 40 using (var ctx = new PluginStoreClassesDataContext()) { 41 return GetExistingPlugin(ctx, pluginDescription.Name, pluginDescription.Version).PluginPackage.Data.ToArray(); 42 } 58 43 } 59 44 60 45 public void Persist(PluginDescription pluginDescription, byte[] pluginPackage) { 61 try { 62 using (var transaction = new TransactionScope()) { 63 Plugin pluginEntity = InsertOrUpdatePlugin(pluginDescription); 64 if (pluginEntity.PluginPackage == null) { 65 // insert 66 pluginEntity.PluginPackage = MakePluginPackage(pluginDescription, pluginPackage); 67 } else { 68 // update 69 pluginEntity.PluginPackage.Data = pluginPackage; 46 using (var ctx = new PluginStoreClassesDataContext()) { 47 try { 48 using (var transaction = new TransactionScope()) { 49 Plugin pluginEntity = InsertOrUpdatePlugin(ctx, pluginDescription); 50 if (pluginEntity.PluginPackage == null) { 51 // insert 52 pluginEntity.PluginPackage = MakePluginPackage(pluginDescription, pluginPackage); 53 } else { 54 // update 55 pluginEntity.PluginPackage.Data = pluginPackage; 56 } 57 ctx.SubmitChanges(); 58 transaction.Complete(); 70 59 } 71 ctx.SubmitChanges(); 72 transaction.Complete(); 73 } 74 } 75 catch (SqlException ex) { 76 throw new ArgumentException("Something went wrong while trying to persist plugin", ex); 77 } 78 catch (InvalidOperationException ex) { 79 throw new ArgumentException("Something went wrong while trying to persist plugin", ex); 60 } 61 catch (SqlException ex) { 62 throw new ArgumentException("Something went wrong while trying to persist plugin", ex); 63 } 64 catch (InvalidOperationException ex) { 65 throw new ArgumentException("Something went wrong while trying to persist plugin", ex); 66 } 80 67 } 81 68 } 82 69 83 70 public void Persist(ProductDescription product) { 84 try { 85 using (var transaction = new TransactionScope()) { 86 InsertOrUpdateProduct(product); 87 foreach (var plugin in product.Plugins) { 88 InsertOrUpdatePlugin(plugin); 71 using (var ctx = new PluginStoreClassesDataContext()) { 72 try { 73 using (var transaction = new TransactionScope()) { 74 foreach (var plugin in product.Plugins) { 75 var pluginEntity = GetExistingPlugin(ctx, plugin.Name, plugin.Version); 76 UpdatePlugin(ctx, pluginEntity, plugin); 77 } 78 InsertOrUpdateProduct(ctx, product); 79 ctx.SubmitChanges(); 80 transaction.Complete(); 89 81 } 90 ctx.SubmitChanges(); 91 transaction.Complete(); 92 } 93 } 94 catch (SqlException ex) { 95 throw new ArgumentException("Something went wrong while trying to persist product", ex); 96 } 97 catch (InvalidOperationException ex) { 98 throw new ArgumentException("Something went wrong while trying to persist product", ex); 99 } 100 } 101 102 private void InsertOrUpdateProduct(ProductDescription product) { 82 } 83 catch (SqlException ex) { 84 throw new ArgumentException("Something went wrong while trying to persist product", ex); 85 } 86 catch (InvalidOperationException ex) { 87 throw new ArgumentException("Something went wrong while trying to persist product", ex); 88 } 89 } 90 } 91 92 #endregion 93 94 #region insert/update product 95 private void InsertOrUpdateProduct(PluginStoreClassesDataContext ctx, ProductDescription product) { 103 96 var productEntity = (from p in ctx.Products 104 97 where p.Name == product.Name … … 113 106 product.Id = productEntity.Id; 114 107 115 DeleteOldPlugins( productEntity);108 DeleteOldPlugins(ctx, productEntity); 116 109 117 110 foreach (var plugin in product.Plugins) { 118 var existingPlugin = GetExistingPlugin( plugin.Name, plugin.Version);111 var existingPlugin = GetExistingPlugin(ctx, plugin.Name, plugin.Version); 119 112 ProductPlugin prodPlugin = new ProductPlugin(); 120 113 prodPlugin.PluginId = existingPlugin.Id; … … 124 117 } 125 118 126 private void DeleteOldPlugins(P roduct productEntity) {119 private void DeleteOldPlugins(PluginStoreClassesDataContext ctx, Product productEntity) { 127 120 var oldPlugins = (from p in ctx.ProductPlugins 128 121 where p.ProductId == productEntity.Id … … 131 124 ctx.SubmitChanges(); 132 125 } 133 134 private Plugin InsertOrUpdatePlugin(PluginDescription pluginDescription) { 126 #endregion 127 128 #region insert/update plugins 129 private Plugin InsertOrUpdatePlugin(PluginStoreClassesDataContext ctx, PluginDescription pluginDescription) { 135 130 var pluginEntity = (from p in ctx.Plugins 136 131 where p.Name == pluginDescription.Name … … 142 137 ctx.SubmitChanges(); 143 138 } 139 140 UpdatePlugin(ctx, pluginEntity, pluginDescription); 141 return pluginEntity; 142 } 143 144 private void UpdatePlugin(PluginStoreClassesDataContext ctx, Plugin pluginEntity, PluginDescription pluginDescription) { 145 // delete cached entry 146 if (pluginDescriptions.ContainsKey(pluginEntity)) pluginDescriptions.Remove(pluginEntity); 147 144 148 pluginDescription.Id = pluginEntity.Id; 145 149 146 DeleteOldDependencies( pluginEntity);150 DeleteOldDependencies(ctx, pluginEntity); 147 151 148 152 foreach (var dependency in pluginDescription.Dependencies) { 149 var dependencyEntity = GetExistingPlugin( dependency.Name, dependency.Version);153 var dependencyEntity = GetExistingPlugin(ctx, dependency.Name, dependency.Version); 150 154 Dependency d = new Dependency(); 151 155 d.PluginId = pluginDescription.Id; … … 153 157 ctx.Dependencies.InsertOnSubmit(d); 154 158 } 155 return pluginEntity;156 157 } 158 159 private void DeleteOldDependencies(Plugin pluginEntity) {159 } 160 161 162 163 private void DeleteOldDependencies(PluginStoreClassesDataContext ctx, Plugin pluginEntity) { 160 164 var oldDependencies = (from dep in ctx.Dependencies 161 165 where dep.PluginId == pluginEntity.Id … … 165 169 ctx.SubmitChanges(); 166 170 } 167 168 private Plugin GetExistingPlugin(string name, Version version) { 169 return (from p in ctx.Plugins 170 where p.Name == name 171 where p.Version == version.ToString() 172 select p).Single(); 171 #endregion 172 173 #region product <-> productDescription transformation 174 private ProductDescription MakeProductDescription(PluginStoreClassesDataContext ctx, Product p, IQueryable<Plugin> plugins) { 175 var desc = new ProductDescription(p.Id, p.Name, new Version(p.Version), from plugin in plugins 176 select MakePluginDescription(ctx, plugin)); 177 return desc; 178 } 179 private Product MakeProductFromDescription(ProductDescription desc) { 180 var product = new Product(); 181 product.Id = desc.Id; 182 product.Name = desc.Name; 183 product.Version = desc.Version.ToString(); 184 return product; 185 } 186 #endregion 187 188 #region plugin <-> pluginDescription transformation 189 // cache for plugin descriptions 190 private Dictionary<Plugin, PluginDescription> pluginDescriptions = new Dictionary<Plugin, PluginDescription>(); 191 private PluginDescription MakePluginDescription(PluginStoreClassesDataContext ctx, Plugin plugin) { 192 if (!pluginDescriptions.ContainsKey(plugin)) { 193 // no cached description -> create new 194 var desc = new PluginDescription(plugin.Id, plugin.Name, new Version(plugin.Version), from dep in GetDependencies(ctx, plugin) 195 select MakePluginDescription(ctx, dep)); 196 pluginDescriptions[plugin] = desc; 197 } 198 return pluginDescriptions[plugin]; 173 199 } 174 200 … … 181 207 } 182 208 183 private Product MakeProductFromDescription(ProductDescription desc) {184 var product = new Product();185 product.Id = desc.Id;186 product.Name = desc.Name;187 product.Version = desc.Version.ToString();188 return product;189 }190 191 209 private PluginPackage MakePluginPackage(PluginDescription pluginDescription, byte[] pluginPackage) { 192 210 var package = new PluginPackage(); … … 196 214 return package; 197 215 } 216 217 #endregion 218 219 #region helper queries 220 private Plugin GetExistingPlugin(PluginStoreClassesDataContext ctx, string name, Version version) { 221 return (from p in ctx.Plugins 222 where p.Name == name 223 where p.Version == version.ToString() 224 select p).Single(); 225 } 226 227 private IEnumerable<Plugin> GetDependencies(PluginStoreClassesDataContext ctx, Plugin plugin) { 228 return from pair in ctx.Dependencies 229 from dependency in ctx.Plugins 230 where pair.PluginId == plugin.Id 231 where pair.DependencyId == dependency.Id 232 select dependency; 233 } 234 #endregion 198 235 } 199 236 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment.Test/HeuristicLab.Services.Deployment.Test.csproj
r2742 r2771 47 47 <RequiredTargetFramework>3.0</RequiredTargetFramework> 48 48 </Reference> 49 <Reference Include="System.ServiceModel"> 50 <RequiredTargetFramework>3.0</RequiredTargetFramework> 51 </Reference> 49 52 <Reference Include="System.Xml" /> 50 53 <Reference Include="System.Xml.Linq"> … … 53 56 </ItemGroup> 54 57 <ItemGroup> 58 <Compile Include="AdminTest.cs" /> 55 59 <Compile Include="PluginStoreTest.cs" /> 56 60 <Compile Include="Properties\AssemblyInfo.cs" /> 61 <Compile Include="Service References\AdminService\Reference.cs"> 62 <AutoGen>True</AutoGen> 63 <DesignTime>True</DesignTime> 64 <DependentUpon>Reference.svcmap</DependentUpon> 65 </Compile> 66 <Compile Include="Service References\UpdateService\Reference.cs"> 67 <AutoGen>True</AutoGen> 68 <DesignTime>True</DesignTime> 69 <DependentUpon>Reference.svcmap</DependentUpon> 70 </Compile> 57 71 </ItemGroup> 58 72 <ItemGroup> 59 73 <Content Include="AuthoringTests.txt" /> 74 <None Include="Service References\AdminService\Reference.svcmap"> 75 <Generator>WCF Proxy Generator</Generator> 76 <LastGenOutput>Reference.cs</LastGenOutput> 77 </None> 78 <None Include="Service References\AdminService\configuration.svcinfo" /> 79 <None Include="Service References\AdminService\configuration91.svcinfo" /> 80 <None Include="Service References\UpdateService\Reference.svcmap"> 81 <Generator>WCF Proxy Generator</Generator> 82 <LastGenOutput>Reference.cs</LastGenOutput> 83 </None> 84 <None Include="Service References\UpdateService\configuration.svcinfo" /> 85 <None Include="Service References\UpdateService\configuration91.svcinfo" /> 60 86 </ItemGroup> 61 87 <ItemGroup> … … 64 90 <Name>HeuristicLab.Services.Deployment.DataAccess</Name> 65 91 </ProjectReference> 92 <ProjectReference Include="..\HeuristicLab.Services.Deployment\HeuristicLab.Services.Deployment.csproj"> 93 <Project>{30D8C5F1-CD3A-4EC1-907F-430177A03FBE}</Project> 94 <Name>HeuristicLab.Services.Deployment</Name> 95 </ProjectReference> 96 </ItemGroup> 97 <ItemGroup> 98 <WCFMetadata Include="Service References\" /> 99 </ItemGroup> 100 <ItemGroup> 101 <None Include="app.config" /> 102 <None Include="Properties\DataSources\HeuristicLab.Services.Deployment.DataAccess.PluginDescription.datasource" /> 103 <None Include="Properties\DataSources\HeuristicLab.Services.Deployment.DataAccess.ProductDescription.datasource" /> 104 <None Include="Service References\AdminService\HeuristicLab.Services.Deployment.DataAccess.xsd" /> 105 <None Include="Service References\AdminService\service.wsdl" /> 106 <None Include="Service References\AdminService\service.xsd" /> 107 <None Include="Service References\AdminService\service1.xsd" /> 108 <None Include="Service References\AdminService\System.xsd" /> 109 <None Include="Service References\UpdateService\HeuristicLab.Services.Deployment.DataAccess.xsd" /> 110 <None Include="Service References\UpdateService\service.wsdl" /> 111 <None Include="Service References\UpdateService\service.xsd" /> 112 <None Include="Service References\UpdateService\service1.xsd" /> 113 <None Include="Service References\UpdateService\System.xsd" /> 114 </ItemGroup> 115 <ItemGroup> 116 <WCFMetadataStorage Include="Service References\AdminService\" /> 117 <WCFMetadataStorage Include="Service References\UpdateService\" /> 66 118 </ItemGroup> 67 119 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment.Test/PluginStoreTest.cs
r2766 r2771 72 72 int oldCount = target.Plugins.Count(); 73 73 // store a new entry in the db 74 string name = Guid.NewGuid().ToString();74 string name = RandomName(); 75 75 target.Persist(new PluginDescription(name, new Version(0, 1)), enc.GetBytes("Zipped " + name)); 76 76 int newCount = target.Plugins.Count(); … … 100 100 #region persist single plugin without dependencies 101 101 { 102 string name = Guid.NewGuid().ToString();102 string name = RandomName(); 103 103 int oldCount = target.Plugins.Count(); 104 104 PluginDescription pluginDescription = new PluginDescription(name, vers01); … … 112 112 #region persist a product with same name and version as an existent product 113 113 { 114 string name = Guid.NewGuid().ToString();114 string name = RandomName(); 115 115 int oldCount = target.Plugins.Count(); 116 116 PluginDescription pluginDescription = new PluginDescription(name, vers01); … … 142 142 #region persist a plugin with an already persisted dependency 143 143 { 144 string name = Guid.NewGuid().ToString();144 string name = RandomName(); 145 145 PluginDescription dependency = new PluginDescription(name, vers01); 146 146 // insert dependency first … … 148 148 149 149 // persist another plugin that has a dependency on the first plugin 150 string name2 = Guid.NewGuid().ToString();150 string name2 = RandomName(); 151 151 int oldCount = target.Plugins.Count(); 152 152 … … 168 168 // try to persist a new plugin with a non-existant dependency 169 169 try { 170 string pluginName = Guid.NewGuid().ToString();171 string dependencyName = Guid.NewGuid().ToString();170 string pluginName = RandomName(); 171 string dependencyName = RandomName(); 172 172 var dependency = new PluginDescription(dependencyName, vers01); 173 173 var newEntity = new PluginDescription(pluginName, vers01, Enumerable.Repeat(dependency, 1)); … … 185 185 { 186 186 // insert new plugin 187 string pluginName = Guid.NewGuid().ToString();187 string pluginName = RandomName(); 188 188 var newPlugin = new PluginDescription(pluginName, vers01); 189 189 target.Persist(newPlugin, enc.GetBytes("Zipped " + pluginName)); … … 204 204 #region update the dependencies of an existing plugin 205 205 { 206 string dependency1Name = Guid.NewGuid().ToString();206 string dependency1Name = RandomName(); 207 207 var newDependency1 = new PluginDescription(dependency1Name, vers01); 208 208 target.Persist(newDependency1, enc.GetBytes("Zipped " + dependency1Name)); 209 209 210 string pluginName = Guid.NewGuid().ToString();210 string pluginName = RandomName(); 211 211 var newPlugin = new PluginDescription(pluginName, vers01, Enumerable.Repeat(newDependency1, 1)); 212 212 target.Persist(newPlugin, enc.GetBytes("Zipped " + pluginName)); … … 218 218 219 219 // change dependencies 220 string dependency2Name = Guid.NewGuid().ToString();220 string dependency2Name = RandomName(); 221 221 var newDependency2 = new PluginDescription(dependency2Name, vers01); 222 222 target.Persist(newDependency2, enc.GetBytes("Zipped " + pluginName)); … … 232 232 #region try to insert a plugin that references the same dependency twice and check if the correct exception is thrown 233 233 { 234 string depName = Guid.NewGuid().ToString();234 string depName = RandomName(); 235 235 var depPlugin = new PluginDescription(depName, vers01); 236 236 target.Persist(depPlugin, enc.GetBytes("Zipped " + depName)); 237 237 238 238 // insert new plugin 239 string pluginName = Guid.NewGuid().ToString();239 string pluginName = RandomName(); 240 240 var plugin = new PluginDescription(pluginName, vers01, new PluginDescription[] { depPlugin, depPlugin }); 241 241 try { … … 248 248 } 249 249 #endregion 250 251 #region try to insert a plugin that with a cyclic reference 252 { 253 string depName = RandomName(); 254 var depPlugin = new PluginDescription(depName, vers01); 255 target.Persist(depPlugin, enc.GetBytes("Zipped " + depName)); 256 257 // update the plugin so that it has a dependency on itself 258 var plugin = new PluginDescription(depName, vers01, new PluginDescription[] { depPlugin }); 259 try { 260 target.Persist(plugin, enc.GetBytes("Zipped " + depName)); 261 Assert.Fail("Expected ArgumentException"); 262 } 263 catch (ArgumentException) { 264 Assert.IsTrue(true, "Exception thrown as expected"); 265 } 266 } 267 #endregion 268 250 269 } 251 270 … … 260 279 #region persist a product without plugins to the db 261 280 { 262 string prodName = Guid.NewGuid().ToString();281 string prodName = RandomName(); 263 282 int oldCount = target.Products.Count(); 264 283 ProductDescription product = new ProductDescription(prodName, vers01); … … 271 290 #region persist a product with the same name and version as an existant product 272 291 { 273 string prodName = Guid.NewGuid().ToString();292 string prodName = RandomName(); 274 293 int oldCount = target.Products.Count(); 275 294 ProductDescription product = new ProductDescription(prodName, vers01); … … 300 319 #region try to persist a product referencing an non-existant plugin and check the expected exception 301 320 { 302 // try to persist a product referencing a nnon-existant plugin303 string prodName = Guid.NewGuid().ToString();304 string pluginName = Guid.NewGuid().ToString();321 // try to persist a product referencing a non-existant plugin 322 string prodName = RandomName(); 323 string pluginName = RandomName(); 305 324 var plugin = new PluginDescription(pluginName, vers01); 306 325 var product = new ProductDescription(prodName, vers01, Enumerable.Repeat(plugin, 1)); … … 318 337 #region persist a product with a single plugin reference 319 338 { 320 string prodName = Guid.NewGuid().ToString();321 string pluginName = Guid.NewGuid().ToString();339 string prodName = RandomName(); 340 string pluginName = RandomName(); 322 341 var plugin = new PluginDescription(pluginName, vers01); 323 342 var product = new ProductDescription(prodName, vers01, Enumerable.Repeat(plugin, 1)); … … 339 358 #region update the plugin list of an existing product 340 359 { 341 string prodName = Guid.NewGuid().ToString();342 string plugin1Name = Guid.NewGuid().ToString();360 string prodName = RandomName(); 361 string plugin1Name = RandomName(); 343 362 var plugin1 = new PluginDescription(plugin1Name, vers01); 344 363 var product = new ProductDescription(prodName, vers01, Enumerable.Repeat(plugin1, 1)); … … 352 371 Assert.AreEqual(oldCount + 1, newCount); 353 372 354 var plugin2Name = Guid.NewGuid().ToString();373 var plugin2Name = RandomName(); 355 374 var plugin2 = new PluginDescription(plugin2Name, vers01); 356 375 target.Persist(plugin2, enc.GetBytes("Zipped " + plugin2.Name)); … … 370 389 #region insert a product which references the same plugin twice and check if the correct exception is thrown 371 390 { 372 string prodName = Guid.NewGuid().ToString();373 string plugin1Name = Guid.NewGuid().ToString();391 string prodName = RandomName(); 392 string plugin1Name = RandomName(); 374 393 var plugin1 = new PluginDescription(plugin1Name, vers01); 375 394 var product = new ProductDescription(prodName, vers01, Enumerable.Repeat(plugin1, 2)); … … 406 425 List<PluginDescription> plugins = new List<PluginDescription>(); 407 426 for (int i = 0; i < nPlugins; i++) { 408 string name = Guid.NewGuid().ToString();427 string name = RandomName(); 409 428 var dependencies = store.Plugins; 410 429 if (dependencies.Count() > maxDependencies) dependencies = dependencies.Take(maxDependencies); … … 430 449 // create products 431 450 for (int i = 0; i < nProducts; i++) { 432 string name = Guid.NewGuid().ToString();451 string name = RandomName(); 433 452 List<PluginDescription> prodPlugins = new List<PluginDescription>(); 434 453 for (int j = 0; j < avgProductPlugins; j++) { 435 prodPlugins.Add(plugins[r.Next(0, plugins.Count)]); 454 var selectedPlugin = plugins[r.Next(0, plugins.Count)]; 455 if (!prodPlugins.Contains(selectedPlugin)) prodPlugins.Add(selectedPlugin); 436 456 } 437 457 var prod = new ProductDescription(name, vers01, prodPlugins); … … 442 462 " ms (" + (double)stopWatch.ElapsedMilliseconds / nProducts + " ms / product )"); 443 463 } 464 465 private string RandomName() { 466 return Guid.NewGuid().ToString(); 467 } 444 468 } 445 469 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment/Admin.cs
r2742 r2771 12 12 #region IAdmin Members 13 13 14 public void StoreProduct(ProductDescription product) {14 public void DeployProduct(ProductDescription product) { 15 15 var store = new PluginStore(); 16 16 store.Persist(product); -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment/App.config
r2742 r2771 3 3 <configSections> 4 4 </configSections> 5 <system.diagnostics> 6 <sources> 7 <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing"> 8 <listeners> 9 <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 10 <filter type="" /> 11 </add> 12 <add name="ServiceModelMessageLoggingListener"> 13 <filter type="" /> 14 </add> 15 </listeners> 16 </source> 17 <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" 18 propagateActivity="true"> 19 <listeners> 20 <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 21 <filter type="" /> 22 </add> 23 <add name="ServiceModelTraceListener"> 24 <filter type="" /> 25 </add> 26 </listeners> 27 </source> 28 </sources> 29 <sharedListeners> 30 <add initializeData="c:\users\p40086\documents\heuristiclab\hl3-core\branches\deploymentserver prototype\heuristiclab.services\heuristiclab.services.deployment\app_messages.svclog" 31 type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 32 name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp"> 33 <filter type="" /> 34 </add> 35 <add initializeData="c:\users\p40086\documents\heuristiclab\hl3-core\branches\deploymentserver prototype\heuristiclab.services\heuristiclab.services.deployment\app_tracelog.svclog" 36 type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 37 name="ServiceModelTraceListener" traceOutputOptions="Timestamp"> 38 <filter type="" /> 39 </add> 40 </sharedListeners> 41 </system.diagnostics> 5 42 <connectionStrings> 6 43 <add name="HeuristicLab.Services.Deployment.Properties.Settings.HeuristicLab_PluginStoreConnectionString" … … 14 51 app.config file. System.Configuration does not support config files for libraries. --> 15 52 <system.serviceModel> 53 <bindings> 54 <wsHttpBinding> 55 <binding name="DefaultWsHttpBinding" maxBufferPoolSize="10000000" 56 maxReceivedMessageSize="1000000"> 57 <readerQuotas maxDepth="1000" maxStringContentLength="16000" 58 maxArrayLength="10000000" maxBytesPerRead="10000000" maxNameTableCharCount="16000" /> 59 </binding> 60 </wsHttpBinding> 61 <mexHttpBinding> 62 <binding name="DefaultMexHttpBinding" /> 63 </mexHttpBinding> 64 </bindings> 65 <diagnostics performanceCounters="Default"> 66 <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" /> 67 </diagnostics> 16 68 <services> 17 69 <service behaviorConfiguration="HeuristicLab.Services.Deployment.UpdateBehavior" 18 70 name="HeuristicLab.Services.Deployment.Update"> 19 <endpoint address="" binding="wsHttpBinding" contract="HeuristicLab.Services.Deployment.IUpdate"> 71 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding" 72 contract="HeuristicLab.Services.Deployment.IUpdate"> 20 73 <identity> 21 74 <dns value="localhost" /> 22 75 </identity> 23 76 </endpoint> 24 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 77 <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding" 78 contract="IMetadataExchange" /> 25 79 <host> 26 80 <baseAddresses> … … 31 85 <service behaviorConfiguration="HeuristicLab.Services.Deployment.AdminBehavior" 32 86 name="HeuristicLab.Services.Deployment.Admin"> 33 <endpoint address="" binding="wsHttpBinding" contract="HeuristicLab.Services.Deployment.IAdmin"> 87 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding" 88 contract="HeuristicLab.Services.Deployment.IAdmin"> 34 89 <identity> 35 90 <dns value="localhost" /> 36 91 </identity> 37 92 </endpoint> 38 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 93 <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding" 94 contract="IMetadataExchange" /> 39 95 <host> 40 96 <baseAddresses> -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment/IAdmin.cs
r2742 r2771 12 12 public interface IAdmin { 13 13 [OperationContract] 14 void StoreProduct(ProductDescription product);14 void DeployProduct(ProductDescription product); 15 15 16 16 [OperationContract] -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment/IUpdate.cs
r2742 r2771 17 17 IEnumerable<ProductDescription> GetProducts(); 18 18 19 [OperationContract] 20 IEnumerable<PluginDescription> GetPlugins(); 19 21 } 20 22 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services.Deployment/Update.cs
r2742 r2771 23 23 } 24 24 25 public IEnumerable<PluginDescription> GetPlugins() { 26 PluginStore store = new PluginStore(); 27 return store.Plugins; 28 } 29 25 30 #endregion 26 31 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.Services/Web.config
r2742 r2771 9 9 --> 10 10 <configuration> 11 12 13 <configSections> 14 <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 15 <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 16 <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 17 <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 18 <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> 19 <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 20 <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 21 <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 22 </sectionGroup> 23 </sectionGroup> 24 </sectionGroup> 25 </configSections> 26 27 28 <appSettings/> 29 <connectionStrings/> 30 31 <system.web> 32 <!-- 11 <configSections> 12 <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 13 <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 14 <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 15 <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 16 <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 17 <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 18 <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 19 <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 20 </sectionGroup> 21 </sectionGroup> 22 </sectionGroup> 23 </configSections> 24 <appSettings/> 25 <connectionStrings/> 26 <system.web> 27 <!-- 33 28 Set compilation debug="true" to insert debugging 34 29 symbols into the compiled page. Because this … … 36 31 during development. 37 32 --> 38 <compilation debug="false"> 39 40 <assemblies> 41 <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 42 <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 43 </assemblies> 44 45 </compilation> 46 <!-- 33 <compilation debug="true"> 34 <assemblies> 35 <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 36 <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 37 </assemblies> 38 </compilation> 39 <!-- 47 40 The <authentication> section enables configuration 48 41 of the security authentication mode used by 49 42 ASP.NET to identify an incoming user. 50 43 --> 51 <authentication mode="Windows"/>52 44 <authentication mode="Windows"/> 45 <!-- 53 46 The <customErrors> section enables configuration 54 47 of what to do if/when an unhandled error occurs … … 62 55 </customErrors> 63 56 --> 64 65 66 <pages> 67 <controls> 68 <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 69 </controls> 70 </pages> 71 72 <httpHandlers> 73 <remove verb="*" path="*.asmx"/> 74 <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 75 <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 76 <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 77 </httpHandlers> 78 <httpModules> 79 <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 80 </httpModules> 81 82 83 </system.web> 84 85 <system.codedom> 86 <compilers> 87 <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" 88 type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 89 <providerOption name="CompilerVersion" value="v3.5"/> 90 <providerOption name="WarnAsError" value="false"/> 91 </compiler> 92 </compilers> 93 </system.codedom> 94 95 <!-- 57 <pages> 58 <controls> 59 <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 60 </controls> 61 </pages> 62 <httpHandlers> 63 <remove verb="*" path="*.asmx"/> 64 <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 65 <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 66 <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 67 </httpHandlers> 68 <httpModules> 69 <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 70 </httpModules> 71 </system.web> 72 <system.codedom> 73 <compilers> 74 <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 75 <providerOption name="CompilerVersion" value="v3.5"/> 76 <providerOption name="WarnAsError" value="false"/> 77 </compiler> 78 </compilers> 79 </system.codedom> 80 <!-- 96 81 The system.webServer section is required for running ASP.NET AJAX under Internet 97 82 Information Services 7.0. It is not necessary for previous version of IIS. 98 83 --> 99 <system.webServer> 100 <validation validateIntegratedModeConfiguration="false"/> 101 <modules> 102 <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 103 </modules> 104 <handlers> 105 <remove name="WebServiceHandlerFactory-Integrated"/> 106 <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" 107 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 108 <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" 109 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 110 <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 111 </handlers> 112 </system.webServer> 113 114 115 <system.serviceModel> 116 <services> 117 <service behaviorConfiguration="HeuristicLab.Services.Service1Behavior" 118 name="HeuristicLab.Services.Service1"> 119 <endpoint address="" binding="wsHttpBinding" contract="HeuristicLab.Services.IService1"> 120 <identity> 121 <dns value="localhost" /> 122 </identity> 123 </endpoint> 124 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 125 </service> 126 <service behaviorConfiguration="HeuristicLab.Services.UpdateBehavior" 127 name="HeuristicLab.Services.Update"> 128 <endpoint address="" binding="wsHttpBinding" contract="HeuristicLab.Services.IUpdate"> 129 <identity> 130 <dns value="localhost" /> 131 </identity> 132 </endpoint> 133 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 134 </service> 135 <service behaviorConfiguration="HeuristicLab.Services.AdminBehavior" 136 name="HeuristicLab.Services.Admin"> 137 <endpoint address="" binding="wsHttpBinding" contract="HeuristicLab.Services.IAdmin"> 138 <identity> 139 <dns value="localhost" /> 140 </identity> 141 </endpoint> 142 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 143 </service> 144 </services> 145 <behaviors> 146 <serviceBehaviors> 147 <behavior name="HeuristicLab.Services.Service1Behavior"> 148 <serviceMetadata httpGetEnabled="true" /> 149 <serviceDebug includeExceptionDetailInFaults="false" /> 150 </behavior> 151 <behavior name="HeuristicLab.Services.UpdateBehavior"> 152 <serviceMetadata httpGetEnabled="true" /> 153 <serviceDebug includeExceptionDetailInFaults="false" /> 154 </behavior> 155 <behavior name="HeuristicLab.Services.AdminBehavior"> 156 <serviceMetadata httpGetEnabled="true" /> 157 <serviceDebug includeExceptionDetailInFaults="false" /> 158 </behavior> 159 </serviceBehaviors> 160 </behaviors> 161 </system.serviceModel> 84 <system.webServer> 85 <validation validateIntegratedModeConfiguration="false"/> 86 <modules> 87 <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 88 </modules> 89 <handlers> 90 <remove name="WebServiceHandlerFactory-Integrated"/> 91 <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 92 <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 93 <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 94 </handlers> 95 </system.webServer> 96 <system.serviceModel> 97 <bindings> 98 <wsHttpBinding> 99 <binding name="DefaultWsBindingConfiguration"> 100 <readerQuotas maxDepth="1000" maxStringContentLength="1000000" 101 maxArrayLength="1000" maxBytesPerRead="1000000" maxNameTableCharCount="1000" /> 102 </binding> 103 </wsHttpBinding> 104 <mexHttpBinding> 105 <binding name="DefaultMexBindingConfiguration" /> 106 </mexHttpBinding> 107 </bindings> 108 <services> 109 <service behaviorConfiguration="HeuristicLab.Services.UpdateBehavior" 110 name="HeuristicLab.Services.Update"> 111 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="DefaultWsBindingConfiguration" 112 contract="HeuristicLab.Services.IUpdate"> 113 <identity> 114 <dns value="localhost" /> 115 </identity> 116 </endpoint> 117 <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexBindingConfiguration" 118 contract="IMetadataExchange" /> 119 </service> 120 <service behaviorConfiguration="HeuristicLab.Services.AdminBehavior" 121 name="HeuristicLab.Services.Admin"> 122 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="DefaultWsBindingConfiguration" 123 contract="HeuristicLab.Services.IAdmin"> 124 <identity> 125 <dns value="localhost" /> 126 </identity> 127 </endpoint> 128 <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexBindingConfiguration" 129 contract="IMetadataExchange" /> 130 </service> 131 </services> 132 <behaviors> 133 <serviceBehaviors> 134 <behavior name="HeuristicLab.Services.UpdateBehavior"> 135 <serviceMetadata httpGetEnabled="true" /> 136 <serviceDebug includeExceptionDetailInFaults="false" /> 137 </behavior> 138 <behavior name="HeuristicLab.Services.AdminBehavior"> 139 <serviceMetadata httpGetEnabled="true" /> 140 <serviceDebug includeExceptionDetailInFaults="false" /> 141 </behavior> 142 </serviceBehaviors> 143 </behaviors> 144 </system.serviceModel> 162 145 </configuration>
Note: See TracChangeset
for help on using the changeset viewer.