Search in sources :

Example 6 with EmbeddedServer

use of org.teiid.runtime.EmbeddedServer 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)6 EmbeddedServer (org.teiid.runtime.EmbeddedServer)6 Before (org.junit.Before)3 FileInputStream (java.io.FileInputStream)2 BeforeClass (org.junit.BeforeClass)2 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)2 MetadataFactory (org.teiid.metadata.MetadataFactory)2 Table (org.teiid.metadata.Table)2 HardCodedExecutionFactory (org.teiid.runtime.HardCodedExecutionFactory)2 LoopbackExecutionFactory (org.teiid.translator.loopback.LoopbackExecutionFactory)2 Identity (java.security.Identity)1 Principal (java.security.Principal)1 Group (java.security.acl.Group)1 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 Vector (java.util.Vector)1 ConnectionFactory (javax.resource.cci.ConnectionFactory)1 Subject (javax.security.auth.Subject)1 DummyBaseTransactionManager (org.infinispan.transaction.tm.DummyBaseTransactionManager)1