Changeset 1515 for trunk/sources/HeuristicLab.Hive.Server.Core
- Timestamp:
- 04/04/09 15:46:43 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/DbTestApp.cs
r1468 r1515 68 68 clients = clientAdapter.GetAll(); 69 69 Debug.Assert(count - 1 == clients.Count); 70 } */ 71 72 private void TestClientGroupAdapter() { 73 ISessionFactory factory = 74 ServiceLocator.GetSessionFactory(); 75 76 ISession session = 77 factory.GetSessionForCurrentThread(); 78 79 ITransaction trans = null; 80 81 try { 82 IClientGroupAdapter clientGroupAdapter = 83 session.GetDataAdapter<ClientGroup, IClientGroupAdapter>(); 84 85 trans = 86 session.BeginTransaction(); 87 88 ClientInfo client = 89 new ClientInfo(); 90 client.Name = "Stefan"; 91 client.Login = DateTime.Now; 92 93 ClientInfo client2 = 94 new ClientInfo(); 95 client2.Name = "Martin"; 96 client2.Login = DateTime.Now; 97 98 ClientInfo client3 = 99 new ClientInfo(); 100 client3.Name = "Heinz"; 101 client3.Login = DateTime.Now; 102 103 ClientGroup group = 104 new ClientGroup(); 105 106 ClientGroup subGroup = 107 new ClientGroup(); 108 subGroup.Resources.Add(client); 109 110 group.Resources.Add(client3); 111 group.Resources.Add(client2); 112 group.Resources.Add(subGroup); 113 114 clientGroupAdapter.Update(group); 115 116 ClientGroup read = 117 clientGroupAdapter.GetById(group.Id); 118 119 ICollection<ClientGroup> clientGroups = 120 clientGroupAdapter.GetAll(); 121 122 IClientAdapter clientAdapter = 123 session.GetDataAdapter<ClientInfo, IClientAdapter>(); 124 125 clientAdapter.Delete(client3); 126 127 read = 128 clientGroupAdapter.GetById(group.Id); 129 130 clientGroupAdapter.Delete(subGroup); 131 132 read = 133 clientGroupAdapter.GetById(group.Id); 134 135 clientGroups = 136 clientGroupAdapter.GetAll(); 137 138 clientGroupAdapter.Delete(group); 139 140 clientGroups = 141 clientGroupAdapter.GetAll(); 142 143 clientAdapter.Delete(client); 144 clientAdapter.Delete(client2); 145 } 146 finally { 147 if (trans != null) 148 trans.Rollback(); 149 150 session.EndSession(); 151 } 70 152 } 71 153 72 private void TestClientGroupAdapter() { 73 IClientGroupAdapter clientGroupAdapter = 74 ServiceLocator.GetClientGroupAdapter(); 75 76 ClientInfo client = 77 new ClientInfo(); 78 client.Name = "Stefan"; 79 client.Login = DateTime.Now; 80 81 ClientInfo client2 = 82 new ClientInfo(); 83 client2.Name = "Martin"; 84 client2.Login = DateTime.Now; 85 86 ClientInfo client3 = 87 new ClientInfo(); 88 client3.Name = "Heinz"; 89 client3.Login = DateTime.Now; 90 91 ClientGroup group = 92 new ClientGroup(); 93 94 ClientGroup subGroup = 95 new ClientGroup(); 96 subGroup.Resources.Add(client); 97 98 group.Resources.Add(client3); 99 group.Resources.Add(client2); 100 group.Resources.Add(subGroup); 101 102 clientGroupAdapter.Update(group); 103 104 ClientGroup read = 105 clientGroupAdapter.GetById(group.Id); 106 107 ICollection<ClientGroup> clientGroups = 108 clientGroupAdapter.GetAll(); 109 110 IClientAdapter clientAdapter = 111 ServiceLocator.GetClientAdapter(); 112 113 clientAdapter.Delete(client3); 114 115 read = 116 clientGroupAdapter.GetById(group.Id); 117 118 clientGroupAdapter.Delete(subGroup); 119 120 read = 121 clientGroupAdapter.GetById(group.Id); 122 123 clientGroups = 124 clientGroupAdapter.GetAll(); 125 126 clientGroupAdapter.Delete(group); 127 128 clientGroups = 129 clientGroupAdapter.GetAll(); 130 131 clientAdapter.Delete(client); 132 clientAdapter.Delete(client2); 133 } 134 135 private void TestJobAdapter() { 154 /* private void TestJobAdapter() { 136 155 IJobAdapter jobAdapter = 137 156 ServiceLocator.GetJobAdapter(); … … 201 220 } */ 202 221 203 p ublic override void Run() {222 private void TestTransaction() { 204 223 ISessionFactory factory = 205 224 ServiceLocator.GetSessionFactory(); 206 225 207 ISession session = 226 ISession session = 208 227 factory.GetSessionForCurrentThread(); 209 228 210 IClientAdapter clientAdapter = 229 IClientAdapter clientAdapter = 211 230 session.GetDataAdapter<ClientInfo, IClientAdapter>(); 212 231 213 ITransaction trans = 214 session.BeginTransaction(); 232 ITransaction trans = 233 session.BeginTransaction(); 215 234 216 235 ClientInfo client = new ClientInfo(); … … 221 240 222 241 session.EndSession(); 242 } 243 244 public override void Run() { 245 TestClientGroupAdapter(); 223 246 } 224 247 }
Note: See TracChangeset
for help on using the changeset viewer.