Package org.apache.tuscany.das.rdb.merge.impl

Examples of org.apache.tuscany.das.rdb.merge.impl.GraphMerger


    select.setParameterValue("ID", "5");
    DataObject graph2 = select.executeQuery();
    assertEquals(5, graph2.getList("CUSTOMER").size());

    GraphMerger merger = new GraphMerger();
    merger.addPrimaryKey("CUSTOMER.ID");
    DataObject mergedGraph = merger.merge(graph1, graph2);

    assertEquals(5, mergedGraph.getList("CUSTOMER").size());
  }
View Full Code Here


    select.setParameterValue("ID", "5");
    DataObject graph3 = select.executeQuery();
    assertEquals(5, graph3.getList("CUSTOMER").size());

    GraphMerger merger = new GraphMerger();
    merger.addPrimaryKey("CUSTOMER.ID");
    ArrayList graphs = new ArrayList();
    graphs.add(graph1);
    graphs.add(graph2);
    graphs.add(graph3);
    DataObject mergedGraph = merger.merge(graphs);

    assertEquals(5, mergedGraph.getList("CUSTOMER").size());

  }
View Full Code Here

        DataObject customer2 = (DataObject)graph2.getList("CUSTOMER").get(0);
        assertEquals(1, graph2.getList("CUSTOMER").size());
        assertEquals(1, customer2.getList("orders").size());
        assertEquals(2, customer2.getInt("ID"));
       
        GraphMerger merger = new GraphMerger();
        merger.addPrimaryKey("CUSTOMER.ID");
        merger.addPrimaryKey("ANORDER.ID");
        DataObject mergedGraph = merger.merge(graph1, graph2);
       
        assertEquals(3, mergedGraph.getList("ANORDER").size());
        assertEquals(2, mergedGraph.getList("CUSTOMER").size());
       
        DataObject mergedCustomer = (DataObject) mergedGraph.getList("CUSTOMER").get(1);
View Full Code Here

        Command select2 = Command.FACTORY.createCommand("select * from ANORDER");
        select2.setConnection(getConnection());
        DataObject graph2 = select2.executeQuery();
        assertEquals(4, graph2.getList("ANORDER").size());
       
        GraphMerger merger = new GraphMerger();
        merger.addPrimaryKey("CUSTOMER.ID");
        merger.addPrimaryKey("ANORDER.ID");
        DataObject mergedGraph = merger.merge(graph1, graph2);
        assertEquals(4, mergedGraph.getList("ANORDER").size());
        assertEquals(1, mergedGraph.getList("CUSTOMER").size());
    }
View Full Code Here

        DataObject customer2 = (DataObject) graph2.getList("CUSTOMER").get(0);
        assertEquals(1, graph2.getList("CUSTOMER").size());
        assertEquals(1, customer2.getList("orders").size());
        assertEquals(2, customer2.getInt("ID"));

        GraphMerger merger = new GraphMerger();
        merger.addPrimaryKey("CUSTOMER.ID");
        merger.addPrimaryKey("ANORDER.ID");
        DataObject mergedGraph = merger.merge(graph1, graph2);

        assertEquals(3, mergedGraph.getList("ANORDER").size());
        assertEquals(2, mergedGraph.getList("CUSTOMER").size());

        DataObject mergedCustomer = (DataObject) mergedGraph.getList("CUSTOMER").get(1);
View Full Code Here

        DAS das2 = DAS.FACTORY.createDAS(getConnection());
        Command select2 = das2.createCommand("select * from ANORDER");
        DataObject graph2 = select2.executeQuery();
        assertEquals(4, graph2.getList("ANORDER").size());

        GraphMerger merger = new GraphMerger();
        merger.addPrimaryKey("CUSTOMER.ID");
        merger.addPrimaryKey("ANORDER.ID");
        DataObject mergedGraph = merger.merge(graph1, graph2);
        assertEquals(4, mergedGraph.getList("ANORDER").size());
        assertEquals(1, mergedGraph.getList("CUSTOMER").size());
    }
View Full Code Here

    public void testCreateEmptyGraph() throws Exception {
        String typeUri = "http:///org.apache.tuscany.das.rdb.test/customer.xsd";
        SDOUtil.registerStaticTypes(CustomerFactory.class);
        ConfigHelper helper = new ConfigHelper();
        helper.setDataObjectModel(typeUri);
        DataObject graph = new GraphMerger().emptyGraph(helper.getConfig());
        assertEquals(0, graph.getList("Customer").size());
        assertEquals(0, graph.getList("AnOrder").size());

    }
View Full Code Here

        ConfigHelper helper = new ConfigHelper();
        helper.setDataObjectModel(typeUri);
        helper.addTable("CUSTOMER", "Customer");
        helper.addPrimaryKey("CUSTOMER.ID");

        DataObject graph = new GraphMerger().emptyGraph(helper.getConfig());
        Customer c = (Customer) graph.createDataObject("Customer");
        c.setID(4000);
        c.setLastName("Smith");
        c.setAddress("400 Fourth Street");
View Full Code Here

        select.setParameter(1, "5");
        DataObject graph2 = select.executeQuery();
        assertEquals(5, graph2.getList("CUSTOMER").size());

        GraphMerger merger = new GraphMerger();
        merger.addPrimaryKey("CUSTOMER.ID");
        DataObject mergedGraph = merger.merge(graph1, graph2);

        assertEquals(5, mergedGraph.getList("CUSTOMER").size());
    }
View Full Code Here

        select.setParameter(1, "5");
        DataObject graph3 = select.executeQuery();
        assertEquals(5, graph3.getList("CUSTOMER").size());

        GraphMerger merger = new GraphMerger();
        merger.addPrimaryKey("CUSTOMER.ID");
        List graphs = new ArrayList();
        graphs.add(graph1);
        graphs.add(graph2);
        graphs.add(graph3);
        DataObject mergedGraph = merger.merge(graphs);

        assertEquals(5, mergedGraph.getList("CUSTOMER").size());

    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.das.rdb.merge.impl.GraphMerger

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.