Search in sources :

Example 6 with TestFor

use of jetbrains.exodus.TestFor in project xodus by JetBrains.

the class BinaryOperatorsTests method testConcat2.

@TestFor(issue = "XD-566")
public void testConcat2() {
    final StoreTransaction txn = getStoreTransaction();
    Objects.requireNonNull(txn).newEntity("Issue");
    Assert.assertEquals(1, toList(txn.getAll("User").concat(txn.getAll("Issue"))).size());
    Assert.assertTrue(txn.flush());
    txn.newEntity("User");
    Assert.assertTrue(txn.flush());
    Assert.assertEquals(2, toList(txn.getAll("User").concat(txn.getAll("Issue"))).size());
    Objects.requireNonNull(txn.getAll("User").getFirst()).delete();
    Assert.assertTrue(txn.flush());
    while (true) {
        txn.revert();
        final EntityIterableBase concat = (EntityIterableBase) txn.getAll("User").concat(txn.getAll("Issue"));
        Assert.assertEquals(1, toList(concat).size());
        if (concat.isCached())
            break;
        Thread.yield();
    }
    txn.revert();
    txn.newEntity("User");
    Assert.assertTrue(txn.flush());
    final EntityIterableBase concat = (EntityIterableBase) txn.getAll("User").concat(txn.getAll("Issue"));
    Assert.assertFalse(concat.isCached());
    Assert.assertEquals(2, toList(concat).size());
}
Also used : EntityIterableBase(jetbrains.exodus.entitystore.iterate.EntityIterableBase) TestFor(jetbrains.exodus.TestFor)

Example 7 with TestFor

use of jetbrains.exodus.TestFor in project xodus by JetBrains.

the class TreeCursorNoDuplicatesTest method failingGetNextAndGetPrevDontInvalidateKeyValue.

@Test
@TestFor(issue = "XD-614")
public void failingGetNextAndGetPrevDontInvalidateKeyValue() {
    tm = createMutableTree(false, 1);
    tm.put(kv("0", "0"));
    try (Cursor cursor = tm.openCursor()) {
        Assert.assertTrue(cursor.getNext());
        Assert.assertEquals(key("0"), cursor.getKey());
        Assert.assertEquals(key("0"), cursor.getValue());
        Assert.assertFalse(cursor.getNext());
        Assert.assertEquals(key("0"), cursor.getKey());
        Assert.assertEquals(key("0"), cursor.getValue());
    }
    try (Cursor cursor = tm.openCursor()) {
        Assert.assertTrue(cursor.getPrev());
        Assert.assertEquals(key("0"), cursor.getKey());
        Assert.assertEquals(key("0"), cursor.getValue());
        Assert.assertFalse(cursor.getPrev());
        Assert.assertEquals(key("0"), cursor.getKey());
        Assert.assertEquals(key("0"), cursor.getValue());
    }
}
Also used : Cursor(jetbrains.exodus.env.Cursor) Test(org.junit.Test) TestFor(jetbrains.exodus.TestFor)

Aggregations

TestFor (jetbrains.exodus.TestFor)7 Test (org.junit.Test)5 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 Cursor (jetbrains.exodus.env.Cursor)2 Transaction (jetbrains.exodus.env.Transaction)2 ArrayByteIterable (jetbrains.exodus.ArrayByteIterable)1 ByteIterable (jetbrains.exodus.ByteIterable)1 IntHashSet (jetbrains.exodus.core.dataStructures.hash.IntHashSet)1 ComparablePair (jetbrains.exodus.entitystore.custom.ComparablePair)1 ComparablePairBinding (jetbrains.exodus.entitystore.custom.ComparablePairBinding)1 EntityIterableBase (jetbrains.exodus.entitystore.iterate.EntityIterableBase)1 PropertyTypes (jetbrains.exodus.entitystore.tables.PropertyTypes)1