use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class DefaultSchemaIndexConfigTest method indexShouldHaveIndexConfig.
@ParameterizedTest
@MethodSource("providers")
void indexShouldHaveIndexConfig(GraphDatabaseSettings.SchemaIndex provider) throws IndexNotFoundKernelException {
DatabaseManagementServiceBuilder databaseManagementServiceBuilder = dbBuilder.setConfig(default_schema_provider, provider == null ? null : provider.providerName());
DatabaseManagementService managementService = databaseManagementServiceBuilder.build();
GraphDatabaseService db = managementService.database(DEFAULT_DATABASE_NAME);
try {
// when
createIndex(db);
// then
validateIndexConfig(db);
} finally {
managementService.shutdown();
}
managementService = databaseManagementServiceBuilder.build();
db = managementService.database(DEFAULT_DATABASE_NAME);
try {
validateIndexConfig(db);
} finally {
managementService.shutdown();
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class MultipleOpenCursorsTest method multipleIteratorsNestedInterleavedExact.
@ParameterizedTest
@MethodSource(value = "params")
void multipleIteratorsNestedInterleavedExact(IndexCoordinator indexCoordinator) throws Exception {
indexCoordinator.init(db);
try (Transaction tx = db.beginTx()) {
// when
KernelTransaction ktx = ((InternalTransaction) tx).kernelTransaction();
try (NodeValueIndexCursor cursor1 = indexCoordinator.queryExact(ktx)) {
List<Long> actual1 = new ArrayList<>();
try (NodeValueIndexCursor cursor2 = indexCoordinator.queryExact(ktx)) {
List<Long> actual2 = new ArrayList<>();
// Interleave
exhaustInterleaved(cursor1, actual1, cursor2, actual2);
// then
indexCoordinator.assertExactResult(actual1);
indexCoordinator.assertExactResult(actual2);
}
}
tx.commit();
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class UniqueIndexApplicationIT method tx_createNode_addLabel_tx_setProperty.
@ParameterizedTest
@MethodSource("indexTypes")
void tx_createNode_addLabel_tx_setProperty(Function<Transaction, Void> createIndexFunc) {
createIndex(createIndexFunc);
Node node;
try (var transaction = db.beginTx()) {
node = transaction.createNode();
node.addLabel(label("Label1"));
transaction.commit();
}
try (var transaction = db.beginTx()) {
transaction.getNodeById(node.getId()).setProperty("key1", "value1");
transaction.commit();
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class UniqueIndexApplicationIT method tx_createNode_tx_addLabel_tx_setProperty.
@ParameterizedTest
@MethodSource("indexTypes")
void tx_createNode_tx_addLabel_tx_setProperty(Function<Transaction, Void> createIndexFunc) {
createIndex(createIndexFunc);
Node node;
try (var transaction = db.beginTx()) {
node = transaction.createNode();
transaction.commit();
}
try (var transaction = db.beginTx()) {
transaction.getNodeById(node.getId()).addLabel(label("Label1"));
transaction.commit();
}
try (var transaction = db.beginTx()) {
transaction.getNodeById(node.getId()).setProperty("key1", "value1");
transaction.commit();
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class MultipleOpenCursorsTest method multipleIteratorsNestedInterleavedRange.
@ParameterizedTest
@MethodSource(value = "params")
void multipleIteratorsNestedInterleavedRange(IndexCoordinator indexCoordinator) throws Exception {
assumeTrue(indexCoordinator.supportRangeQuery());
indexCoordinator.init(db);
try (Transaction tx = db.beginTx()) {
// when
KernelTransaction ktx = ((InternalTransaction) tx).kernelTransaction();
try (NodeValueIndexCursor cursor1 = indexCoordinator.queryRange(ktx);
NodeValueIndexCursor cursor2 = indexCoordinator.queryRange(ktx)) {
List<Long> actual1 = new ArrayList<>();
List<Long> actual2 = new ArrayList<>();
// Interleave
exhaustInterleaved(cursor1, actual1, cursor2, actual2);
// then
indexCoordinator.assertRangeResult(actual1);
indexCoordinator.assertRangeResult(actual2);
}
tx.commit();
}
}
Aggregations