本文整理汇总了Java中jetbrains.exodus.env.Transaction.abort方法的典型用法代码示例。如果您正苦于以下问题:Java Transaction.abort方法的具体用法?Java Transaction.abort怎么用?Java Transaction.abort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jetbrains.exodus.env.Transaction
的用法示例。
在下文中一共展示了Transaction.abort方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRenameFile
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void testRenameFile() throws InterruptedException {
testFileCreation();
final Transaction txn = env.beginTransaction();
File file0 = vfs.openFile(txn, "file0", false);
txn.revert();
Assert.assertNotNull(file0);
final long fd = file0.getDescriptor();
final long created = file0.getCreated();
final long lastModified = file0.getLastModified();
Thread.sleep(50);
vfs.renameFile(txn, file0, "file1");
txn.flush();
file0 = vfs.openFile(txn, "file0", false);
File file1 = vfs.openFile(txn, "file1", false);
txn.abort();
Assert.assertNull(file0);
Assert.assertNotNull(file1);
Assert.assertEquals(fd, file1.getDescriptor());
Assert.assertEquals(created, file1.getCreated());
Assert.assertTrue(file1.getLastModified() > lastModified);
}
示例2: writeRandomAccessRead
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void writeRandomAccessRead() throws IOException {
final Transaction txn = env.beginTransaction();
final File file0 = vfs.createFile(txn, "file0");
final OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write((HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + HOEGAARDEN).getBytes(UTF_8));
outputStream.close();
txn.flush();
InputStream inputStream = vfs.readFile(txn, file0, 0);
Assert.assertEquals(HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + HOEGAARDEN, streamAsString(inputStream));
inputStream.close();
inputStream = vfs.readFile(txn, file0, 10);
Assert.assertEquals(HOEGAARDEN + HOEGAARDEN + HOEGAARDEN, streamAsString(inputStream));
inputStream.close();
inputStream = vfs.readFile(txn, file0, 20);
Assert.assertEquals(HOEGAARDEN + HOEGAARDEN, streamAsString(inputStream));
inputStream.close();
inputStream = vfs.readFile(txn, file0, 30);
Assert.assertEquals(HOEGAARDEN, streamAsString(inputStream));
inputStream.close();
txn.abort();
}
示例3: writeOverwriteRead
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void writeOverwriteRead() throws IOException {
final Transaction txn = env.beginTransaction();
final File file0 = vfs.createFile(txn, "file0");
OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write(HOEGAARDEN.getBytes(UTF_8));
outputStream.close();
txn.flush();
outputStream = vfs.writeFile(txn, file0);
outputStream.write("x".getBytes(UTF_8));
outputStream.close();
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file0);
Assert.assertEquals('x' + HOEGAARDEN.substring(1), streamAsString(inputStream));
inputStream.close();
txn.abort();
}
示例4: writeOverwriteRead2
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void writeOverwriteRead2() throws IOException {
final Transaction txn = env.beginTransaction();
final File file0 = vfs.createFile(txn, "file0");
OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write((HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + HOEGAARDEN).getBytes(UTF_8));
outputStream.close();
txn.flush();
outputStream = vfs.writeFile(txn, file0);
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.close();
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file0);
Assert.assertEquals('x' + HOEGAARDEN.substring(1) +
'x' + HOEGAARDEN.substring(1) + 'x' + HOEGAARDEN.substring(1) +
'x' + HOEGAARDEN.substring(1), streamAsString(inputStream));
inputStream.close();
txn.abort();
}
示例5: writeRandomAccessOverwriteRead2
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void writeRandomAccessOverwriteRead2() throws IOException {
final Transaction txn = env.beginTransaction();
final File file0 = vfs.createFile(txn, "file0");
OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write((HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + HOEGAARDEN).getBytes(UTF_8));
outputStream.close();
txn.flush();
outputStream = vfs.writeFile(txn, file0, 1000000);
outputStream.write("x".getBytes(UTF_8));
outputStream.close();
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file0);
Assert.assertEquals(HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + 'x', streamAsString(inputStream));
inputStream.close();
txn.abort();
}
示例6: testTimeFieldsOfFiles
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void testTimeFieldsOfFiles() throws IOException, InterruptedException {
final long start = System.currentTimeMillis();
Thread.sleep(20);
final Transaction txn = env.beginTransaction();
File file0 = vfs.createFile(txn, "file0");
txn.flush();
Thread.sleep(20);
final OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write(RENAT_GILFANOV.getBytes(UTF_8));
outputStream.close();
txn.flush();
file0 = vfs.openFile(txn, "file0", false);
Assert.assertNotNull(file0);
Assert.assertTrue(file0.getCreated() > start);
Assert.assertTrue(file0.getCreated() < file0.getLastModified());
txn.abort();
}
示例7: testFileLength
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void testFileLength() throws IOException {
final Transaction txn = env.beginTransaction();
vfs.createFile(txn, "file0");
txn.flush();
for (int i = 0; i < 300; ++i) {
final File file0 = vfs.openFile(txn, "file0", false);
Assert.assertNotNull(file0);
Assert.assertEquals((long) i, vfs.getFileLength(txn, file0));
final OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write(i);
outputStream.close();
txn.flush();
}
txn.abort();
}
示例8: testWriteAndSeek2
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
@TestFor(issues = "XD-624")
public void testWriteAndSeek2() throws IOException {
Transaction txn = env.beginTransaction();
vfs.getConfig().setClusteringStrategy(new ClusteringStrategy.LinearClusteringStrategy(8));
final File file = vfs.createFile(txn, "file0");
OutputStream outputStream = vfs.writeFile(txn, file);
final byte[] bytes = HOEGAARDEN.getBytes(UTF_8);
outputStream.write(bytes);
outputStream.close();
outputStream = vfs.writeFile(txn, file, bytes.length);
outputStream.write(bytes);
outputStream.close();
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file);
Assert.assertEquals(HOEGAARDEN + HOEGAARDEN, streamAsString(inputStream));
txn.abort();
}
示例9: testWriteAndSeek3
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
@TestFor(issues = "XD-624")
public void testWriteAndSeek3() throws IOException {
Transaction txn = env.beginTransaction();
vfs.getConfig().setClusteringStrategy(new ClusteringStrategy.LinearClusteringStrategy(8));
final File file = vfs.createFile(txn, "file0");
OutputStream outputStream = vfs.writeFile(txn, file);
final byte[] bytes = HOEGAARDEN.getBytes(UTF_8);
outputStream.write(bytes);
outputStream.close();
outputStream = vfs.appendFile(txn, file);
outputStream.write(bytes);
outputStream.close();
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file);
Assert.assertEquals(HOEGAARDEN + HOEGAARDEN, streamAsString(inputStream));
txn.abort();
}
示例10: readOnly_XD_444
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void readOnly_XD_444() throws Exception {
beanIsAccessible();
final Transaction txn = env.beginTransaction();
try {
env.openStore("New Store", StoreConfig.WITHOUT_DUPLICATES, txn);
Assert.assertFalse(txn.isIdempotent());
platformMBeanServer.setAttribute(envConfigName, new Attribute(READ_ONLY_ATTR, true));
TestUtil.runWithExpectedException(new Runnable() {
@Override
public void run() {
txn.flush();
}
}, ReadonlyTransactionException.class);
} finally {
txn.abort();
}
}
示例11: writeRead
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void writeRead() throws IOException {
final Transaction txn = env.beginTransaction();
final File file0 = vfs.createFile(txn, "file0");
final OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write(HOEGAARDEN.getBytes(UTF_8));
outputStream.close();
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file0);
Assert.assertEquals(HOEGAARDEN, streamAsString(inputStream));
inputStream.close();
txn.abort();
}
示例12: writeOverwriteAppendRead
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void writeOverwriteAppendRead() throws IOException {
final Transaction txn = env.beginTransaction();
final File file0 = vfs.createFile(txn, "file0");
OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write((HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + HOEGAARDEN).getBytes(UTF_8));
outputStream.close();
txn.flush();
outputStream = vfs.writeFile(txn, file0);
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.write("x".getBytes(UTF_8));
outputStream.write(HOEGAARDEN.substring(1).getBytes(UTF_8));
outputStream.close();
txn.flush();
outputStream = vfs.appendFile(txn, file0);
outputStream.write(HOEGAARDEN.getBytes(UTF_8));
outputStream.close();
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file0);
Assert.assertEquals('x' + HOEGAARDEN.substring(1) +
'x' + HOEGAARDEN.substring(1) + 'x' + HOEGAARDEN.substring(1) +
'x' + HOEGAARDEN.substring(1) + HOEGAARDEN, streamAsString(inputStream));
inputStream.close();
txn.abort();
}
示例13: writeRandomAccessOverwriteRead
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void writeRandomAccessOverwriteRead() throws IOException {
final Transaction txn = env.beginTransaction();
final File file0 = vfs.createFile(txn, "file0");
OutputStream outputStream = vfs.appendFile(txn, file0);
outputStream.write((HOEGAARDEN + HOEGAARDEN + HOEGAARDEN + HOEGAARDEN).getBytes(UTF_8));
outputStream.close();
txn.flush();
Assert.assertEquals(40, vfs.getFileLength(txn, file0));
outputStream = vfs.writeFile(txn, file0, 0);
outputStream.write("x".getBytes(UTF_8));
outputStream.close();
Assert.assertEquals(40, vfs.getFileLength(txn, file0));
outputStream = vfs.writeFile(txn, file0, 10);
outputStream.write("x".getBytes(UTF_8));
outputStream.close();
Assert.assertEquals(40, vfs.getFileLength(txn, file0));
outputStream = vfs.writeFile(txn, file0, 20);
outputStream.write("x".getBytes(UTF_8));
outputStream.close();
Assert.assertEquals(40, vfs.getFileLength(txn, file0));
outputStream = vfs.writeFile(txn, file0, 30);
outputStream.write("x".getBytes(UTF_8));
outputStream.close();
txn.flush();
Assert.assertEquals(40, vfs.getFileLength(txn, file0));
final InputStream inputStream = vfs.readFile(txn, file0);
Assert.assertEquals('x' + HOEGAARDEN.substring(1) +
'x' + HOEGAARDEN.substring(1) + 'x' + HOEGAARDEN.substring(1) +
'x' + HOEGAARDEN.substring(1), streamAsString(inputStream));
inputStream.close();
txn.abort();
}
示例14: testWriteAndSeek
import jetbrains.exodus.env.Transaction; //导入方法依赖的package包/类
@Test
public void testWriteAndSeek() throws IOException {
Transaction txn = env.beginTransaction();
final File file = vfs.createFile(txn, "file0");
OutputStream outputStream;
for (int i = 0; i < 4; ++i) {
outputStream = vfs.writeFile(txn, file, i);
outputStream.write(HOEGAARDEN.getBytes(UTF_8));
outputStream.close();
}
txn.flush();
final InputStream inputStream = vfs.readFile(txn, file);
Assert.assertEquals("hhh" + HOEGAARDEN, streamAsString(inputStream));
txn.abort();
}