use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class IndexTxStateLookupTest method lookupWithoutTransactionWithCacheEviction.
@ParameterizedTest(name = "store=<{0}> lookup=<{1}>")
@MethodSource("argumentsProvider")
public void lookupWithoutTransactionWithCacheEviction(Object store, Object lookup) {
init(store, lookup);
// when
Node node;
try (Transaction tx = db.beginTx()) {
(node = tx.createNode(label("Node"))).setProperty("prop", this.store);
tx.commit();
}
// then
try (Transaction tx = db.beginTx()) {
assertEquals(1, count(tx.findNodes(label("Node"), "prop", this.lookup)));
tx.commit();
}
deleteNode(node);
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class UniqueIndexRecoveryTest method shouldRecoverWhenCommandsTemporarilyViolateConstraints.
@ParameterizedTest
@MethodSource("parameters")
void shouldRecoverWhenCommandsTemporarilyViolateConstraints(SchemaIndex schemaIndex) throws Exception {
setupDatabase(schemaIndex);
// GIVEN
Node unLabeledNode = createUnLabeledNodeWithProperty();
Node labeledNode = createLabeledNode();
createUniqueConstraint();
// snapshot
rotateLogAndCheckPoint();
setPropertyOnLabeledNode(labeledNode);
deletePropertyOnLabeledNode(labeledNode);
addLabelToUnLabeledNode(unLabeledNode);
// persist - recovery will do everything since last log rotate
flushAll();
// WHEN recovery is triggered
restart(snapshot(storeDir.absolutePath()), schemaIndex);
// it should just not blow up!
try (Transaction tx = db.beginTx()) {
assertThat(tx.findNode(LABEL, PROPERTY_KEY, PROPERTY_VALUE)).isEqualTo(unLabeledNode);
tx.commit();
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class StoreUpgraderTest method upgradeShouldGiveProgressMonitorProgressMessages.
@ParameterizedTest
@MethodSource("versions")
void upgradeShouldGiveProgressMonitorProgressMessages(RecordFormats formats) throws Exception {
init(formats);
// Given
StoreVersionCheck check = getVersionCheck(pageCache);
// When
AssertableLogProvider logProvider = new AssertableLogProvider();
newUpgrader(check, pageCache, allowMigrateConfig, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(databaseLayout, false);
// Then
assertThat(logProvider).containsMessages("Store files", "Indexes", "Successfully finished");
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class TransactionMonitorTest method shouldCountTerminatedTransactions.
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
void shouldCountTerminatedTransactions(String name, ThrowingConsumer<Transaction, Exception> txConsumer, boolean isWriteTx) throws Exception {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().impermanent().build();
GraphDatabaseAPI db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
try {
TransactionCounters counts = db.getDependencyResolver().resolveDependency(TransactionCounters.class);
TransactionCountersChecker checker = new TransactionCountersChecker(counts);
try (Transaction tx = db.beginTx()) {
txConsumer.accept(tx);
tx.terminate();
}
checker.verifyTerminated(isWriteTx, counts);
} finally {
managementService.shutdown();
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class StoreUpgraderTest method failToMoveTransactionLogsIfTheyAlreadyExist.
@ParameterizedTest
@MethodSource("versions")
void failToMoveTransactionLogsIfTheyAlreadyExist(RecordFormats formats) throws IOException {
init(formats);
Path txRoot = testDirectory.directory("customTxRoot");
AssertableLogProvider logProvider = new AssertableLogProvider();
StoreVersionCheck check = getVersionCheck(pageCache);
Config config = Config.newBuilder().fromConfig(allowMigrateConfig).set(neo4j_home, testDirectory.homePath()).set(GraphDatabaseSettings.transaction_logs_root_path, txRoot.toAbsolutePath()).set(default_database, databaseLayout.getDatabaseName()).build();
DatabaseLayout migrationLayout = DatabaseLayout.of(config);
Path databaseTransactionLogsHome = txRoot.resolve(migrationLayout.getDatabaseName());
fileSystem.mkdir(databaseTransactionLogsHome);
createDummyTxLogFiles(databaseTransactionLogsHome);
assertThrows(StoreUpgrader.TransactionLogsRelocationException.class, () -> newUpgrader(check, pageCache, config, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(migrationLayout, false));
}
Aggregations