Author: lgiessmann Date: Mon Jun 27 14:22:59 2011 New Revision: 518
Log: gdl-frontend: Topic Maps Engine: added a unit-test for the class Role;
Modified: branches/gdl-frontend/src/anaToMia/GDL_TmEngine/test/us/isidor/gdl/anaToMia/TmEngine/jtmsBasedEngine/JtmsTmEngineTest.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_TmEngine/test/us/isidor/gdl/anaToMia/TmEngine/jtmsBasedEngine/JtmsTmEngineTest.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_TmEngine/test/us/isidor/gdl/anaToMia/TmEngine/jtmsBasedEngine/JtmsTmEngineTest.java Mon Jun 27 14:02:45 2011 (r517) +++ branches/gdl-frontend/src/anaToMia/GDL_TmEngine/test/us/isidor/gdl/anaToMia/TmEngine/jtmsBasedEngine/JtmsTmEngineTest.java Mon Jun 27 14:22:59 2011 (r518) @@ -5,6 +5,7 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant; @@ -286,10 +287,45 @@ assoc1.remove(); assertEquals(1, tm.getAssociations().length()); assertEquals(assoc2, tm.getAssociations().get(0)); + assertEquals(tm, assoc1.getParent()); + assertEquals(tm, assoc1.getTopicMap()); + } + + + public void testRole(){ + jtme = new JtmsTmEngine(); + + TopicMap tm = jtme.createTopicMap(tmLocator1); + Topic aType = tm.createTopic(); + Topic rType = tm.createTopic(); + Topic rPlayer1 = tm.createTopic(); + Topic rPlayer2 = tm.createTopic(); + Topic reifier = tm.createTopic(); + Association assoc = tm.createAssociation(aType, appendToJsArray(null, null)); + Role role1 = assoc.createRole(rType, rPlayer1); + Role role2 = assoc.createRole(rType, rPlayer2); + role1.addItemIdentifier(tm.createLocator(iiLocator1)); + role1.setReifier(reifier); + assertEquals(assoc, role1.getParent()); + assertEquals(tm, role1.getTopicMap()); + assertEquals(rPlayer1, role1.getPlayer()); + assertEquals(rType, role1.getType()); + assertEquals(1, role1.getItemIdentifiers().length()); + assertEquals(iiLocator1, role1.getItemIdentifiers().get(0).getReference()); + assertEquals(reifier, role1.getReifier()); + role1.removeItemIdentifier(tm.createLocator(iiLocator1)); + role1.setReifier(null); + assertEquals(0, role1.getItemIdentifiers().length()); + assertNull(role1.getReifier()); + assertEquals(2, assoc.getRoles(rType).length()); + assertEquals(1, assoc.getRoleTypes().length()); + assertEquals(rType, assoc.getRoleTypes().get(0)); + role2.remove(); + assertEquals(1, assoc.getRoles().length()); + assertEquals(role1, assoc.getRoles().get(0)); } - // TODO: Role // TODO: JTM 1.1 import // TODO: JTM 1.1 export