Examples of DAS


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

    }

    public CustomerProfileData testgetCustomerByLoginIDThroughDASRead(final String logonID) throws Exception {
        InputStream mapping = createConfigStream();
        Connection conn = createConnection();
        DAS das = DAS.FACTORY.createDAS(mapping, conn);
        Command select = das.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = ?");

        select.setParameter(1, logonID);

        DataObject root = select.executeQuery();
        conn.close();
View Full Code Here

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

    protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver";

    protected static final String protocol = "jdbc:derby:";

    public void logDeposit(int id, String account, float amount) throws RemoteException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, account);
        insert.setParameter(3, ACCT_ACTION_TYPE_DEPOSIT);
        insert.setParameter(4, new Float(amount));
View Full Code Here

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

         * ACCT_ACTION_TYPE_DEPOSIT + "', " + amount + ")");
         */
    }

    public void logWithdrawal(int id, String account, float amount) throws RemoteException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into acctLog (id, accountNumber, actionType, amount) values (?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, account);
        insert.setParameter(3, ACCT_ACTION_TYPE_WITHDRAW);
        insert.setParameter(4, new Float(amount));

View Full Code Here

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

         * ACCT_ACTION_TYPE_WITHDRAW + "', " + amount + ")");
         */
    }

    public void logPurchaseStock(int id, StockSummary stock) throws RemoteException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, stock.getSymbol());
        insert.setParameter(3, new Integer(stock.getQuantity()));
        insert.setParameter(4, STOCK_ACTION_TYPE_PURCHASE);
        insert.setParameter(5, new Integer(stock.getPurchaseLotNumber()));
View Full Code Here

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

    }

    public void logSellStock(int id, StockSummary stock, int quantity) throws RemoteException {

        String symbol = ((stock.getSymbol() != null) ? stock.getSymbol() : "null");
        DAS das = DAS.FACTORY.createDAS(getConnection());
        Command insert = das.createCommand("insert into stockLog (id, Symbol, quantity, actionType, purchaseLotNumber) values (?,?,?,?,?)");
        insert.setParameter(1, new Integer(id));
        insert.setParameter(2, symbol);
        insert.setParameter(3, new Integer(quantity));
        insert.setParameter(4, STOCK_ACTION_TYPE_SELL);
        insert.setParameter(5, new Integer(stock.getPurchaseLotNumber()));
View Full Code Here

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

            final AccountFactory accountFactory = AccountFactory.INSTANCE;
            final AccountLog accountLog = accountFactory.createAccountLog();
            InputStream mapping = createConfigStream();

            Connection conn = getConnection();
            DAS das = DAS.FACTORY.createDAS(mapping, conn);
            Command select = das.createCommand("SELECT logSeqNo, accountNumber, actionType, amount FROM acctLog where id = ?");

            select.setParameter(1, customerID);

            DataObject root = select.executeQuery();
            accountLog.getAccountLogEntries().addAll(root.getList("AccountLogEntry"));

            select = das.createCommand("SELECT logSeqNo, Symbol, quantity, actionType, purchaseLotNumber  FROM stockLog where id = ?");
            select.setParameter(1, customerID);
            root = select.executeQuery();
            accountLog.getStockLogEntries().addAll(root.getList("StockLogEntry"));

            conn.close();
View Full Code Here

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

        super.setUp();
        new CustomerData(getAutoConnection()).refresh();
    }

    public void testPaging() throws SQLException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        // Build command to read all customers
        Command custCommand = das.createCommand("select * from CUSTOMER order by ID");

        // Create a pager with the command
        Pager pager = new PagerImpl(custCommand, 2);

        // Get and work with first page
View Full Code Here

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

        assertEquals(2, customer2.getInt("ID"));

    }

    public void testRandomPage() throws SQLException {
        DAS das = DAS.FACTORY.createDAS(getConnection());
        // Build the select command
        Command select = das.createCommand("select * from CUSTOMER order by ID");

        // Create a pager
        Pager pager = new PagerImpl(select, 2);

        // Get the first page
View Full Code Here

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

    }

    public void testSimple() throws Exception {

        DAS das = DAS.FACTORY.createDAS(getConnection());

        // Build the select command
        Command selectCommand = das.createCommand("select * from DOG");

        // Get the graph
        DataObject root = selectCommand.executeQuery();

        assertEquals(3, root.getList("DOG").size());
View Full Code Here

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

    }
   
    public void testSimple2() throws Exception {

        DAS das = DAS.FACTORY.createDAS(getConnection());

        // Build the select command
        Command selectCommand = das.createCommand("select * from OWNER");

        // Get the graph
        DataObject root = selectCommand.executeQuery();

        assertEquals(3, root.getList("OWNER").size());
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.