001: /*
002: * Copyright (C) The MX4J Contributors.
003: * All rights reserved.
004: *
005: * This software is distributed under the terms of the MX4J License version 1.0.
006: * See the terms of the MX4J License in the documentation provided with this software.
007: */
008:
009: package test.javax.management.relation;
010:
011: // Java imports
012:
013: import java.util.ArrayList;
014: import java.util.Iterator;
015: import java.util.List;
016: import java.util.Map;
017: import javax.management.InstanceNotFoundException;
018: import javax.management.MBeanServer;
019: import javax.management.MBeanServerFactory;
020: import javax.management.ObjectName;
021: import javax.management.relation.RelationService;
022: import javax.management.relation.RelationTypeNotFoundException;
023: import javax.management.relation.RelationTypeSupport;
024: import javax.management.relation.Role;
025: import javax.management.relation.RoleInfo;
026: import javax.management.relation.RoleList;
027: import javax.management.relation.RoleResult;
028: import javax.management.relation.RoleStatus;
029:
030: import junit.framework.TestCase;
031:
032: /**
033: * @version $Revision: 1.18 $
034: */
035: public class RelationServiceTest extends TestCase {
036: private MBeanServer m_server = null;
037: private ObjectName m_relationServiceObjectName = null;
038: private RelationService m_relationService;
039:
040: // convenience MBean ObjectNames
041: ObjectName mbeanObjectName1;
042: ObjectName mbeanObjectName2;
043: ObjectName mbeanObjectName3;
044: ObjectName mbeanObjectName4;
045: ObjectName mbeanObjectName5;
046: ObjectName mbeanObjectName6;
047:
048: public RelationServiceTest(String s) {
049: super (s);
050: }
051:
052: protected void setUp() {
053: m_server = MBeanServerFactory.createMBeanServer();
054: // create and register relation service
055: try {
056: m_relationServiceObjectName = new ObjectName(
057: "DefaultDomain:type=javax.management.relation.RelationService");
058: } catch (Exception ex) {
059: ex.printStackTrace();
060: }
061: }
062:
063: public void tearDown() throws Exception {
064: m_server.unregisterMBean(m_relationServiceObjectName);
065: MBeanServerFactory.releaseMBeanServer(m_server);
066: }
067:
068: public void testIsActive() {
069: try {
070: registerRelationService(true);
071: m_relationService.isActive();
072: } catch (Exception e) {
073: fail("Relation Service should be active");
074: }
075: }
076:
077: public void testGetFalsePurgeFlag() throws Exception {
078: registerRelationService(false);
079: assertTrue(m_relationService.getPurgeFlag() == false);
080: }
081:
082: public void testGetTruePurgeFlag() throws Exception {
083: registerRelationService(true);
084: assertTrue(m_relationService.getPurgeFlag());
085: }
086:
087: public void testCreateRelationType() {
088: try {
089: registerRelationService(true);
090: RoleInfo[] roleInfos = createRoleInfos("contained",
091: "container");
092: m_relationService.createRelationType("relationTypeName1",
093: roleInfos);
094: // create one relation type expect 1 returned from call getAllRelationTypeNames
095: assertTrue(m_relationService.getAllRelationTypeNames()
096: .size() == 1);
097: assertEquals("relationTypeName1", m_relationService
098: .getAllRelationTypeNames().get(0));
099: } catch (Exception e) {
100: fail("Valid call to createRelationType");
101: }
102: }
103:
104: public void testAddRelationType() {
105: try {
106: registerRelationService(true);
107:
108: String relationTypeName = "RelationTypeUnitTest";
109: m_relationService.addRelationType(new SimpleRelationType(
110: relationTypeName));
111: assertTrue(m_relationService.getAllRelationTypeNames()
112: .size() == 1);
113: assertEquals(relationTypeName, m_relationService
114: .getAllRelationTypeNames().get(0));
115:
116: } catch (Exception e) {
117: fail("Valid call to createRelationType");
118: }
119: }
120:
121: public void testGetAllRelationTypeNames() throws Exception {
122: registerRelationService(true);
123: String relationTypeName1 = "TestRelation1";
124: String relationTypeName2 = "TestRelation2";
125: String relationTypeName3 = "TestRelation3";
126: String relationTypeName4 = "TestRelation4";
127: m_relationService.addRelationType(new SimpleRelationType(
128: relationTypeName1));
129: m_relationService.addRelationType(new SimpleRelationType(
130: relationTypeName2));
131: m_relationService.addRelationType(new SimpleRelationType(
132: relationTypeName3));
133: m_relationService.addRelationType(new SimpleRelationType(
134: relationTypeName4));
135:
136: assertTrue(m_relationService.getAllRelationTypeNames().size() == 4);
137: }
138:
139: public void testDuplicateRelationTypeNameThrowsException()
140: throws Exception {
141: registerRelationService(true);
142: String relationTypeName1 = "TestRelation1";
143: String relationTypeName2 = "TestRelation1";
144: try {
145: m_relationService.addRelationType(new SimpleRelationType(
146: relationTypeName1));
147: } catch (Exception e) {
148: fail("first one should be ok as no duplicates");
149: }
150:
151: try {
152: m_relationService.addRelationType(new SimpleRelationType(
153: relationTypeName2));
154: fail("Should have had an exception");
155: } catch (Exception expected) {
156: // should be an exception 2 relationTypeNames the same!!
157: }
158: }
159:
160: public void testGetRoleInfos() throws Exception {
161: registerRelationService(true);
162: registerMBeans();
163: m_relationService.createRelationType("aRelationTypeName",
164: createRoleInfos("mother", "child"));
165:
166: RoleList roleList = new RoleList();
167:
168: createRoleList(mbeanObjectName1, "mother", roleList);
169: createRoleList(mbeanObjectName2, "child", roleList);
170:
171: m_relationService.createRelation("relationId1",
172: "aRelationTypeName", roleList);
173: List l = m_relationService.getRoleInfos("aRelationTypeName");
174: assertTrue(l.size() == 2);
175: }
176:
177: public void testRemoveRelationType() throws Exception {
178: registerRelationService(true);
179: registerMBeans();
180:
181: RoleList roleList = new RoleList();
182:
183: createRoleList(mbeanObjectName1, "owner", roleList);
184: createRoleList(mbeanObjectName2, "car", roleList);
185:
186: m_relationService.createRelationType(
187: "testValidRelationTypeNameRemoval", createRoleInfos(
188: "car", "owner"));
189: m_relationService.createRelation("relationID",
190: "testValidRelationTypeNameRemoval", roleList);
191:
192: try {
193: m_relationService
194: .removeRelationType("testValidRelationTypeNameRemoval");
195: } catch (Exception e) {
196: fail("No exception expected as relationType registered and valid");
197: }
198:
199: assertTrue(m_relationService.getAllRelationTypeNames().size() == 0);
200: }
201:
202: public void testRemoveRelationType_NonExistent() throws Exception {
203: registerRelationService(true);
204: try {
205: m_relationService
206: .removeRelationType("invalidRelationType_notCreated");
207: fail("Expected a RelationTypeNotFoundException to be thrown");
208: } catch (RelationTypeNotFoundException expected) {
209: // ok
210: } catch (Exception e) {
211: fail("Wrong exception this was not expected");
212: }
213: }
214:
215: public void testAddRelationMBeanNotRegistered() throws Exception {
216: registerRelationService(true);
217: ObjectName mbeanObjectName = new ObjectName(
218: "domain:name=testMbeanNotRegistered");
219: try {
220: m_relationService.addRelation(mbeanObjectName);
221: fail("MBean not registered should throw an exception");
222: } catch (InstanceNotFoundException expected) {
223: //ok exception expected
224: } catch (Exception e) {
225: fail("not expected");
226: }
227: }
228:
229: /**
230: * Call RelationService.addService passing an object name
231: * of a Relation with a set of roles.
232: * <p/>
233: * Call RelationService.addService passing an object name
234: * of another relation with a different set of roles.
235: * <p/>
236: * Call RelationService.getAllRoles passing the relation id of
237: * the second relation added.
238: * <p/>
239: * You will see that the roles returned are actually those of
240: * the first relation added.
241: *
242: * @throws Exception
243: */
244: public void testAddRelation_correctRolesReturned() throws Exception {
245: registerRelationService(true);
246: registerMBeans();
247:
248: RoleList roleList = new RoleList();
249: createRoleList(mbeanObjectName1, "owner", roleList);
250: createRoleList(mbeanObjectName2, "car", roleList);
251:
252: ObjectName relationSupportObjectName = new ObjectName(
253: "relationDomain:name=aRelationSupport");
254: SimpleRelationTestSupport relationSupport = new SimpleRelationTestSupport(
255: "relationID", m_relationServiceObjectName,
256: "relationTypeName", roleList);
257:
258: m_server.registerMBean(relationSupport,
259: relationSupportObjectName);
260:
261: /* create the relationType */
262: m_relationService.createRelationType("relationTypeName",
263: createRoleInfos("car", "owner"));
264:
265: /* now add the relation */
266: m_relationService.addRelation(relationSupportObjectName);
267:
268: ////////////////////////////////////////////////////////////////////////////////////////////////
269:
270: RoleList roleList1 = new RoleList();
271: createRoleList(mbeanObjectName3, "parent", roleList1);
272: createRoleList(mbeanObjectName4, "child", roleList1);
273:
274: ObjectName relationSupportObjectName2 = new ObjectName(
275: "relationDomain:name=aRelationSupport2");
276: SimpleRelationTestSupport relationSupport2 = new SimpleRelationTestSupport(
277: "relationID2", m_relationServiceObjectName,
278: "relationTypeName2", roleList1);
279:
280: m_server.registerMBean(relationSupport2,
281: relationSupportObjectName2);
282:
283: m_relationService.createRelationType("relationTypeName2",
284: createRoleInfos("parent", "child"));
285: m_relationService.addRelation(relationSupportObjectName2);
286:
287: ///////////////// validate querying roles for relationId2(added second) returns the correct roles ////////////////////////////////
288: RoleResult result1 = m_relationService
289: .getAllRoles("relationID2");
290: RoleList actual1 = result1.getRoles();
291: // we have to do this as role does not have an equals or hashcode, must check if it is added it will break compatibility!!!!
292: final Role role = (Role) roleList1.get(0);
293: boolean success = false;
294: for (Iterator iterator = actual1.iterator(); iterator.hasNext();) {
295: Role role1 = (Role) iterator.next();
296: String roleName = role1.getRoleName();
297: if (roleName.equals(role.getRoleName()))
298: success = true;
299: }
300: assertTrue(success);
301:
302: ///////////////////// validate querying roles for relaionID (added first) returns the expected roles ///////////////////////////////
303: RoleResult result = m_relationService.getAllRoles("relationID");
304: RoleList actual = result.getRoles();
305:
306: final Role role2 = (Role) roleList.get(0);
307: boolean success2 = false;
308: for (Iterator iterator = actual.iterator(); iterator.hasNext();) {
309: Role role1 = (Role) iterator.next();
310: String roleName = role1.getRoleName();
311: if (roleName.equals(role2.getRoleName()))
312: success2 = true;
313: }
314: assertTrue(success2);
315:
316: //assertTrue(roleList.contains(actual.get(0)));
317: }
318:
319: public void testAddRelation() throws Exception {
320: registerRelationService(true);
321: registerMBeans();
322:
323: RoleList roleList = new RoleList();
324: createRoleList(mbeanObjectName1, "owner", roleList);
325: createRoleList(mbeanObjectName2, "car", roleList);
326:
327: ObjectName relationSupportObjectName = new ObjectName(
328: "relationDomain:name=aRelationSupport");
329: SimpleRelationTestSupport relationSupport = new SimpleRelationTestSupport(
330: "relationID", m_relationServiceObjectName,
331: "relationTypeName", roleList);
332:
333: m_server.registerMBean(relationSupport,
334: relationSupportObjectName);
335:
336: /* create the relationType */
337: m_relationService.createRelationType("relationTypeName",
338: createRoleInfos("car", "owner"));
339: try {
340: /* now add the relation */
341: m_relationService.addRelation(relationSupportObjectName);
342: } catch (Exception e) {
343: e.printStackTrace();
344: }
345: }
346:
347: public void testGetRoleInfo() throws Exception {
348: registerRelationService(true);
349: registerMBeans();
350:
351: RoleList roleList = new RoleList();
352: createRoleList(mbeanObjectName1, "owner", roleList);
353: createRoleList(mbeanObjectName2, "car", roleList);
354:
355: ObjectName relationSupportObjectName = new ObjectName(
356: "relationDomain:name=aRelationSupport");
357: SimpleRelationTestSupport relationSupport = new SimpleRelationTestSupport(
358: "relationID", m_relationServiceObjectName,
359: "relationTypeName", roleList);
360:
361: m_server.registerMBean(relationSupport,
362: relationSupportObjectName);
363:
364: RoleInfo[] roleInfos = createRoleInfos("car", "owner");
365:
366: /* create the relationType */
367: m_relationService.createRelationType("relationTypeName",
368: roleInfos);
369:
370: RoleInfo info = m_relationService.getRoleInfo(
371: "relationTypeName", "owner");
372:
373: assertEquals(info, roleInfos[1]);
374: }
375:
376: public void testIsRelationMBean() throws Exception {
377: String relationID = "relationID";
378: try {
379: ObjectName relationSupportObjectName = new ObjectName(
380: "relationDomain:name=aRelationSupport");
381: setUpRelationServiceForQueryTesting(relationID,
382: relationSupportObjectName);
383: assertTrue(m_relationService.isRelationMBean(relationID)
384: .equals(relationSupportObjectName));
385: } catch (Exception e) {
386: e.printStackTrace(); //To change body of catch statement use Options | File Templates.
387: }
388: }
389:
390: public void testIsRelation() {
391: String relationID = "relationID";
392: try {
393: ObjectName relationSupportObjectName = new ObjectName(
394: "relationDomain:name=aRelationSupport");
395: setUpRelationServiceForQueryTesting(relationID,
396: relationSupportObjectName);
397: assertTrue(m_relationService.isRelation(
398: relationSupportObjectName).equals(relationID));
399: } catch (Exception e) {
400: e.printStackTrace(); //To change body of catch statement use Options | File Templates.
401: }
402: }
403:
404: public void testHasRelation() {
405: String relationID = "relationID";
406: try {
407: ObjectName relationSupportObjectName = new ObjectName(
408: "relationDomain:name=aRelationSupport");
409: setUpRelationServiceForQueryTesting(relationID,
410: relationSupportObjectName);
411: assertTrue((m_relationService.hasRelation(relationID))
412: .booleanValue());
413: } catch (Exception e) {
414: e.printStackTrace(); //To change body of catch statement use Options | File Templates.
415: }
416: }
417:
418: public void tesetGetAllRelationIds() throws Exception {
419: registerRelationService(true);
420: registerMBeans();
421:
422: RoleList roleList = new RoleList();
423: createRoleList(mbeanObjectName1, "owner", roleList);
424: createRoleList(mbeanObjectName2, "car", roleList);
425:
426: /* create the relationType first then creaste the relation*/
427: m_relationService.createRelationType("relationTypeName1",
428: createRoleInfos("car", "owner"));
429: m_relationService.createRelationType("relationTypeName2",
430: createRoleInfos("car", "owner"));
431: m_relationService.createRelationType("relationTypeName3",
432: createRoleInfos("car", "owner"));
433:
434: m_relationService.createRelation("relationID1",
435: "relationTypeName1", roleList);
436: m_relationService.createRelation("relationID2",
437: "relationTypeName2", roleList);
438: m_relationService.createRelation("relationID3",
439: "relationTypeName3", roleList);
440:
441: List allIds = m_relationService.getAllRelationIds();
442:
443: assertTrue(allIds.size() == 3);
444: }
445:
446: public void testRoleReading0() throws Exception {
447: registerRelationService(true);
448: registerMBeans();
449: String relationTypeName = "relationTypeName";
450: m_relationService.addRelationType(new SimpleRelationType(
451: relationTypeName));
452: Integer value = m_relationService.checkRoleReading("primary",
453: relationTypeName);
454: // role is a ok returns 0
455: assertEquals(value.intValue(), 0);
456: }
457:
458: public void testRoleReading1() throws Exception {
459: registerRelationService(true);
460: registerMBeans();
461: String relationTypeName = "relationTypeName";
462: m_relationService.addRelationType(new SimpleRelationType(
463: relationTypeName));
464: Integer value = m_relationService.checkRoleReading("book",
465: relationTypeName);
466: // RoleStatus.NO_ROLE_WITH_NAME = 1
467: assertEquals(value.intValue(), RoleStatus.NO_ROLE_WITH_NAME);
468: }
469:
470: public void testRoleReading2() throws Exception {
471: registerRelationService(true);
472: registerMBeans();
473: String relationTypeName = "relationTypeName";
474: m_relationService.addRelationType(new TestRelationType(
475: relationTypeName));
476: Integer value = m_relationService.checkRoleReading("primary",
477: relationTypeName);
478: // RoleStatus.ROLE_NOT_READABLE = 2
479: assertEquals(value.intValue(), RoleStatus.ROLE_NOT_READABLE);
480: }
481:
482: public void testCreateRelation() throws Exception {
483: registerRelationService(true);
484: registerMBeans();
485: RoleList roleList = new RoleList();
486: createRoleList(mbeanObjectName1, "owner", roleList);
487: createRoleList(mbeanObjectName2, "car", roleList);
488:
489: /* create the relationType first then creaste the relation*/
490: String relationTypeName = "relationTypeName";
491: RoleInfo[] roleInfos = createRoleInfos("car", "owner");
492: Object[] params1 = { relationTypeName, roleInfos };
493: String[] signature1 = { "java.lang.String",
494: roleInfos.getClass().getName() };
495:
496: m_server.invoke(m_relationServiceObjectName,
497: "createRelationType", params1, signature1);
498: String relationId = "relationId1";
499:
500: Object[] params = { relationId, relationTypeName, roleList };
501: String[] signature = { "java.lang.String", "java.lang.String",
502: "javax.management.relation.RoleList" };
503: m_server.invoke(m_relationServiceObjectName, "createRelation",
504: params, signature);
505: }
506:
507: private void setUpRelationServiceForQueryTesting(String relationID,
508: ObjectName mbeanObjectName) throws Exception {
509: registerRelationService(true);
510: registerMBeans();
511:
512: RoleList roleList = new RoleList();
513: createRoleList(mbeanObjectName1, "owner", roleList);
514: createRoleList(mbeanObjectName2, "car", roleList);
515:
516: //ObjectName relationSupportObjectName = new ObjectName("relationDomain:name=aRelationSupport");
517: SimpleRelationTestSupport relationSupport = new SimpleRelationTestSupport(
518: relationID, m_relationServiceObjectName,
519: "relationTypeName", roleList);
520:
521: m_server.registerMBean(relationSupport, mbeanObjectName);
522:
523: /* create the relationType */
524: try {
525: m_relationService.createRelationType("relationTypeName",
526: createRoleInfos("car", "owner"));
527:
528: /* now add the relation */
529: m_relationService.addRelation(mbeanObjectName);
530: } catch (Exception e) {
531: e.printStackTrace(); //To change body of catch statement use Options | File Templates.
532: }
533: }
534:
535: private void registerMBeans() {
536: try {
537: // create and build 6 MBeans in the server to act as relations in the relationService
538: String mbeanClassName = "test.javax.management.relation.SimpleStandard";
539: mbeanObjectName1 = new ObjectName(
540: "domain:type=SimpleStandard_1");
541: mbeanObjectName2 = new ObjectName(
542: "domain:type=SimpleStandard_2");
543: mbeanObjectName3 = new ObjectName(
544: "domain:type=SimpleStandard_3");
545: mbeanObjectName4 = new ObjectName(
546: "domain:type=SimpleStandard_4");
547: mbeanObjectName5 = new ObjectName(
548: "domain:type=SimpleStandard_5");
549: mbeanObjectName6 = new ObjectName(
550: "domain:type=SimpleStandard_6");
551:
552: m_server
553: .createMBean(mbeanClassName, mbeanObjectName1, null);
554: m_server
555: .createMBean(mbeanClassName, mbeanObjectName2, null);
556: m_server
557: .createMBean(mbeanClassName, mbeanObjectName3, null);
558: m_server
559: .createMBean(mbeanClassName, mbeanObjectName4, null);
560: m_server
561: .createMBean(mbeanClassName, mbeanObjectName5, null);
562: m_server
563: .createMBean(mbeanClassName, mbeanObjectName6, null);
564: } catch (Exception e) {
565: e.printStackTrace();
566: }
567: }
568:
569: private void registerRelationService(boolean purge)
570: throws Exception {
571: m_relationService = new RelationService(purge);
572: m_server.registerMBean(m_relationService,
573: m_relationServiceObjectName);
574: }
575:
576: private RoleInfo[] createRoleInfos(String roleName1,
577: String roleName2) throws Exception {
578: RoleInfo[] roleInfos = new RoleInfo[2];
579: roleInfos[0] = new RoleInfo(roleName1,
580: "test.javax.management.relation.SimpleStandard", true,
581: true, 1, -1, null);
582: roleInfos[1] = new RoleInfo(roleName2,
583: "test.javax.management.relation.SimpleStandard", true,
584: true, 0, -1, null);
585: return roleInfos;
586: }
587:
588: private RoleList createRoleList(ObjectName mbeanObjectName,
589: String roleName, RoleList roleList) {
590: ArrayList roleValue = new ArrayList();
591: roleValue.add(mbeanObjectName);
592: Role role = new Role(roleName, roleValue);
593: roleList.add(role);
594: return roleList;
595: }
596:
597: class TestRelationType extends RelationTypeSupport {
598: public TestRelationType(String relationTypeName) {
599: super (relationTypeName);
600: try {
601: RoleInfo primaryRoleInfo = new RoleInfo(
602: "primary",
603: "test.javax.management.relation.SimpleStandard",
604: false, //read
605: true, //write
606: 2, 2, "Primary :)");
607: addRoleInfo(primaryRoleInfo);
608:
609: RoleInfo secondaryRoleInfo = new RoleInfo(
610: "secondary",
611: "test.javax.management.relation.SimpleStandard",
612: true, false, 2, 2, "Secondary");
613: addRoleInfo(secondaryRoleInfo);
614: } catch (Exception ex) {
615: throw new RuntimeException(ex.getMessage());
616: }
617: }
618: }
619:
620: public void testSimpleRoleListCtor() throws Exception {
621: registerRelationService(true);
622: registerMBeans();
623: RoleList rl = new RoleList();
624: assertTrue("New RoleList isn't empty", rl.isEmpty());
625: rl = new RoleList(42);
626: assertTrue("New RoleList(42) isn't empty", rl.isEmpty());
627: }
628:
629: public void testRoleListCopyCtor() throws Exception {
630: registerRelationService(true);
631: registerMBeans();
632: RoleList rl = new RoleList();
633: rl.add(new Role("romeo", new ArrayList()));
634: rl.add(new Role("juliet", new ArrayList()));
635: RoleList rlcopy = new RoleList(rl);
636: assertTrue("Bogus copy", rl.equals(rlcopy));
637:
638: try {
639: new RoleList(null);
640: fail("Expecting IllegalArgumentException");
641: } catch (IllegalArgumentException x) {
642: assertTrue(true);
643: }
644: }
645:
646: public void testUpdateRoleMap() throws Exception {
647: List roleValue = new ArrayList();
648: roleValue.add(new ObjectName("domain:type=SimpleStandard_2"));
649: Role role = new Role("myTestRoleName", roleValue);
650:
651: String relationID = "myTestRelation";
652: setUpRelationServiceForQueryTesting(relationID, new ObjectName(
653: "domain:type=testType"));
654:
655: m_relationService.updateRoleMap("domain:type=SimpleStandard_1",
656: role, new ArrayList());
657: Map result = m_relationService.getReferencedMBeans(relationID);
658: assertTrue(
659: "The referenced mbeans are not as expected, 2 were added but only "
660: + result.size() + " found", result.size() == 2);
661: }
662:
663: public void testFindReferencingMBeans() throws Exception {
664: //basic init...
665: registerRelationService(true);
666: registerMBeans();
667:
668: //this is going to be our referenced bean
669: ObjectName targetObjectName = mbeanObjectName1;
670:
671: //create constraint
672: m_relationService.createRelationType("relationType1",
673: createRoleInfos("roleName1", "roleName2"));
674:
675: RoleList roleList = new RoleList();
676: ArrayList values = new ArrayList();
677: values.add(targetObjectName); //our test target
678: values.add(mbeanObjectName2);
679:
680: roleList.add(new Role("roleName1", values));
681:
682: //create first referencing relation (to meanObjectName1);
683: m_relationService.createRelation("relationID1",
684: "relationType1", roleList);
685:
686: roleList = new RoleList();
687: values = new ArrayList();
688: values.add(targetObjectName); //our test target
689: values.add(mbeanObjectName3);
690: roleList.add(new Role("roleName1", values));
691: roleList.add(new Role("roleName2", values));
692:
693: //create second referencing relation (to meanObjectName1);
694: m_relationService.createRelation("relationID2",
695: "relationType1", roleList);
696:
697: Map result = m_relationService.findReferencingRelations(
698: targetObjectName, null, null); //our test target should have 2 references by now....
699:
700: //dsamsonoff - under 575066 this would fail - map size would always return 1
701: assertTrue(
702: "The referencing mbeans are not as expected, 2 were added but only "
703: + result.size() + " found", result.size() == 2);
704:
705: }
706: }
|