Package org.teiid.query.unittest

Examples of org.teiid.query.unittest.FakeMetadataStore


        FakeMetadataObject transactions = FakeMetadataFactory.createVirtualGroup("Master.Transactions", master, masterPlan); //$NON-NLS-1$
        List transactionsElem = FakeMetadataFactory.createElements(transactions,
                                            new String[] { "CustomerID", "First", "Last", "AccountID", "TransactionID", "TxnCode", "Amount" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
                                            new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.BIG_DECIMAL });
       
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(us);
        store.addObject(usAccts);
        store.addObjects(usAcctsElem);

        store.addObject(europe);
        store.addObject(euAccts);
        store.addObjects(euAcctsElem);

        store.addObject(cust);
        store.addObject(customers);
        store.addObjects(customersElem);
        store.addObject(locations);
        store.addObjects(locationsElem);
       
        store.addObject(vAccts);
        store.addObject(accounts);
        store.addObjects(accountsElem);

        store.addObject(master);
        store.addObject(transactions);
        store.addObjects(transactionsElem);

        return new FakeMetadataFacade(store);
    }
View Full Code Here


       
        FakeMetadataObject p1 = FakeMetadataFactory.createParameter("v1.vp2.in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null)//$NON-NLS-1$
        QueryNode n2 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN declare string VARIABLES.x; declare string VARIABLES.y; VARIABLES.x = '2'; VARIABLES.y = v1.vp2.in; select VARIABLES.y; end"); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject vt2 = FakeMetadataFactory.createVirtualProcedure("v1.vp2", v1, Arrays.asList(new FakeMetadataObject[] { rs1p1, p1 }), n2); //$NON-NLS-1$
               
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(v1);
        store.addObject(rs1);
        store.addObject(vt1);
        store.addObject(vt2);
        store.addObject(vt2);
       
        String sql = "select * from (exec v1.vp1()) foo"; //$NON-NLS-1$
       
        List[] expected = new List[] { 
            Arrays.asList(new Object[] { "1" }), //$NON-NLS-1$
View Full Code Here

        FakeMetadataObject in1 = FakeMetadataFactory.createParameter("pm1.sp119.in1", 2, SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
    FakeMetadataObject rs3 = FakeMetadataFactory.createResultSet("pm1.sp119.rs1", pm1, new String[] { "e1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject rs3p1 = FakeMetadataFactory.createParameter("ret", 1, SPParameter.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs3)//$NON-NLS-1$
    FakeMetadataObject sp1 = FakeMetadataFactory.createStoredProcedure("pm1.sp119", pm1, Arrays.asList(new FakeMetadataObject[] { rs3p1, in1 }))//$NON-NLS-1$ //$NON-NLS-2$

        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(pm1);
        store.addObject(v1);
        store.addObject(rs1);
        store.addObject(vt1);
        store.addObject(sp1);
       
        String sql = "select * from (exec v1.vp1(1)) foo order by e4, e5"; //$NON-NLS-1$
       
        List<?>[] expected = new List[] {
          Arrays.asList(1, 1, 3, 3, 5)
View Full Code Here

                "vm1.doc1", //$NON-NLS-1$
                vm1,
                doc);

        // Add all objects to the store
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(pm1);
        store.addObject(pm1g1);
        store.addObjects(pm1g1e);
        store.addObject(stagingTable);
        store.addObjects(stagingTableElements);
        store.addObject(doc1);

        // Create the facade from the store
        return new FakeMetadataFacade(store);
    }
View Full Code Here

        QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN insert into #temp (var1) values (1); select #temp.var1 from #temp; END"); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject rs = FakeMetadataFactory.createResultSet("rs", v1, new String[] { "var1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject paramRS = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs)//$NON-NLS-1$
        FakeMetadataObject vp = FakeMetadataFactory.createVirtualProcedure("v1.vp", v1, Arrays.asList(new Object[] {paramRS}), n1); //$NON-NLS-1$
       
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(v1);
        store.addObject(vp);
       
        ProcessorPlan plan = helpGetPlan("exec v1.vp()", new FakeMetadataFacade(store)); //$NON-NLS-1$
       
        List[] expected = new List[] {
            Arrays.asList(new Object[] { new Integer(1) })
View Full Code Here

        QueryNode n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN insert into #temp (var1) values (1); select 2 as var1 into #temp; select #temp.var1 from #temp; END"); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject rs = FakeMetadataFactory.createResultSet("rs", v1, new String[] { "var1" }, new String[] { DataTypeManager.DefaultDataTypes.INTEGER}); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject paramRS = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs)//$NON-NLS-1$
        FakeMetadataObject vp = FakeMetadataFactory.createVirtualProcedure("v1.vp", v1, Arrays.asList(new Object[] {paramRS}), n1); //$NON-NLS-1$
       
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(v1);
        store.addObject(vp);
       
        ProcessorPlan plan = helpGetPlan("exec v1.vp()", new FakeMetadataFacade(store)); //$NON-NLS-1$
       
        List[] expected = new List[] {
            Arrays.asList(new Object[] { new Integer(1) }),
View Full Code Here

                    DataTypeManager.DefaultDataTypes.STRING,
                    DataTypeManager.DefaultDataTypes.STRING,
                    DataTypeManager.DefaultDataTypes.STRING });
       
        // Add all objects to the store
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(pm1);
        store.addObject(pm1g1);
        store.addObjects(pm1g1e);
        store.addObject(pm1g2);
        store.addObjects(pm1g2e);
        store.addObject(pm1g3);
        store.addObjects(pm1g3e);
        store.addObject(pm1g4);
        store.addObjects(pm1g4e);
        store.addObject(pm1g5);
        store.addObjects(pm1g5e);

        store.addObject(vm1);
        store.addObject(vm1g1);
        store.addObjects(vm1g1e);
        store.addObject(vm1g2);
        store.addObjects(vm1g2e);
        store.addObject(vm1g3);
        store.addObjects(vm1g3e);
        store.addObject(vm1g4);
        store.addObjects(vm1g4e);
        store.addObject(vm1g5);
        store.addObjects(vm1g5e);
        store.addObject(tm1g1);
        store.addObjects(tm1g1e);
        store.addObject(doc1);
        store.addObject(doc2);
        store.addObject(doc3);
        store.addObject(doc4);
        store.addObject(doc5);
        store.addObject(doc6);
        store.addObject(docWithExcluded);
        store.addObject(doc2WithExcluded);
        store.addObject(docWithAttribute);
        store.addObject(docWithAttribute2);
        store.addObject(docWithAttribute3);
        store.addObjects(docE1);
        store.addObjects(docE2);
        store.addObjects(docE3);
        store.addObjects(docE4);
        store.addObjects(docE5);
        store.addObjects(docE6);
        store.addObjects(docWithExcludedElements);
        store.addObjects(doc2WithExcludedElements);
        store.addObjects(docWithAttributeElements);
        store.addObjects(docWithAttributeElements2);
        store.addObjects(docWithAttributeElements3);

        // Create the facade from the store
        return new FakeMetadataFacade(store);
    }
View Full Code Here

        QueryNode n3 = new QueryNode("SELECT c, b FROM v1.t1 UNION ALL SELECT c, b FROM v1.t1"); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject vu1 = FakeMetadataFactory.createVirtualGroup("v1.u1", v1, n3); //$NON-NLS-1$
        List vtu1 = FakeMetadataFactory.createElements(vu1, new String[] {"c", "b" }, new String[] { "integer", "string" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
       
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(p1);
        store.addObject(t1);
        store.addObjects(e1);
        store.addObject(v1);
        store.addObject(vt1);
        store.addObjects(vte1);
        store.addObject(vu1);
        store.addObjects(vtu1);
        return new FakeMetadataFacade(store);
    }
View Full Code Here

        List pm2g1e = FakeMetadataFactory.createElements(pm2g1,
            new String[] { "myColumn", "myColumn2" }, //$NON-NLS-1$ //$NON-NLS-2$
            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER });
       
        // Add all objects to the store
        FakeMetadataStore store = new FakeMetadataStore();
        store.addObject(pm1);
        store.addObject(pm1g1);    
        store.addObjects(pm1g1e);
        store.addObject(pm2g1);    
        store.addObjects(pm2g1e);
       
        return new FakeMetadataFacade(store);
    }
View Full Code Here

    }
   
    @Test public void testExecWithDuplicateNames() {
        FakeMetadataFacade metadata = FakeMetadataFactory.example1();
       
        FakeMetadataStore store = metadata.getStore();
       
        FakeMetadataObject pm1 = store.findObject("pm1", FakeMetadataObject.MODEL); //$NON-NLS-1$
       
        FakeMetadataObject rs2 = FakeMetadataFactory.createResultSet("pm1.rs2", pm1, new String[] { "in", "e2" }, new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.INTEGER }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        FakeMetadataObject rs2p1 = FakeMetadataFactory.createParameter("ret", 1, ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2)//$NON-NLS-1$
        FakeMetadataObject rs2p2 = FakeMetadataFactory.createParameter("in", 2, ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null)//$NON-NLS-1$
        QueryNode sq2n1 = new QueryNode("CREATE VIRTUAL PROCEDURE BEGIN SELECT e1, e2 FROM pm1.g1 WHERE e1=pm1.sq2.in; END"); //$NON-NLS-1$ //$NON-NLS-2$
        FakeMetadataObject sq2 = FakeMetadataFactory.createVirtualProcedure("pm1.sq2", pm1, Arrays.asList(new FakeMetadataObject[] { rs2p1, rs2p2 }), sq2n1)//$NON-NLS-1$

        store.addObject(rs2);
        store.addObject(sq2);
       
        helpResolveException("select * from pm1.sq2", metadata, "Cannot access procedure pm1.sq2 using table semantics since the parameter and result set column names are not all unique."); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

TOP

Related Classes of org.teiid.query.unittest.FakeMetadataStore

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.