Search in sources :

Example 16 with FakeServer

use of org.teiid.jdbc.FakeServer in project teiid by teiid.

the class TestSystemVirtualModel method setup.

@BeforeClass
public static void setup() throws Exception {
    server = new FakeServer(true);
    server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
    ModelMetaData mmd = new ModelMetaData();
    mmd.setName("x");
    mmd.setModelType(Type.VIRTUAL);
    mmd.addSourceMetadata("DDL", "create view t as select 1");
    ModelMetaData mmd1 = new ModelMetaData();
    mmd1.setName("y");
    mmd1.setModelType(Type.VIRTUAL);
    mmd1.addSourceMetadata("DDL", "create view T as select 1");
    server.deployVDB("test", mmd, mmd1);
    ModelMetaData mmd2 = new ModelMetaData();
    mmd2.setName("x");
    mmd2.setModelType(Type.VIRTUAL);
    mmd2.addSourceMetadata("DDL", "create view t (g geometry options (\"teiid_spatial:srid\" 3819)) as select null;");
    server.deployVDB("test1", mmd2);
}
Also used : FakeServer(org.teiid.jdbc.FakeServer) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData) BeforeClass(org.junit.BeforeClass)

Example 17 with FakeServer

use of org.teiid.jdbc.FakeServer 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 18 with FakeServer

use of org.teiid.jdbc.FakeServer in project teiid by teiid.

the class TestVirtualDocWithVirtualProc method oneTimeSetup.

@BeforeClass
public static void oneTimeSetup() throws Exception {
    server = new FakeServer(true);
    // this vdb has invalid update procedures
    server.setThrowMetadataErrors(false);
    server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/xml-vp/xmlvp_1.vdb");
}
Also used : FakeServer(org.teiid.jdbc.FakeServer) BeforeClass(org.junit.BeforeClass)

Example 19 with FakeServer

use of org.teiid.jdbc.FakeServer 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 20 with FakeServer

use of org.teiid.jdbc.FakeServer 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)

Aggregations

FakeServer (org.teiid.jdbc.FakeServer)23 BeforeClass (org.junit.BeforeClass)13 EmbeddedConfiguration (org.teiid.runtime.EmbeddedConfiguration)8 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)5 Before (org.junit.Before)4 Test (org.junit.Test)4 HardCodedExecutionFactory (org.teiid.runtime.HardCodedExecutionFactory)4 InetSocketAddress (java.net.InetSocketAddress)3 Connection (java.sql.Connection)3 QueryExpression (org.teiid.language.QueryExpression)3 TranslatorException (org.teiid.translator.TranslatorException)3 ResultSet (java.sql.ResultSet)2 Properties (java.util.Properties)2 DummyTransactionManager (org.infinispan.transaction.tm.DummyTransactionManager)2 TeiidSQLException (org.teiid.jdbc.TeiidSQLException)2 RuntimeMetadata (org.teiid.metadata.RuntimeMetadata)2 ExecutionContext (org.teiid.translator.ExecutionContext)2 ResultSetExecution (org.teiid.translator.ResultSetExecution)2 IOException (java.io.IOException)1 NotSerializableException (java.io.NotSerializableException)1