Package org.teiid.query.metadata

Examples of org.teiid.query.metadata.TransformationMetadata


        };
        helpTestProcess(plan, expected, new HardcodedDataManager(), metadata);
    }
   
    @Test public void testParameterAssignments() throws Exception {
        TransformationMetadata metadata = RealMetadataFactory.exampleBQTCached();
        String userQuery = "EXEC TEIIDSP7(1)"; //$NON-NLS-1$
        HardcodedDataManager dataMgr = new HardcodedDataManager();
        ProcessorPlan plan = getProcedurePlan(userQuery, metadata);
        dataMgr.addData("x = EXEC spTest9(1)", new List[] {Arrays.asList(3)});
        dataMgr.addData("EXEC spTest11(3, null)", new List[] {Arrays.asList("1", 1, null), Arrays.asList(null, null, 4)});
View Full Code Here


        helpTestProcess(plan, expected, dataMgr, metadata);
    }
   
    @Test public void testReturnParamWithNoResultSetVirtual() throws Exception {
        String sql = "EXEC TEIIDSP8(51)";     //$NON-NLS-1$
        TransformationMetadata metadata = RealMetadataFactory.exampleBQTCached();
        ProcessorPlan plan = getProcedurePlan(sql, metadata);

        // Set up data
        FakeDataManager dataMgr = new FakeDataManager();
 
View Full Code Here

        helpTestProcess(plan, expected, dataMgr, metadata);
    }
   
    @Test(expected=QueryProcessingException.class) public void testParamsWithResultSetVirtualNotNull() throws Exception {
        String sql = "{? = call TEIIDSP9(51)}";     //$NON-NLS-1$
        TransformationMetadata metadata = RealMetadataFactory.exampleBQTCached();
        ProcessorPlan plan = getProcedurePlan(sql, metadata);

        FakeDataManager dataMgr = new FakeDataManager();
 
        helpTestProcess(plan, null, dataMgr, metadata);
View Full Code Here

        helpTestProcess(plan, null, dataMgr, metadata);
    }

    @Test public void testParamsWithResultSetVirtual() throws Exception {
        String sql = "{? = call TEIIDSP9(1)}";     //$NON-NLS-1$
        TransformationMetadata metadata = RealMetadataFactory.exampleBQTCached();
        ProcessorPlan plan = getProcedurePlan(sql, metadata);

        FakeDataManager dataMgr = new FakeDataManager();
 
        List[] expected = new List[] { Arrays.asList("hello", null, null),
View Full Code Here

      throw new TeiidRuntimeException("System VDB not found");
    }
    }
 
  public static TransformationMetadata getVDBMetadata(URL vdbURL, URL udfFile) throws IOException {
    TransformationMetadata vdbmetadata = VDB_CACHE.get(vdbURL);
    if (vdbmetadata != null) {
      return vdbmetadata;
    }

    try {
      IndexMetadataFactory imf = loadMetadata(vdbURL);
     
      Collection <FunctionMethod> methods = null;
      Collection<FunctionTree> trees = null;
      if (udfFile != null) {
        String schema = FileUtils.getFilenameWithoutExtension(udfFile.getPath());
        methods = FunctionMetadataReader.loadFunctionMethods(udfFile.openStream());
        trees = Arrays.asList(new FunctionTree(schema, new UDFSource(methods), true));
      }
      SystemFunctionManager sfm = new SystemFunctionManager();
      vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(getSystem(), imf.getMetadataStore(getSystem().getDatatypes()))), imf.getEntriesPlusVisibilities(), sfm.getSystemFunctions(), trees);
      VDB_CACHE.put(vdbURL, vdbmetadata);
      return vdbmetadata;
    } catch (URISyntaxException e) {
      throw new IOException(e);
    } catch (JAXBException e) {
View Full Code Here

      return funcs;   
  }
 
 
  private void helpResolve(String sql) throws Exception {
    TransformationMetadata metadata = createTransformationMetadata(RealMetadataFactory.exampleBQTStore(), "bqt");
    Command command = QueryParser.getQueryParser().parseCommand(sql);
    QueryResolver.resolveCommand(command, metadata);   
  }
View Full Code Here

@SuppressWarnings("nls")
public class TestMultipleModelIndexes {

  @Test public void testMultiple() throws Exception {
    TransformationMetadata tm = VDBMetadataFactory.getVDBMetadata(UnitTestUtil.getTestDataPath() + "/ZZZ.vdb");
    Collection<String> names = tm.getGroupsForPartialName("PRODUCTDATA");
    assertEquals(1, names.size());
    names = tm.getGroupsForPartialName("PARTS");
    assertEquals(1, names.size());
   
    //ensure that datatypes are set
    Table t = tm.getGroupID(names.iterator().next());
    assertNotNull(t.getColumns().get(0).getDatatype());
  }
View Full Code Here

    Table t = tm.getGroupID(names.iterator().next());
    assertNotNull(t.getColumns().get(0).getDatatype());
  }
 
  @Test public void testSchemaLoad() throws Exception {
    TransformationMetadata tm = VDBMetadataFactory.getVDBMetadata(UnitTestUtil.getTestDataPath() + "/Test.vdb");
   
    //ensure that datatypes are set
    Table t = tm.getGroupID("Northwind.Northwind.dbo.Employees");
    assertFalse(t.isVirtual());
  }
View Full Code Here

        for(int i=1; i<2; i++) {
            cols.get(i).setSearchType(SearchType.Unsearchable);
        }
       
        // Create the facade from the store
        return new TransformationMetadata(null, new CompositeMetadataStore(metadataStore), null, FakeMetadataFactory.SFM.getSystemFunctions(), null);
    }   
View Full Code Here

@SuppressWarnings("nls")
public class TestTransformationMetadata {

  @Test public void testAmbiguousProc() throws Exception {
    TransformationMetadata tm = exampleTransformationMetadata();

    try {
      tm.getStoredProcedureInfoForProcedure("y"); //$NON-NLS-1$
      fail("expected exception"); //$NON-NLS-1$
    } catch (QueryMetadataException e) {
      assertEquals("Procedure 'y' is ambiguous, use the fully qualified name instead", e.getMessage()); //$NON-NLS-1$
    }
  }
View Full Code Here

TOP

Related Classes of org.teiid.query.metadata.TransformationMetadata

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.