use of com.orientechnologies.orient.core.index.OIndexTxAwareOneValue in project orientdb by orientechnologies.
the class IndexTxAwareOneValueGetTest method testPutAfterTransaction.
@Test
public void testPutAfterTransaction() {
database.getMetadata().getIndexManager().reload();
database.begin();
final OIndex<?> index = database.getMetadata().getIndexManager().getIndex("idxTxAwareOneValueGetTest");
Assert.assertTrue(index instanceof OIndexTxAwareOneValue);
final int clusterId = database.getDefaultClusterId();
index.put(1, new ORecordId(clusterId, 1));
Assert.assertNotNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(index.get(1));
database.commit();
index.put(2, new ORecordId(clusterId, 2));
Assert.assertNotNull(index.get(2));
}
use of com.orientechnologies.orient.core.index.OIndexTxAwareOneValue in project orientdb by orientechnologies.
the class IndexTxAwareOneValueGetTest method testMultiPut.
@Test
public void testMultiPut() {
database.getMetadata().getIndexManager().reload();
database.begin();
final OIndex<?> index = database.getMetadata().getIndexManager().getIndex("idxTxAwareOneValueGetTest");
Assert.assertTrue(index instanceof OIndexTxAwareOneValue);
final int clusterId = database.getDefaultClusterId();
index.put(1, new ORecordId(clusterId, 1));
index.put(1, new ORecordId(clusterId, 1));
Assert.assertNotNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(((OIndexTxAwareOneValue) index).get(1));
database.commit();
Assert.assertNotNull(((OIndexTxAwareOneValue) index).get(1));
}
use of com.orientechnologies.orient.core.index.OIndexTxAwareOneValue in project orientdb by orientechnologies.
the class IndexTxAwareOneValueGetTest method testRemove.
@Test
public void testRemove() {
database.getMetadata().getIndexManager().reload();
database.begin();
final OIndex<?> index = database.getMetadata().getIndexManager().getIndex("idxTxAwareOneValueGetTest");
Assert.assertTrue(index instanceof OIndexTxAwareOneValue);
final int clusterId = database.getDefaultClusterId();
index.put(1, new ORecordId(clusterId, 1));
index.put(2, new ORecordId(clusterId, 2));
database.commit();
Assert.assertNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(index.get(1));
Assert.assertNotNull(index.get(2));
database.begin();
index.remove(1);
Assert.assertNotNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNull(index.get(1));
Assert.assertNotNull(index.get(2));
database.rollback();
Assert.assertNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(index.get(1));
Assert.assertNotNull(index.get(2));
}
use of com.orientechnologies.orient.core.index.OIndexTxAwareOneValue in project orientdb by orientechnologies.
the class IndexTxAwareOneValueGetTest method testClearAndPut.
@Test
public void testClearAndPut() {
database.getMetadata().getIndexManager().reload();
database.begin();
final OIndex<?> index = database.getMetadata().getIndexManager().getIndex("idxTxAwareOneValueGetTest");
Assert.assertTrue(index instanceof OIndexTxAwareOneValue);
final int clusterId = database.getDefaultClusterId();
index.put(1, new ORecordId(clusterId, 1));
index.put(2, new ORecordId(clusterId, 2));
database.commit();
Assert.assertNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(index.get(1));
Assert.assertNotNull(index.get(2));
database.begin();
index.clear();
index.put(2, new ORecordId(clusterId, 2));
Assert.assertNotNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNull(index.get(1));
Assert.assertNotNull(index.get(2));
database.rollback();
Assert.assertNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(index.get(1));
Assert.assertNotNull(index.get(2));
}
use of com.orientechnologies.orient.core.index.OIndexTxAwareOneValue in project orientdb by orientechnologies.
the class IndexTxAwareOneValueGetTest method testClear.
@Test
public void testClear() {
database.getMetadata().getIndexManager().reload();
database.begin();
final OIndex<?> index = database.getMetadata().getIndexManager().getIndex("idxTxAwareOneValueGetTest");
Assert.assertTrue(index instanceof OIndexTxAwareOneValue);
final int clusterId = database.getDefaultClusterId();
index.put(1, new ORecordId(clusterId, 1));
index.put(2, new ORecordId(clusterId, 2));
database.commit();
Assert.assertNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(index.get(1));
Assert.assertNotNull(index.get(2));
database.begin();
index.clear();
Assert.assertNotNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNull(index.get(1));
Assert.assertNull(index.get(2));
database.rollback();
Assert.assertNull(database.getTransaction().getIndexChanges("idxTxAwareOneValueGetTest"));
Assert.assertNotNull(index.get(1));
Assert.assertNotNull(index.get(2));
}
Aggregations