use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder 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.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j by neo4j.
the class IndexConfigMigrationIT method create3_5Database.
@Disabled("Here as reference for how 3.5 db was created")
@Test
void create3_5Database() throws Exception {
Path storeDir = tempStoreDirectory();
DatabaseManagementServiceBuilder builder = new TestDatabaseManagementServiceBuilder(storeDir);
setSpatialConfig(builder);
DatabaseManagementService dbms = builder.build();
GraphDatabaseService db = dbms.database(DEFAULT_DATABASE_NAME);
createIndex(db, NATIVE_BTREE10.providerName(), label1);
// createIndex( db, NATIVE20.providerName(), label2 ); // <- Those index providers are removed in 4.0, but here for reference.
// createIndex( db, NATIVE10.providerName(), label3 );
// createIndex( db, LUCENE10.providerName(), label4 );
createSpatialData(db, label1, label2, label3, label4);
for (FulltextIndexDescription fulltextIndex : FulltextIndexDescription.values()) {
createFulltextIndex(db, fulltextIndex.indexProcedure, fulltextIndex.indexName, fulltextIndex.tokenName, propKey, fulltextIndex.configMap);
}
dbms.shutdown();
Path zipFile = storeDir.resolveSibling(storeDir.getFileName().toString() + ".zip");
ZipUtils.zip(new DefaultFileSystemAbstraction(), storeDir, zipFile);
System.out.println("Db created in " + zipFile.toAbsolutePath());
}
use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j by neo4j.
the class DatabaseStartupTest method startCommunityDatabaseOnProvidedNonAbsoluteFile.
@Test
void startCommunityDatabaseOnProvidedNonAbsoluteFile() {
Path directory = Path.of("target/notAbsoluteDirectory");
EphemeralCommunityManagementServiceFactory factory = new EphemeralCommunityManagementServiceFactory();
DatabaseManagementServiceBuilder databaseFactory = new EphemeralDatabaseManagementServiceBuilder(directory, factory);
DatabaseManagementService managementService = databaseFactory.build();
managementService.database(DEFAULT_DATABASE_NAME);
managementService.shutdown();
}
use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j by neo4j.
the class TestLogPruning method newDb.
private GraphDatabaseAPI newDb(String logPruning, int rotateEveryNTransactions) {
this.rotateEveryNTransactions = rotateEveryNTransactions;
fs = new EphemeralFileSystemAbstraction();
TestDatabaseManagementServiceBuilder gdf = new TestDatabaseManagementServiceBuilder();
gdf.setFileSystem(new UncloseableDelegatingFileSystemAbstraction(fs));
DatabaseManagementServiceBuilder builder = gdf.impermanent();
builder.setConfig(keep_logical_logs, logPruning);
managementService = builder.build();
this.db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
files = db.getDependencyResolver().resolveDependency(LogFiles.class);
return db;
}
use of org.neo4j.dbms.api.DatabaseManagementServiceBuilder in project neo4j by neo4j.
the class AuthProceduresIT method setup.
@BeforeEach
void setup() throws InvalidAuthTokenException {
fs = new EphemeralFileSystemAbstraction();
DatabaseManagementServiceBuilder graphDatabaseFactory = new TestDatabaseManagementServiceBuilder().setFileSystem(fs).impermanent().setConfig(GraphDatabaseSettings.auth_enabled, true);
managementService = graphDatabaseFactory.build();
db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
systemDb = (GraphDatabaseAPI) managementService.database(SYSTEM_DATABASE_NAME);
authManager = db.getDependencyResolver().resolveDependency(BasicSystemGraphRealm.class);
assertSuccess(login("neo4j", "neo4j"), "ALTER CURRENT USER SET PASSWORD FROM 'neo4j' TO 'temp'");
assertSuccess(login("neo4j", "temp"), "ALTER CURRENT USER SET PASSWORD FROM 'temp' TO 'neo4j'");
admin = login("neo4j", "neo4j");
}
Aggregations