Package org.apache.tuscany.das.rdb

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


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

        //Build apply changes command
        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
        apply.setConnection( getConnection() );

        //Manually create and add update command
        Command update = Command.FACTORY.createCommand( "update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID" );
        update.addParameter( "LASTNAME", SDODataTypes.STRING );
        update.addParameter( "ID", SDODataTypes.INTEGER );
        apply.addUpdateCommand( customer.getType(), update );

        //Flush changes
        apply.execute( root );

        //Verify changes
        root = select.executeQuery();
        assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
View Full Code Here


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

        //Build apply changes command
        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMappingWithCUD.xml"));
        apply.setConnection( getConnection() );

        //Flush changes
        apply.execute( root );

        //Verify changes
        root = select.executeQuery();
        assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) );
View Full Code Here

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

        //Build apply changes command
        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
        apply.setConnection( getConnection() );

        //Flush changes
        apply.execute( root );

        //Verify the change
        root = select.executeQuery();
        assertEquals( "Pavick", root.getDataObject( "CUSTOMER[1]" ).getString( "LASTNAME" ) );
View Full Code Here

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

        //Build apply changes command
        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMapping.xml"));
        apply.setConnection( getConnection() );

        //Flush changes
        apply.execute( root );

        //Verify the change
        root = select.executeQuery();
        assertEquals( "Pavick", root.getDataObject( "CUSTOMER[1]" ).getString( "LASTNAME" ) );
View Full Code Here

        cust4.set( "ID", new Integer( 100 ) );
        cust4.set( "ADDRESS", "5528 Wells Fargo Drive" );
        cust4.set( "LASTNAME", "Gerkin" );

        //Build apply changes command
        ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMapping.xml"));
        apply.setConnection( getConnection() );

        //Flush changes
        apply.execute( root );

        //Verify deletes
        select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = :ID" );
        select.setConnection( getConnection() );
        select.setParameterValue( "ID", new Integer( cust2ID ) );
View Full Code Here

    DataObject newCustomer = root.createDataObject("CUSTOMER");
    newCustomer.set("LASTNAME", "NewCustomer");
    newCustomer.setInt("ID", 9000);
   
    //Build apply changes command
    ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
    apply.setConnection(getConnection());   

    //Flush changes
    apply.execute(root);

    //Verify the change
    root = select.executeQuery();
    assertEquals("Pavick", getCustomerByLastName(root, "Pavick").getString("LASTNAME"));
    assertEquals("NewCustomer", getCustomerByLastName(root, "NewCustomer").getString("LASTNAME"));
View Full Code Here

    //Modify customer
    od.setInt("PRODUCTID", 72)
   
    //Build apply changes command
    ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
    apply.setConnection(getConnection());   

    //Flush changes -- This should fail because Order Details does not have a column that
    // we can assume to be an ID
    try {
      apply.execute(root)
    } catch (RuntimeException ex) {
      assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config"));
    }

  }
View Full Code Here

    DataObject od = root.getDataObject("ORDERDETAILS[1]");
    od.delete()
   
    //Build apply changes command
    ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
    apply.setConnection(getConnection());   

    //Flush changes -- This should fail because Order Details does not have a column that
    // we can assume to be an ID
    try {
      apply.execute(root)
    } catch (RuntimeException ex) {
      assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config"));
    }

  }
View Full Code Here

    //Modify customer
    od.setInt("PRODUCTID", 72)
    od.setInt("ORDERID", 500);
   
    //Build apply changes command
    ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand();
    apply.setConnection(getConnection());   

    //Flush changes -- This should fail because Order Details does not have a column that
    // we can assume to be an ID
    try {
      apply.execute(root)
    } catch (RuntimeException ex) {
      assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config"));
    }

  }
View Full Code Here

    georgia.setString("NAME", "GA");

    georgia.getList("cities").add(atlanta);

    // Create apply command
    ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("cityStates.xml"));
    apply.setConnection(getConnection());

    // Flush changes
    apply.execute(root);

    select.setConnection(getConnection());
    root = select.executeQuery();
    assertEquals(numberOfCities + 1, root.getList("CITIES").size());
    assertEquals(numberOfStates + 1, root.getList("STATES").size());
View Full Code Here

TOP

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

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.