use of org.teiid.jdbc.FakeServer in project teiid by teiid.
the class TestResultSetMetadata method setUp.
@Before
public void setUp() throws Exception {
server = new FakeServer(true);
server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
// $NON-NLS-1$ //$NON-NLS-2$
this.internalConnection = server.createConnection("jdbc:teiid:" + VDB);
}
use of org.teiid.jdbc.FakeServer in project teiid by teiid.
the class TestStats method setUp.
@BeforeClass
public static void setUp() throws Exception {
server = new FakeServer(true);
server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
// $NON-NLS-1$ //$NON-NLS-2$
connection = server.createConnection("jdbc:teiid:" + VDB);
}
use of org.teiid.jdbc.FakeServer in project teiid by teiid.
the class TestExecutionReuse method oneTimeSetUp.
@BeforeClass
public static void oneTimeSetUp() throws Exception {
EmbeddedConfiguration config = new EmbeddedConfiguration();
config.setUserRequestSourceConcurrency(1);
server = new FakeServer(false);
server.setConnectorManagerRepository(new ConnectorManagerRepository() {
private ConnectorManager cm = new ConnectorManager("x", "y") {
private ExecutionFactory<Object, Object> ef = new ExecutionFactory<Object, Object>() {
@Override
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Object connection) throws TranslatorException {
ec = executionContext;
return execution;
}
public boolean isSourceRequired() {
return false;
}
};
@Override
public ExecutionFactory<Object, Object> getExecutionFactory() {
return ef;
}
@Override
public Object getConnectionFactory() throws TranslatorException {
return null;
}
};
@Override
public ConnectorManager getConnectorManager(String connectorName) {
return cm;
}
});
server.start(config, false);
server.deployVDB("PartsSupplier", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
}
use of org.teiid.jdbc.FakeServer in project teiid by teiid.
the class TestEventDistributor method testEvents.
@Test
public void testEvents() throws Exception {
FakeServer server = null;
try {
server = new FakeServer(true);
EventListener events = Mockito.mock(EventListener.class);
server.getEventDistributor().register(events);
server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
Mockito.verify(events).vdbDeployed(VDB, "1");
Mockito.verify(events).vdbLoaded((VDB) Mockito.any());
server.undeployVDB(VDB);
Mockito.verify(events).vdbDeployed(VDB, "1");
Mockito.verify(events).vdbLoaded((VDB) Mockito.any());
Mockito.verify(events).vdbUndeployed(VDB, "1");
} finally {
if (server != null) {
server.stop();
}
}
}
use of org.teiid.jdbc.FakeServer in project teiid by teiid.
the class TestAsynch method oneTimeSetup.
@BeforeClass
public static void oneTimeSetup() throws Exception {
server = new FakeServer(true);
ModelMetaData mmd = new ModelMetaData();
mmd.setName("v");
mmd.setModelType(Type.PHYSICAL);
mmd.setSchemaSourceType("ddl");
mmd.addSourceMapping("z", "z", null);
mmd.setSchemaText("create view test (col integer) as select 1; create foreign table someTable (col integer);");
ef = new HardCodedExecutionFactory() {
@Override
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Object connection) throws TranslatorException {
partIds.add(executionContext.getPartIdentifier());
return super.createResultSetExecution(command, executionContext, metadata, connection);
}
};
server.addTranslator("z", ef);
server.deployVDB("x", mmd);
}
Aggregations