use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestSessionServiceImpl method testActiveVDBWithNoVersion.
@Test
public void testActiveVDBWithNoVersion() throws Exception {
VDBRepository repo = Mockito.mock(VDBRepository.class);
VDBMetaData vdb = new VDBMetaData();
vdb.setName("name");
vdb.setVersion(1);
vdb.setStatus(Status.ACTIVE);
Mockito.stub(repo.getLiveVDB("name")).toReturn(vdb);
ssi.setVDBRepository(repo);
ssi.getActiveVDB("name", null);
Mockito.verify(repo, Mockito.times(1)).getLiveVDB("name");
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestSessionServiceImpl method testActiveVDBNameWithVersionNonInteger.
@Test
public void testActiveVDBNameWithVersionNonInteger() throws Exception {
VDBRepository repo = Mockito.mock(VDBRepository.class);
VDBMetaData vdb = new VDBMetaData();
vdb.setName("name");
vdb.setVersion(1);
vdb.setStatus(Status.ACTIVE);
Mockito.stub(repo.getLiveVDB("name", 1)).toReturn(vdb);
ssi.setVDBRepository(repo);
assertNull(ssi.getActiveVDB("name.x", null));
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestLogonImpl method addVdb.
private VDBMetaData addVdb(VDBRepository repo, String name, String sc, String authenticationType) {
VDBMetaData vdb = new VDBMetaData();
vdb.setName(name);
vdb.setVersion(1);
vdb.setStatus(Status.ACTIVE);
Mockito.stub(repo.getLiveVDB(name, "1")).toReturn(vdb);
vdb.addProperty(SessionServiceImpl.SECURITY_DOMAIN_PROPERTY, sc);
vdb.addProperty(SessionServiceImpl.AUTHENTICATION_TYPE_PROPERTY, authenticationType);
return vdb;
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class TestDDLMetadataStore method testVDBExport.
@Test
public void testVDBExport() throws Exception {
EmbeddedConfiguration ec = new EmbeddedConfiguration();
ec.setUseDisk(false);
ec.setSecurityHelper(new ThreadLocalSecurityHelper());
es.addTranslator("y", new TestEmbeddedServer.FakeTranslator(false));
es.start(ec);
final AtomicInteger counter = new AtomicInteger();
ConnectionFactoryProvider<AtomicInteger> cfp = new EmbeddedServer.SimpleConnectionFactoryProvider<AtomicInteger>(counter);
es.addConnectionFactoryProvider("z", cfp);
es.addMetadataRepository("myrepo", Mockito.mock(MetadataRepository.class));
es.deployVDB(new FileInputStream(UnitTestUtil.getTestDataPath() + "/first-db.ddl"), true);
Admin admin = es.getAdmin();
VDBMetaData vdb = (VDBMetaData) admin.getVDB("empty", "2");
ByteArrayOutputStream out = new ByteArrayOutputStream();
VDBMetadataParser.marshell(vdb, out);
String expected = ObjectConverterUtil.convertFileToString(new File(UnitTestUtil.getTestDataPath() + "/" + "first-vdb.xml"));
assertEquals(expected, new String(out.toByteArray()));
String exportedDdl = admin.getSchema("empty", "2", null, null, null);
Assert.assertEquals(ObjectConverterUtil.convertFileToString(UnitTestUtil.getTestDataFile("first-vdb.ddl")), exportedDdl);
}
use of org.teiid.adminapi.impl.VDBMetaData in project teiid by teiid.
the class Request method initMetadata.
/**
* if the metadata has not been supplied via setMetadata, this method will create the appropriate state
*
* @throws TeiidComponentException
*/
protected void initMetadata() throws TeiidComponentException {
if (this.metadata != null) {
return;
}
// Prepare dependencies for running the optimizer
this.capabilitiesFinder = new CachedFinder(this.connectorManagerRepo, workContext.getVDB());
if (this.bufferManager.getOptions() != null) {
this.capabilitiesFinder = new TempCapabilitiesFinder(this.capabilitiesFinder, this.bufferManager.getOptions().getDefaultNullOrder());
} else {
this.capabilitiesFinder = new TempCapabilitiesFinder(this.capabilitiesFinder);
}
VDBMetaData vdbMetadata = workContext.getVDB();
metadata = vdbMetadata.getAttachment(QueryMetadataInterface.class);
globalTables = vdbMetadata.getAttachment(GlobalTableStore.class);
if (metadata == null) {
throw new TeiidComponentException(QueryPlugin.Event.TEIID30489, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30489, this.vdbName, this.vdbVersion));
}
TempMetadataAdapter tma = new TempMetadataAdapter(metadata, this.tempTableStore.getMetadataStore());
tma.setSession(true);
this.metadata = tma;
}
Aggregations