Package org.teiid.query.processor

Examples of org.teiid.query.processor.FakeDataManager


        }
       
        return dataMgr;
    }  
    private FakeDataManager exampleDataManagerNormalization2(FakeMetadataFacade metadata) {
        FakeDataManager dataMgr = new FakeDataManager();
   
        try {
            // Group stock.items
            FakeMetadataObject groupID = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$
            List elementIDs = metadata.getElementIDsInGroupID(groupID);
            List elementSymbols = createElements(elementIDs);

            dataMgr.registerTuples(
                groupID,
                elementSymbols,
               
                new List[] {
                    Arrays.asList( new Object[] { "001", null, new Integer(5), "okay" } ),         //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here


        notIncludedSibling2.setExclude(true);
        return doc;       
    }

    static FakeDataManager exampleDataManagerCase3225(FakeMetadataFacade metadata) {
        FakeDataManager dataMgr = new FakeDataManager();
   
        try {
            // Group stock.items
            FakeMetadataObject groupItems = (FakeMetadataObject) metadata.getGroupID("stock.items"); //$NON-NLS-1$

            // Group stock.supplier
            FakeMetadataObject groupSuppliers = (FakeMetadataObject) metadata.getGroupID("stock.suppliers"); //$NON-NLS-1$

            // Group stock.orders
            FakeMetadataObject groupOrders = (FakeMetadataObject) metadata.getGroupID("stock.orders"); //$NON-NLS-1$

            // Group stock.employees
            FakeMetadataObject groupEmployees = (FakeMetadataObject) metadata.getGroupID("stock.employees"); //$NON-NLS-1$
           
            // Group stock.item_supplier
            FakeMetadataObject groupItemSupplier = (FakeMetadataObject) metadata.getGroupID("stock.item_supplier"); //$NON-NLS-1$

            // Items
            List elementIDs = metadata.getElementIDsInGroupID(groupItems);
            List elementSymbols = createElements(elementIDs);

            // Supplier
            elementIDs = metadata.getElementIDsInGroupID(groupSuppliers);
            List supplierElementSymbols = createElements(elementIDs);

            // Orders
            elementIDs = metadata.getElementIDsInGroupID(groupOrders);
            List ordersElementSymbols = createElements(elementIDs);

            // Employees
            elementIDs = metadata.getElementIDsInGroupID(groupEmployees);
            List employeesElementSymbols = createElements(elementIDs);
           
            // Item_supplier
            elementIDs = metadata.getElementIDsInGroupID(groupItemSupplier);
            List itemSupplierElementSymbols = createElements(elementIDs);
       
            dataMgr.registerTuples(
                groupItems,
                elementSymbols,
               
                new List[] {
                    Arrays.asList( new Object[] { "001", "Lamp", new Integer(5), "okay" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100), "okay" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Arrays.asList( new Object[] { "003", "Goat", new Integer(4), "okay" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    } );   

            dataMgr.registerTuples(
                groupItemSupplier,
                itemSupplierElementSymbols,
               
                new List[] {
                    Arrays.asList( new Object[] { "001", "51" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "001", "52" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "001", "53" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "001", "56" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "002", "54" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "002", "55" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "002", "56" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "003", "56" } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    } );   


            dataMgr.registerTuples(
                groupSuppliers,
                supplierElementSymbols,
               
                new List[] {
                    Arrays.asList( new Object[] { "51", "Chucky", "11111" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Arrays.asList( new Object[] { "52", "Biff's Stuff", "22222" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Arrays.asList( new Object[] { "53", "AAAA", "33333" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Arrays.asList( new Object[] { "54", "Nugent Co.", "44444" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Arrays.asList( new Object[] { "55", "Zeta", "55555" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Arrays.asList( new Object[] { "56", "Microsoft", "66666" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    } );   

            dataMgr.registerTuples(
                groupOrders,
                ordersElementSymbols,
               
                new List[] {
                    Arrays.asList( new Object[] { "1", "001", "51", "2/13/05", new Integer(2), "complete" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                    Arrays.asList( new Object[] { "2", "001", "52", "3/13/05", new Integer(1), "processing" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                    Arrays.asList( new Object[] { "3", "002", "53", "4/13/05", new Integer(1), "complete" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                    Arrays.asList( new Object[] { "4", "002", "56", "5/13/05", new Integer(1), "cancelled" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                    Arrays.asList( new Object[] { "5", "003", "56", "6/13/05", new Integer(800), "processing" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                    } );   

            dataMgr.registerTuples(
                groupEmployees,
                employeesElementSymbols,
              
                new List[] {
                    Arrays.asList( new Object[] { "1001", "51", "001", "1004", "Albert", "Pujols" } ),         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
View Full Code Here

     * Test of doc model w/o criteria, just as a baseline
     * @throws Exception
     */
    @Test public void testCase3225() throws Exception {
        FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
        String expectedDoc =
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" //$NON-NLS-1$
        "<Catalogs>\r\n" + //$NON-NLS-1$
        "    <Catalog>\r\n" + //$NON-NLS-1$
        "        <Items>\r\n" + //$NON-NLS-1$
View Full Code Here

     * the combined criteria should limit returned items to item 001.
     * @throws Exception
     */
    @Test public void testCase3225WithCriteria() throws Exception {
        FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
        helpTestProcess("select * from xmltest.itemsdoc where employee.@supervisorID='1004' and order.orderquantity > 1", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr);         //$NON-NLS-1$
    }   
View Full Code Here

     * the combined criteria should limit returned items to item 001.
     * @throws Exception
     */
    @Test public void testCase3225WithCriteriaReversed() throws Exception {
        FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
        helpTestProcess("select * from xmltest.itemsdoc where order.orderquantity > 1 and employee.@supervisorID='1004'", CASE_3225_WITH_CRITERIA_EXPECTED_DOC, metadata, dataMgr);         //$NON-NLS-1$
    }     
View Full Code Here

     * to make sure all of the criteria is processed correctly.
     * @throws Exception
     */
    @Test public void testCase3225WithEmptyDocCriteria() throws Exception {
        FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
        String expectedDoc =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" //$NON-NLS-1$
            "<Catalogs>\r\n" + //$NON-NLS-1$
            "    <Catalog>\r\n" + //$NON-NLS-1$
            "        <Items/>\r\n" + //$NON-NLS-1$
View Full Code Here

     * @since 4.3
     */
    @Test public void testBaseballPlayersDoc() throws Exception {
       
        FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
        String expectedDoc =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" //$NON-NLS-1$
            "<BaseballPlayers>\r\n" + //$NON-NLS-1$
            "   <Player PlayerID=\"1001\">\r\n" + //$NON-NLS-1$
            "      <FirstName>Albert</FirstName>\r\n" + //$NON-NLS-1$
View Full Code Here

     * @since 4.3
     */
    @Test public void testBaseballPlayersDocCriteria() throws Exception {
       
        FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
        String expectedDoc =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" //$NON-NLS-1$
            "<BaseballPlayers>\r\n" + //$NON-NLS-1$
            "   <Player PlayerID=\"1001\">\r\n" + //$NON-NLS-1$
            "      <FirstName>Albert</FirstName>\r\n" + //$NON-NLS-1$
View Full Code Here

     * @since 4.3
     */
    @Test public void testBaseballPlayersDocContextCriteria() throws Exception {
       
        FakeMetadataFacade metadata = FakeMetadataFactory.exampleCase3225();
        FakeDataManager dataMgr = exampleDataManagerCase3225(metadata);
        String expectedDoc =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" //$NON-NLS-1$
            "<BaseballPlayers>\r\n" + //$NON-NLS-1$
            "   <Player PlayerID=\"1001\">\r\n" + //$NON-NLS-1$
            "      <FirstName>Albert</FirstName>\r\n" + //$NON-NLS-1$
View Full Code Here

    /**
     * Ensures that temp tables are still visible when processing criteria
     */
    @Test public void testProcedureAndXML() throws Exception {
        FakeMetadataFacade metadata = exampleMetadataCached();
        FakeDataManager dataMgr = exampleDataManager(metadata);
        String expectedDoc =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" //$NON-NLS-1$
            "<Catalogs xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" + //$NON-NLS-1$
            "    <Catalog>\r\n" //$NON-NLS-1$
            "        <Items>\r\n" //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.teiid.query.processor.FakeDataManager

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.