use of org.teiid.transport.TestSocketRemoting.FakeService in project teiid by teiid.
the class TestCommSockets method testLobs.
@Test
public void testLobs() throws Exception {
SocketServerConnection conn = helpEstablishConnection(false);
FakeService fs = conn.getService(FakeService.class);
assertEquals(150, fs.lobMethod(new ByteArrayInputStream(new byte[100]), new StringReader(new String(new char[50]))));
assertEquals(2, storageManager.getCreated());
assertEquals(2, storageManager.getRemoved());
assertEquals(0, fs.lobMethod(new ByteArrayInputStream(new byte[0]), new StringReader(new String(new char[0]))));
assertEquals(4, storageManager.getCreated());
assertEquals(4, storageManager.getRemoved());
assertEquals((1 << 17) + 50, fs.lobMethod(new ByteArrayInputStream(new byte[1 << 17]), new StringReader(new String(new char[50]))));
assertEquals(6, storageManager.getCreated());
assertEquals(6, storageManager.getRemoved());
}
use of org.teiid.transport.TestSocketRemoting.FakeService in project teiid by teiid.
the class TestCommSockets method testServerRemoteStreaming.
@Test
public void testServerRemoteStreaming() throws Exception {
SocketServerConnection conn = helpEstablishConnection(false);
FakeService fs = conn.getService(FakeService.class);
assertEquals("hello world", ObjectConverterUtil.convertToString(fs.getReader()));
assertTrue(Serializable.class.isAssignableFrom(fs.getReader().getClass()));
}
use of org.teiid.transport.TestSocketRemoting.FakeService in project teiid by teiid.
the class TestCommSockets method testAutoFailoverPing.
@Test
public void testAutoFailoverPing() throws Exception {
Properties p = new Properties();
p.setProperty(TeiidURL.CONNECTION.AUTO_FAILOVER, "true");
p.setProperty("org.teiid.sockets.synchronousttl", "20000");
SocketServerConnection conn = helpEstablishConnection(false, new SSLConfiguration(), p);
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();
Future<?> future = exec.submit(new Runnable() {
@Override
public void run() {
final FakeService fs = conn.getService(FakeService.class);
ResultsFuture<Integer> f = fs.delayedAsynchResult();
f.addCompletionListener(new CompletionListener<Integer>() {
@Override
public void onCompletion(ResultsFuture<Integer> future) {
// potentially recurrent;
fs.asynchResult();
}
});
try {
f.get();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
future.get(19, TimeUnit.SECONDS);
}
Aggregations