public void test_SBMLNamespaces_add_and_remove_namespaces() { SBMLNamespaces sbmlns = new SBMLNamespaces(3, 1); assertTrue(sbmlns.getLevel() == 3); assertTrue(sbmlns.getVersion() == 1); sbmlns.addNamespace("http://www.sbml.org/sbml/level3/version1/group/version1", "group"); sbmlns.addNamespace("http://www.sbml.org/sbml/level3/version1/layout/version1", "layout"); sbmlns.addNamespace("http://www.sbml.org/sbml/level3/version1/render/version1", "render"); sbmlns.addNamespace("http://www.sbml.org/sbml/level3/version1/multi/version1", "multi"); XMLNamespaces ns = sbmlns.getNamespaces(); assertTrue(ns.getLength() == 5); assertTrue(ns.getURI(0) == "http://www.sbml.org/sbml/level3/version1/core"); assertTrue(ns.getPrefix(0) == ""); assertTrue(ns.getURI(1) == "http://www.sbml.org/sbml/level3/version1/group/version1"); assertTrue(ns.getPrefix(1) == "group"); assertTrue(ns.getURI(2) == "http://www.sbml.org/sbml/level3/version1/layout/version1"); assertTrue(ns.getPrefix(2) == "layout"); assertTrue(ns.getURI(3) == "http://www.sbml.org/sbml/level3/version1/render/version1"); assertTrue(ns.getPrefix(3) == "render"); assertTrue(ns.getURI(4) == "http://www.sbml.org/sbml/level3/version1/multi/version1"); assertTrue(ns.getPrefix(4) == "multi"); sbmlns.removeNamespace("http://www.sbml.org/sbml/level3/version1/layout/version1"); sbmlns.removeNamespace("http://www.sbml.org/sbml/level3/version1/group/version1"); sbmlns.removeNamespace("http://www.sbml.org/sbml/level3/version1/render/version1"); sbmlns.removeNamespace("http://www.sbml.org/sbml/level3/version1/multi/version1"); }
public void test_SBMLNamespaces_L2V4() { SBMLNamespaces sbml = new SBMLNamespaces(2, 4); assertTrue(sbml.getLevel() == 2); assertTrue(sbml.getVersion() == 4); XMLNamespaces ns = sbml.getNamespaces(); assertTrue(ns.getLength() == 1); assertTrue(ns.getURI(0) == "http://www.sbml.org/sbml/level2/version4"); assertTrue(ns.getPrefix(0) == ""); sbml = null; }
public void test_NS_copyConstructor() { XMLNamespaces ns = new XMLNamespaces(); ns.add("http://test1.org/", "test1"); assertTrue(ns.getLength() == 1); assertTrue(ns.isEmpty() == false); assertTrue(ns.getPrefix(0) == "test1"); assertTrue(ns.getURI("test1") == "http://test1.org/"); XMLNamespaces ns2 = new XMLNamespaces(ns); assertTrue(ns2.getLength() == 1); assertTrue(ns2.isEmpty() == false); assertTrue(ns2.getPrefix(0) == "test1"); assertTrue(ns2.getURI("test1") == "http://test1.org/"); ns2 = null; ns = null; }
public void test_XMLNode_getters() { XMLToken token; XMLNode node; XMLTriple triple; XMLAttributes attr; XMLNamespaces NS; NS = new XMLNamespaces(); NS.add("http://test1.org/", "test1"); token = new XMLToken("This is a test"); node = new XMLNode(token); assertTrue(node != null); assertTrue(node.getNumChildren() == 0); assertTrue(("This is a test" != node.getCharacters()) == false); assertTrue(node.getChild(1) != null); attr = new XMLAttributes(); assertTrue(attr != null); attr.add("attr2", "value"); triple = new XMLTriple("attr", "uri", "prefix"); token = new XMLToken(triple, attr); assertTrue(token != null); node = new XMLNode(token); assertTrue(("attr" != node.getName()) == false); assertTrue(("uri" != node.getURI()) == false); assertTrue(("prefix" != node.getPrefix()) == false); XMLAttributes returnattr = node.getAttributes(); assertTrue(("attr2" != returnattr.getName(0)) == false); assertTrue(("value" != returnattr.getValue(0)) == false); token = new XMLToken(triple, attr, NS); node = new XMLNode(token); XMLNamespaces returnNS = node.getNamespaces(); assertTrue(returnNS.getLength() == 1); assertTrue(returnNS.isEmpty() == false); triple = null; token = null; node = null; }
public void test_ModifierSpeciesReference_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add("http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2, 1); sbmlns.addNamespaces(xmlns); SBase object1 = new ModifierSpeciesReference(sbmlns); assertTrue(object1.getTypeCode() == libsbml.SBML_MODIFIER_SPECIES_REFERENCE); assertTrue(object1.getMetaId() == ""); assertTrue(object1.getNotes() == null); assertTrue(object1.getAnnotation() == null); assertTrue(object1.getLevel() == 2); assertTrue(object1.getVersion() == 1); assertTrue(object1.getNamespaces() != null); XMLNamespaces n = object1.getNamespaces(); assertTrue(n.getLength() == 2); object1 = null; }
public void test_XMLNamespaces_add() { assertTrue(NS.getLength() == 0); assertTrue(NS.isEmpty() == true); NS.add("http://test1.org/", "test1"); assertTrue(NS.getLength() == 1); assertTrue(NS.isEmpty() == false); NS.add("http://test2.org/", "test2"); assertTrue(NS.getLength() == 2); assertTrue(NS.isEmpty() == false); NS.add("http://test1.org/", "test1a"); assertTrue(NS.getLength() == 3); assertTrue(NS.isEmpty() == false); NS.add("http://test1.org/", "test1a"); assertTrue(NS.getLength() == 3); assertTrue(NS.isEmpty() == false); assertTrue(!(NS.getIndex("http://test1.org/") == -1)); }