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;
}
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);
}
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));
}
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));
}
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());
}
Aggregations