Package org.apache.tuscany.das.rdb

Examples of org.apache.tuscany.das.rdb.DAS.applyChanges()


        DataObject newBook = root.createDataObject("Book");       
        newBook.setString("bookName", "Ant Colonies of the Old World");
        newBook.setInt("BOOK_ID", 1001);
        root.getList("Book").add(newBook);

        das.applyChanges(root);

        //Verify
        select.setParameter(1, new Integer(1001));
        root = select.executeQuery();
        assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/bookName"));
View Full Code Here


        root = custOrders.executeQuery();

        // Modify the first order and flush this change back to the database
        root.setString("CUSTOMER[1]/orders[1]/PRODUCT", "Defibrillator");
        Integer orderId = (Integer) root.get("CUSTOMER[1]/orders[1]/ID");
        das.applyChanges(root);

        // Verify
        Command orderByID = das.getCommand("order by id");
        orderByID.setParameter(1, orderId);
        assertEquals("Defibrillator", root.getString("ANORDER[1]/PRODUCT"));
View Full Code Here

        DataObject custB = root.createDataObject("CUSTOMER");
        custB.set("ID", new Integer(100));
        custB.set("ADDRESS", "5528 Wells Fargo Drive");
        custB.set("LASTNAME", "Gerkin");
        try {
            das.applyChanges(root);
            fail("An exception was expected");
        } catch (Exception e) {
            //do nothing
        }
View Full Code Here

        assertEquals(kbday, root.getDate("CUSTOMER[1]/LASTNAME"));

        // Modify
        root.setDate("CUSTOMER[1]/LASTNAME", tbday);

        das.applyChanges(root);

        // Read
        root = read.executeQuery();

        // Verify
View Full Code Here

        customer.setAddress("an address");

        customer.getOrders().add(order);

        try {
            das.applyChanges(root);
        } catch (Exception ex) {
            assertEquals("java.lang.ClassNotFoundException: not.a.valid.class", ex.getMessage());
        }

    }
View Full Code Here

        DataObject root = read.executeQuery();
       
        //Modify
        root.setString("CUSTOMER[1]/LASTNAME", "Some new name");
      
        das.applyChanges(root);

        // Read
        root = read.executeQuery();

        // Verify that I can read back the deobfuscated value
View Full Code Here

        // Modify customer
        customer.set("LASTNAME", "Pavick");

        // Flush changes
        try {
            das.applyChanges(root);
            fail("Should fail with invalid SQL.  Provided CUD not used!!");
        } catch (RuntimeException e) {
            // Everything OK
        }
View Full Code Here

        DataObject customer = root.createDataObject("CUSTOMER");
        customer.setInt("ID", 720);
        customer.set("LASTNAME", "foobar");
        customer.set("ADDRESS", "asdfasdf");

        das.applyChanges(root);

        select = das.createCommand("select * from CUSTOMER where ID = 720");
        root = select.executeQuery();

        assertEquals(1, root.getList("CUSTOMER").size());
View Full Code Here

        // Modify an order
        DataObject order = (DataObject) customer.get("orders[1]");
        order.setString("PRODUCT", "Kitchen Sink 001");

        das.applyChanges(root);

    }

}
View Full Code Here

        // Modify
        orderDetails.setFloat("PRICE", 0f);

        // Build apply changes command

        das.applyChanges(root);

        // Verify
        root = getOrderDetails.executeQuery();
        orderDetails = root.getDataObject("ORDERDETAILS[1]");
        assertEquals(0f, orderDetails.getFloat("PRICE"), 0.01);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.