use of org.teiid.common.buffer.FileStore in project teiid by teiid.
the class TestFileStorageManager method testGrowth.
@Test
public void testGrowth() throws Exception {
FileStorageManager sm = getStorageManager(null, null);
FileStore store = sm.createFileStore("0");
FileStoreOutputStream fsos = store.createOutputStream(1 << 15);
assertTrue(fsos.getBuffer().length < 1 << 15);
fsos.write(1);
fsos.write(new byte[1 << 14]);
fsos.flush();
assertEquals(1 + (1 << 14), fsos.getCount());
assertEquals(1 << 15, fsos.getBuffer().length);
}
use of org.teiid.common.buffer.FileStore in project teiid by teiid.
the class TestFileStorageManager method testFlush.
@Test
public void testFlush() throws Exception {
FileStorageManager sm = getStorageManager(null, null);
FileStore store = sm.createFileStore("0");
FileStoreOutputStream fsos = store.createOutputStream(2);
fsos.write(new byte[3]);
fsos.write(1);
fsos.flush();
assertEquals(0, fsos.getCount());
}
use of org.teiid.common.buffer.FileStore in project teiid by teiid.
the class TestSaveOnReadInputStream method getSaveOnReadInputStream.
private SaveOnReadInputStream getSaveOnReadInputStream() {
FileStore fs = BufferManagerFactory.getStandaloneBufferManager().createFileStore("test");
FileStoreInputStreamFactory factory = new FileStoreInputStreamFactory(fs, Streamable.ENCODING);
InputStream is = new ByteArrayInputStream("hello world".getBytes(Streamable.CHARSET));
SaveOnReadInputStream soris = new SaveOnReadInputStream(is, factory);
return soris;
}
use of org.teiid.common.buffer.FileStore in project teiid by teiid.
the class TestLocalBufferService method testUseDiskFalse.
@Test
public void testUseDiskFalse() throws Exception {
BufferServiceImpl svc = new BufferServiceImpl();
svc.setDiskDirectory(UnitTestUtil.getTestScratchPath() + "/teiid/1");
svc.setUseDisk(false);
svc.start();
// all the properties are set
BufferManagerImpl mgr = svc.getBufferManager();
FileStore f = mgr.getCache().createFileStore("x");
f.write(new byte[1234], 0, 1234);
}
Aggregations