Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.XmlObject$Factory


            GerConnectorDocument doc = GerConnectorDocument.Factory.newInstance();
            doc.addNewConnector().addNewResourceadapter();
            return doc;
        } else {
            try {
                XmlObject result =  GerConnectorDocument.Factory.parse(in);
                in.close();
                return result;
            } catch (XmlException e) {
                throw new RuntimeException("Unable to load default Geronimo RA data", e);
            } catch (IOException e) {
View Full Code Here


    //The schemas have been fixed by sun, we can use the official schemas.

    public void testOrderDescriptionGroup() throws Exception {
        URL srcXml = classLoader.getResource("j2ee_1_3dtd/DescriptionGroupTestSource.xml");
        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/DescriptionGroupTestExpected.xml");
        XmlObject srcObject = XmlObject.Factory.parse(srcXml);
        XmlCursor srcCursor = srcObject.newCursor();
        XmlCursor moveable = srcObject.newCursor();
        try {
            srcCursor.toFirstChild();
            srcCursor.toFirstChild();
            assertTrue(srcCursor.getName().toString(), "filter".equals(srcCursor.getName().getLocalPart()));
            do {
                srcCursor.push();
                srcCursor.toFirstChild();
                SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.J2EE_NAMESPACE, srcCursor, moveable);
                srcCursor.pop();
            } while (srcCursor.toNextSibling());
        } finally {
            srcCursor.dispose();
        }
//        log.debug(srcObject.toString());
        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
        List problems = new ArrayList();
        boolean ok = compareXmlObjects(srcObject, expected, problems);
        assertTrue("Differences: " + problems, ok);
    }
View Full Code Here

    }

    public void testOrderJNDIEnvironmentRefsGroup() throws Exception {
        URL srcXml = classLoader.getResource("j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml");
        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml");
        XmlObject srcObject = XmlObject.Factory.parse(srcXml);
        XmlCursor srcCursor = srcObject.newCursor();
        XmlCursor moveable = srcObject.newCursor();
        try {
            srcCursor.toFirstChild();
            srcCursor.toFirstChild();
            assertTrue(srcCursor.getName().toString(), "web-app".equals(srcCursor.getName().getLocalPart()));
            do {
                srcCursor.push();
                srcCursor.toFirstChild();
                srcCursor.toNextSibling();
                srcCursor.toNextSibling();
                moveable.toCursor(srcCursor);
                SchemaConversionUtils.convertToJNDIEnvironmentRefsGroup(SchemaConversionUtils.J2EE_NAMESPACE, srcCursor, moveable);
                srcCursor.pop();
            } while (srcCursor.toNextSibling());
        } finally {
            srcCursor.dispose();
        }
//        log.debug(srcObject.toString());
        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
        List problems = new ArrayList();
        boolean ok = compareXmlObjects(srcObject, expected, problems);
        assertTrue("Differences: " + problems, ok);
    }
View Full Code Here

    }

    public void testGeronimoNamingNamespaceChange() throws Exception {
        URL srcXml = classLoader.getResource("geronimo/ejb-naming-pre.xml");
        URL expectedOutputXml = classLoader.getResource("geronimo/ejb-naming-post.xml");
        XmlObject xmlObject = XmlBeansUtil.parse(srcXml, this.getClass().getClassLoader());
        XmlCursor cursor = xmlObject.newCursor();
        try {
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
            log.debug(xmlObject.toString());
           
            XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
            log.debug(expected.toString());
           
            List problems = new ArrayList();
            boolean ok = compareXmlObjects(xmlObject, expected, problems);
            assertTrue("Differences: " + problems, ok);
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
View Full Code Here

    }
//
    public void testGetNestedObjectAsType() throws Exception {
        URL srcXml = classLoader.getResource("geronimo/ejb-naming-pre.xml");
//        URL expectedOutputXml = classLoader.getResource("geronimo/ejb-naming-post.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
        //this is not a usable type, we'll see what happens though
        xmlObject = SchemaConversionUtils.getNestedObjectAsType(xmlObject, new QName("http://openejb.apache.org/xml/ns/openejb-jar-2.3", "openejb-jar"), EjbJarType.type);
//          log.debug(xmlObject.toString());
    }
View Full Code Here

    }

    public void testSecurityElementConverter() throws Exception {
        URL srcXml = classLoader.getResource("geronimo/security-pre.xml");
        URL expectedOutputXml = classLoader.getResource("geronimo/security-post.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
        ElementConverter elementConverter = new SecurityElementConverter();
        XmlCursor cursor = xmlObject.newCursor();
        XmlCursor end = cursor.newCursor();
        try {
            elementConverter.convertElement(cursor, end);
            //        log.debug(xmlObject.toString());
            XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
            List problems = new ArrayList();
            boolean ok = compareXmlObjects(xmlObject, expected, problems);
            assertTrue("Differences: " + problems, ok);
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
            boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
View Full Code Here

    }

    public void testGBeanElementConverter() throws Exception {
        URL srcXml = classLoader.getResource("geronimo/gbean-pre.xml");
        URL expectedOutputXml = classLoader.getResource("geronimo/gbean-post.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
        ElementConverter elementConverter = new GBeanElementConverter();
        XmlCursor cursor = xmlObject.newCursor();
        XmlCursor end = cursor.newCursor();
        try {
            elementConverter.convertElement(cursor, end);
            //        log.debug(xmlObject.toString());
            XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
            List problems = new ArrayList();
            boolean ok = compareXmlObjects(xmlObject, expected, problems);
            assertTrue("Differences: " + problems, ok);
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
            boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
View Full Code Here

    }

    public void testQNameConverter1() throws Exception {
        URL srcXml = classLoader.getResource("geronimo/qname1-pre.xml");
        URL expectedOutputXml = classLoader.getResource("geronimo/qname1-post.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
        ElementConverter elementConverter = new QNameConverter("import", "http://geronimo.apache.org/xml/ns/deployment-1.0", "parent");
        XmlCursor cursor = xmlObject.newCursor();
        XmlCursor end = cursor.newCursor();
        try {
            elementConverter.convertElement(cursor, end);
            //        log.debug(xmlObject.toString());
            XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
            List problems = new ArrayList();
            boolean ok = compareXmlObjects(xmlObject, expected, problems);
            assertTrue("Differences: " + problems, ok);
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
            boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
View Full Code Here

    }
    public void testQNameConverter2() throws Exception {
        URL srcXml = classLoader.getResource("geronimo/qname2-pre.xml");
        URL expectedOutputXml = classLoader.getResource("geronimo/qname2-post.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
        ElementConverter elementConverter = new QNameConverter("import", "http://geronimo.apache.org/xml/ns/deployment-1.0", "parent");
        XmlCursor cursor = xmlObject.newCursor();
        XmlCursor end = cursor.newCursor();
        try {
            elementConverter.convertElement(cursor, end);
            //        log.debug(xmlObject.toString());
            XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
            List problems = new ArrayList();
            boolean ok = compareXmlObjects(xmlObject, expected, problems);
            assertTrue("Differences: " + problems, ok);
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
            boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
View Full Code Here

    }
    public void testWebMessageDestination1() throws Exception {
        URL srcXml = classLoader.getResource("geronimo/web-md-pre.xml");
        URL expectedOutputXml = classLoader.getResource("geronimo/web-md-post.xml");
        XmlObject xmlObject = XmlBeansUtil.parse(srcXml, this.getClass().getClassLoader());
        XmlCursor cursor = xmlObject.newCursor();
        try {
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
            log.debug(xmlObject.toString());
           
            XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
            log.debug(expected.toString());
           
            List problems = new ArrayList();
            boolean ok = compareXmlObjects(xmlObject, expected, problems);
            assertTrue("Differences: " + problems, ok);
            SchemaConversionUtils.convertToGeronimoSubSchemas(cursor);
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.XmlObject$Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.