@@ -92,9 +92,9 @@ namespace Xtensive.Orm.Tests.Storage.Multinode
9292{
9393 public sealed class QueryCachingTest : MultinodeTest
9494 {
95- private const string dbo = WellKnownSchemas . SqlServerDefaultSchema ;
96- private const string Schema1 = WellKnownSchemas . Schema1 ;
97- private const string Schema2 = WellKnownSchemas . Schema2 ;
95+ private const string DefaultSchema = WellKnownSchemas . Schema1 ;
96+ private const string Schema1 = WellKnownSchemas . Schema2 ;
97+ private const string Schema2 = WellKnownSchemas . Schema3 ;
9898
9999 private readonly object SimpleQueryKey = new object ( ) ;
100100 private readonly object FilterByIdQueryKey = new object ( ) ;
@@ -113,21 +113,21 @@ protected override DomainConfiguration BuildConfiguration()
113113 var configuration = base . BuildConfiguration ( ) ;
114114 configuration . Types . Register ( typeof ( BaseTestEntity ) . Assembly , typeof ( BaseTestEntity ) . Namespace ) ;
115115 configuration . UpgradeMode = DomainUpgradeMode . Recreate ;
116- configuration . DefaultSchema = dbo ;
116+ configuration . DefaultSchema = DefaultSchema ;
117117 return configuration ;
118118 }
119119
120120 protected override void PopulateNodes ( )
121121 {
122122 CustomUpgradeHandler . CurrentNodeId = TestNodeId2 ;
123123 var nodeConfiguration = new NodeConfiguration ( TestNodeId2 ) ;
124- nodeConfiguration . SchemaMapping . Add ( dbo , Schema1 ) ;
124+ nodeConfiguration . SchemaMapping . Add ( DefaultSchema , Schema1 ) ;
125125 nodeConfiguration . UpgradeMode = DomainUpgradeMode . Recreate ;
126126 _ = Domain . StorageNodeManager . AddNode ( nodeConfiguration ) ;
127127
128128 CustomUpgradeHandler . CurrentNodeId = TestNodeId3 ;
129129 nodeConfiguration = new NodeConfiguration ( TestNodeId3 ) ;
130- nodeConfiguration . SchemaMapping . Add ( dbo , Schema2 ) ;
130+ nodeConfiguration . SchemaMapping . Add ( DefaultSchema , Schema2 ) ;
131131 nodeConfiguration . UpgradeMode = DomainUpgradeMode . Recreate ;
132132 _ = Domain . StorageNodeManager . AddNode ( nodeConfiguration ) ;
133133 }
@@ -142,68 +142,70 @@ protected override void PopulateData()
142142 using ( var tx = session . OpenTransaction ( ) ) {
143143 #region Entity creation
144144
145- _ = new BaseTestEntity ( session ) { BaseName = "A" , BaseOwnerNodeId = nodeId } ;
145+ var nodeIdName = string . IsNullOrEmpty ( nodeId ) ? "<default>" : nodeId ;
146+
147+ _ = new BaseTestEntity ( session ) { BaseName = "A" , BaseOwnerNodeId = nodeIdName } ;
146148 _ = new MiddleTestEntity ( session ) {
147149 BaseName = "AA" ,
148150 MiddleName = "AAM" ,
149- BaseOwnerNodeId = nodeId ,
150- MiddleOwnerNodeId = nodeId
151+ BaseOwnerNodeId = nodeIdName ,
152+ MiddleOwnerNodeId = nodeIdName
151153 } ;
152154 _ = new LeafTestEntity ( session ) {
153155 BaseName = "AAA" ,
154156 MiddleName = "AAAM" ,
155157 LeafName = "AAAL" ,
156- BaseOwnerNodeId = nodeId ,
157- MiddleOwnerNodeId = nodeId ,
158- LeafOwnerNodeId = nodeId
158+ BaseOwnerNodeId = nodeIdName ,
159+ MiddleOwnerNodeId = nodeIdName ,
160+ LeafOwnerNodeId = nodeIdName
159161 } ;
160162
161- _ = new BaseTestEntity ( session ) { BaseName = "B" , BaseOwnerNodeId = nodeId } ;
163+ _ = new BaseTestEntity ( session ) { BaseName = "B" , BaseOwnerNodeId = nodeIdName } ;
162164 _ = new MiddleTestEntity ( session ) {
163165 BaseName = "BB" ,
164166 MiddleName = "BBM" ,
165- BaseOwnerNodeId = nodeId ,
166- MiddleOwnerNodeId = nodeId
167+ BaseOwnerNodeId = nodeIdName ,
168+ MiddleOwnerNodeId = nodeIdName
167169 } ;
168170 _ = new LeafTestEntity ( session ) {
169171 BaseName = "BBB" ,
170172 MiddleName = "BBBM" ,
171173 LeafName = "BBBL" ,
172- BaseOwnerNodeId = nodeId ,
173- MiddleOwnerNodeId = nodeId ,
174- LeafOwnerNodeId = nodeId
174+ BaseOwnerNodeId = nodeIdName ,
175+ MiddleOwnerNodeId = nodeIdName ,
176+ LeafOwnerNodeId = nodeIdName
175177 } ;
176178
177- _ = new BaseTestEntity ( session ) { BaseName = "C" , BaseOwnerNodeId = nodeId } ;
179+ _ = new BaseTestEntity ( session ) { BaseName = "C" , BaseOwnerNodeId = nodeIdName } ;
178180 _ = new MiddleTestEntity ( session ) {
179181 BaseName = "CC" ,
180182 MiddleName = "CCM" ,
181- BaseOwnerNodeId = nodeId ,
182- MiddleOwnerNodeId = nodeId
183+ BaseOwnerNodeId = nodeIdName ,
184+ MiddleOwnerNodeId = nodeIdName
183185 } ;
184186 _ = new LeafTestEntity ( session ) {
185187 BaseName = "CCC" ,
186188 MiddleName = "CCCM" ,
187189 LeafName = "CCCL" ,
188- BaseOwnerNodeId = nodeId ,
189- MiddleOwnerNodeId = nodeId ,
190- LeafOwnerNodeId = nodeId
190+ BaseOwnerNodeId = nodeIdName ,
191+ MiddleOwnerNodeId = nodeIdName ,
192+ LeafOwnerNodeId = nodeIdName
191193 } ;
192194
193- _ = new BaseTestEntity ( session ) { BaseName = "D" , BaseOwnerNodeId = nodeId } ;
195+ _ = new BaseTestEntity ( session ) { BaseName = "D" , BaseOwnerNodeId = nodeIdName } ;
194196 _ = new MiddleTestEntity ( session ) {
195197 BaseName = "DD" ,
196198 MiddleName = "DDM" ,
197- BaseOwnerNodeId = nodeId ,
198- MiddleOwnerNodeId = nodeId
199+ BaseOwnerNodeId = nodeIdName ,
200+ MiddleOwnerNodeId = nodeIdName
199201 } ;
200202 _ = new LeafTestEntity ( session ) {
201203 BaseName = "DDD" ,
202204 MiddleName = "DDDM" ,
203205 LeafName = "DDDL" ,
204- BaseOwnerNodeId = nodeId ,
205- MiddleOwnerNodeId = nodeId ,
206- LeafOwnerNodeId = nodeId
206+ BaseOwnerNodeId = nodeIdName ,
207+ MiddleOwnerNodeId = nodeIdName ,
208+ LeafOwnerNodeId = nodeIdName
207209 } ;
208210
209211 #endregion
@@ -254,10 +256,11 @@ private void RunTestSimpleQueryTest(string nodeId)
254256 using ( var session = selectedNode . OpenSession ( ) )
255257 using ( var tx = session . OpenTransaction ( ) ) {
256258 var expectedTypeId = GetExpectedTypeId ( nodeId ) ;
259+ var nodeIdName = string . IsNullOrEmpty ( nodeId ) ? "<default>" : nodeId ;
257260
258261 var allResults = ExecuteSimpleQueryNoCache ( session ) . OrderBy ( e => e . TypeId ) . ToList ( ) ;
259262 Assert . That ( allResults . Count , Is . EqualTo ( 3 ) ) ;
260- Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeId ) , Is . True ) ;
263+ Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeIdName ) , Is . True ) ;
261264 Assert . That ( allResults [ 0 ] . BaseName , Is . EqualTo ( "C" ) ) ;
262265 Assert . That ( allResults [ 0 ] . TypeId , Is . EqualTo ( expectedTypeId ) ) ;
263266 Assert . That ( allResults [ 1 ] . BaseName , Is . EqualTo ( "CC" ) ) ;
@@ -267,18 +270,18 @@ private void RunTestSimpleQueryTest(string nodeId)
267270
268271 var middles = allResults . OfType < MiddleTestEntity > ( ) . ToList ( ) ;
269272 Assert . That ( middles . Count , Is . EqualTo ( 2 ) ) ;
270- Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeId ) , Is . True ) ;
273+ Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeIdName ) , Is . True ) ;
271274 Assert . That ( middles [ 0 ] . MiddleName , Is . EqualTo ( "CCM" ) ) ;
272275 Assert . That ( middles [ 1 ] . MiddleName , Is . EqualTo ( "CCCM" ) ) ;
273276
274277 var leafs = middles . OfType < LeafTestEntity > ( ) . ToList ( ) ;
275278 Assert . That ( leafs . Count , Is . EqualTo ( 1 ) ) ;
276- Assert . That ( leafs [ 0 ] . LeafOwnerNodeId , Is . EqualTo ( nodeId ) ) ;
279+ Assert . That ( leafs [ 0 ] . LeafOwnerNodeId , Is . EqualTo ( nodeIdName ) ) ;
277280 Assert . That ( leafs [ 0 ] . LeafName , Is . EqualTo ( "CCCL" ) ) ;
278281
279282 allResults = ExecuteSimpleQueryCaching ( session ) ;
280283 Assert . That ( allResults . Count , Is . EqualTo ( 3 ) ) ;
281- Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeId ) , Is . True ) ;
284+ Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeIdName ) , Is . True ) ;
282285 Assert . That ( allResults [ 0 ] . BaseName , Is . EqualTo ( "B" ) ) ;
283286 Assert . That ( allResults [ 0 ] . TypeId , Is . EqualTo ( expectedTypeId ) ) ;
284287 Assert . That ( allResults [ 1 ] . BaseName , Is . EqualTo ( "BB" ) ) ;
@@ -288,13 +291,13 @@ private void RunTestSimpleQueryTest(string nodeId)
288291
289292 middles = allResults . OfType < MiddleTestEntity > ( ) . ToList ( ) ;
290293 Assert . That ( middles . Count , Is . EqualTo ( 2 ) ) ;
291- Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeId ) , Is . True ) ;
294+ Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeIdName ) , Is . True ) ;
292295 Assert . That ( middles [ 0 ] . MiddleName , Is . EqualTo ( "BBM" ) ) ;
293296 Assert . That ( middles [ 1 ] . MiddleName , Is . EqualTo ( "BBBM" ) ) ;
294297
295298 leafs = middles . OfType < LeafTestEntity > ( ) . ToList ( ) ;
296299 Assert . That ( leafs . Count , Is . EqualTo ( 1 ) ) ;
297- Assert . That ( leafs [ 0 ] . LeafOwnerNodeId , Is . EqualTo ( nodeId ) ) ;
300+ Assert . That ( leafs [ 0 ] . LeafOwnerNodeId , Is . EqualTo ( nodeIdName ) ) ;
298301 Assert . That ( leafs [ 0 ] . LeafName , Is . EqualTo ( "BBBL" ) ) ;
299302 }
300303 }
@@ -305,50 +308,51 @@ private void RunFilterByTypeIdQueryTest(string nodeId)
305308 using ( var session = selectedNode . OpenSession ( ) )
306309 using ( var tx = session . OpenTransaction ( ) ) {
307310 var expectedTypeId = GetExpectedTypeId ( nodeId ) ;
311+ var nodeIdName = string . IsNullOrEmpty ( nodeId ) ? "<default>" : nodeId ;
308312
309313 var resultWithoutCache = ExecuteFilterByTypeIdNoCache ( session , expectedTypeId ) ;
310314 Assert . That ( resultWithoutCache . Count , Is . EqualTo ( 4 ) ) ;
311- Assert . That ( resultWithoutCache . All ( e => e . BaseOwnerNodeId == nodeId ) ) ;
315+ Assert . That ( resultWithoutCache . All ( e => e . BaseOwnerNodeId == nodeIdName ) ) ;
312316 Assert . That ( resultWithoutCache . All ( e => e . TypeId == expectedTypeId ) , Is . True ) ;
313317 Assert . That ( resultWithoutCache . OfType < BaseTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
314318 Assert . That ( resultWithoutCache . OfType < MiddleTestEntity > ( ) . Any ( ) , Is . False ) ;
315319 Assert . That ( resultWithoutCache . OfType < LeafTestEntity > ( ) . Any ( ) , Is . False ) ;
316320
317321 resultWithoutCache = ExecuteFilterByTypeIdNoCache ( session , expectedTypeId + 1 ) ;
318322 Assert . That ( resultWithoutCache . Count , Is . EqualTo ( 4 ) ) ;
319- Assert . That ( resultWithoutCache . All ( e => e . BaseOwnerNodeId == nodeId ) ) ;
323+ Assert . That ( resultWithoutCache . All ( e => e . BaseOwnerNodeId == nodeIdName ) ) ;
320324 Assert . That ( resultWithoutCache . All ( e => e . TypeId == expectedTypeId + 1 ) , Is . True ) ;
321325 Assert . That ( resultWithoutCache . OfType < BaseTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
322326 Assert . That ( resultWithoutCache . OfType < MiddleTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
323327 Assert . That ( resultWithoutCache . OfType < LeafTestEntity > ( ) . Any ( ) , Is . False ) ;
324328
325329 resultWithoutCache = ExecuteFilterByTypeIdNoCache ( session , expectedTypeId + 2 ) ;
326330 Assert . That ( resultWithoutCache . Count , Is . EqualTo ( 4 ) ) ;
327- Assert . That ( resultWithoutCache . All ( e => e . BaseOwnerNodeId == nodeId ) ) ;
331+ Assert . That ( resultWithoutCache . All ( e => e . BaseOwnerNodeId == nodeIdName ) ) ;
328332 Assert . That ( resultWithoutCache . All ( e => e . TypeId == expectedTypeId + 2 ) , Is . True ) ;
329333 Assert . That ( resultWithoutCache . OfType < BaseTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
330334 Assert . That ( resultWithoutCache . OfType < MiddleTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
331335 Assert . That ( resultWithoutCache . OfType < LeafTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
332336
333337 var resultWithCache = ExecuteFilterByTypeIdCaching ( session , expectedTypeId ) ;
334338 Assert . That ( resultWithCache . Count , Is . EqualTo ( 4 ) ) ;
335- Assert . That ( resultWithCache . All ( e => e . BaseOwnerNodeId == nodeId ) ) ;
339+ Assert . That ( resultWithCache . All ( e => e . BaseOwnerNodeId == nodeIdName ) ) ;
336340 Assert . That ( resultWithCache . All ( e => e . TypeId == expectedTypeId ) , Is . True ) ;
337341 Assert . That ( resultWithCache . OfType < BaseTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
338342 Assert . That ( resultWithCache . OfType < MiddleTestEntity > ( ) . Any ( ) , Is . False ) ;
339343 Assert . That ( resultWithCache . OfType < LeafTestEntity > ( ) . Any ( ) , Is . False ) ;
340344
341345 resultWithCache = ExecuteFilterByTypeIdCaching ( session , expectedTypeId + 1 ) ;
342346 Assert . That ( resultWithCache . Count , Is . EqualTo ( 4 ) ) ;
343- Assert . That ( resultWithCache . All ( e => e . BaseOwnerNodeId == nodeId ) ) ;
347+ Assert . That ( resultWithCache . All ( e => e . BaseOwnerNodeId == nodeIdName ) ) ;
344348 Assert . That ( resultWithCache . All ( e => e . TypeId == expectedTypeId + 1 ) , Is . True ) ;
345349 Assert . That ( resultWithCache . OfType < BaseTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
346350 Assert . That ( resultWithCache . OfType < MiddleTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
347351 Assert . That ( resultWithCache . OfType < LeafTestEntity > ( ) . Any ( ) , Is . False ) ;
348352
349353 resultWithCache = ExecuteFilterByTypeIdCaching ( session , expectedTypeId + 2 ) ;
350354 Assert . That ( resultWithCache . Count , Is . EqualTo ( 4 ) ) ;
351- Assert . That ( resultWithCache . All ( e => e . BaseOwnerNodeId == nodeId ) ) ;
355+ Assert . That ( resultWithCache . All ( e => e . BaseOwnerNodeId == nodeIdName ) ) ;
352356 Assert . That ( resultWithCache . All ( e => e . TypeId == expectedTypeId + 2 ) , Is . True ) ;
353357 Assert . That ( resultWithCache . OfType < BaseTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
354358 Assert . That ( resultWithCache . OfType < MiddleTestEntity > ( ) . Count ( ) , Is . EqualTo ( 4 ) ) ;
@@ -369,28 +373,29 @@ private void RunFilterBySeveralTypeIdsTest(string nodeId)
369373 using ( var session = selectedNode . OpenSession ( ) )
370374 using ( var tx = session . OpenTransaction ( ) ) {
371375 var expectedTypeId = GetExpectedTypeId ( nodeId ) ;
376+ var nodeIdName = string . IsNullOrEmpty ( nodeId ) ? "<default>" : nodeId ;
372377
373378 var allResults = ExecuteFilterBySeveralTypeIdsNoCache ( session , new [ ] { expectedTypeId , expectedTypeId + 1 } )
374379 . OrderBy ( e => e . TypeId )
375380 . ToList ( ) ;
376381 Assert . That ( allResults . Count , Is . EqualTo ( 8 ) ) ;
377- Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeId ) , Is . True ) ;
382+ Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeIdName ) , Is . True ) ;
378383 Assert . That ( allResults . Count ( e => e . TypeId == expectedTypeId ) , Is . EqualTo ( 4 ) ) ;
379384 Assert . That ( allResults . Count ( e => e . TypeId == expectedTypeId + 1 ) , Is . EqualTo ( 4 ) ) ;
380385
381386 var middles = allResults . OfType < MiddleTestEntity > ( ) . ToList ( ) ;
382387 Assert . That ( middles . Count , Is . EqualTo ( 4 ) ) ;
383- Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeId ) , Is . True ) ;
388+ Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeIdName ) , Is . True ) ;
384389
385390 allResults = ExecuteFilterBySeveralTypeIdsCaching ( session , new [ ] { expectedTypeId , expectedTypeId + 1 } ) ;
386391 Assert . That ( allResults . Count , Is . EqualTo ( 8 ) ) ;
387- Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeId ) , Is . True ) ;
392+ Assert . That ( allResults . All ( e => e . BaseOwnerNodeId == nodeIdName ) , Is . True ) ;
388393 Assert . That ( allResults . Count ( e => e . TypeId == expectedTypeId ) , Is . EqualTo ( 4 ) ) ;
389394 Assert . That ( allResults . Count ( e => e . TypeId == expectedTypeId + 1 ) , Is . EqualTo ( 4 ) ) ;
390395
391396 middles = allResults . OfType < MiddleTestEntity > ( ) . ToList ( ) ;
392397 Assert . That ( middles . Count , Is . EqualTo ( 4 ) ) ;
393- Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeId ) , Is . True ) ;
398+ Assert . That ( middles . All ( e => e . MiddleOwnerNodeId == nodeIdName ) , Is . True ) ;
394399
395400 var unexpectedTypeIds = GetUnexpectedTypeIds ( nodeId ) ;
396401 allResults = ExecuteFilterBySeveralTypeIdsNoCache ( session , unexpectedTypeIds ) ;
0 commit comments