use of org.teiid.transport.SocketConfiguration in project teiid by teiid.
the class TestInternalConnection method testInternalRemote.
@Test
public void testInternalRemote() throws Exception {
SocketConfiguration s = new SocketConfiguration();
InetSocketAddress addr = new InetSocketAddress(0);
s.setBindAddress(addr.getHostName());
s.setPortNumber(addr.getPort());
s.setProtocol(WireProtocol.teiid);
EmbeddedConfiguration config = new EmbeddedConfiguration();
config.addTransport(s);
config.setSecurityHelper(new ThreadLocalSecurityHelper());
es.start(config);
es.deployVDB(new ByteArrayInputStream(vdb.getBytes()));
Connection conn = null;
try {
TeiidDriver driver = new TeiidDriver();
Properties p = new Properties();
p.setProperty("user", "me");
conn = driver.connect("jdbc:teiid:test@mm://" + addr.getHostName() + ":" + es.getPort(0), p);
ResultSet rs = conn.createStatement().executeQuery("select func(1)");
rs.next();
assertEquals("me@teiid-securityHELLO WORLD1", rs.getString(1));
} finally {
if (conn != null) {
conn.close();
}
}
}
Aggregations