[isidorus-cvs] r514 - in branches/gdl-frontend/src/anaToMia/GDL_TmEngine: lib test/us/isidor/gdl/anaToMia/TmEngine/jtmsBasedEngine
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Mon Jun 27 12:58:02 UTC 2011
Author: lgiessmann
Date: Mon Jun 27 05:58:01 2011
New Revision: 514
Log:
gdl-frontend: Topic Maps Engine: added a unit-test for the class Variant; modified the referenced file: GDL_TopicMaps_Model.jar
Modified:
branches/gdl-frontend/src/anaToMia/GDL_TmEngine/lib/GDL_TopicMaps_Model.jar
branches/gdl-frontend/src/anaToMia/GDL_TmEngine/test/us/isidor/gdl/anaToMia/TmEngine/jtmsBasedEngine/JtmsTmEngineTest.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_TmEngine/lib/GDL_TopicMaps_Model.jar
==============================================================================
Binary file (source and/or target). No diff available.
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 05:57:38 2011 (r513)
+++ branches/gdl-frontend/src/anaToMia/GDL_TmEngine/test/us/isidor/gdl/anaToMia/TmEngine/jtmsBasedEngine/JtmsTmEngineTest.java Mon Jun 27 05:58:01 2011 (r514)
@@ -6,6 +6,7 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.junit.client.GWTTestCase;
@@ -21,6 +22,8 @@
final String slLocator2 = "http'://us.isidor.gdl.anaToMia/sl-2";
final String iiLocator1 = "http'://us.isidor.gdl.anaToMia/ii-1";
final String iiLocator2 = "http'://us.isidor.gdl.anaToMia/ii-2";
+ final String xsdString = "http://www.w3.org/2001/XMLSchema#string";
+ final String xsdUri = "http://www.w3.org/2001/XMLSchema#anyUri";
JtmsTmEngine jtme = null;
@@ -133,7 +136,7 @@
Topic defaultNameType = jtme.createDefaultNameType(tm);
assertNotNull(defaultNameType);
- Name name1 = top1.createName("name 1", appendToJsArray(null, null));//appendToJsArray(null, null));
+ Name name1 = top1.createName("name 1", appendToJsArray(null, null));
Name name2 = top1.createName("name 2", createJsArray(scope));
Name name3 = top1.createName("name 3", type, appendToJsArray(null, null));
Name name4 = top1.createName("name 4", type, createJsArray(scope));
@@ -152,8 +155,49 @@
assertEquals(3, name4.getScope().length());
}
- // TODO: Name
- // TODO: Variant
+
+ public void testVariant(){
+ jtme = new JtmsTmEngine();
+
+ TopicMap tm = jtme.createTopicMap(tmLocator1);
+
+ Topic top1 = tm.createTopicBySubjectLocator(tm.createLocator(slLocator1));
+ Name name1 = top1.createName("name 1", appendToJsArray(null, null));
+
+ Topic theme1 = tm.createTopic();
+ Topic theme2 = tm.createTopic();
+ Topic theme3 = tm.createTopic();
+ ArrayList<Topic> scope = new ArrayList<Topic>();
+ scope.add(theme1);
+ scope.add(theme2);
+
+ Variant variant1 = name1.createVariant("variant 1", appendToJsArray(null, null));
+ Variant variant2 = name1.createVariant("variant 2", createJsArray(scope));
+ Variant variant3 = name1.createVariant("variant 3", tm.createLocator(xsdUri), appendToJsArray(null, null));
+ Variant variant4 = name1.createVariant("variant 4", tm.createLocator(xsdUri), createJsArray(scope));
+ Variant variant5 = name1.createVariant(tm.createLocator("http://some.where/variant-5"), appendToJsArray(null, null));
+ Variant variant6 = name1.createVariant(tm.createLocator("http://some.where/variant-6"), createJsArray(scope));
+ variant4.addItemIdentifier(tm.createLocator(iiLocator1));
+ variant4.addTheme(theme3);
+
+ assertEquals(6, name1.getVariants().length());
+ assertEquals(name1, variant1.getParent());
+ assertEquals(name1, variant4.getParent());
+ assertEquals(name1, variant5.getParent());
+ assertEquals(tm, variant2.getTopicMap());
+ assertEquals(tm, variant3.getTopicMap());
+ assertEquals(tm, variant6.getTopicMap());
+ assertEquals("variant 1", variant1.getValue());
+ assertEquals(1, variant4.getItemIdentifiers().length());
+ assertEquals(iiLocator1, variant4.getItemIdentifiers().get(0).getReference());
+ assertEquals("http://some.where/variant-6", variant6.getValue());
+ assertEquals(3, variant4.getScope().length());
+ assertEquals(2, variant6.getScope().length());
+ assertEquals(xsdString, variant1.getDatatype().getReference());
+ assertEquals(xsdUri, variant3.getDatatype().getReference());
+ assertEquals(xsdUri, variant5.getDatatype().getReference());
+ }
+
// TODO: Occurrence
// TODO: Association
// TODO: Role
More information about the Isidorus-cvs
mailing list