Package org.apache.geronimo.xbeans.connector

Examples of org.apache.geronimo.xbeans.connector.GerConnectorDocument


    }

    public void testRectifyPlan() throws Exception {
        URL srcXml = classLoader.getResource("data/old-schema-plan.xml");
        XmlObject plan = XmlBeansUtil.parse(srcXml, getClass().getClassLoader());
        GerConnectorDocument doc = (GerConnectorDocument) plan.changeType(GerConnectorDocument.type);
        if (doc == null) {
            doc = (GerConnectorDocument) plan;
        }
        GerConnectorType gerConnector = doc.getConnector();
        ConnectorPlanRectifier.rectifyPlan(gerConnector);
        gerConnector = (GerConnectorType) SchemaConversionUtils.fixGeronimoSchema(gerConnector, CONNECTOR_QNAME, GerConnectorType.type);
    }
View Full Code Here


    }

    private static XmlObject loadDefaultData(DDBeanRoot root) {
        InputStream in = root.getDeployableObject().getEntry("META-INF/geronimo-ra.xml");
        if(in == null) {
            GerConnectorDocument doc = GerConnectorDocument.Factory.newInstance();
            doc.addNewConnector().addNewResourceadapter();
            return doc;
        } else {
            try {
                XmlObject result =  GerConnectorDocument.Factory.parse(in);
                in.close();
View Full Code Here

        assertEquals(2, nullCount);
        ByteArrayOutputStream pout = new ByteArrayOutputStream();
        dcbRoot.toXML(pout);
        pout.close();
        ByteArrayInputStream pin = new ByteArrayInputStream(pout.toByteArray());
        GerConnectorDocument doc = GerConnectorDocument.Factory.parse(pin);
        pin.close();
        GerConfigPropertySettingType[] settings = doc.getConnector().getResourceadapterArray(0).
                getOutboundResourceadapter().getConnectionDefinitionArray(0).
                getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
        assertEquals(2, settings.length);
        Set seen = new HashSet();
        for (int i = 0; i < settings.length; i++) {
            GerConfigPropertySettingType setting = settings[i];
            if(seen.contains(setting.getName())) {
                fail("Duplicate for config property setting '"+setting.getName()+"'");
            }
            seen.add(setting.getName());
// These two are set to their defaults and now no longer appear
//            if(setting.getName().equals("CommitBeforeAutocommit")) {
//                assertEquals("false", setting.getStringValue());
//            } else if(setting.getName().equals("ExceptionSorterClass")) {
//                assertEquals("org.tranql.connector.AllExceptionsAreFatalSorter", setting.getStringValue());
            if(setting.getName().equals("Driver")) {
                assertEquals("org.apache.derby.jdbc.EmbeddedDriver", setting.getStringValue());
            } else if(setting.getName().equals("ConnectionURL")) {
                assertEquals("jdbc:derby:TestDatabase;create=true", setting.getStringValue());
            } else fail("Unknown connection setting '"+setting.getName()+"'");
        }
        // Make sure the original objects didn't lose track of the null config settings
        assertEquals(6, instance.getConfigPropertySetting().length);
        // Now set them to blank
        nullCount = 0;
        for (int i = 0; i < 6; i++) {
            if(instance.getConfigPropertySetting()[i].getValue() == null || instance.getConfigPropertySetting()[i].isSetToDefault()) {
                instance.getConfigPropertySetting()[i].setValue("");
                ++nullCount;
            }
        }
        assertEquals(4, nullCount);
        // Now make sure we write out with 6
        pout = new ByteArrayOutputStream();
        dcbRoot.toXML(pout);
        pout.close();
        pin = new ByteArrayInputStream(pout.toByteArray());
        doc = GerConnectorDocument.Factory.parse(pin);
        pin.close();
        settings = doc.getConnector().getResourceadapterArray(0).
                getOutboundResourceadapter().getConnectionDefinitionArray(0).
                getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
        assertEquals(6, settings.length);
        seen.clear();
        for (int i = 0; i < settings.length; i++) {
View Full Code Here

        // Make sure that saving clears out the null/default values
        ByteArrayOutputStream pout = new ByteArrayOutputStream();
        dcbRoot.toXML(pout);
        pout.close();
        ByteArrayInputStream pin = new ByteArrayInputStream(pout.toByteArray());
        GerConnectorDocument doc = GerConnectorDocument.Factory.parse(pin);
        pin.close();
        GerConfigPropertySettingType[] settings = doc.getConnector().getResourceadapterArray(0).
                getResourceadapterInstance().getConfigPropertySettingArray();
        assertEquals(2, settings.length);
        seen.clear();
        for (int i = 0; i < settings.length; i++) {
            GerConfigPropertySettingType setting = settings[i];
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xbeans.connector.GerConnectorDocument

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.