Search in sources :

Example 1 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestMetaDataProcessor method examplePrivatePhysicalModelVDB.

public static VDBMetaData examplePrivatePhysicalModelVDB() {
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("example1");
    vdb.setVersion(1);
    ModelMetaData m = RealMetadataFactory.createModel("pm1", true);
    m.setVisible(false);
    vdb.addModel(m);
    vdb.addModel(RealMetadataFactory.createModel("vm1", false));
    return vdb;
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Example 2 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestMultiSourcePlanToProcessConverter method testGroupByCountPushdownMultiSource.

@Test
public void testGroupByCountPushdownMultiSource() throws Exception {
    String userSql = "SELECT s.e1, m.e1, COUNT(*) FROM pm1.g1 AS s INNER JOIN pm2.g2 AS m ON s.e2 = m.e2 GROUP BY s.e1, m.e1";
    HardcodedDataManager hdm = new HardcodedDataManager();
    hdm.addData("SELECT g_0.e2, COUNT(*) FROM pm1.g1 AS g_0 GROUP BY g_0.e2", Arrays.asList(1, 2));
    hdm.addData("SELECT g_0.e2 AS c_0, g_0.e1 AS c_1 FROM pm2.g2 AS g_0 ORDER BY c_0", Arrays.asList(1, "other"));
    BasicSourceCapabilities bsc = TestAggregatePushdown.getAggregateCapabilities();
    bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, false);
    bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, false);
    TransformationMetadata metadata = RealMetadataFactory.example1Cached();
    final List<?>[] expected = new List<?>[] { Arrays.asList("a", "other", 2), Arrays.asList("b", "other", 2) };
    VDBMetaData vdb = new VDBMetaData();
    vdb.setName("exampleMultiBinding");
    vdb.setVersion(1);
    ModelMetaData model = new ModelMetaData();
    model.setName("pm1");
    model.setModelType(Model.Type.PHYSICAL);
    model.setVisible(true);
    model.setSupportsMultiSourceBindings(true);
    model.addProperty(MultiSourceMetadataWrapper.MULTISOURCE_COLUMN_NAME, "e1");
    vdb.addModel(model);
    helpTestMultiSourcePlan(metadata, userSql, "pm1", 2, hdm, expected, vdb, null, new Options().implicitMultiSourceJoin(false), bsc);
}
Also used : Options(org.teiid.query.util.Options) TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) HardcodedDataManager(org.teiid.query.processor.HardcodedDataManager) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) List(java.util.List) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData) Test(org.junit.Test)

Example 3 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestConnectorCapabilitiesFinder method testFindRequiresSource.

@Test
public void testFindRequiresSource() throws Exception {
    // $NON-NLS-1$
    String modelName = "model";
    // $NON-NLS-1$
    String functionName = "fakeFunction";
    ArrayList<String> bindings = new ArrayList<String>();
    bindings.add(modelName);
    VDBMetaData vdb = Mockito.mock(VDBMetaData.class);
    ModelMetaData model = Mockito.mock(ModelMetaData.class);
    Mockito.stub(vdb.getModel(modelName)).toReturn(model);
    Mockito.stub(model.getSourceNames()).toReturn(bindings);
    BasicSourceCapabilities basicSourceCapabilities = new BasicSourceCapabilities();
    basicSourceCapabilities.setFunctionSupport(functionName, true);
    ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);
    ConnectorManager cm = Mockito.mock(ConnectorManager.class);
    Mockito.stub(cm.getCapabilities()).toThrow(new TranslatorException());
    Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(cm);
    CachedFinder finder = new CachedFinder(repo, vdb);
    // Test
    SourceCapabilities actual = finder.findCapabilities(modelName);
    // $NON-NLS-1$
    assertNotNull(actual);
    assertFalse(finder.isValid(modelName));
}
Also used : BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) ConnectorManagerRepository(org.teiid.dqp.internal.datamgr.ConnectorManagerRepository) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ArrayList(java.util.ArrayList) TranslatorException(org.teiid.translator.TranslatorException) ConnectorManager(org.teiid.dqp.internal.datamgr.ConnectorManager) SourceCapabilities(org.teiid.query.optimizer.capabilities.SourceCapabilities) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData) Test(org.junit.Test)

Example 4 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestMetadataFactory method setUp.

@Before
public void setUp() {
    MetadataStore metadataStore = new MetadataStore();
    CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
    VDBMetaData vdbMetaData = new VDBMetaData();
    // $NON-NLS-1$
    vdbMetaData.setName("foo");
    vdbMetaData.setVersion(1);
    Map<String, VDBResources.Resource> vdbEntries = new LinkedHashMap<String, VDBResources.Resource>();
    vdbEntries.put(MY_RESOURCE_PATH, new VDBResources.Resource(root.getChild("foo")));
    metadataFactory = new RuntimeMetadataImpl(new TransformationMetadata(vdbMetaData, store, vdbEntries, null, null));
}
Also used : MetadataStore(org.teiid.metadata.MetadataStore) CompositeMetadataStore(org.teiid.query.metadata.CompositeMetadataStore) TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) CompositeMetadataStore(org.teiid.query.metadata.CompositeMetadataStore) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) VDBResources(org.teiid.query.metadata.VDBResources) LinkedHashMap(java.util.LinkedHashMap) Before(org.junit.Before)

Example 5 with VDBMetaData

use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.

the class TestTransformationMetadata method testProcVisibility.

@Test
public void testProcVisibility() throws Exception {
    TransformationMetadata tm = exampleTransformationMetadata();
    VDBMetaData vdb = tm.getVdbMetaData();
    vdb.getModel("x").setVisible(false);
    // $NON-NLS-1$
    StoredProcedureInfo spi = tm.getStoredProcedureInfoForProcedure("y");
    assertEquals("x1.y", spi.getProcedureCallableName());
    // $NON-NLS-1$
    spi = tm.getStoredProcedureInfoForProcedure("x.y");
    assertEquals("x.y", spi.getProcedureCallableName());
}
Also used : VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) Test(org.junit.Test)

Aggregations

VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)121 Test (org.junit.Test)48 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)36 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)16 MetadataStore (org.teiid.metadata.MetadataStore)15 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)14 VDBRepository (org.teiid.deployers.VDBRepository)12 ArrayList (java.util.ArrayList)10 IOException (java.io.IOException)9 ConnectorManager (org.teiid.dqp.internal.datamgr.ConnectorManager)9 Properties (java.util.Properties)8 XMLStreamException (javax.xml.stream.XMLStreamException)8 VDBImportMetadata (org.teiid.adminapi.impl.VDBImportMetadata)8 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)7 TeiidComponentException (org.teiid.core.TeiidComponentException)7 VDBKey (org.teiid.vdb.runtime.VDBKey)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6 VDBTranslatorMetaData (org.teiid.adminapi.impl.VDBTranslatorMetaData)6 Schema (org.teiid.metadata.Schema)6 SessionMetadata (org.teiid.adminapi.impl.SessionMetadata)5