Package org.apache.tuscany.das.rdb

Examples of org.apache.tuscany.das.rdb.DAS


    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testMultipleResultSets() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command read = das.createCommand("{call GETALLCUSTOMERSANDORDERS()}");

        DataObject root = read.executeQuery();

        // Verify
        assertEquals(5, root.getList("CUSTOMER").size());
View Full Code Here


        assertEquals(4, root.getList("ANORDER").size());
    }

    // Call a simple stored proc to read all companies
    public void testGetCompanies() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command read = das.createCommand("{call GETALLCOMPANIES()}");

        DataObject root = read.executeQuery();

        // Verify
        assertEquals(3, root.getList("COMPANY").size());
View Full Code Here

        assertTrue(root.getInt("COMPANY[1]/ID") > 0);

    }

    public void testGetNamedCompany() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command read = das.createCommand("{call GETNAMEDCOMPANY(?)}");

        read.setParameter(1, "MegaCorp");
        DataObject root = read.executeQuery();

        assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME"));
View Full Code Here

        assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME"));

    }

    public void testGetNamedCompanyByName() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command read = das.createCommand("{call GETNAMEDCOMPANY(?)}");

        read.setParameter(1, "MegaCorp");
        DataObject root = read.executeQuery();

        assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME"));
View Full Code Here

        assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME"));
    }

    // Retreive heirarchy using a stored proc ... new programming model
    public void testGetCustomersAndOrder() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("CustomersOrdersConfig.xml"), getConnection());
        Command read = das.createCommand("{call getCustomerAndOrders(?)}");
        read.setParameter(1, Integer.valueOf(1));

        DataObject root = read.executeQuery();

        DataObject customer = (DataObject) root.getList("CUSTOMER").get(0);
View Full Code Here

     * graph of customers with that last name. The number of read
     * customers is returned in
     * the out parameter
     */
    public void testGetNamedCustomers() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("storedProcTest.xml"), getConnection());
        Command read = das.getCommand("getNamedCustomers");
        read.setParameter(1, "Williams");
        DataObject root = read.executeQuery();

        Integer customersRead = (Integer) read.getParameter(2);

View Full Code Here

    // TODO - Resolve issue with programmatic creation of GETNAMEDCUSTOMERS on DB2 and
    // re-enable this test

    // Simplest possible SP write
    public void testDelete() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command delete = das.createCommand("{call DELETECUSTOMER(?)}");
        delete.setParameter(1, Integer.valueOf(1));
        delete.execute();

        // Verify DELETE
        Command select = das.createCommand("Select * from CUSTOMER where ID = 1");
        DataObject root = select.executeQuery();
        assertTrue(root.getList("CUSTOMER").isEmpty());

    }
View Full Code Here

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testMissingConnection() throws Exception {
        DAS das = DAS.FACTORY.createDAS((Connection) null);

        try {
            Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");
            readCustomers.executeQuery();
            fail("RuntimeException should be thrown");
        } catch (RuntimeException ex) {
            assertEquals("No connection has been provided and no data source has been specified", ex.getMessage());
        }
View Full Code Here

        }

    }

    public void testUnregisteredTypes() throws Exception {
        DAS das = DAS.FACTORY.createDAS(getConfig("staticInvalid.xml"), getConnection());
        Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");

        try {
            readCustomers.executeQuery();

            fail("Exception should be thrown");
View Full Code Here

        }
    }

    public void testMissingMapping() throws Exception {
        SDOUtil.registerStaticTypes(CustomerFactory.class);
        DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomer.xml"), getConnection());
        Command readCustomers = das.createCommand("select * from CUSTOMER where ID = 1");

        try {
            readCustomers.executeQuery();

            fail("Exception should be thrown");
View Full Code Here

TOP

Related Classes of org.apache.tuscany.das.rdb.DAS

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.