public void test_Constraint_setMessage2() { XMLNode text = XMLNode.convertStringToXMLNode(" Some text ", null); XMLTriple triple = new XMLTriple("p", "http://www.w3.org/1999/xhtml", ""); XMLAttributes att = new XMLAttributes(); XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add("http://www.w3.org/1999/xhtml", ""); XMLNode p = new XMLNode(triple, att, xmlns); p.addChild(text); XMLTriple triple1 = new XMLTriple("message", "", ""); XMLAttributes att1 = new XMLAttributes(); XMLNode node = new XMLNode(triple1, att1); node.addChild(p); int i = C.setMessage(node); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(C.isSetMessage() == true); i = C.unsetMessage(); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertEquals(false, C.isSetMessage()); if (C.getMessage() != null) { ; } { } node = null; }
public void test_XMLNode_convert() { string xmlstr = "<annotation>\n" + " <test xmlns=\"http://test.org/\" id=\"test\">test</test>\n" + "</annotation>"; XMLNode node; XMLNode child, gchild; XMLAttributes attr; XMLNamespaces ns; node = XMLNode.convertStringToXMLNode(xmlstr, null); child = node.getChild(0); gchild = child.getChild(0); attr = child.getAttributes(); ns = child.getNamespaces(); assertTrue(("annotation" != node.getName()) == false); assertTrue(("test" != child.getName()) == false); assertTrue(("test" != gchild.getCharacters()) == false); assertTrue(("id" != attr.getName(0)) == false); assertTrue(("test" != attr.getValue(0)) == false); assertTrue(("http://test.org/" != ns.getURI(0)) == false); assertTrue(ns.getPrefix(0) == ""); string toxmlstring = node.toXMLString(); assertTrue((xmlstr != toxmlstring) == false); node = null; }
public void test_XMLNode_hasChild() { string xmlstr = "<annotation>\n" + " <test xmlns=\"http://test.org/\" id=\"test\">test</test>\n" + "</annotation>"; XMLNode node = new XMLNode(); assertTrue(node.hasChild("test") == false); node = null; node = XMLNode.convertStringToXMLNode(xmlstr, null); assertTrue(node.hasChild("test") == true); node = null; }
public void test_XMLNode_getIndex() { string xmlstr = "<annotation>\n" + " <test xmlns=\"http://test.org/\" id=\"test\">test</test>\n" + "</annotation>"; XMLNode node = new XMLNode(); assertTrue(node.getIndex("test") == -1); node = null; node = XMLNode.convertStringToXMLNode(xmlstr, null); assertTrue(node.getIndex("test") == 0); node = null; }
public void test_XMLNode_getChildForName() { string xmlstr = "<annotation>\n" + " <test xmlns=\"http://test.org/\" id=\"test\">test</test>\n" + "</annotation>"; XMLNode node = new XMLNode(); XMLNode annotation = node.getChild("test"); string name = annotation.getName(); assertTrue(name == ""); node = null; node = XMLNode.convertStringToXMLNode(xmlstr, null); annotation = node.getChild("test"); assertTrue(("test" != annotation.getName()) == false); node = null; }
public void test_XMLNode_equals() { string xmlstr = "<annotation>\n" + " <test xmlns=\"http://test.org/\" id=\"test\">test</test>\n" + "</annotation>"; XMLNode node = new XMLNode(); XMLNode node1 = XMLNode.convertStringToXMLNode(xmlstr, null); assertEquals(false, node.equals(node1)); node = null; XMLNode node2 = XMLNode.convertStringToXMLNode(xmlstr, null); assertEquals(true, node2.equals(node1)); node1 = null; node2 = null; }
public void test_Constraint_assignmentOperator() { Constraint o1 = new Constraint(2, 4); o1.setMetaId("c"); assertTrue(o1.getMetaId() == "c"); XMLNode text = XMLNode.convertStringToXMLNode(" Some text "); XMLTriple triple = new XMLTriple("p", "http://www.w3.org/1999/xhtml", ""); XMLAttributes att = new XMLAttributes(); XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add("http://www.w3.org/1999/xhtml"); XMLNode p = new XMLNode(triple, att, xmlns); p.addChild(text); XMLTriple triple1 = new XMLTriple("message", "", ""); XMLAttributes att1 = new XMLAttributes(); XMLNode message = new XMLNode(triple1, att1); message.addChild(p); ASTNode math = new ASTNode(libsbml.AST_CONSTANT_PI); o1.setMath(math); o1.setMessage(message); math = null; message = null; XMLNode msg; assertTrue(o1.getMath() != null); msg = o1.getMessage(); assertTrue(msg != null); Constraint o2 = new Constraint(2, 4); o2 = o1; assertTrue(o2.getMetaId() == "c"); assertTrue(o2.getMath() != null); msg = o2.getMessage(); assertTrue(msg != null); assertTrue(o2.getParentSBMLObject() == o1.getParentSBMLObject()); o2 = null; o1 = null; }
public void test_XMLNode_convert_dummyroot() { string xmlstr_nodummy1 = "<notes>\n" + " <p>test</p>\n" + "</notes>"; string xmlstr_nodummy2 = "<html>\n" + " <p>test</p>\n" + "</html>"; string xmlstr_nodummy3 = "<body>\n" + " <p>test</p>\n" + "</body>"; string xmlstr_nodummy4 = "<p>test</p>"; string xmlstr_nodummy5 = "<test1>\n" + " <test2>test</test2>\n" + "</test1>"; string xmlstr_dummy1 = "<p>test1</p><p>test2</p>"; string xmlstr_dummy2 = "<test1>test1</test1><test2>test2</test2>"; XMLNode rootnode; XMLNode child, gchild; XMLAttributes attr; XMLNamespaces ns; string toxmlstring; rootnode = XMLNode.convertStringToXMLNode(xmlstr_nodummy1, null); assertTrue(rootnode.getNumChildren() == 1); child = rootnode.getChild(0); gchild = child.getChild(0); assertTrue(("notes" != rootnode.getName()) == false); assertTrue(("p" != child.getName()) == false); assertTrue(("test" != gchild.getCharacters()) == false); toxmlstring = rootnode.toXMLString(); assertTrue((xmlstr_nodummy1 != toxmlstring) == false); rootnode = null; rootnode = XMLNode.convertStringToXMLNode(xmlstr_nodummy2, null); assertTrue(rootnode.getNumChildren() == 1); child = rootnode.getChild(0); gchild = child.getChild(0); assertTrue(("html" != rootnode.getName()) == false); assertTrue(("p" != child.getName()) == false); assertTrue(("test" != gchild.getCharacters()) == false); toxmlstring = rootnode.toXMLString(); assertTrue((xmlstr_nodummy2 != toxmlstring) == false); rootnode = null; rootnode = XMLNode.convertStringToXMLNode(xmlstr_nodummy3, null); assertTrue(rootnode.getNumChildren() == 1); child = rootnode.getChild(0); gchild = child.getChild(0); assertTrue(("body" != rootnode.getName()) == false); assertTrue(("p" != child.getName()) == false); assertTrue(("test" != gchild.getCharacters()) == false); toxmlstring = rootnode.toXMLString(); assertTrue((xmlstr_nodummy3 != toxmlstring) == false); rootnode = null; rootnode = XMLNode.convertStringToXMLNode(xmlstr_nodummy4, null); assertTrue(rootnode.getNumChildren() == 1); child = rootnode.getChild(0); assertTrue(("p" != rootnode.getName()) == false); assertTrue(("test" != child.getCharacters()) == false); toxmlstring = rootnode.toXMLString(); assertTrue((xmlstr_nodummy4 != toxmlstring) == false); rootnode = null; rootnode = XMLNode.convertStringToXMLNode(xmlstr_nodummy5, null); assertTrue(rootnode.getNumChildren() == 1); child = rootnode.getChild(0); gchild = child.getChild(0); assertTrue(("test1" != rootnode.getName()) == false); assertTrue(("test2" != child.getName()) == false); assertTrue(("test" != gchild.getCharacters()) == false); toxmlstring = rootnode.toXMLString(); assertTrue((xmlstr_nodummy5 != toxmlstring) == false); rootnode = null; rootnode = XMLNode.convertStringToXMLNode(xmlstr_dummy1, null); assertTrue(rootnode.isEOF() == true); assertTrue(rootnode.getNumChildren() == 2); child = rootnode.getChild(0); gchild = child.getChild(0); assertTrue(("p" != child.getName()) == false); assertTrue(("test1" != gchild.getCharacters()) == false); child = rootnode.getChild(1); gchild = child.getChild(0); assertTrue(("p" != child.getName()) == false); assertTrue(("test2" != gchild.getCharacters()) == false); toxmlstring = rootnode.toXMLString(); assertTrue((xmlstr_dummy1 != toxmlstring) == false); rootnode = null; rootnode = XMLNode.convertStringToXMLNode(xmlstr_dummy2, null); assertTrue(rootnode.isEOF() == true); assertTrue(rootnode.getNumChildren() == 2); child = rootnode.getChild(0); gchild = child.getChild(0); assertTrue(("test1" != child.getName()) == false); assertTrue(("test1" != gchild.getCharacters()) == false); child = rootnode.getChild(1); gchild = child.getChild(0); assertTrue(("test2" != child.getName()) == false); assertTrue(("test2" != gchild.getCharacters()) == false); toxmlstring = rootnode.toXMLString(); assertTrue((xmlstr_dummy2 != toxmlstring) == false); rootnode = null; }