1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.directory.server.core.trigger;
22
23
24 import org.apache.directory.server.core.DirectoryService;
25 import org.apache.directory.server.core.integ.CiRunner;
26 import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
27 import org.apache.directory.shared.ldap.constants.SchemaConstants;
28 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
29 import static org.junit.Assert.assertEquals;
30 import static org.junit.Assert.assertNull;
31 import static org.junit.Assert.assertNotNull;
32 import static org.junit.Assert.fail;
33 import org.junit.Ignore;
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36
37 import javax.naming.NamingEnumeration;
38 import javax.naming.directory.Attribute;
39 import javax.naming.directory.Attributes;
40 import javax.naming.directory.BasicAttribute;
41 import javax.naming.directory.BasicAttributes;
42 import javax.naming.directory.DirContext;
43 import javax.naming.directory.ModificationItem;
44 import javax.naming.directory.SearchControls;
45 import javax.naming.directory.SearchResult;
46 import javax.naming.ldap.LdapContext;
47 import java.util.HashMap;
48 import java.util.Map;
49
50
51
52
53
54
55
56
57 @RunWith ( CiRunner.class )
58 @Ignore ( "Reverts are failing to delete marked entries. Fixing this " +
59 "problem in testEntryAdd() will fix it all over." )
60 public class SubentryServiceForTriggersIT
61 {
62 public static DirectoryService service;
63
64
65 public Attributes getTestEntry( String cn )
66 {
67 Attributes subentry = new BasicAttributes( true );
68 Attribute objectClass = new BasicAttribute( "objectClass" );
69 objectClass.add( "top" );
70 objectClass.add( "person" );
71 subentry.put( objectClass );
72 subentry.put( "cn", cn );
73 subentry.put( "sn", "testentry" );
74 return subentry;
75 }
76
77
78 public Attributes getTestSubentry()
79 {
80 Attributes subentry = new BasicAttributes( true );
81 Attribute objectClass = new BasicAttribute( "objectClass" );
82 objectClass.add( "top" );
83 objectClass.add( SchemaConstants.SUBENTRY_OC );
84 objectClass.add( "triggerExecutionSubentry" );
85 subentry.put( objectClass );
86 subentry.put( "subtreeSpecification", "{ base \"ou=configuration\" }" );
87 subentry.put( "prescriptiveTriggerSpecification", "AFTER Delete CALL \"LogUtils.logDelete\"($name);" );
88 subentry.put( "cn", "testsubentry" );
89 return subentry;
90 }
91
92 public Attributes getTestSubentryWithExclusion()
93 {
94 Attributes subentry = new BasicAttributes( true );
95 Attribute objectClass = new BasicAttribute( "objectClass" );
96 objectClass.add( "top" );
97 objectClass.add( SchemaConstants.SUBENTRY_OC );
98 objectClass.add( "triggerExecutionSubentry" );
99 subentry.put( objectClass );
100 String spec = "{ base \"ou=configuration\", specificExclusions { chopBefore:\"cn=unmarked\" } }";
101 subentry.put( "subtreeSpecification", spec );
102 subentry.put( "prescriptiveTriggerSpecification", "AFTER Delete CALL \"LogUtils.logDelete\"($name);" );
103 subentry.put( "cn", "testsubentry" );
104 return subentry;
105 }
106
107
108 public void addTheAdministrativeRole() throws Exception
109 {
110 LdapContext sysRoot = getSystemContext( service );
111 Attribute attribute = new BasicAttribute( "administrativeRole" );
112 attribute.add( "autonomousArea" );
113 attribute.add( "triggerSpecificArea" );
114 ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attribute );
115 sysRoot.modifyAttributes( "", new ModificationItem[] { item } );
116 }
117
118
119 public Map<String, Attributes> getAllEntries() throws Exception
120 {
121 LdapContext sysRoot = getSystemContext( service );
122 Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
123 SearchControls controls = new SearchControls();
124 controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
125 controls.setReturningAttributes( new String[]
126 { "+", "*" } );
127 NamingEnumeration<SearchResult> results = sysRoot.search( "", "(objectClass=*)", controls );
128
129 while ( results.hasMore() )
130 {
131 SearchResult result = results.next();
132 resultMap.put( result.getName(), result.getAttributes() );
133 }
134 return resultMap;
135 }
136
137
138 @Test
139 public void testEntryAdd() throws Exception
140 {
141 LdapContext sysRoot = getSystemContext( service );
142 addTheAdministrativeRole();
143 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
144 sysRoot.createSubcontext( "cn=unmarked", getTestEntry( "unmarked" ) );
145 sysRoot.createSubcontext( "cn=marked,ou=configuration", getTestEntry( "marked" ) );
146 Map<String, Attributes> results = getAllEntries();
147
148
149
150
151
152 Attributes marked = results.get( "cn=marked,ou=configuration,ou=system" );
153 Attribute triggerSubentries = marked.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
154 assertNotNull( "cn=marked,ou=configuration,ou=system should be marked", triggerSubentries );
155 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
156 assertEquals( 1, triggerSubentries.size() );
157
158
159
160
161
162 Attributes unmarked = results.get( "cn=unmarked,ou=system" );
163 assertNull( "cn=unmarked,ou=system should not be marked", unmarked
164 .get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
165
166
167 sysRoot.destroySubcontext( "cn=marked,ou=configuration" );
168 }
169
170
171 @Test
172 public void testSubentryAdd() throws Exception
173 {
174 LdapContext sysRoot = getSystemContext( service );
175
176
177 try
178 {
179 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
180 fail( "should never get here: cannot create subentry under regular entries" );
181 }
182 catch ( LdapNoSuchAttributeException e )
183 {
184 }
185
186 addTheAdministrativeRole();
187 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
188 Map<String, Attributes> results = getAllEntries();
189
190
191
192
193
194 Attributes configuration = results.get( "ou=configuration,ou=system" );
195 Attribute triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
196 assertNotNull( "ou=configuration,ou=system should be marked", triggerSubentries );
197 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
198 assertEquals( 1, triggerSubentries.size() );
199
200 Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
201 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
202 assertNotNull( "ou=interceptors,ou=configuration,ou=system should be marked", triggerSubentries );
203 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
204 assertEquals( 1, triggerSubentries.size() );
205
206
207
208
209
210 Attributes system = results.get( "ou=system" );
211 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
212
213 Attributes users = results.get( "ou=users,ou=system" );
214 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
215 }
216
217
218 @Test
219 public void testSubentryModify() throws Exception
220 {
221 LdapContext sysRoot = getSystemContext( service );
222 addTheAdministrativeRole();
223 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
224 Map<String, Attributes> results = getAllEntries();
225
226
227
228
229
230 Attributes configuration = results.get( "ou=configuration,ou=system" );
231 Attribute triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
232 assertNotNull( "ou=configuration,ou=system should be marked", triggerSubentries );
233 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
234 assertEquals( 1, triggerSubentries.size() );
235
236 Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
237 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
238 assertNotNull( "ou=interceptors,ou=configuration,ou=system should be marked", triggerSubentries );
239 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
240 assertEquals( 1, triggerSubentries.size() );
241
242
243
244
245
246 Attributes system = results.get( "ou=system" );
247 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
248
249 Attributes users = results.get( "ou=users,ou=system" );
250 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
251
252
253
254
255
256 Attribute subtreeSpecification = new BasicAttribute( "subtreeSpecification" );
257 subtreeSpecification.add( "{ base \"ou=configuration\", specificExclusions { chopBefore:\"ou=interceptors\" } }" );
258 ModificationItem item = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, subtreeSpecification );
259 sysRoot.modifyAttributes( "cn=testsubentry", new ModificationItem[] { item } );
260 results = getAllEntries();
261
262
263
264
265
266 configuration = results.get( "ou=configuration,ou=system" );
267 triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
268 assertNotNull( "ou=configuration,ou=system should be marked", triggerSubentries );
269 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
270 assertEquals( 1, triggerSubentries.size() );
271
272
273
274
275
276 system = results.get( "ou=system" );
277 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
278
279 users = results.get( "ou=users,ou=system" );
280 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
281
282 interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
283 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
284 if ( triggerSubentries != null )
285 {
286 assertEquals( "ou=interceptors,ou=configuration,ou=system should not be marked", 0, triggerSubentries.size() );
287 }
288 }
289
290
291 @Test
292 public void testSubentryDelete() throws Exception
293 {
294 LdapContext sysRoot = getSystemContext( service );
295 addTheAdministrativeRole();
296 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
297 sysRoot.destroySubcontext( "cn=testsubentry" );
298 Map<String, Attributes> results = getAllEntries();
299
300
301
302
303
304 Attributes configuration = results.get( "ou=configuration,ou=system" );
305 Attribute triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
306 if ( triggerSubentries != null )
307 {
308 assertEquals( "ou=configuration,ou=system should not be marked", 0, triggerSubentries.size() );
309 }
310
311 Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
312 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
313 if ( triggerSubentries != null )
314 {
315 assertEquals( "ou=interceptors,ou=configuration,ou=system should not be marked", 0, triggerSubentries.size() );
316 }
317
318 Attributes system = results.get( "ou=system" );
319 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
320
321 Attributes users = results.get( "ou=users,ou=system" );
322 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
323 }
324
325
326 @Test
327 public void testSubentryModifyRdn() throws Exception
328 {
329 addTheAdministrativeRole();
330 LdapContext sysRoot = getSystemContext( service );
331 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
332 sysRoot.rename( "cn=testsubentry", "cn=newname" );
333 Map<String, Attributes> results = getAllEntries();
334
335
336
337
338
339 Attributes configuration = results.get( "ou=configuration,ou=system" );
340 Attribute triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
341 assertNotNull( "ou=configuration,ou=system should be marked", triggerSubentries );
342 assertEquals( "2.5.4.3=newname,2.5.4.11=system", triggerSubentries.get() );
343 assertEquals( 1, triggerSubentries.size() );
344
345 Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
346 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
347 assertNotNull( "ou=interceptors,ou=configuration,ou=system should be marked", triggerSubentries );
348 assertEquals( "2.5.4.3=newname,2.5.4.11=system", triggerSubentries.get() );
349 assertEquals( 1, triggerSubentries.size() );
350
351
352
353
354
355 Attributes system = results.get( "ou=system" );
356 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
357
358 Attributes users = results.get( "ou=users,ou=system" );
359 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
360 }
361
362
363 @Test
364 public void testEntryModifyRdn() throws Exception
365 {
366 addTheAdministrativeRole();
367 LdapContext sysRoot = getSystemContext( service );
368 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentryWithExclusion() );
369 sysRoot.createSubcontext( "cn=unmarked,ou=configuration", getTestEntry( "unmarked" ) );
370 sysRoot.createSubcontext( "cn=marked,ou=configuration", getTestEntry( "marked" ) );
371 Map<String, Attributes> results = getAllEntries();
372
373
374
375
376
377 Attributes configuration = results.get( "ou=configuration,ou=system" );
378 Attribute triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
379 assertNotNull( "ou=configuration,ou=system should be marked", triggerSubentries );
380 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
381 assertEquals( 1, triggerSubentries.size() );
382
383 Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
384 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
385 assertNotNull( "ou=interceptors,ou=configuration,ou=system should be marked", triggerSubentries );
386 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
387 assertEquals( 1, triggerSubentries.size() );
388
389 Attributes marked = results.get( "cn=marked,ou=configuration,ou=system" );
390 triggerSubentries = marked.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
391 assertNotNull( "cn=marked,ou=configuration,ou=system should be marked", triggerSubentries );
392 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
393 assertEquals( 1, triggerSubentries.size() );
394
395
396
397
398
399 Attributes system = results.get( "ou=system" );
400 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
401
402 Attributes users = results.get( "ou=users,ou=system" );
403 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
404
405 Attributes unmarked = results.get( "cn=unmarked,ou=configuration,ou=system" );
406 assertNull( "cn=unmarked,ou=configuration,ou=system should not be marked", unmarked
407 .get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
408
409
410
411
412
413 sysRoot.destroySubcontext( "cn=unmarked,ou=configuration" );
414 sysRoot.rename( "cn=marked,ou=configuration", "cn=unmarked,ou=configuration" );
415 results = getAllEntries();
416
417 unmarked = results.get( "cn=unmarked,ou=configuration,ou=system" );
418 assertNull( "cn=unmarked,ou=configuration,ou=system should not be marked", unmarked
419 .get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
420 assertNull( results.get( "cn=marked,ou=configuration,ou=system" ) );
421
422
423
424
425
426 sysRoot.rename( "cn=unmarked,ou=configuration", "cn=marked,ou=configuration" );
427 results = getAllEntries();
428 assertNull( results.get( "cn=unmarked,ou=configuration,ou=system" ) );
429 marked = results.get( "cn=marked,ou=configuration,ou=system" );
430 assertNotNull( marked );
431 triggerSubentries = marked.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
432 assertNotNull( "cn=marked,ou=configuration,ou=system should be marked", triggerSubentries );
433 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
434 assertEquals( 1, triggerSubentries.size() );
435 }
436
437
438 @Test
439 public void testEntryMoveWithRdnChange() throws Exception
440 {
441 LdapContext sysRoot = getSystemContext( service );
442 addTheAdministrativeRole();
443 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentryWithExclusion() );
444 sysRoot.createSubcontext( "cn=unmarked", getTestEntry( "unmarked" ) );
445 sysRoot.createSubcontext( "cn=marked,ou=configuration", getTestEntry( "marked" ) );
446 Map<String, Attributes> results = getAllEntries();
447
448
449
450
451
452 Attributes configuration = results.get( "ou=configuration,ou=system" );
453 Attribute triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
454 assertNotNull( "ou=configuration,ou=system should be marked", triggerSubentries );
455 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
456 assertEquals( 1, triggerSubentries.size() );
457
458 Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
459 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
460 assertNotNull( "ou=interceptors,ou=configuration,ou=system should be marked", triggerSubentries );
461 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
462 assertEquals( 1, triggerSubentries.size() );
463
464 Attributes marked = results.get( "cn=marked,ou=configuration,ou=system" );
465 triggerSubentries = marked.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
466 assertNotNull( "cn=marked,ou=configuration,ou=system should be marked", triggerSubentries );
467 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
468 assertEquals( 1, triggerSubentries.size() );
469
470
471
472
473
474 Attributes system = results.get( "ou=system" );
475 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
476
477 Attributes users = results.get( "ou=users,ou=system" );
478 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
479
480 Attributes unmarked = results.get( "cn=unmarked,ou=system" );
481 assertNull( "cn=unmarked,ou=system should not be marked", unmarked
482 .get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
483
484
485
486
487
488 sysRoot.destroySubcontext( "cn=unmarked" );
489 sysRoot.rename( "cn=marked,ou=configuration", "cn=unmarked" );
490 results = getAllEntries();
491
492 unmarked = results.get( "cn=unmarked,ou=system" );
493 assertNull( "cn=unmarked,ou=system should not be marked", unmarked
494 .get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
495 assertNull( results.get( "cn=marked,ou=configuration,ou=system" ) );
496
497
498
499
500
501 sysRoot.rename( "cn=unmarked", "cn=marked,ou=configuration" );
502 results = getAllEntries();
503 assertNull( results.get( "cn=unmarked,ou=system" ) );
504 marked = results.get( "cn=marked,ou=configuration,ou=system" );
505 assertNotNull( marked );
506 triggerSubentries = marked.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
507 assertNotNull( "cn=marked,ou=configuration,ou=system should be marked", triggerSubentries );
508 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
509 assertEquals( 1, triggerSubentries.size() );
510 }
511
512
513 @Test
514 public void testEntryMove() throws Exception
515 {
516 LdapContext sysRoot = getSystemContext( service );
517 addTheAdministrativeRole();
518 sysRoot.createSubcontext( "cn=testsubentry", getTestSubentryWithExclusion() );
519 sysRoot.createSubcontext( "cn=unmarked", getTestEntry( "unmarked" ) );
520 sysRoot.createSubcontext( "cn=marked,ou=configuration", getTestEntry( "marked" ) );
521 Map<String, Attributes> results = getAllEntries();
522
523
524
525
526
527 Attributes configuration = results.get( "ou=configuration,ou=system" );
528 Attribute triggerSubentries = configuration.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
529 assertNotNull( "ou=configuration,ou=system should be marked", triggerSubentries );
530 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
531 assertEquals( 1, triggerSubentries.size() );
532
533 Attributes interceptors = results.get( "ou=interceptors,ou=configuration,ou=system" );
534 triggerSubentries = interceptors.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
535 assertNotNull( "ou=interceptors,ou=configuration,ou=system should be marked", triggerSubentries );
536 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
537 assertEquals( 1, triggerSubentries.size() );
538
539 Attributes marked = results.get( "cn=marked,ou=configuration,ou=system" );
540 triggerSubentries = marked.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
541 assertNotNull( "cn=marked,ou=configuration,ou=system should be marked", triggerSubentries );
542 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
543 assertEquals( 1, triggerSubentries.size() );
544
545
546
547
548
549 Attributes system = results.get( "ou=system" );
550 assertNull( "ou=system should not be marked", system.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
551
552 Attributes users = results.get( "ou=users,ou=system" );
553 assertNull( "ou=users,ou=system should not be marked", users.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
554
555 Attributes unmarked = results.get( "cn=unmarked,ou=system" );
556 assertNull( "cn=unmarked,ou=system should not be marked", unmarked
557 .get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
558
559
560
561
562
563 sysRoot.destroySubcontext( "cn=unmarked" );
564 sysRoot.rename( "cn=marked,ou=configuration", "cn=marked,ou=interceptors,ou=configuration" );
565 results = getAllEntries();
566
567 unmarked = results.get( "cn=unmarked,ou=system" );
568 assertNull( "cn=unmarked,ou=system should not be marked", unmarked );
569 assertNull( results.get( "cn=marked,ou=configuration,ou=system" ) );
570
571 marked = results.get( "cn=marked,ou=interceptors,ou=configuration,ou=system" );
572 assertNotNull( marked );
573 triggerSubentries = marked.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
574 assertNotNull( "cn=marked,ou=interceptors,ou=configuration should be marked", triggerSubentries );
575 assertEquals( "2.5.4.3=testsubentry,2.5.4.11=system", triggerSubentries.get() );
576 assertEquals( 1, triggerSubentries.size() );
577 }
578
579 }