Search in sources :

Example 26 with EmbeddedConfiguration

use of org.teiid.runtime.EmbeddedConfiguration in project teiid by teiid.

the class TestSystemPerformance method setup.

@Before
public void setup() throws VirtualDatabaseException, ConnectorManagerException, TranslatorException {
    es = new EmbeddedServer();
    es.start(new EmbeddedConfiguration());
    ModelMetaData mmm = new ModelMetaData();
    mmm.setName("test");
    mmm.setSchemaSourceType("native");
    mmm.addSourceMapping("x", "hc", null);
    HardCodedExecutionFactory hardCodedExecutionFactory = new HardCodedExecutionFactory() {

        @Override
        public void getMetadata(MetadataFactory metadataFactory, Object conn) throws TranslatorException {
            String[] colNames = new String[COLS];
            for (int i = 0; i < colNames.length; i++) {
                colNames[i] = "col" + i;
            }
            for (int i = 0; i < TABLES; i++) {
                Table t = metadataFactory.addTable("x" + i);
                for (int j = 0; j < COLS; j++) {
                    metadataFactory.addColumn(colNames[j], "string", t);
                }
            }
        }

        @Override
        public boolean isSourceRequiredForMetadata() {
            return false;
        }
    };
    es.addTranslator("hc", hardCodedExecutionFactory);
    es.deployVDB("test", mmm);
}
Also used : Table(org.teiid.metadata.Table) MetadataFactory(org.teiid.metadata.MetadataFactory) EmbeddedServer(org.teiid.runtime.EmbeddedServer) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) HardCodedExecutionFactory(org.teiid.runtime.HardCodedExecutionFactory) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData) Before(org.junit.Before)

Aggregations

EmbeddedConfiguration (org.teiid.runtime.EmbeddedConfiguration)26 Test (org.junit.Test)12 Connection (java.sql.Connection)9 BeforeClass (org.junit.BeforeClass)8 FakeServer (org.teiid.jdbc.FakeServer)8 ByteArrayInputStream (java.io.ByteArrayInputStream)7 FileInputStream (java.io.FileInputStream)7 ResultSet (java.sql.ResultSet)6 EmbeddedServer (org.teiid.runtime.EmbeddedServer)6 Statement (java.sql.Statement)5 InetSocketAddress (java.net.InetSocketAddress)4 DummyTransactionManager (org.infinispan.transaction.tm.DummyTransactionManager)3 Before (org.junit.Before)3 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)3 HardCodedExecutionFactory (org.teiid.runtime.HardCodedExecutionFactory)3 File (java.io.File)2 SQLException (java.sql.SQLException)2 Properties (java.util.Properties)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Subject (javax.security.auth.Subject)2