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;
        }
Пример #2
0
        public void test_Node_copyConstructor()
        {
            XMLAttributes att   = new XMLAttributes();
            XMLTriple     t     = new XMLTriple("sarah", "http://foo.org/", "bar");
            XMLToken      token = new XMLToken(t, att, 3, 4);
            XMLNode       node  = new XMLNode(token);
            XMLNode       child = new XMLNode();

            node.addChild(child);
            assertTrue(node.getNumChildren() == 1);
            assertTrue(node.getName() == "sarah");
            assertTrue(node.getURI() == "http://foo.org/");
            assertTrue(node.getPrefix() == "bar");
            assertTrue(node.isEnd() == false);
            assertTrue(node.isEOF() == false);
            assertTrue(node.getLine() == 3);
            assertTrue(node.getColumn() == 4);
            XMLNode node2 = new XMLNode(node);

            assertTrue(node2.getNumChildren() == 1);
            assertTrue(node2.getName() == "sarah");
            assertTrue(node2.getURI() == "http://foo.org/");
            assertTrue(node2.getPrefix() == "bar");
            assertTrue(node2.isEnd() == false);
            assertTrue(node2.isEOF() == false);
            assertTrue(node2.getLine() == 3);
            assertTrue(node2.getColumn() == 4);
            t     = null;
            token = null;
            node  = null;
            node2 = null;
        }
Пример #3
0
        public void test_XMLNode_clearAttributes()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLNode       node   = new XMLNode(triple, attr);
            XMLTriple     xt2    = new  XMLTriple("name3", "http://name3.org/", "p3");
            XMLTriple     xt1    = new  XMLTriple("name5", "http://name5.org/", "p5");
            int           i      = node.addAttr("name1", "val1");

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(node.getAttributes().getLength() == 1);
            i = node.addAttr("name2", "val2", "http://name1.org/", "p1");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(node.getAttributes().getLength() == 2);
            i = node.addAttr(xt2, "val2");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(node.getAttributes().getLength() == 3);
            i = node.addAttr("name4", "val4");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(node.getAttributes().getLength() == 4);
            i = node.clearAttributes();
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(node.getAttributes().getLength() == 0);
            xt1    = null;
            xt2    = null;
            triple = null;
            attr   = null;
            node   = null;
        }
Пример #4
0
        public void test_XMLToken_namespace_add()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);

            assertTrue(token.getNamespacesLength() == 0);
            assertTrue(token.isNamespacesEmpty() == true);
            token.addNamespace("http://test1.org/", "test1");
            assertTrue(token.getNamespacesLength() == 1);
            assertTrue(token.isNamespacesEmpty() == false);
            token.addNamespace("http://test2.org/", "test2");
            assertTrue(token.getNamespacesLength() == 2);
            assertTrue(token.isNamespacesEmpty() == false);
            token.addNamespace("http://test1.org/", "test1a");
            assertTrue(token.getNamespacesLength() == 3);
            assertTrue(token.isNamespacesEmpty() == false);
            token.addNamespace("http://test1.org/", "test1a");
            assertTrue(token.getNamespacesLength() == 3);
            assertTrue(token.isNamespacesEmpty() == false);
            assertTrue(!(token.getNamespaceIndex("http://test1.org/") == -1));
            token  = null;
            triple = null;
            attr   = null;
        }
Пример #5
0
        public void test_Token_copyConstructor()
        {
            XMLTriple t     = new XMLTriple("sarah", "http://foo.org/", "bar");
            XMLToken  token = new XMLToken(t, 3, 4);

            assertTrue(token.getName() == "sarah");
            assertTrue(token.getURI() == "http://foo.org/");
            assertTrue(token.getPrefix() == "bar");
            assertTrue(token.isEnd() == true);
            assertTrue(token.isEOF() == false);
            assertTrue(token.getLine() == 3);
            assertTrue(token.getColumn() == 4);
            XMLToken token2 = new XMLToken(token);

            assertTrue(token2.getName() == "sarah");
            assertTrue(token2.getURI() == "http://foo.org/");
            assertTrue(token2.getPrefix() == "bar");
            assertTrue(token2.isEnd() == true);
            assertTrue(token2.isEOF() == false);
            assertTrue(token2.getLine() == 3);
            assertTrue(token2.getColumn() == 4);
            t      = null;
            token  = null;
            token2 = null;
        }
Пример #6
0
        public void test_XMLToken_newSetters_addAttributes1()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);
            XMLTriple     xt2    = new  XMLTriple("name3", "http://name3.org/", "p3");
            int           i      = token.addAttr("name1", "val1");

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(token.getAttributesLength() == 1);
            assertTrue(token.isAttributesEmpty() == false);
            assertTrue(("name1" != token.getAttrName(0)) == false);
            assertTrue(("val1" != token.getAttrValue(0)) == false);
            i = token.addAttr("name2", "val2", "http://name1.org/", "p1");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(token.getAttributesLength() == 2);
            assertTrue(token.isAttributesEmpty() == false);
            assertTrue(("name2" != token.getAttrName(1)) == false);
            assertTrue(("val2" != token.getAttrValue(1)) == false);
            assertTrue(("http://name1.org/" != token.getAttrURI(1)) == false);
            assertTrue(("p1" != token.getAttrPrefix(1)) == false);
            i = token.addAttr(xt2, "val2");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(token.getAttributesLength() == 3);
            assertTrue(token.isAttributesEmpty() == false);
            assertTrue(("name3" != token.getAttrName(2)) == false);
            assertTrue(("val2" != token.getAttrValue(2)) == false);
            assertTrue(("http://name3.org/" != token.getAttrURI(2)) == false);
            assertTrue(("p3" != token.getAttrPrefix(2)) == false);
            xt2    = null;
            triple = null;
            attr   = null;
            token  = null;
        }
        public void test_XMLAttributes_remove1()
        {
            XMLAttributes xa  = new  XMLAttributes();
            XMLTriple     xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
            int           i   = xa.add("name1", "val1", "http://name1.org/", "p1");

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            i = xa.add(xt2, "val2");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            i = xa.add("noprefix", "val3");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            i = xa.add("name4", "val4", "http://name4.org/", "p1");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(xa.getLength() == 4);
            i = xa.remove(4);
            assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE);
            i = xa.remove(3);
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(xa.getLength() == 3);
            i = xa.remove("noprefix");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(xa.getLength() == 2);
            i = xa.remove(xt2);
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(xa.getLength() == 1);
            i = xa.remove("name1", "http://name1.org/");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(xa.getLength() == 0);
            xa  = null;
            xt2 = null;
        }
Пример #8
0
        public void test_XMLToken_namespace_set_clear()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);
            XMLNamespaces ns     = new  XMLNamespaces();

            assertTrue(token.getNamespacesLength() == 0);
            assertTrue(token.isNamespacesEmpty() == true);
            ns.add("http://test1.org/", "test1");
            ns.add("http://test2.org/", "test2");
            ns.add("http://test3.org/", "test3");
            ns.add("http://test4.org/", "test4");
            ns.add("http://test5.org/", "test5");
            token.setNamespaces(ns);
            assertTrue(token.getNamespacesLength() == 5);
            assertTrue(token.isNamespacesEmpty() == false);
            assertTrue(("test1" != token.getNamespacePrefix(0)) == false);
            assertTrue(("test2" != token.getNamespacePrefix(1)) == false);
            assertTrue(("test3" != token.getNamespacePrefix(2)) == false);
            assertTrue(("test4" != token.getNamespacePrefix(3)) == false);
            assertTrue(("test5" != token.getNamespacePrefix(4)) == false);
            assertTrue(("http://test1.org/" != token.getNamespaceURI(0)) == false);
            assertTrue(("http://test2.org/" != token.getNamespaceURI(1)) == false);
            assertTrue(("http://test3.org/" != token.getNamespaceURI(2)) == false);
            assertTrue(("http://test4.org/" != token.getNamespaceURI(3)) == false);
            assertTrue(("http://test5.org/" != token.getNamespaceURI(4)) == false);
            token.clearNamespaces();
            assertTrue(token.getNamespacesLength() == 0);
            ns     = null;
            token  = null;
            triple = null;
            attr   = null;
        }
Пример #9
0
        public void test_XMLToken_attribute_set_clear()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);
            XMLAttributes nattr  = new  XMLAttributes();
            XMLTriple     xt1    = new  XMLTriple("name1", "http://name1.org/", "p1");
            XMLTriple     xt2    = new  XMLTriple("name2", "http://name2.org/", "p2");
            XMLTriple     xt3    = new  XMLTriple("name3", "http://name3.org/", "p3");
            XMLTriple     xt4    = new  XMLTriple("name4", "http://name4.org/", "p4");
            XMLTriple     xt5    = new  XMLTriple("name5", "http://name5.org/", "p5");

            nattr.add(xt1, "val1");
            nattr.add(xt2, "val2");
            nattr.add(xt3, "val3");
            nattr.add(xt4, "val4");
            nattr.add(xt5, "val5");
            token.setAttributes(nattr);
            assertTrue(token.getAttributesLength() == 5);
            assertTrue(token.isAttributesEmpty() == false);
            assertTrue(("name1" != token.getAttrName(0)) == false);
            assertTrue(("val1" != token.getAttrValue(0)) == false);
            assertTrue(("http://name1.org/" != token.getAttrURI(0)) == false);
            assertTrue(("p1" != token.getAttrPrefix(0)) == false);
            assertTrue(("name2" != token.getAttrName(1)) == false);
            assertTrue(("val2" != token.getAttrValue(1)) == false);
            assertTrue(("http://name2.org/" != token.getAttrURI(1)) == false);
            assertTrue(("p2" != token.getAttrPrefix(1)) == false);
            assertTrue(("name3" != token.getAttrName(2)) == false);
            assertTrue(("val3" != token.getAttrValue(2)) == false);
            assertTrue(("http://name3.org/" != token.getAttrURI(2)) == false);
            assertTrue(("p3" != token.getAttrPrefix(2)) == false);
            assertTrue(("name4" != token.getAttrName(3)) == false);
            assertTrue(("val4" != token.getAttrValue(3)) == false);
            assertTrue(("http://name4.org/" != token.getAttrURI(3)) == false);
            assertTrue(("p4" != token.getAttrPrefix(3)) == false);
            assertTrue(("name5" != token.getAttrName(4)) == false);
            assertTrue(("val5" != token.getAttrValue(4)) == false);
            assertTrue(("http://name5.org/" != token.getAttrURI(4)) == false);
            assertTrue(("p5" != token.getAttrPrefix(4)) == false);
            XMLTriple ntriple = new  XMLTriple("test2", "http://test2.org/", "p2");

            token.setTriple(ntriple);
            assertTrue(("test2" != token.getName()) == false);
            assertTrue(("http://test2.org/" != token.getURI()) == false);
            assertTrue(("p2" != token.getPrefix()) == false);
            token.clearAttributes();
            assertTrue(token.getAttributesLength() == 0);
            assertTrue(token.isAttributesEmpty() != false);
            nattr   = null;
            triple  = null;
            ntriple = null;
            attr    = null;
            token   = null;
            xt1     = null;
            xt2     = null;
            xt3     = null;
            xt4     = null;
            xt5     = null;
        }
Пример #10
0
        public void test_XMLToken_create()
        {
            XMLToken      token;
            XMLTriple     triple;
            XMLAttributes attr;

            token = new  XMLToken();
            assertTrue(token != null);
            token  = null;
            triple = new  XMLTriple("attr", "uri", "prefix");
            token  = new  XMLToken(triple);
            assertTrue(token != null);
            assertTrue(("attr" != token.getName()) == false);
            assertTrue(("prefix" != token.getPrefix()) == false);
            assertTrue(("uri" != token.getURI()) == false);
            token = null;
            attr  = new  XMLAttributes();
            assertTrue(attr != null);
            attr.add("attr2", "value");
            token = new  XMLToken(triple, attr);
            assertTrue(token != null);
            XMLAttributes returnattr = token.getAttributes();

            assertTrue(("attr2" != returnattr.getName(0)) == false);
            token  = null;
            triple = null;
            attr   = null;
        }
Пример #11
0
        public void test_XMLNode_removeNamespaces()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLNode       node   = new XMLNode(triple, attr);
            XMLNamespaces nms;
            int           i = node.addNamespace("http://test1.org/", "test1");

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            nms = node.getNamespaces();
            assertTrue(nms.getLength() == 1);
            i = node.addNamespace("http://test2.org/", "test2");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            nms = node.getNamespaces();
            assertTrue(nms.getLength() == 2);
            i = node.removeNamespace(7);
            assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE);
            nms = node.getNamespaces();
            assertTrue(nms.getLength() == 2);
            i = node.removeNamespace("name7");
            assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE);
            nms = node.getNamespaces();
            assertTrue(nms.getLength() == 2);
            i = node.removeNamespace(0);
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            nms = node.getNamespaces();
            assertTrue(nms.getLength() == 1);
            i = node.removeNamespace("test2");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            nms = node.getNamespaces();
            assertTrue(nms.getLength() == 0);
            triple = null;
            attr   = null;
            node   = null;
        }
Пример #12
0
        public void test_XMLToken_namespace_remove_by_prefix()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);

            token.addNamespace("http://test1.org/", "test1");
            token.addNamespace("http://test2.org/", "test2");
            token.addNamespace("http://test3.org/", "test3");
            token.addNamespace("http://test4.org/", "test4");
            token.addNamespace("http://test5.org/", "test5");
            assertTrue(token.getNamespacesLength() == 5);
            token.removeNamespace("test1");
            assertTrue(token.getNamespacesLength() == 4);
            token.removeNamespace("test2");
            assertTrue(token.getNamespacesLength() == 3);
            token.removeNamespace("test3");
            assertTrue(token.getNamespacesLength() == 2);
            token.removeNamespace("test4");
            assertTrue(token.getNamespacesLength() == 1);
            token.removeNamespace("test5");
            assertTrue(token.getNamespacesLength() == 0);
            token.addNamespace("http://test1.org/", "test1");
            token.addNamespace("http://test2.org/", "test2");
            token.addNamespace("http://test3.org/", "test3");
            token.addNamespace("http://test4.org/", "test4");
            token.addNamespace("http://test5.org/", "test5");
            assertTrue(token.getNamespacesLength() == 5);
            token.removeNamespace("test5");
            assertTrue(token.getNamespacesLength() == 4);
            token.removeNamespace("test4");
            assertTrue(token.getNamespacesLength() == 3);
            token.removeNamespace("test3");
            assertTrue(token.getNamespacesLength() == 2);
            token.removeNamespace("test2");
            assertTrue(token.getNamespacesLength() == 1);
            token.removeNamespace("test1");
            assertTrue(token.getNamespacesLength() == 0);
            token.addNamespace("http://test1.org/", "test1");
            token.addNamespace("http://test2.org/", "test2");
            token.addNamespace("http://test3.org/", "test3");
            token.addNamespace("http://test4.org/", "test4");
            token.addNamespace("http://test5.org/", "test5");
            assertTrue(token.getNamespacesLength() == 5);
            token.removeNamespace("test3");
            assertTrue(token.getNamespacesLength() == 4);
            token.removeNamespace("test1");
            assertTrue(token.getNamespacesLength() == 3);
            token.removeNamespace("test4");
            assertTrue(token.getNamespacesLength() == 2);
            token.removeNamespace("test5");
            assertTrue(token.getNamespacesLength() == 1);
            token.removeNamespace("test2");
            assertTrue(token.getNamespacesLength() == 0);
            token  = null;
            triple = null;
            attr   = null;
        }
Пример #13
0
        public void test_XMLToken_newSetters_setTriple1()
        {
            XMLTriple triple = new  XMLTriple("test", "", "");
            XMLToken  token  = new  XMLToken();
            int       i      = token.setTriple(triple);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(("test" == token.getName()));
            triple = null;
            token  = null;
        }
Пример #14
0
        public void test_XMLToken_newSetters_setTriple2()
        {
            int       i;
            XMLTriple triple = new  XMLTriple("test", "", "");
            XMLToken  token  = new  XMLToken("This is text");

            i = token.setTriple(triple);
            assertTrue(i == libsbml.LIBSBML_INVALID_XML_OPERATION);
            triple = null;
            token  = null;
        }
Пример #15
0
        public void test_XMLNode_addChild3()
        {
            XMLTriple triple = new  XMLTriple("test", "", "");
            XMLNode   node   = new XMLNode(triple);
            XMLNode   node2  = new XMLNode();
            int       i      = node.addChild(node2);

            assertTrue(i == libsbml.LIBSBML_INVALID_XML_OPERATION);
            assertTrue(node.getNumChildren() == 0);
            triple = null;
            node   = null;
            node2  = null;
        }
Пример #16
0
        public void test_XMLToken_newSetters_addNamespaces2()
        {
            XMLTriple triple = new  XMLTriple("test", "", "");
            XMLToken  token  = new  XMLToken(triple);

            assertTrue(token.getNamespacesLength() == 0);
            assertTrue(token.isNamespacesEmpty() == true);
            int i = token.addNamespace("http://test1.org/", "test1");

            assertTrue(i == libsbml.LIBSBML_INVALID_XML_OPERATION);
            assertTrue(token.getNamespacesLength() == 0);
            assertTrue(token.isNamespacesEmpty() == true);
            triple = null;
            token  = null;
        }
Пример #17
0
        public void test_Triple_copyConstructor()
        {
            XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");

            assertTrue(t.getName() == "sarah");
            assertTrue(t.getURI() == "http://foo.org/");
            assertTrue(t.getPrefix() == "bar");
            XMLTriple t2 = new XMLTriple(t);

            assertTrue(t2.getName() == "sarah");
            assertTrue(t2.getURI() == "http://foo.org/");
            assertTrue(t2.getPrefix() == "bar");
            t  = null;
            t2 = null;
        }
Пример #18
0
        public void test_Triple_clone()
        {
            XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");

            assertTrue(t.getName() == "sarah");
            assertTrue(t.getURI() == "http://foo.org/");
            assertTrue(t.getPrefix() == "bar");
            XMLTriple t2 = (XMLTriple)t.clone();

            assertTrue(t2.getName() == "sarah");
            assertTrue(t2.getURI() == "http://foo.org/");
            assertTrue(t2.getPrefix() == "bar");
            t  = null;
            t2 = null;
        }
Пример #19
0
        public void test_XMLNode_addChild2()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLNode       node   = new XMLNode(triple, attr);
            XMLNode       node2  = new XMLNode();
            int           i      = node.addChild(node2);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(node.getNumChildren() == 1);
            triple = null;
            attr   = null;
            node   = null;
            node2  = null;
        }
Пример #20
0
        public void test_Triple_assignmentOperator()
        {
            XMLTriple t = new XMLTriple("sarah", "http://foo.org/", "bar");

            assertTrue(t.getName() == "sarah");
            assertTrue(t.getURI() == "http://foo.org/");
            assertTrue(t.getPrefix() == "bar");
            XMLTriple t2 = new XMLTriple();

            t2 = t;
            assertTrue(t2.getName() == "sarah");
            assertTrue(t2.getURI() == "http://foo.org/");
            assertTrue(t2.getPrefix() == "bar");
            t  = null;
            t2 = null;
        }
Пример #21
0
        public void test_XMLToken_namespace_get()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);

            token.addNamespace("http://test1.org/", "test1");
            token.addNamespace("http://test2.org/", "test2");
            token.addNamespace("http://test3.org/", "test3");
            token.addNamespace("http://test4.org/", "test4");
            token.addNamespace("http://test5.org/", "test5");
            token.addNamespace("http://test6.org/", "test6");
            token.addNamespace("http://test7.org/", "test7");
            token.addNamespace("http://test8.org/", "test8");
            token.addNamespace("http://test9.org/", "test9");
            assertTrue(token.getNamespacesLength() == 9);
            assertTrue(token.getNamespaceIndex("http://test1.org/") == 0);
            assertTrue(("test2" != token.getNamespacePrefix(1)) == false);
            assertTrue(("test1" != token.getNamespacePrefix("http://test1.org/")) == false);
            assertTrue(("http://test2.org/" != token.getNamespaceURI(1)) == false);
            assertTrue(("http://test2.org/" != token.getNamespaceURI("test2")) == false);
            assertTrue(token.getNamespaceIndex("http://test1.org/") == 0);
            assertTrue(token.getNamespaceIndex("http://test2.org/") == 1);
            assertTrue(token.getNamespaceIndex("http://test5.org/") == 4);
            assertTrue(token.getNamespaceIndex("http://test9.org/") == 8);
            assertTrue(token.getNamespaceIndex("http://testX.org/") == -1);
            assertTrue(token.hasNamespaceURI("http://test1.org/") != false);
            assertTrue(token.hasNamespaceURI("http://test2.org/") != false);
            assertTrue(token.hasNamespaceURI("http://test5.org/") != false);
            assertTrue(token.hasNamespaceURI("http://test9.org/") != false);
            assertTrue(token.hasNamespaceURI("http://testX.org/") == false);
            assertTrue(token.getNamespaceIndexByPrefix("test1") == 0);
            assertTrue(token.getNamespaceIndexByPrefix("test5") == 4);
            assertTrue(token.getNamespaceIndexByPrefix("test9") == 8);
            assertTrue(token.getNamespaceIndexByPrefix("testX") == -1);
            assertTrue(token.hasNamespacePrefix("test1") != false);
            assertTrue(token.hasNamespacePrefix("test5") != false);
            assertTrue(token.hasNamespacePrefix("test9") != false);
            assertTrue(token.hasNamespacePrefix("testX") == false);
            assertTrue(token.hasNamespaceNS("http://test1.org/", "test1") != false);
            assertTrue(token.hasNamespaceNS("http://test5.org/", "test5") != false);
            assertTrue(token.hasNamespaceNS("http://test9.org/", "test9") != false);
            assertTrue(token.hasNamespaceNS("http://testX.org/", "testX") == false);
            token  = null;
            triple = null;
            attr   = null;
        }
Пример #22
0
        public void test_XMLToken_newSetters_addNamespaces1()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);

            assertTrue(token.getNamespacesLength() == 0);
            assertTrue(token.isNamespacesEmpty() == true);
            int i = token.addNamespace("http://test1.org/", "test1");

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(token.getNamespacesLength() == 1);
            assertTrue(token.isNamespacesEmpty() == false);
            attr   = null;
            triple = null;
            token  = null;
        }
Пример #23
0
        public void test_XMLAttributes_clear1()
        {
            XMLAttributes xa  = new  XMLAttributes();
            XMLTriple     xt2 = new  XMLTriple("name2", "http://name2.org/", "p2");
            int           i   = xa.add("name1", "val1", "http://name1.org/", "p1");

            i = xa.add(xt2, "val2");
            i = xa.add("noprefix", "val3");
            assertTrue(xa.getLength() == 3);
            assertTrue(xa.isEmpty() == false);
            i = xa.clear();
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(xa.getLength() == 0);
            assertTrue(xa.isEmpty() == true);
            xa  = null;
            xt2 = null;
        }
Пример #24
0
        public void test_SyntaxChecker_validXHTML()
        {
            SBMLNamespaces NS24 = new  SBMLNamespaces(2, 4);
            SBMLNamespaces NS31 = new  SBMLNamespaces(3, 1);
            XMLToken       toptoken;
            XMLNode        topnode;
            XMLTriple      toptriple = new  XMLTriple("notes", "", "");
            XMLToken       token;
            XMLNode        node;
            XMLTriple      triple = new  XMLTriple("p", "", "");
            XMLAttributes  att    = new  XMLAttributes();
            XMLNamespaces  ns     = new  XMLNamespaces();

            ns.add("http://www.w3.org/1999/xhtml", "");
            XMLToken tt = new  XMLToken("This is my text");
            XMLNode  n1 = new XMLNode(tt);

            toptoken = new  XMLToken(toptriple, att);
            topnode  = new XMLNode(toptoken);
            token    = new  XMLToken(triple, att, ns);
            node     = new XMLNode(token);
            node.addChild(n1);
            topnode.addChild(node);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, null) == true);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, NS24) == true);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, NS31) == true);
            triple = new  XMLTriple("html", "", "");
            token  = new  XMLToken(triple, att, ns);
            node   = new XMLNode(token);
            node.addChild(n1);
            topnode.removeChild(0);
            topnode.addChild(node);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, null) == true);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, NS24) == false);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, NS31) == true);
            triple = new  XMLTriple("html", "", "");
            ns.clear();
            token = new  XMLToken(triple, att, ns);
            node  = new XMLNode(token);
            node.addChild(n1);
            topnode.removeChild(0);
            topnode.addChild(node);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, null) == false);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, NS24) == false);
            assertTrue(SyntaxChecker.hasExpectedXHTMLSyntax(topnode, NS31) == false);
        }
Пример #25
0
        public void test_XMLToken_newSetters_setAttributes2()
        {
            int           i;
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLToken      token  = new  XMLToken(triple);
            XMLAttributes nattr  = new  XMLAttributes();
            XMLTriple     xt1    = new  XMLTriple("name1", "http://name1.org/", "p1");

            nattr.add(xt1, "val1");
            i = token.setAttributes(nattr);
            assertTrue(i == libsbml.LIBSBML_INVALID_XML_OPERATION);
            assertTrue(token.isAttributesEmpty() == true);
            nattr  = null;
            triple = null;
            token  = null;
            xt1    = null;
        }
Пример #26
0
        public void test_XMLToken_fields()
        {
            XMLTriple triple;
            XMLToken  token;

            triple = new  XMLTriple("attr", "uri", "prefix");
            token  = new  XMLToken(triple);
            assertTrue(token.isElement() == true);
            assertTrue(token.isEnd() == true);
            assertTrue(token.isStart() == false);
            assertTrue(token.isText() == false);
            assertTrue(token.isEOF() == false);
            assertTrue(("attr" != token.getName()) == false);
            assertTrue(("uri" != token.getURI()) == false);
            assertTrue(("prefix" != token.getPrefix()) == false);
            token  = null;
            triple = null;
        }
Пример #27
0
        public void test_XMLNode_createFromToken()
        {
            XMLToken  token;
            XMLTriple triple;
            XMLNode   node;

            triple = new  XMLTriple("attr", "uri", "prefix");
            token  = new  XMLToken(triple);
            node   = new XMLNode(token);
            assertTrue(node != null);
            assertTrue(node.getNumChildren() == 0);
            assertTrue(("attr" != node.getName()) == false);
            assertTrue(("prefix" != node.getPrefix()) == false);
            assertTrue(("uri" != node.getURI()) == false);
            assertTrue(node.getChild(1) != null);
            token  = null;
            triple = null;
            node   = null;
        }
Пример #28
0
        public void test_XMLToken_newSetters_removeNamespaces1()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);

            token.addNamespace("http://test1.org/", "test1");
            assertTrue(token.getNamespacesLength() == 1);
            int i = token.removeNamespace("test2");

            assertTrue(i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE);
            assertTrue(token.getNamespacesLength() == 1);
            i = token.removeNamespace("test1");
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(token.getNamespacesLength() == 0);
            token  = null;
            triple = null;
            attr   = null;
        }
Пример #29
0
        public void test_XMLToken_newSetters_setAttributes1()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLToken      token  = new  XMLToken(triple, attr);
            XMLAttributes nattr  = new  XMLAttributes();
            XMLTriple     xt1    = new  XMLTriple("name1", "http://name1.org/", "p1");

            nattr.add(xt1, "val1");
            int i = token.setAttributes(nattr);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(token.isAttributesEmpty() == false);
            nattr  = null;
            attr   = null;
            triple = null;
            token  = null;
            xt1    = null;
        }
Пример #30
0
        public void test_XMLNode_namespace_remove()
        {
            XMLTriple     triple = new  XMLTriple("test", "", "");
            XMLAttributes attr   = new  XMLAttributes();
            XMLNode       node   = new XMLNode(triple, attr);

            node.addNamespace("http://test1.org/", "test1");
            node.addNamespace("http://test2.org/", "test2");
            node.addNamespace("http://test3.org/", "test3");
            node.addNamespace("http://test4.org/", "test4");
            node.addNamespace("http://test5.org/", "test5");
            assertTrue(node.getNamespacesLength() == 5);
            node.removeNamespace(4);
            assertTrue(node.getNamespacesLength() == 4);
            node.removeNamespace(3);
            assertTrue(node.getNamespacesLength() == 3);
            node.removeNamespace(2);
            assertTrue(node.getNamespacesLength() == 2);
            node.removeNamespace(1);
            assertTrue(node.getNamespacesLength() == 1);
            node.removeNamespace(0);
            assertTrue(node.getNamespacesLength() == 0);
            node.addNamespace("http://test1.org/", "test1");
            node.addNamespace("http://test2.org/", "test2");
            node.addNamespace("http://test3.org/", "test3");
            node.addNamespace("http://test4.org/", "test4");
            node.addNamespace("http://test5.org/", "test5");
            assertTrue(node.getNamespacesLength() == 5);
            node.removeNamespace(0);
            assertTrue(node.getNamespacesLength() == 4);
            node.removeNamespace(0);
            assertTrue(node.getNamespacesLength() == 3);
            node.removeNamespace(0);
            assertTrue(node.getNamespacesLength() == 2);
            node.removeNamespace(0);
            assertTrue(node.getNamespacesLength() == 1);
            node.removeNamespace(0);
            assertTrue(node.getNamespacesLength() == 0);
            node   = null;
            triple = null;
            attr   = null;
        }