use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class LogPositionMarkerTest method shouldReturnTheMarkedPosition.
@Test
public void shouldReturnTheMarkedPosition() {
// given
final LogPositionMarker marker = new LogPositionMarker();
// when
marker.mark(1, 2);
final LogPosition logPosition = marker.newPosition();
// given
assertEquals(new LogPosition(1, 2), logPosition);
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class LogPositionMarkerTest method shouldReturnUnspecifiedIfNothingHasBeenMarked.
@Test
public void shouldReturnUnspecifiedIfNothingHasBeenMarked() {
// given
final LogPositionMarker marker = new LogPositionMarker();
// when
final LogPosition logPosition = marker.newPosition();
// given
assertEquals(LogPosition.UNSPECIFIED, logPosition);
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class LogVersionLocatorTest method shouldFindLogPosition.
@Test
public void shouldFindLogPosition() throws NoSuchTransactionException {
// given
final long txId = 42L;
final PhysicalLogicalTransactionStore.LogVersionLocator locator = new PhysicalLogicalTransactionStore.LogVersionLocator(txId);
final LogPosition position = new LogPosition(1, 128);
// when
final boolean result = locator.visit(position, firstTxIdInLog, lastTxIdInLog);
// then
assertFalse(result);
assertEquals(position, locator.getLogPosition());
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class LogVersionLocatorTest method shouldNotFindLogPosition.
@Test
public void shouldNotFindLogPosition() throws NoSuchTransactionException {
// given
final long txId = 1L;
final PhysicalLogicalTransactionStore.LogVersionLocator locator = new PhysicalLogicalTransactionStore.LogVersionLocator(txId);
final LogPosition position = new LogPosition(1, 128);
// when
final boolean result = locator.visit(position, firstTxIdInLog, lastTxIdInLog);
// then
assertTrue(result);
try {
locator.getLogPosition();
fail("should have thrown");
} catch (NoSuchTransactionException e) {
assertEquals("Unable to find transaction " + txId + " in any of my logical logs: " + "Couldn't find any log containing " + txId, e.getMessage());
}
}
use of org.neo4j.kernel.impl.transaction.log.LogPosition in project neo4j by neo4j.
the class TransactionMetadataCacheTest method shouldReturnTheTxValueTIfInTheCached.
@Test
public void shouldReturnTheTxValueTIfInTheCached() {
// given
final TransactionMetadataCache cache = new TransactionMetadataCache(2);
final LogPosition position = new LogPosition(3, 4);
final int txId = 42;
final int masterId = 0;
final int authorId = 1;
final int checksum = 2;
final long timestamp = System.currentTimeMillis();
// when
cache.cacheTransactionMetadata(txId, position, masterId, authorId, checksum, timestamp);
final TransactionMetadataCache.TransactionMetadata metadata = cache.getTransactionMetadata(txId);
// then
assertEquals(new TransactionMetadataCache.TransactionMetadata(masterId, authorId, position, checksum, timestamp), metadata);
}
Aggregations