Search in sources :

Example 21 with EmbeddedConfiguration

use of org.teiid.runtime.EmbeddedConfiguration 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");
}
Also used : FakeServer(org.teiid.jdbc.FakeServer) ConnectorManagerRepository(org.teiid.dqp.internal.datamgr.ConnectorManagerRepository) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) ExecutionFactory(org.teiid.translator.ExecutionFactory) ConnectorManager(org.teiid.dqp.internal.datamgr.ConnectorManager) RuntimeMetadata(org.teiid.metadata.RuntimeMetadata) ResultSetExecution(org.teiid.translator.ResultSetExecution) ExecutionContext(org.teiid.translator.ExecutionContext) TranslatorException(org.teiid.translator.TranslatorException) QueryExpression(org.teiid.language.QueryExpression) BeforeClass(org.junit.BeforeClass)

Example 22 with EmbeddedConfiguration

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

the class TestTempOrdering method setup.

@BeforeClass
public static void setup() throws Exception {
    server = new FakeServer(false);
    EmbeddedConfiguration ec = new EmbeddedConfiguration();
    Properties p = new Properties();
    p.setProperty("org.teiid.defaultNullOrder", "HIGH");
    ec.setProperties(p);
    server.start(ec, false);
    server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
}
Also used : FakeServer(org.teiid.jdbc.FakeServer) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) Properties(java.util.Properties) BeforeClass(org.junit.BeforeClass)

Example 23 with EmbeddedConfiguration

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

the class TestJDBCSocketAuthentication method oneTimeSetup.

@BeforeClass
public static void oneTimeSetup() throws Exception {
    SocketConfiguration config = new SocketConfiguration();
    config.setSSLConfiguration(new SSLConfiguration());
    addr = new InetSocketAddress(0);
    config.setBindAddress(addr.getHostName());
    config.setPortNumber(0);
    EmbeddedConfiguration dqpConfig = new EmbeddedConfiguration();
    dqpConfig.setMaxActivePlans(2);
    dqpConfig.setSecurityHelper(new DoNothingSecurityHelper() {

        @Override
        public Subject getSubjectInContext(Object context) {
            return null;
        }

        @Override
        public Subject getSubjectInContext(String securityDomain) {
            return null;
        }
    });
    server = new FakeServer(false);
    server.start(dqpConfig, false);
    server.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
    jdbcTransport = new SocketListener(addr, config, server.getClientServiceRegistry(), BufferManagerFactory.getStandaloneBufferManager()) {

        @Override
        protected SSLAwareChannelHandler createChannelHandler() {
            SSLAwareChannelHandler result = new SSLAwareChannelHandler(this) {

                public void messageReceived(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception {
                    if (delay > 0) {
                        Thread.sleep(delay);
                    }
                    super.messageReceived(ctx, msg);
                }
            };
            return result;
        }
    };
}
Also used : FakeServer(org.teiid.jdbc.FakeServer) InetSocketAddress(java.net.InetSocketAddress) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) DoNothingSecurityHelper(org.teiid.runtime.DoNothingSecurityHelper) Subject(javax.security.auth.Subject) TeiidSQLException(org.teiid.jdbc.TeiidSQLException) BeforeClass(org.junit.BeforeClass)

Example 24 with EmbeddedConfiguration

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

the class TestJDBCSocketAuthentication method testSetAuthType.

@Test
public void testSetAuthType() throws Exception {
    FakeServer es = new FakeServer(false);
    EmbeddedConfiguration ec = new EmbeddedConfiguration();
    ec.setAuthenticationType(AuthenticationType.GSS);
    es.start(ec);
    es.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
    assertEquals(AuthenticationType.GSS, es.getSessionService().getAuthenticationType("parts", null, "testuser"));
    assertEquals(AuthenticationType.GSS, es.getClientServiceRegistry().getAuthenticationType());
    es.stop();
}
Also used : FakeServer(org.teiid.jdbc.FakeServer) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) Test(org.junit.Test)

Example 25 with EmbeddedConfiguration

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

the class TestJDBCSocketTransport method oneTimeSetup.

@BeforeClass
public static void oneTimeSetup() throws Exception {
    SocketConfiguration config = new SocketConfiguration();
    config.setSSLConfiguration(new SSLConfiguration());
    addr = new InetSocketAddress(0);
    config.setBindAddress(addr.getHostName());
    config.setPortNumber(0);
    EmbeddedConfiguration dqpConfig = new EmbeddedConfiguration();
    dqpConfig.setMaxActivePlans(2);
    server = new FakeServer(false);
    server.start(dqpConfig, false);
    server.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
    jdbcTransport = new SocketListener(addr, config, server.getClientServiceRegistry(), BufferManagerFactory.getStandaloneBufferManager()) {

        @Override
        protected SSLAwareChannelHandler createChannelHandler() {
            SSLAwareChannelHandler result = new SSLAwareChannelHandler(this) {

                public void messageReceived(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception {
                    if (delay > 0) {
                        Thread.sleep(delay);
                    }
                    super.messageReceived(ctx, msg);
                }
            };
            return result;
        }
    };
    jdbcTransport.setMaxMessageSize(MAX_MESSAGE);
    jdbcTransport.setMaxLobSize(MAX_LOB);
}
Also used : FakeServer(org.teiid.jdbc.FakeServer) InetSocketAddress(java.net.InetSocketAddress) EmbeddedConfiguration(org.teiid.runtime.EmbeddedConfiguration) TeiidSQLException(org.teiid.jdbc.TeiidSQLException) ConnectionException(org.teiid.net.ConnectionException) BatchUpdateException(java.sql.BatchUpdateException) SQLException(java.sql.SQLException) TranslatorException(org.teiid.translator.TranslatorException) CommunicationException(org.teiid.net.CommunicationException) IOException(java.io.IOException) NotSerializableException(java.io.NotSerializableException) BeforeClass(org.junit.BeforeClass)

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