Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Program.cs @ 5335

Last change on this file since 5335 was 5335, checked in by fruehrli, 14 years ago

#1197
modified and new service methods

File size: 6.6 KB
Line 
1using System;
2using System.Text;
3using System.Collections.Generic;
4using System.Linq;
5
6using HeuristicLab.Services.Authentication;
7using HL = HeuristicLab.Services.Authentication;
8using DA = HeuristicLab.Services.Authentication.DataAccess;
9using DT = HeuristicLab.Services.Authentication.DataTransfer;
10using System.Data;
11using System.Data.Common;
12using System.Data.Linq;
13using System.Collections;
14
15namespace Test {
16  class Program {
17    static void Main(string[] args) {
18
19      //// //DA.ClientManagmentDataContext dc = new DA.ClientManagmentDataContext(@"Data Source=.\SQL2008;Initial Catalog=HeuristicLab.ClientManagment;Integrated Security=True");
20      //// DA.ClientManagmentDataContext dc = new DA.ClientManagmentDataContext();
21
22      //// if (dc.DatabaseExists()) {
23      ////   Console.WriteLine("DB exsits");
24      ////   dc.DeleteDatabase();
25      ////   dc.SubmitChanges();
26      ////   Console.WriteLine("DB deleted");
27      //// }
28      //// Console.WriteLine("DB create");
29      //// dc.CreateDatabase();
30      //// dc.SubmitChanges();
31      //// Console.WriteLine("Finished");
32
33      //// AuthenticationService cs = new AuthenticationService();
34
35      //// DT.Client c = new DT.Client();
36
37      //// c.Id = Guid.NewGuid();
38      //// c.Name = "Eagle-Eye";
39      //// c.Description = "Development-PC";
40      //// c.IPAdress = "192.168.0.1";
41
42      //// //c.ResourceType = "Client";
43      //// DT.ResourceGroup r = new DT.ResourceGroup();
44      //// r.Name = "test";
45
46      //// //r.Id = cs.AddResourceGroup(r);
47
48      //// //c.ResourceGroup = r.Id;
49      //// //c.Id = cs.AddClient(c);
50
51      //// //ResourceResourceGroup rrg = new ResourceResourceGroup();
52      //// //rrg.ResourceGroup = r;
53      //// //rrg.Client = c;
54
55
56      //// //dc.GetTable<Resource>().InsertOnSubmit(r);
57      //// //dc.GetTable<Resource>().InsertOnSubmit(c);
58
59      //// //dc.GetTable<ResourceResourceGroup>().InsertOnSubmit(rrg);
60
61      //// //dc.SubmitChanges();
62
63
64      ////// cs.GetClients();
65
66      //// //cs.DeleteClient(c);
67      ////cs.DeleteResourceGroup(r);
68      //Guid groupID1 = Guid.NewGuid();
69      //string groupName1 = "groupName1";
70      //Guid groupID2 = Guid.NewGuid();
71      //string groupName2 = "groupName2";
72      //Guid groupID3 = Guid.NewGuid();
73      //string groupName3 = "groupName3";
74
75      //Guid clientID1 = Guid.NewGuid();
76      //string clientName1 = "clientName1";
77      //Guid clientID2 = Guid.NewGuid();
78      //string clientName2 = "clientName2";
79
80      //DA.ClientManagmentDataContext dc = null;
81
82      //DT.Client cl1 = null;
83      //DT.Client cl2 = null;
84      //DT.Client cl3 = null;
85
86      //DT.ResourceGroup rg1 = null;
87      //DT.ResourceGroup rg2 = null;
88      //DT.ResourceGroup rg3 = null;
89
90      //DA.ResourceResourceGroup rrg1 = null;
91      //DA.ResourceResourceGroup rrg2 = null;
92      //DA.ResourceResourceGroup rrg3 = null;
93
94      //dc = new DA.ClientManagmentDataContext();
95      //if (dc.DatabaseExists()) {
96      //  //dc.DeleteDatabase();
97      //  dc.ExecuteCommand("delete from ResourceResourceGroup");
98      //  dc.ExecuteCommand("delete from Resource");
99      //  dc.SubmitChanges();
100      //}
101      //else {
102      //  dc.CreateDatabase();
103      //  dc.SubmitChanges();
104      //}
105
106
107      //// create groups
108      //rg1 = new DT.ResourceGroup();
109      //rg1.Name = groupName1;
110      //rg1.Id = groupID1;
111      //rg1.Description = "descr rg1";
112      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg1));
113
114      //rg2 = new DT.ResourceGroup();
115      //rg2.Name = groupName2;
116      //rg2.Id = groupID2;
117
118      //IList<Guid> rgList = new List<Guid>();
119      //rgList.Add(rg1.Id);
120      //rg2.ResourceGroup = rgList;
121
122      //rg2.Description = "descrrg2";
123      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg2));
124
125      //rg3 = new DT.ResourceGroup();
126      //rg3.Name = groupName3;
127      //rg3.Id = groupID3;
128      //rg3.Description = "descrrg3";
129      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg3));
130
131      //// create clients
132      //cl1 = new DT.Client();
133      //cl1.Name = clientName1;
134      //cl1.Id = clientID1;
135
136      //IList<Guid> rgList1 = new List<Guid>();
137      //rgList.Add(groupID1);
138      //cl1.ResourceGroup = rgList1;
139
140      //cl1.Description = "Test-PC-1";
141      //cl1.IPAdress = "192.168.0.10";
142      //cl1.NumberOfProcessors = "2";
143      //cl1.NumberOfThreads = "4";
144      //cl1.OperatingSystem = "WINXP";
145      //cl1.MemorySize = "2048";
146      //cl1.ProcessorType = "AMD";
147      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(cl1));
148
149      //cl2 = new DT.Client();
150      //cl2.Name = clientName2;
151      //cl2.Id = clientID2;
152
153      //IList<Guid> rgList2 = new List<Guid>();
154      //rgList.Add(groupID2);
155      //cl2.ResourceGroup = rgList2;
156
157      //cl2.Description = "Test-PC-2";
158      //cl2.IPAdress = "192.168.0.20";
159      //cl2.NumberOfProcessors = "4";
160      //cl2.NumberOfThreads = "4";
161      //cl2.OperatingSystem = "Vista";
162      //cl2.MemorySize = "4096";
163      //cl2.ProcessorType = "Intel";
164      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(cl2));
165
166      //// ResourceResourceGroups
167      //rrg1 = new DA.ResourceResourceGroup();
168      //rrg1.ResourceId = cl1.Id;
169      //rrg1.ResourceGroupId = rg1.Id;
170      //dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg1);
171
172      //rrg2 = new DA.ResourceResourceGroup();
173      //rrg2.ResourceId = cl2.Id;
174      //rrg2.ResourceGroupId = rg2.Id;
175      //dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg2);
176
177      //rrg3 = new DA.ResourceResourceGroup();
178      //rrg3.ResourceId = rg1.Id;
179      //rrg3.ResourceGroupId = rg3.Id;
180      //dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg3);
181
182      //dc.SubmitChanges();
183
184
185     // AuthenticationService cs = new AuthenticationService();
186
187     // DA.Client client = dc.Resources.OfType<DA.Client>().First(x => x.Id == cl1.Id);
188     // DT.Client modClient = HeuristicLab.Services.Authentication.Convert.ToDto(client);
189
190     // //cl1.Id ;
191     // //cl1.ResourceType ;
192     // modClient.Name = "clientName1_modified";
193
194     //// IList<Guid> rgList = new List<Guid>();
195     //// rgList.Add(groupID3);
196
197     // //cl1.ResourceGroup = rgList;
198
199     // modClient.Description = "Test-PC-1_modifiet";
200     // modClient.IPAdress = "192.168.0.11";
201     // modClient.NumberOfProcessors = "4";
202     // modClient.NumberOfThreads = "2";
203     // modClient.OperatingSystem = "Vista";
204     // modClient.MemorySize = "2196";
205     // modClient.ProcessorType = "Intel";
206
207     // cs.UpdateClient(modClient);
208
209    }
210  }
211}
Note: See TracBrowser for help on using the repository browser.